00001
00002
00003
00004
00005
00006
00007 #include <iostream>
00008 #include <iomanip>
00009 #include "cgiExtend.h"
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 "list_base.hpp"
00018 #include "openLogin.h"
00019 #include "siteLimit.h"
00020 #include "templates.hpp"
00021
00022 using namespace std;
00023 openLogin oLogin;
00024
00025 class template_form: public Template, public forms_base
00026 {
00027 public:
00028 template_form(cgiScript & script):Template(),forms_base(script){setKey(*this);}
00029 virtual ~template_form(){;}
00030
00031 void form_id_transfer( void )
00032 {
00033 llongFXfer( "id", id );
00034 }
00035 void form_data_transfer( void )
00036 {
00037
00038 llongFXfer( "site_id", site_id );
00039 stringFXfer( "name", name);
00040 stringFXfer( "path",path );
00041 }
00042
00043 bool dbf_action( string mode, changeMap & changes )
00044 {
00045 return db_action( mode, changes );
00046 }
00047
00048
00049 bool form_display( void )
00050 {
00051 bool breturn = true;
00052 string siteLimitation = siteFocus(oLogin);
00053 string sql = "select id, name from metasite.sites";
00054 if( siteLimitation.length() != 0 )
00055 {
00056 sql += " where id ";
00057 sql += siteLimitation;
00058 }
00059 sql += " order by name";
00060 script << "<!--" << sql << "-->" << endl;
00061 script << makeTop("template_ui.cgi", "TEMPLATES")
00062 << makeStaticBox("id", "id", id, "12")
00063 << makeComboBox( "Site", "site_id", site_id,
00064 sql )
00065 << makeTextBox("name","name",name,"50")
00066 << makeFileBox( "path","path",path,"50")
00067 << makeButtons( key() );
00068
00069 script << makeBottom( m_result ) << endl;
00070 return breturn;
00071 }
00072 };
00073
00074
00075 int main( int argcount, char ** args )
00076 {
00077 cgiScript script( "text/html", false );
00078 template_form myFrm(script);
00079
00080 if( oLogin.testLoginStatus() )
00081 {
00082 script.closeHeader();
00083 cgiTemplates pgTemplate;
00084 pgTemplate.load("Templates/adminPane.htmp");
00085
00086 script << ocString(pgTemplate.getParagraph("top"))
00087 .replaceAll("$heading$","SITES");
00088
00089 myFrm.loadControlTemplates("Templates/form.htmp");
00090 myFrm.form_action();
00091 myFrm.form_display();
00092
00093 ocString end = pgTemplate.getParagraph("bottom");
00094 if( myFrm.getMode() != "s" )
00095 {
00096 script << end.replace("/*_extra_js_*/"," remenu();");
00097 }
00098 else
00099 {
00100 script << end;
00101 }
00102 }
00103 else
00104 {
00105 script.Redirect("signIn.html");
00106 }
00107 }
00108
00109
00110
00111
00112 #include "read_write_base.cpp"
00113 #include "forms_base.cpp"