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 "paragraphs.hpp"
00023 #include "openLogin.h"
00024 #include "diaButtons.h"
00025
00026 using namespace std;
00027 openLogin oLogin;
00028
00029 #include "sublist_base.hpp"
00030
00031
00032
00033 class paragraphs_List: public sublist_base
00034 {
00035
00036 public:
00037 ocString Parent_Id;
00038
00039 paragraphs_List(cgiScript&sc):sublist_base(sc){;}
00040 ~paragraphs_List(){;}
00041
00042 bool list_display( void )
00043 {
00044 bool breturn = true;
00045 string sql = "select "
00046 "id, "
00047 "site_id, "
00048 "page_id, "
00049 "place_order, "
00050 "template_tag, "
00051 "replace_tag, "
00052 "name, "
00053 "content, "
00054 "author, "
00055 "time_authored, "
00056 "time_start, "
00057 "time_end, "
00058 "approved, "
00059 "section "
00060 "from paragraphs where TODO:??? = '" ;
00061 sql += Parent_Id;
00062 sql += "'";
00063
00064 hotCol=-2;
00065 editLink = listTemplate.getParagraph("peerlink");
00066 editLink = editLink.replace("$prog$","contentEdit.cgi");
00067 string heading =
00068 "id| "
00069 "site_id| "
00070 "page_id| "
00071 "place_order| "
00072 "template_tag| "
00073 "replace_tag| "
00074 "name| "
00075 "content| "
00076 "author| "
00077 "time_authored| "
00078 "time_start| "
00079 "time_end| "
00080 "approved| "
00081 "section "
00082 ;
00083 emitHeadings(heading);
00084
00085 getData( sql );
00086 emitData();
00087 ocString list_new = listTemplate.getParagraph("peernew");
00088 ocString url = "contentEdit.cgi?TODO:???=";
00089 url += Parent_Id;
00090
00091 webIO << list_new.replace("$location",url.c_str()).replace("$cols","7").replace("Item","paragraphs");
00092 emitEnd();
00093 return breturn;
00094 }
00095 };
00096 class paragraphs_form: public paragraphs_Obj, public forms_base
00097 {
00098 public:
00099 paragraphs_form(cgiScript & script):paragraphs_Obj(),forms_base(script)
00100 {
00101 setKey(*this);
00102 }
00103 virtual ~paragraphs_form(){;}
00104
00105 void form_id_transfer( void )
00106 {
00107 llongFXfer( "id", id );
00108 }
00109 void form_data_transfer( void )
00110 {
00111 llongFXfer( "site_id", site_id);
00112 llongFXfer( "page_id", page_id);
00113 intFXfer( "place_order", place_order);
00114 stringFXfer( "template_tag", template_tag);
00115 stringFXfer( "replace_tag", replace_tag);
00116 stringFXfer( "name", name);
00117 stringFXfer( "content", content);
00118 llongFXfer( "author", author);
00119 dateFXfer( "time_authored", time_authored);
00120 dateFXfer( "time_start", time_start);
00121 dateFXfer( "time_end", time_end);
00122 boolFXfer( "approved", approved);
00123 stringFXfer( "section", section);
00124 }
00125
00126 bool dbf_action( string mode, changeMap & changes )
00127 {
00128 return db_action( mode, changes );
00129 }
00130
00131
00132 bool form_display( void )
00133 {
00134 bool breturn = true;
00135 ocString sql;
00136 script << makeTop("contentEdit.cgi", "paragraphs")
00137 << formTemplate.getParagraph("advanced_begin");
00138 script << makeStaticBox("id", "id", id ,"8");
00139 script << "<br class='clearall'>" << endl;
00140 script << formTemplate.getParagraph("advanced_end");
00141
00142 script << makeComboBox("site_id", "site_id", site_id ,sql,"Please Choose");
00143 script << "<br class='clearall'>" << endl;
00144 script << makeComboBox("page_id", "page_id", page_id ,sql,"Please Choose");
00145 script << "<br class='clearall'>" << endl;
00146 script << makeTextBox("place_order", "place_order", place_order ,"8","8");
00147 script << "<br class='clearall'>" << endl;
00148 script << makeTextBox("template_tag", "template_tag", template_tag ,"125","35");
00149 script << "<br class='clearall'>" << endl;
00150 script << makeTextBox("replace_tag", "replace_tag", replace_tag ,"125","35");
00151 script << "<br class='clearall'>" << endl;
00152 script << makeTextBox("name", "name", name ,"125","35");
00153 script << "<br class='clearall'>" << endl;
00154 script << makeTextBox("content", "content", content ,"125","35");
00155 script << "<br class='clearall'>" << endl;
00156 script << makeComboBox("author", "author", author ,sql,"Please Choose");
00157 script << "<br class='clearall'>" << endl;
00158 script << makeTextBox("time_authored", "time_authored", time_authored ,"24","24");
00159 script << "<br class='clearall'>" << endl;
00160 script << makeTextBox("time_start", "time_start", time_start ,"24","24");
00161 script << "<br class='clearall'>" << endl;
00162 script << makeTextBox("time_end", "time_end", time_end ,"24","24");
00163 script << "<br class='clearall'>" << endl;
00164 script << makeBoolBox("approved", "approved", approved );
00165 script << "<br class='clearall'>" << endl;
00166 script << makeTextBox("section", "section", section ,"125","35");
00167 script << "<br class='clearall'>" << endl;
00168
00169 script << diaButtons( key() ,
00170 " Insert paragraphs ",
00171 " Update paragraphs ",
00172 " Delete paragraphs ",
00173 "",
00174 "");
00175 script << makeBottom( m_result ) << endl;
00176 return breturn;
00177 }
00178 };
00179
00180
00181 int main( int argcount, char ** args )
00182 {
00183 cgiScript script( "text/html", false );
00184 paragraphs_form myFrm(script);
00185
00186 if( oLogin.testLoginStatus() )
00187 {
00188 script.closeHeader();
00189 cgiTemplates pgTemplate;
00190 pgTemplate.load("Templates/childPane.htmp");
00191
00192 script << ocString(pgTemplate.getParagraph("top"))
00193 .replaceAll("$heading$","paragraphs");
00194
00195 myFrm.loadControlTemplates("Templates/childdivform.htmp");
00196 myFrm.form_action();
00197 myFrm.form_display();
00198 if( myFrm.TODO??? )
00199 {
00200 paragraphs_List paragraphsList(script);
00201 paragraphsList.Parent_Id.append(myFrm.TODO???);
00202 paragraphsList.loadListTemplates("Templates/spawninglist.htmp");
00203 script << "<div class=\"ui\">" << endl;
00204 script << "<div class='heading'>paragraphs List:</div>" << endl;
00205 paragraphsList.list_display();
00206 script << "</div>" << endl;
00207 }
00208 ocString end = pgTemplate.getParagraph("bottom");
00209 script << end;
00210 }
00211 else
00212 {
00213 script << "<html><body>"
00214 << "<a href='javascript:window.close()'><h1>You are not logged in</h1></a>"
00215 << "</body></html>" << endl;
00216 }
00217 }
00218
00219 #include "read_write_base.cpp"
00220 #include "forms_base.cpp"
00221
00222