00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <iostream>
00015 #include <iomanip>
00016 #include "cgiClass.h"
00017 #include "cgiTemplates.h"
00018 #include "connectstring"
00019 #include "forms.h"
00020 #include "ocTypes.h"
00021 #include "ocString.h"
00022 #include "cgiTemplates.h"
00023
00024 #include "read_write_base.hpp"
00025 #include "list_base.hpp"
00026 #include "forms_base.hpp"
00027 #include "Manufacturer.hpp"
00028 #include "openLogin.h"
00029
00030 using namespace std;
00031 openLogin oLogin;
00032
00033 class Manufacturer_List: public list_base
00034 {
00035 public:
00036
00037 Manufacturer_List(cgiScript&sc):list_base(sc){;}
00038 ~Manufacturer_List(){;}
00039
00040 bool list_display( void )
00041 {
00042 bool breturn = true;
00043
00044 hotCol=-2;
00045 editLink = listTemplate.getParagraph("hotcolumn");
00046 editLink = editLink.replace("$prog$","Manufacturer_ui.cgi");
00047 emitFilter( "Manufacturer_ui.cgi",
00048 " <B>FILTER (by Name)</B>" );
00049 string heading =
00050 "<a class='sortcol' href='Manufacturer_ui.cgi?sort=Id'>Id</a>|"
00051 "<a class='sortcol' href='Manufacturer_ui.cgi?sort=Name'>Name</a>|"
00052 "<a class='sortcol' href='Manufacturer_ui.cgi?sort=Email_Contact'>Email Contact</a>"
00053 ;
00054 emitHeadings(heading);
00055 getFilteredData(
00056 "Id, "
00057 "Name, "
00058 "Email_Contact "
00059 ,"Manufacturer",
00060 "Name like '$filter$%'" );
00061 emitData();
00062 emitNavigation("Manufacturer_ui.cgi");
00063 emitEnd();
00064 return breturn;
00065 }
00066 };
00067
00068 class Manufacturer_form: public Manufacturer_Obj, public forms_base
00069 {
00070 public:
00071 Manufacturer_form(cgiScript & script):Manufacturer_Obj(),forms_base(script){setKey(*this);}
00072 virtual ~Manufacturer_form(){;}
00073
00074 void form_id_transfer( void )
00075 {
00076 llongFXfer( "Id", Id );
00077 }
00078 void form_data_transfer( void )
00079 {
00080 stringFXfer( "Name", Name);
00081 stringFXfer( "Email_Contact", Email_Contact);
00082
00083 }
00084
00085 bool dbf_action( string mode, changeMap & changes )
00086 {
00087 return db_action( mode, changes );
00088 }
00089
00090
00091 bool form_display( void )
00092 {
00093 bool breturn = true;
00094 ocString sql;
00095
00096 script << makeTop("Manufacturer_ui.cgi", "Manufacturer")
00097 << formTemplate.getParagraph("advanced_begin");
00098 script << makeStaticBox("Id", "Id", Id ,"8");
00099 script << "<br class='clearall'>" << endl;
00100 script << formTemplate.getParagraph("advanced_end");
00101
00102 script << makeTextBox("Name", "Name", Name ,"125","35");
00103 script << "<br class='clearall'>" << endl;
00104 script << makeTextBox("Email Contact", "Email_Contact", Email_Contact ,"125","35");
00105 script << "<br class='clearall'>" << endl;
00106
00107 script << makeButtons( key() );
00108 script << makeBottom( m_result ) << endl;
00109 return breturn;
00110 }
00111 };
00112
00113
00114 int main( int argcount, char ** args )
00115 {
00116 cgiScript script( "text/html", false );
00117 Manufacturer_form myFrm(script);
00118 Manufacturer_List mylist(script);
00119 if( oLogin.testLoginStatus() )
00120 {
00121 script.closeHeader();
00122 cgiTemplates pgTemplate;
00123 pgTemplate.load("Templates/adminPane.htmp");
00124
00125 script << ocString(pgTemplate.getParagraph("top"))
00126 .replaceAll("$heading$","Manufacturer");
00127
00128 myFrm.loadControlTemplates("Templates/divform.htmp");
00129 myFrm.form_action();
00130 myFrm.form_display();
00131
00132 mylist.loadListTemplates("Templates/list.htmp");
00133 mylist.list_display();
00134
00135 ocString end = pgTemplate.getParagraph("bottom");
00136 script << end;
00137 }
00138 else
00139 {
00140 script.Redirect("signIn.html");
00141 }
00142 }
00143
00144 #include "read_write_base.cpp"
00145 #include "forms_base.cpp"
00146
00147
00148
00149
00150
00151