00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <iostream>
00013 #include <iomanip>
00014 #include "cgiTemplates.h"
00015 #include "connectstring"
00016 #include "forms.h"
00017 #include "ocTypes.h"
00018 #include "ocString.h"
00019 #include "read_write_base.hpp"
00020 #include "forms_base.hpp"
00021 #include "list_base.hpp"
00022 #include "cgiTemplates.h"
00023 #include "Product_Categories.hpp"
00024 #include "list_base.hpp"
00025 #include "openLogin.h"
00026
00027 #include "richForm.hpp"
00028
00029 using namespace std;
00030 openLogin oLogin;
00031
00032 class Product_Categories_form: public Product_Categories_Obj, public richForm
00033 {
00034 public:
00035 Product_Categories_form(cgiScript & script):Product_Categories_Obj(),richForm(script)
00036 {
00037 setKey(*this);
00038 }
00039 virtual ~Product_Categories_form(){;}
00040
00041 void form_id_transfer( void )
00042 {
00043 llongFXfer( "Id", Id );
00044 }
00045 void form_data_transfer( void )
00046 {
00047 llongFXfer( "Product", Product);
00048 llongFXfer( "Category", Category);
00049 intFXfer( "Position", Position);
00050 stringFXfer( "Leading_Text", Leading_Text);
00051 }
00052
00053 bool dbf_action( string mode, changeMap & changes )
00054 {
00055 if( mode=="i" || mode=="u" )
00056 {
00057 Leading_Text=htmlDecode(Leading_Text);
00058 changes["Leading_Text"]="Leading_Text";
00059 }
00060 return db_action( mode, changes );
00061 }
00062
00063
00064 bool form_display( void )
00065 {
00066 bool breturn = true;
00067 ocString sql;
00068 script << makeTop("Product_Categories_ui.cgi", "Product_Categories")
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 sql = "select Id, Name from Product order by Name";
00074 script << makeComboBox("Product", "Product", Product ,sql);
00075 script << "<br class='clearall'>" << endl;
00076 sql = "select Id, Name from Category where Id = ";
00077 sql.append(Category);
00078 script << makeComboBox("Category", "Category", Category ,sql);
00079 script << "<br class='clearall'>" << endl;
00080 script << makeTextBox("Position", "Position", Position ,"8","8");
00081 script << "<br class='clearall'>" << endl;
00082
00083
00084 Leading_Text = htmlFixup( Leading_Text );
00085 string cedit = makeHiddenBox( "Leading_Text", Leading_Text );
00086
00087 cedit += "<a href=\"javascript:jopen( 'richPopUpEditor.html?control=Leading_Text', 'scrollbars,resizable,width=730,height=510', 'rich' )\">";
00088 cedit += "Edit</a>";
00089
00090 ocString ctrlGrp = formTemplate.getParagraph("control_group");
00091
00092 script << ctrlGrp.replace("$label$","Leading_Text")
00093 .replace("$control$", cedit.c_str());
00094
00095 script << "<br class='clearall'>" << endl;
00096 script << makeButtons( key() );
00097 script << makeBottom( m_result ) << endl;
00098 return breturn;
00099 }
00100 };
00101
00102
00103 int main( int argcount, char ** args )
00104 {
00105 cgiScript script( "text/html", false );
00106 Product_Categories_form myFrm(script);
00107
00108 if( oLogin.testLoginStatus() )
00109 {
00110 script.closeHeader();
00111 cgiTemplates pgTemplate;
00112 pgTemplate.load("Templates/adminPane.htmp");
00113
00114 script << ocString(pgTemplate.getParagraph("top"))
00115 .replaceAll("$heading$","Product_Categories");
00116
00117 myFrm.loadControlTemplates("Templates/childdivform.htmp");
00118 myFrm.form_action();
00119 myFrm.form_display();
00120
00121 ocString end = pgTemplate.getParagraph("bottom");
00122 script << end;
00123 }
00124 else
00125 {
00126 script.Redirect("signIn.html");
00127 }
00128 }
00129
00130 #include "read_write_base.cpp"
00131 #include "forms_base.cpp"
00132