00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <iostream>
00012 #include <iomanip>
00013 #include "cgiTemplates.h"
00014 #include "connectstring"
00015 #include "forms.h"
00016 #include "ocTypes.h"
00017 #include "ocString.h"
00018 #include "cgiTemplates.h"
00019
00020 #include "Size.hpp"
00021 #include "list_base.hpp"
00022 #include "forms_base.hpp"
00023
00024 #include "openLogin.h"
00025
00026
00027 using namespace std;
00028 openLogin oLogin;
00029
00030 class Size_List: public list_base
00031 {
00032 public:
00033
00034 Size_List(cgiScript&sc):list_base(sc){;}
00035 ~Size_List(){;}
00036
00037 bool list_display( void )
00038 {
00039 bool breturn = true;
00040
00041 hotCol=-2;
00042 itemsPerPg=100;
00043 editLink = listTemplate.getParagraph("hotcolumn");
00044 editLink = editLink.replace("$prog$","Size_ui.cgi");
00045
00046 string heading =
00047 "<a class='sortcol' href='Size_ui.cgi?sort=Id'>Id</a>|"
00048 "<a class='sortcol' href='Size_ui.cgi?sort=Width'>Width</a>|"
00049 "<a class='sortcol' href='Size_ui.cgi?sort=Length'>Length</a>|"
00050 "<a class='sortcol' href='Size_ui.cgi?sort=Units'>Units</a>|"
00051 ;
00052 emitHeadings(heading);
00053 getFilteredData(
00054 "s.Id, "
00055 "s.Width, "
00056 "s.Length, "
00057 "u.Name "
00058 ,"Size s inner join Unit u on s.Units = u.Id",
00059 "" );
00060 emitData();
00061 emitNavigation("Size_ui.cgi");
00062 emitEnd();
00063 return breturn;
00064 }
00065 };
00066
00067 class Size_form: public Size_Obj, public forms_base
00068 {
00069 public:
00070 Size_form(cgiScript & script):Size_Obj(),forms_base(script){setKey(*this);}
00071 virtual ~Size_form(){;}
00072
00073 void form_id_transfer( void )
00074 {
00075 llongFXfer( "Id", Id );
00076 }
00077 void form_data_transfer( void )
00078 {
00079 intFXfer( "Width", Width);
00080 intFXfer( "Length", Length);
00081 llongFXfer( "Units", Units);
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 = "select Id, Name from Unit order by Id";
00095
00096 script << makeTop("Size_ui.cgi", "Size")
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("Width", "Width", Width ,"8","8");
00103 script << "<br class='clearall'>" << endl;
00104 script << makeTextBox("Length", "Length", Length ,"8","8");
00105 script << "<br class='clearall'>" << endl;
00106 script << makeComboBox("Units", "Units", Units ,sql);
00107 script << " <a href=\"javascript:addChild('Unit_ui.cgi','Units')\">Create Unit</a>";
00108 if( Units )
00109 {
00110 script << " <a href=\"javascript:updateChild('Unit_ui.cgi','Units', 'Units' )\">Update Unit</a>";
00111 }
00112 script << "<br class='clearall'>" << endl;
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 script << makeButtons( key() );
00135 script << makeBottom( m_result ) << endl;
00136 return breturn;
00137 }
00138 };
00139
00140
00141 int main( int argcount, char ** args )
00142 {
00143 cgiScript script( "text/html", false );
00144 Size_form myFrm(script);
00145 Size_List mylist(script);
00146 if( oLogin.testLoginStatus() )
00147 {
00148 script.closeHeader();
00149 cgiTemplates pgTemplate;
00150 pgTemplate.load("Templates/adminPane.htmp");
00151
00152 script << ocString(pgTemplate.getParagraph("top"))
00153 .replaceAll("$heading$","Size");
00154
00155 myFrm.loadControlTemplates("Templates/divform.htmp");
00156 myFrm.form_action();
00157 myFrm.form_display();
00158
00159 mylist.loadListTemplates("Templates/list.htmp");
00160 mylist.list_display();
00161
00162 ocString end = pgTemplate.getParagraph("bottom");
00163 script << end;
00164 }
00165 else
00166 {
00167 script.Redirect("signIn.html");
00168 }
00169 }
00170
00171 #include "read_write_base.cpp"
00172 #include "forms_base.cpp"
00173