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 "cgiTemplates.h"
00020 #include "openLogin.h"
00021 #include "Report_Templates.hpp"
00022 #include "list_base.hpp"
00023 #include "forms_base.hpp"
00024 #include "siteLimit.h"
00025
00026 using namespace std;
00027 openLogin oLogin;
00028
00029 class Report_Templates_List: public list_base
00030 {
00031 public:
00032
00033 Report_Templates_List(cgiScript&sc):list_base(sc){;}
00034 ~Report_Templates_List(){;}
00035
00036 bool list_display( void )
00037 {
00038 bool breturn = true;
00039 string siteLimitation = siteFocus(oLogin);
00040 if( siteLimitation.length() != 0 )
00041 {
00042 addedCriteria = " Site_Id ";
00043 addedCriteria += siteLimitation;
00044 }
00045 hotCol=-2;
00046 editLink = listTemplate.getParagraph("hotcolumn");
00047 editLink = editLink.replace("$prog$","Report_Templates_ui.cgi");
00048 emitFilter( "Report_Templates_ui.cgi",
00049 " <B>FILTER (by Name)</B>" );
00050 string heading =
00051 "<a class='sortcol' href='Report_Templates_ui.cgi?sort=Id'>Id</a>|"
00052 "<a class='sortcol' href='Report_Templates_ui.cgi?sort=Name'>Name</a>|"
00053 "<a class='sortcol' href='Report_Templates_ui.cgi?sort=Path'>Path</a>|"
00054 ;
00055 emitHeadings(heading);
00056 getFilteredData(
00057 "Id, "
00058 "Name, "
00059 "Path "
00060 ,"Report_Templates",
00061 "Name like '$filter$%'" );
00062 emitData();
00063 emitNavigation("Report_Templates_ui.cgi");
00064 emitEnd();
00065 return breturn;
00066 }
00067 };
00068
00069 class Report_Templates_form: public Report_Templates_Obj, public forms_base
00070 {
00071 public:
00072 Report_Templates_form(cgiScript & script):Report_Templates_Obj(),forms_base(script){setKey(*this);}
00073 virtual ~Report_Templates_form(){;}
00074
00075 void form_id_transfer( void )
00076 {
00077 llongFXfer( "Id", Id );
00078 }
00079 void form_data_transfer( void )
00080 {
00081 llongFXfer( "Site_Id", Site_Id);
00082 stringFXfer( "Name", Name);
00083 stringFXfer( "Path", Path);
00084
00085 }
00086
00087 bool dbf_action( string mode, changeMap & changes )
00088 {
00089 return db_action( mode, changes );
00090 }
00091
00092
00093 bool form_display( void )
00094 {
00095 bool breturn = true;
00096 ocString sql= "select id, name from metasite.sites";
00097 string siteLimitation = siteFocus(oLogin);
00098 if( siteLimitation.length() != 0 )
00099 {
00100 sql += " where id ";
00101 sql += siteLimitation;
00102 }
00103 sql += " order by name";
00104 script << makeTop("Report_Templates_ui.cgi", "Report_Templates")
00105 << formTemplate.getParagraph("advanced_begin");
00106 script << makeStaticBox("Id", "Id", Id ,"8");
00107 script << "<br class='clearall'>" << endl;
00108
00109 script << makeComboBox("Site_Id", "Site_Id", Site_Id ,sql);
00110 script << "<br class='clearall'>" << endl;
00111 script << formTemplate.getParagraph("advanced_end");
00112 script << makeTextBox("Name", "Name", Name ,"25");
00113 script << "<br class='clearall'>" << endl;
00114 script << makeFileBox( "Path", "Path", Path, "55" );
00115 script << "<br class='clearall'>" << endl;
00116
00117 script << makeButtons( key() );
00118 script << makeBottom( m_result ) << endl;
00119 return breturn;
00120 }
00121 };
00122
00123
00124 int main( int argcount, char ** args )
00125 {
00126 cgiScript script( "text/html", false );
00127 Report_Templates_form myFrm(script);
00128 Report_Templates_List mylist(script);
00129 if( oLogin.testLoginStatus() )
00130 {
00131 script.closeHeader();
00132 cgiTemplates pgTemplate;
00133 pgTemplate.load("Templates/adminPane.htmp");
00134
00135 script << ocString(pgTemplate.getParagraph("top"))
00136 .replace("filePick.cgi","repTemplatePick.cgi");
00137
00138 myFrm.loadControlTemplates("Templates/divform.htmp");
00139 myFrm.form_action();
00140 myFrm.form_display();
00141
00142 mylist.loadListTemplates("Templates/list.htmp");
00143 mylist.list_display();
00144
00145 ocString end = pgTemplate.getParagraph("bottom");
00146 script << end;
00147 }
00148 else
00149 {
00150 script.Redirect("signIn.html");
00151 }
00152 }
00153
00154 #include "read_write_base.cpp"
00155 #include "forms_base.cpp"
00156