00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <string>
00013
00014 #include "openLogger.h"
00015 using namespace std;
00016
00017
00018 string baseUrl;
00019
00020 #include "w3affiliate.h"
00021 #include "../admin/Affiliate.hpp"
00022 #include "commissionsReport.hpp"
00023
00024 class Affiliate_form: public Affiliate_Obj, public forms_base
00025 {
00026 public:
00027 Affiliate_form(cgiScript & script):Affiliate_Obj(),forms_base(script){setKey(*this);}
00028 virtual ~Affiliate_form(){;}
00029
00030 void form_id_transfer( void )
00031 {
00032 llongFXfer( "Id", Id );
00033 }
00034 void form_data_transfer( void )
00035 {
00036 stringFXfer( "Organization_Name", Organization_Name);
00037 stringFXfer( "First", First);
00038 stringFXfer( "Last", Last);
00039 llongFXfer( "Promotion", Promotion);
00040 stringFXfer( "Phone", Phone);
00041 stringFXfer( "Mobile", Mobile);
00042 stringFXfer( "Email", Email);
00043 stringFXfer( "Password", Password);
00044 stringFXfer( "Address_1", Address_1);
00045 stringFXfer( "Address_2", Address_2);
00046 stringFXfer( "City", City);
00047 stringFXfer( "State", State);
00048 stringFXfer( "Zip", Zip);
00049
00050 }
00051
00052 bool dbf_action( string mode, changeMap & changes )
00053 {
00054 bool result = db_action( mode, changes );
00055 if( mode == "i" && result == true )
00056 {
00057 m_result = "Registration Successful!";
00058 }
00059 return result;
00060 }
00061
00062
00063 bool form_display( void )
00064 {
00065 bool breturn = true;
00066 ocString sql;
00067
00068 script << makeTop("", "Affiliate")
00069 << formTemplate.getParagraph("advanced_begin");
00070 script << makeStaticBox("Id", "Id", Id ,"8");
00071 script << "<br class='clearall'>" << endl;
00072 script << formTemplate.getParagraph("advanced_end");
00073
00074 script << makeTextBox("Organization Name", "Organization_Name", Organization_Name ,"125","35");
00075 script << "<br class='clearall'>" << endl;
00076 script << makeTextBox("First", "First", First ,"125","35");
00077 script << "<br class='clearall'>" << endl;
00078 script << makeTextBox("Last", "Last", Last ,"125","35");
00079 script << "<br class='clearall'>" << endl;
00080
00081 script << "<br class='clearall'>" << endl;
00082 script << makeTextBox("Phone", "Phone", Phone ,"125","35");
00083 script << "<br class='clearall'>" << endl;
00084 script << makeTextBox("Mobile", "Mobile", Mobile ,"125","35");
00085 script << "<br class='clearall'>" << endl;
00086 script << makeTextBox("Email", "Email", Email ,"125","35");
00087 script << "<br class='clearall'>" << endl;
00088 script << makePasswordBox("Password", "Password", Password ,"25");
00089 script << "<br class='clearall'>" << endl;
00090 script << makeTextBox("Address 1", "Address_1", Address_1 ,"125","35");
00091 script << "<br class='clearall'>" << endl;
00092 script << makeTextBox("Address 2", "Address_2", Address_2 ,"125","35");
00093 script << "<br class='clearall'>" << endl;
00094 script << makeTextBox("City", "City", City ,"125","35");
00095 script << "<br class='clearall'>" << endl;
00096 script << makeStateBox("State", "State", State );
00097 script << "<br class='clearall'>" << endl;
00098 script << makeTextBox("Zip", "Zip", Zip ,"125","35");
00099
00100 script << makeButtons( key() );
00101 script << makeBottom( m_result ) << endl;
00102 return breturn;
00103 }
00104 };
00105
00106 bool intraMain( page & pg , cgiScript & script )
00107 {
00108 Affiliate_form myFrm(script);
00109 myFrm.loadControlTemplates("Templates/divform.htmp");
00110
00111 string view = script.PathInfo().c_str();
00112 if( view == "/Account" )
00113 {
00114 myFrm.Id = atoll( oLogin.Id().c_str());
00115 myFrm.key(myFrm.Id);
00116 myFrm.form_action();
00117 myFrm.form_display();
00118 }
00119 else if( view == "/Register" )
00120 {
00121 myFrm.form_action();
00122 myFrm.form_display();
00123 }
00124 else
00125 {
00126 string Title = "Commissions for " + oLogin.FullName();
00127 llong AffiliateId = atoll(oLogin.Id().c_str());
00128 commissions_report rep(script, pg.get_template());
00129 rep.run( AffiliateId,Title );
00130
00131 }
00132
00133 return true;
00134 }
00135
00136
00137 int main(int argc, char ** argv)
00138 {
00139 baseUrl = "";
00140
00141 cgiScript script("text/html",false);
00142 bool isSignedOn = check(script);
00143 script.closeHeader();
00144
00145
00146
00147
00148
00149
00150 page pg(script);
00151
00152 writelog( "load page" );
00153 if( pg.load() )
00154 {
00155 writelog( "instance of page control" );
00156 page_control ctrl(pg);
00157 ctrl.addOp ( "servicelist", new servicelist_functor(pg,script,isSignedOn) );
00158 ctrl.addOp ( "userinterface", new form_functor(pg,script,isSignedOn) );
00159 writelog( "page control emit" );
00160 ctrl.emit();
00161 }
00162 else
00163 {
00164 script << "<html><head><title>Page Unavailable</title></head>" << endl
00165 << "<body><h1>Sorry</h1>" << endl
00166 << "<p>The page you requested is not available</p></body></html>";
00167 }
00168 return 0;
00169 }
00170
00171
00172 #include "read_write_base.cpp"
00173 #include "forms_base.cpp"
00174