00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <iostream>
00012 #include <iomanip>
00013 #include "cgiClass.h"
00014 #include "cgiTemplates.h"
00015 #include "connectstring"
00016 #include "forms.h"
00017 #include "ocTypes.h"
00018 #include "ocString.h"
00019 #include "cgiTemplates.h"
00020
00021 #include "read_write_base.hpp"
00022 #include "superlist_base.hpp"
00023 #include "forms_base.hpp"
00024 #include "Proofing.hpp"
00025 #include "openLogin.h"
00026
00027 #include "sublist_base.hpp"
00028
00029 using namespace std;
00030 openLogin oLogin;
00031
00032
00033
00034
00035 class Proofing_Text_Area_List: public sublist_base
00036 {
00037
00038 public:
00039 ocString Parent_Id;
00040
00041 Proofing_Text_Area_List(cgiScript&sc):sublist_base(sc){;}
00042 ~Proofing_Text_Area_List(){;}
00043
00044 bool list_display( void )
00045 {
00046 bool breturn = true;
00047 string sql = "select Id, "
00048
00049 "pointSize,"
00050 "height,"
00051 "width,"
00052 "posX,"
00053 "posY,"
00054 "color,"
00055 "background,"
00056 "fontFaceName"
00057
00058 " from Proofing_Text_Area where Proofing = " ;
00059 sql += Parent_Id;
00060 hotCol=-2;
00061 editLink = listTemplate.getParagraph("hotcolumn");
00062 editLink = editLink.replace("$prog$","Proofing_Text_Area_Popup.cgi");
00063 string heading = "Id|"
00064
00065 "pointSize|"
00066 "height|"
00067 "width|"
00068 "posX|"
00069 "posY|"
00070 "color|"
00071 "background|"
00072 "fontFaceName"
00073 ;
00074
00075 emitHeadings(heading);
00076
00077 getData( sql );
00078 emitData();
00079 ocString list_new = listTemplate.getParagraph("list_new");
00080
00081 ocString url = "Proofing_Text_Area_Popup.cgi?Proofing=";
00082 url += Parent_Id;
00083
00084 webIO << list_new.replace("$location",url.c_str()).replace("$cols","9").replace("$name","Proofing_Text_Area");
00085 emitEnd();
00086 return breturn;
00087 }
00088 };
00089
00090 class Proofing_List: public list_base
00091 {
00092 public:
00093
00094 Proofing_List(cgiScript&sc,Session_Obj & session):list_base(sc,session){;}
00095 ~Proofing_List(){;}
00096
00097 bool list_display( void )
00098 {
00099 bool breturn = true;
00100
00101 hotCol=-2;
00102 editLink = listTemplate.getParagraph("hotcolumn");
00103 editLink = editLink.replace("$prog$","Proofing_UI.cgi");
00104
00105 emitFilter( "Proofing_UI.cgi",
00106 "<h5>Proofings ยท Search by Product Line</h5>" );
00107 string heading =
00108 "<a class='sortcol' href='Proofing_UI.cgi?sort=Id'>Id</a>|"
00109 "<a class='sortcol' href='Proofing_UI.cgi?sort=Size_Price'>Size / Price</a>|"
00110 "<a class='sortcol' href='Proofing_UI.cgi?sort=Style'>Style</a>|"
00111 "<a class='sortcol' href='Proofing_UI.cgi?sort=Proof_Image'>Proof Image</a>"
00112 ;
00113 emitHeadings(heading);
00114 getFilteredData("p.Id, "
00115 "concat(l.Name, ' ', z.X, 'x', z.Y ) as 'Size_Price', "
00116 "concat( s.Name, '-', s.Image, '-', s.Manufacturer_Design_No) as 'Style', "
00117 "p.Proof_Image "
00118 ,"Proofing p inner join Size_Price z on z.Id = p.Size_Price "
00119 "inner join Product_Line l on l.Id = z.Product_Line "
00120 "inner join Style s on s.Id = p.Style ",
00121
00122 "l.Name like '$filter$%'" );
00123 emitData();
00124 emitNavigation("Proofing_UI.cgi");
00125 emitEnd();
00126 return breturn;
00127 }
00128 };
00129
00130 class Proofing_form: public Proofing_Obj, public forms_base
00131 {
00132 public:
00133 Proofing_form(cgiScript & script):Proofing_Obj(),forms_base(script){setKey(*this);}
00134 virtual ~Proofing_form(){;}
00135
00136 void form_id_transfer( void )
00137 {
00138 llongFXfer( "Id", Id );
00139 }
00140 void form_data_transfer( void )
00141 {
00142 llongFXfer( "Size_Price", Size_Price);
00143 llongFXfer( "Style", Style);
00144 stringFXfer( "Proof_Image", Proof_Image);
00145 }
00146
00147 bool dbf_action( string mode, changeMap & changes )
00148 {
00149 return db_action( mode, changes );
00150 }
00151
00152
00153 bool form_display( void )
00154 {
00155 bool breturn = true;
00156 ocString sql;
00157
00158
00159 script << makeTop("Proofing_UI.cgi", "Proof Setup")
00160 << formTemplate.getParagraph("advanced_begin");
00161 script << makeStaticBox("Id", "Id", Id ,"8");
00162 script << "<br class='clearall'>" << endl;
00163 script << formTemplate.getParagraph("advanced_end");
00164
00165 sql = "select z.Id, concat(l.Name, ' ', z.X, 'x', z.Y ) as 'Size_Price' "
00166 "from Size_Price z inner join Product_Line l on l.Id = z.Product_Line";
00167 script << makeComboBox("Size_Price", "Size_Price", Size_Price ,sql,"Please Choose");
00168 script << "<br class='clearall'>" << endl;
00169
00170 sql = "select Id, Name, Image, Manufacturer_Design_No from Style";
00171 script << makeComboBox("Style", "Style", Style ,sql,"Please Choose");
00172 script << "<br class='clearall'>" << endl;
00173
00174 script << makeImageBox("Proof_Image", "Proof_Image", Proof_Image ,"55" );
00175 script << "<br class='clearall'>" << endl;
00176 if( key() )
00177 {
00178 script << "<br/><h3>Configure the areas for the user text here:</h3>" << endl;
00179 Proofing_Text_Area_List Proofing_Text_AreaList(script);
00180 Proofing_Text_AreaList.Parent_Id.append(key());
00181 Proofing_Text_AreaList.loadListTemplates("Templates/spawninglist.htmp");
00182 Proofing_Text_AreaList.list_display();
00183 }
00184 script << makeButtons( key() );
00185 script << makeBottom( m_result ) << endl;
00186 return breturn;
00187 }
00188 };
00189
00190
00191
00192 int main( int argcount, char ** args )
00193 {
00194 cgiScript script( "text/html", false );
00195 Proofing_form myFrm(script);
00196 Proofing_List mylist(script,oLogin.Session());
00197 if( oLogin.testLoginStatus() )
00198 {
00199 script.closeHeader();
00200 cgiTemplates pgTemplate;
00201 pgTemplate.load("Templates/adminPane.htmp");
00202
00203 script << ocString(pgTemplate.getParagraph("top"))
00204 .replaceAll("$heading$","Proofing");
00205
00206 myFrm.loadControlTemplates("Templates/divform.htmp");
00207 myFrm.form_action();
00208 myFrm.form_display();
00209
00210 mylist.loadListTemplates("Templates/navlist.htmp");
00211 mylist.list_display();
00212
00213 ocString end = pgTemplate.getParagraph("bottom");
00214 script << end;
00215 }
00216 else
00217 {
00218 script.Redirect("signIn.html");
00219 }
00220 }
00221
00222 #include "read_write_base.cpp"
00223 #include "forms_base.cpp"
00224