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