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 "global_content.hpp"
00023 #include "openLogin.h"
00024 #include "global_content_obj.hpp"
00025 #include "siteLimit.h"
00026
00027 using namespace std;
00028 openLogin oLogin;
00029
00030 class global_content_form: public global_content_Obj, public forms_base
00031 {
00032 public:
00033 global_content_form(cgiScript & script):global_content_Obj(),forms_base(script)
00034 {
00035 setKey(*this);
00036 }
00037 virtual ~global_content_form(){;}
00038
00039 void form_id_transfer( void )
00040 {
00041 llongFXfer( "id", id );
00042 }
00043 void form_data_transfer( void )
00044 {
00045 llongFXfer( "site_id", site_id);
00046
00047 if( site_id <= 0 )
00048 {
00049 site_id = atoll( currentSite().c_str());
00050 }
00051 stringFXfer( "name", name);
00052 stringFXfer( "content", content);
00053 }
00054
00055 bool dbf_action( string mode, changeMap & changes )
00056 {
00057 return db_action( mode, changes );
00058 }
00059
00060
00061 bool form_display( void )
00062 {
00063 bool breturn = true;
00064 ocString sql;
00065 script << makeTop("global_content_Popup.cgi", "global_content")
00066 << formTemplate.getParagraph("advanced_begin");
00067 script << makeStaticBox("Id", "id", id ,"8");
00068 script << makeStaticBox("Site Id", "site_id",site_id ,"8");
00069 script << "<br class='clearall'>" << endl;
00070 script << formTemplate.getParagraph("advanced_end");
00071 script << makeTextBox("Section name", "name", name ,"125","35");
00072 script << "<br class='clearall'>" << endl;
00073 script << makeTextArea( "Content","content", content, "6","80" );
00074 script << "<br class='clearall'>" << endl;
00075
00076 script << makeButtons( key() );
00077 script << makeBottom( m_result ) << endl;
00078 return breturn;
00079 }
00080 };
00081
00082
00083 int main( int argcount, char ** args )
00084 {
00085 cgiScript script( "text/html", false );
00086 global_content_form myFrm(script);
00087
00088 if( oLogin.testLoginStatus() )
00089 {
00090 script.closeHeader();
00091 cgiTemplates pgTemplate;
00092 pgTemplate.load("Templates/editingPane.htmp");
00093
00094 script << ocString(pgTemplate.getParagraph("top"))
00095 .replaceAll("$heading$","Global Content");
00096
00097 myFrm.loadControlTemplates("Templates/editingForm.htmp");
00098 myFrm.form_action();
00099 myFrm.form_display();
00100
00101 ocString end = pgTemplate.getParagraph("bottom");
00102 script << end;
00103 }
00104 else
00105 {
00106 script.Redirect("/");
00107 }
00108 }
00109
00110 #include "read_write_base.cpp"
00111 #include "forms_base.cpp"
00112