Google
Web alhem.net
Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

NewMessageForm Class Reference

#include <NewMessageForm.h>

Inheritance diagram for NewMessageForm:

Inheritance graph
[legend]
Collaboration diagram for NewMessageForm:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NewMessageForm (Web *)
 ~NewMessageForm ()
void Process ()
void Display (long)
void Select (const std::string &)
void List ()

Detailed Description

File ......... NewMessageForm.h Published .... 2004-07-09 Author ....... grymse@alhem.net

Definition at line 31 of file NewMessageForm.h.


Constructor & Destructor Documentation

NewMessageForm::NewMessageForm Web *  w  ) 
 

File ......... NewMessageForm.cpp Published .... 2004-07-09 Author ....... grymse@alhem.net

Definition at line 31 of file NewMessageForm.cpp.

References NewMessageForm().

Referenced by NewMessageForm().

00031 : BaseForm(w, "NewMessageForm") 00032 { 00033 }

NewMessageForm::~NewMessageForm  ) 
 

Definition at line 36 of file NewMessageForm.cpp.

00037 { 00038 }


Member Function Documentation

void NewMessageForm::Display long   ) 
 

Definition at line 89 of file NewMessageForm.cpp.

References Display().

Referenced by Display(), and IWeb::GenerateDocument().

00090 { 00091 IWeb *pWeb = static_cast<IWeb *>(GetWeb()); 00092 00093 // printf("<h3>Post message</h3>"); 00094 Navigator(pWeb -> GetForum(),pWeb -> GetThread(),-1); 00095 printf("</td><td align=right>"); 00096 // printf("<div align=right>"); 00097 printf("[ <a href=\"%s?page=2\">settings</a> ",GetCgiName().c_str()); 00098 printf("| <a href=\"%s?logout=1\">logout</a> ",GetCgiName().c_str()); 00099 // printf("]</div>"); 00100 printf("]</td></tr></table>"); 00101 printf("</div>"); 00102 00103 printf("<form action=\"%s\" method=post enctype=\"multipart/form-data\">", 00104 GetCgiName().c_str()); 00105 printf("Picture (optional)<br>"); 00106 printf("<input type=file name=the_file><br>"); 00107 printf("Title<br>"); 00108 printf("<input type=text name=title size=40><br>"); 00109 printf("Message<br>"); 00110 printf("<textarea name=message rows=10 cols=80></textarea><br>"); 00111 printf("<input type=submit name=\"%s\" value=\" Post \">",GetFormName().c_str()); 00112 printf("</form>"); 00113 }

void NewMessageForm::List  )  [inline]
 

Definition at line 40 of file NewMessageForm.h.

00040 {}

void NewMessageForm::Process  ) 
 

Definition at line 41 of file NewMessageForm.cpp.

00042 { 00043 IWeb *pWeb = static_cast<IWeb *>(GetWeb()); 00044 Database& db = pWeb -> GetDatabase(); 00045 char action[200]; 00046 00047 // <input type="submit" name="NewMessageForm" value="action" ... 00048 if (GetForm() -> getvalue( (char *)GetFormName().c_str(), action, 200) && *action) 00049 { 00050 std::string title = GetForm() -> getvalue("title"); 00051 std::string message_body = GetForm() -> getvalue("message"); 00052 long image_num = 0; 00053 char fn[1000]; 00054 00055 GetForm() -> getvalue("the_file",fn,255); 00056 if (!strncmp(fn,"/tmp/",5) && strlen(fn) > 5) 00057 { 00058 image_num = AddImage(pWeb -> GetUsernum(), fn); 00059 } 00060 db::Forum forum(db,pWeb -> GetForum()); 00061 forum.updated = GetDate(); 00062 forum.updated_by = pWeb -> GetUsernum(); 00063 forum.save(); 00064 db::Thread thread(db,pWeb -> GetThread()); 00065 thread.updated = GetDate(); 00066 thread.updated_by = pWeb -> GetUsernum(); 00067 thread.save(); 00068 db::Message message(&db); 00069 message.thread = pWeb -> GetThread(); 00070 message.posted_by = pWeb -> GetUsernum(); 00071 message.posted = GetDate(); 00072 message.title = title; 00073 message.body = message_body; 00074 message.version = 1; 00075 message.updated = GetDate(); 00076 message.save(); 00077 if (image_num > 0) 00078 { 00079 db::Linkmessageimage x(&db); 00080 x.message = message.num; 00081 x.image = image_num; 00082 x.save(); 00083 } 00084 pWeb -> SetPage( 5 ); // View Thread 00085 } 00086 }

void NewMessageForm::Select const std::string &   )  [inline]
 

Definition at line 39 of file NewMessageForm.h.

References Select().

Referenced by Select().

00039 {}


The documentation for this class was generated from the following files:
Generated on Sat Feb 12 00:14:57 2005 for IBank by doxygen 1.3.7