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 "cgiTemplates.h"
00022 #include "Proofing_Text_Area.hpp"
00023 #include "openLogin.h"
00024
00025 using namespace std;
00026 openLogin oLogin;
00027
00028 #include "sublist_base.hpp"
00029 #include "lookup.hpp"
00030
00031
00032
00033 class Proofing_Text_Area_List: public sublist_base
00034 {
00035
00036 public:
00037 ocString Parent_Id;
00038
00039 Proofing_Text_Area_List(cgiScript&sc):sublist_base(sc){;}
00040 ~Proofing_Text_Area_List(){;}
00041
00042 bool list_display( void )
00043 {
00044 bool breturn = true;
00045 string sql = "select "
00046 "Id, "
00047
00048 "pointSize, "
00049 "height, "
00050 "width, "
00051 "posX, "
00052 "posY, "
00053 "color, "
00054 "background, "
00055 "fontFaceName "
00056 "from Proofing_Text_Area where Proofing = '" ;
00057 sql += Parent_Id;
00058 sql += "'";
00059
00060 hotCol=-2;
00061 editLink = listTemplate.getParagraph("peerlink");
00062 editLink = editLink.replace("$prog$","Proofing_Text_Area_Popup.cgi");
00063 string heading =
00064 "Id| "
00065
00066 "pointSize| "
00067 "height| "
00068 "width| "
00069 "posX| "
00070 "posY| "
00071 "color| "
00072 "background| "
00073 "fontFaceName "
00074 ;
00075 emitHeadings(heading);
00076
00077 getData( sql );
00078 emitData();
00079 ocString list_new = listTemplate.getParagraph("peernew");
00080 ocString url = "Proofing_Text_Area_Popup.cgi?Proofing=";
00081 url += Parent_Id;
00082
00083 webIO << list_new.replace("$location",url.c_str()).replace("$cols","9").replace("Item","Proofing_Text_Area");
00084 emitEnd();
00085 return breturn;
00086 }
00087 };
00088 class Proofing_Text_Area_form: public Proofing_Text_Area_Obj, public forms_base
00089 {
00090 public:
00091 Proofing_Text_Area_form(cgiScript & script):Proofing_Text_Area_Obj(),forms_base(script)
00092 {
00093 setKey(*this);
00094 }
00095 virtual ~Proofing_Text_Area_form(){;}
00096
00097 void form_id_transfer( void )
00098 {
00099 llongFXfer( "Id", Id );
00100 }
00101 void form_data_transfer( void )
00102 {
00103 llongFXfer( "Proofing", Proofing);
00104 intFXfer( "pointSize", pointSize);
00105 intFXfer( "height", height);
00106 intFXfer( "width", width);
00107 intFXfer( "posX", posX);
00108 intFXfer( "posY", posY);
00109 stringFXfer( "color", color);
00110 stringFXfer( "background", background);
00111 stringFXfer( "fontFaceName", fontFaceName);
00112 }
00113
00114 bool dbf_action( string mode, changeMap & changes )
00115 {
00116 return db_action( mode, changes );
00117 }
00118
00119
00120 bool form_display( void )
00121 {
00122 bool breturn = true;
00123 ocString sql;
00124
00125 string pattern;
00126 script << makeTop("Proofing_Text_Area_Popup.cgi", "Proofing_Text_Area")
00127 << formTemplate.getParagraph("advanced_begin");
00128 script << makeStaticBox("Id", "Id", Id ,"8");
00129 script << "<br class='clearall'>" << endl;
00130 script << formTemplate.getParagraph("advanced_end");
00131
00132 script << makeHiddenBox("Proofing", Proofing);
00133 script << "<br class='clearall'>" << endl;
00134 script << makeTextBox("pointSize", "pointSize", pointSize ,"8","8");
00135 script << "<br class='clearall'>" << endl;
00136 if(Proofing)
00137 {
00138 sql = "select Proof_Image from Proofing where Id = ";
00139 sql.append(Proofing);
00140 pattern = tableLookup(sql);
00141 script <<"<img alt=\"Click on the upper left corner and drag to the lower right corner of the drag area"
00142 "\" style=\"float: right;\" id=\"pattern\" src=\"/images/" + pattern + "\">"
00143 << endl;
00144 }
00145
00146 script << makeTextBox("height", "height", height ,"8","8");
00147 script << "<br class='clearall'>" << endl;
00148 script << makeTextBox("width", "width", width ,"8","8");
00149 script << "<br class='clearall'>" << endl;
00150 script << makeTextBox("posX", "posX", posX ,"8","8");
00151 script << "<br class='clearall'>" << endl;
00152 script << makeTextBox("posY", "posY", posY ,"8","8");
00153 script << "<br class='clearall'>" << endl;
00154 script << makeTextBox("color", "color", color ,"125","35");
00155 script << "<br class='clearall'>" << endl;
00156 script << makeTextBox("background", "background", background ,"125","35");
00157 script << "<br class='clearall'>" << endl;
00158 script << makeTextBox("fontFaceName", "fontFaceName", fontFaceName ,"125","35");
00159 script << "<br class='clearall'>" << endl;
00160 script << makeButtons( key() );
00161
00162 script << makeBottom( m_result ) << endl;
00163 return breturn;
00164 }
00165 };
00166
00167
00168 int main( int argcount, char ** args )
00169 {
00170 cgiScript script( "text/html", false );
00171 Proofing_Text_Area_form myFrm(script);
00172
00173 if( oLogin.testLoginStatus() )
00174 {
00175 script.closeHeader();
00176 cgiTemplates pgTemplate;
00177 pgTemplate.load("Templates/childPane.htmp");
00178
00179 script << ocString(pgTemplate.getParagraph("top"))
00180 .replaceAll("$heading$","Proofing_Text_Area");
00181
00182 myFrm.loadControlTemplates("Templates/childdivform.htmp");
00183 myFrm.form_action();
00184 myFrm.form_display();
00185 if( myFrm.Proofing )
00186 {
00187 Proofing_Text_Area_List Proofing_Text_AreaList(script);
00188 Proofing_Text_AreaList.Parent_Id.append(myFrm.Proofing);
00189 Proofing_Text_AreaList.loadListTemplates("Templates/spawninglist.htmp");
00190
00191 Proofing_Text_AreaList.list_display();
00192 }
00193
00194 ocString end = pgTemplate.getParagraph("bottom");
00195 script << end.replace( "/*_extra_js_*/",
00196 "var x=0; var y=0; var height=0; var width=0; "
00197 "var ptrnImage = myDom.getElementById('pattern');\n"
00198 "if( ptrnImage ) {\n"
00199 "myDom.addListener(ptrnImage,'mousedown', txtTop, true);"
00200 "myDom.addListener(ptrnImage,'mouseup', txtEnd, true);"
00201 "}\n"
00202 "function txtTop(evt) { x=evt.pageX- evt.target.x; y = evt.pageY - evt.target.y;"
00203 "document.forms['uiForm'].posX.value = evt.pageX - evt.target.x;"
00204 "document.forms['uiForm'].posY.value = evt.pageY - evt.target.y; "
00205 "ctrlChanged(document.forms['uiForm'].posX);"
00206 "ctrlChanged(document.forms['uiForm'].posY);"
00207 "if (evt.preventDefault) { evt.preventDefault(); } "
00208 "return false; }\n"
00209 "function txtEnd(evt) {"
00210 "document.forms['uiForm'].width.value = (evt.pageX - evt.target.x)-x ;"
00211 "document.forms['uiForm'].height.value = (evt.pageY - evt.target.y)-y ;"
00212 "ctrlChanged(document.forms['uiForm'].width);"
00213 "ctrlChanged(document.forms['uiForm'].height);"
00214 " }"
00215
00216 );
00217
00218
00219 }
00220 else
00221 {
00222 script << "<html><body>"
00223 << "<a href='javascript:window.close()'><h1>You are not logged in</h1></a>"
00224 << "</body></html>" << endl;
00225 }
00226 }
00227
00228 #include "read_write_base.cpp"
00229 #include "forms_base.cpp"
00230
00231