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

SettingsForm Class Reference

#include <SettingsForm.h>

Inheritance diagram for SettingsForm:

Inheritance graph
[legend]
Collaboration diagram for SettingsForm:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

Detailed Description

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

Definition at line 31 of file SettingsForm.h.


Constructor & Destructor Documentation

SettingsForm::SettingsForm Web *  w  ) 
 

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

Definition at line 31 of file SettingsForm.cpp.

References SettingsForm().

Referenced by SettingsForm().

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

SettingsForm::~SettingsForm  ) 
 

Definition at line 36 of file SettingsForm.cpp.

00037 { 00038 }


Member Function Documentation

void SettingsForm::Display long   ) 
 

Definition at line 75 of file SettingsForm.cpp.

References Display().

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

00076 { 00077 IWeb *pWeb = static_cast<IWeb *>(GetWeb()); 00078 Database& db = pWeb -> GetDatabase(); 00079 db::Account account(db, pWeb -> GetUsernum()); 00080 00081 // printf("<h3>User settings</h3>"); 00082 printf("<div class=navigator>"); 00083 printf("<table cellpadding=0 cellspacing=0 width=\"100%%\"><tr><td>"); 00084 printf("<b>Settings</b>"); 00085 printf("</td><td align=right>"); 00086 // printf("<div align=right>"); 00087 printf("[ <a href=\"%s?page=3\">forums</a> ",GetCgiName().c_str()); 00088 printf("| <a href=\"%s?logout=1\">logout</a> ",GetCgiName().c_str()); 00089 // printf("]</div>"); 00090 printf("]</td></tr></table>"); 00091 printf("</div>"); 00092 00093 printf("<form action=\"%s\" method=post>",GetCgiName().c_str()); 00094 00095 printf("<p><b>Email</b>: %s</p>",account.email.c_str()); 00096 printf("<p><b>Name</b>: %s</p>",account.name.c_str()); 00097 printf("<p>"); 00098 printf("<input type=checkbox name=show_email value=1%s> Show email when posting<br>", 00099 account.show_email ? " CHECKED" : ""); 00100 printf("</p><p>"); 00101 printf("Enter old password to change<br>"); 00102 printf("<input type=password name=old><br>"); 00103 printf("</p><p>"); 00104 printf("Enter new password<br>"); 00105 printf("<input type=new_password><br>"); 00106 printf("</p><p>"); 00107 printf("Repeat new password<br>"); 00108 printf("<input type=new_password2><br>"); 00109 printf("</p>"); 00110 printf("&nbsp;&nbsp;&nbsp;&nbsp;"); 00111 printf("<input type=submit name=\"%s\" value=\" Save changes \">",GetFormName().c_str()); 00112 printf("&nbsp;&nbsp;&nbsp;&nbsp;"); 00113 printf("<input type=submit name=\"%s\" value=\" Return to forums \">",GetFormName().c_str()); 00114 printf("</form>"); 00115 }

void SettingsForm::List  )  [inline]
 

Definition at line 40 of file SettingsForm.h.

00040 {}

void SettingsForm::Process  ) 
 

Definition at line 41 of file SettingsForm.cpp.

00042 { 00043 IWeb *pWeb = static_cast<IWeb *>(GetWeb()); 00044 Database& db = pWeb -> GetDatabase(); 00045 char action[200]; 00046 00047 // <input type="submit" name="SettingsForm" value="action" ... 00048 if (!GetForm() -> getvalue( (char *)GetFormName().c_str(), action, 200) || !*action) 00049 { 00050 return; 00051 } 00052 if (!strcmp(action," Save changes ")) 00053 { 00054 db::Account account(db, pWeb -> GetUsernum()); 00055 account.show_email = atoi(GetForm() -> getvalue("show_email").c_str()); 00056 std::string old = GetForm() -> getvalue("old"); 00057 std::string new_password = GetForm() -> getvalue("new_password"); 00058 std::string new_password2 = GetForm() -> getvalue("new_password2"); 00059 if (!strcmp(old.c_str(),account.secret.c_str())) 00060 { 00061 if (new_password.size() >= 4 && !strcmp(new_password.c_str(),new_password2.c_str())) 00062 { 00063 account.secret = new_password; 00064 } 00065 } 00066 account.save(); 00067 } 00068 if (!strcmp(action," Return to forums ")) 00069 { 00070 pWeb -> SetPage( 3 ); 00071 } 00072 }

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

Definition at line 39 of file SettingsForm.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