00001
00002
00003
00004
00005
00006
00007
00008 #include <iostream>
00009 #include <iomanip>
00010 #include "cgiTemplates.h"
00011 #include "connectstring"
00012 #include "forms.h"
00013 #include "ocTypes.h"
00014 #include "ocString.h"
00015 #include "read_write_base.hpp"
00016 #include "forms_base.hpp"
00017 #include "cgiTemplates.h"
00018 #include "role_services.hpp"
00019
00020 #include "openLogin.h"
00021 #include "siteLimit.h"
00022 #include "ocXML.h"
00023 using namespace std;
00024 openLogin oLogin;
00025 #include "InfoPoints.hpp"
00026 #include "page_obj.hpp"
00027 #include "superlist_base.hpp"
00028
00029 class pages_List: public list_base
00030 {
00031 public:
00032
00033 pages_List(cgiScript&sc,Session_Obj & session):list_base(sc,session){;}
00034 ~pages_List(){;}
00035
00036 bool list_display( void )
00037 {
00038 bool breturn = true;
00039
00040 hotCol=-2;
00041 itemsPerPg = 10;
00042 editLink = listTemplate.getParagraph("hotcolumn");
00043 editLink = editLink.replace("$prog$","pageBuilder.cgi");
00044
00045 addedCriteria = " site_id ";
00046 addedCriteria += siteFocus();
00047
00048 emitFilter( "pageBuilder.cgi",
00049 "<h5>pagess · Search by Name</h5>" );
00050 string heading =
00051 "<a class='sortcol' href='pageBuilder.cgi?sort=id'>Page Id</a>|"
00052 "<a class='sortcol' href='pageBuilder.cgi?sort=name'>Page Name</a>"
00053 ;
00054 emitHeadings(heading);
00055 getFilteredData( "id, "
00056 "name "
00057 ,"metasite.pages",
00058 "name like '$filter$%'" );
00059 emitData();
00060 emitNavigation("pageBuilder.cgi");
00061 emitEnd();
00062 return breturn;
00063 }
00064 };
00065
00066 class page_form: public page, public forms_base
00067 {
00068 public:
00069 page_form(cgiScript & script):page(),forms_base(script){setKey(*this);}
00070 virtual ~page_form(){;}
00071
00072 void form_id_transfer( void )
00073 {
00074 llongFXfer( "id", id );
00075 }
00076 void form_data_transfer( void )
00077 {
00078
00079 site_id = atoll(currentSite().c_str());
00080 llongFXfer( "template_id", template_id );
00081 stringFXfer( "name", name );
00082 stringFXfer( "url", url );
00083 stringFXfer( "meta_description", meta_description );
00084 }
00085
00086 bool dbf_action( string mode, changeMap & changes )
00087 {
00088 return db_action( mode, changes );
00089 }
00090
00091
00092 bool form_display( void )
00093 {
00094 bool breturn = true;
00095 ocString sql;
00096 string siteLimitation = siteFocus();
00097 script << makeTop("pageBuilder.cgi", "Page Builder")
00098 << formTemplate.getParagraph("advanced_begin")
00099 << makeStaticBox("Id", "id", id, "12")
00100 << makeStaticBox( "Site Id", "site_id", site_id, "12");
00101 script << "<br class='clearall'>" << endl
00102 << makeTextBox("SEO Key Phrases","meta_description",meta_description, "355", "50")
00103 << "<br class='clearall'>" << endl
00104 << formTemplate.getParagraph("advanced_end");
00105
00106 sql = "select id, name from metasite.templates";
00107 if( siteLimitation.length() )
00108 {
00109 sql += " where site_id ";
00110 sql += siteLimitation;
00111 }
00112 script << makeComboBox( "Template", "template_id", template_id,
00113 sql );
00114 script << "<br class='clearall'>" << endl;
00115 script << makeTextBox("Title","name",name,"50", "25")
00116 << "<br class='clearall'>" << endl
00117 << makeTextBox("URL","url",url,"255", "25");
00118 script << "<br class='clearall'>" << endl;
00119 if( id )
00120 {
00121 script << "<br class='clearall'>" << endl;
00122 script << "<a style=\"float: right; color: green;\" href=\"" << url << "\">Go To Page</a>" << endl;
00123 script << "<br class='clearall'>" << endl;
00124 }
00125
00126 script << makeButtons( key() );
00127
00128 script << makeBottom( m_result ) << endl;
00129 return breturn;
00130 }
00131 };
00132
00133
00134 int main( int argcount, char ** args )
00135 {
00136 cgiScript script( "text/html", false );
00137 page_form myFrm(script);
00138
00139 if( oLogin.testLoginStatus() )
00140 {
00141 script.closeHeader();
00142 cgiTemplates pgoo;
00143 pgoo.load("Templates/adminPane.htmp");
00144
00145 script << ocString(pgoo.getParagraph("top"))
00146 .replaceAll("$heading$","SITES");
00147
00148 myFrm.loadControlTemplates("Templates/divform.htmp");
00149 myFrm.form_action();
00150 myFrm.form_display();
00151
00152 pages_List mylist(script,oLogin.Session());
00153 mylist.loadListTemplates("Templates/navlist.htmp");
00154 mylist.list_display();
00155
00156 ocString end = pgoo.getParagraph("bottom");
00157 script << end;
00158 }
00159 }
00160
00161
00162 #include "read_write_base.cpp"
00163 #include "forms_base.cpp"