00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <string>
00015
00016 #include "openLogger.h"
00017 using namespace std;
00018
00019
00020 string baseUrl;
00021
00022 #include "connectstring"
00023 #include "w3intranet.h"
00024 #include "Reports.hpp"
00025
00026 bool Report_Parameters_form::hasParamValues = false;
00032 void addListCriteria( Report_List & repList )
00033 {
00034 serviceMap::iterator pos = oLogin.Services().find("ReportListing.meta");
00035 if( pos != oLogin.Services().end() )
00036 {
00037 openService & service = pos->second;
00038 string::size_type idx = service.xml_param1.find("<view>");
00039 if( idx != string::npos )
00040 {
00041 idx += 6;
00042 string::size_type idx2=service.xml_param1.find("</view>");
00043 if( idx2 != string::npos && idx2 > idx )
00044 {
00045 string reps = service.xml_param1.substr(idx, idx2-idx);
00046 repList.addedCriteria = " r.Id in ( " + reps + " ) ";
00047 }
00048 }
00049 }
00050 }
00051 bool intraMain(page & pg ,cgiScript & script)
00052 {
00053 Report_List mylist(script);
00054 mylist.loadListTemplates("Templates/list.htmp");
00055 addListCriteria(mylist);
00056 script << "<h1>Reports: </h1>" << endl;
00057 mylist.list_display();
00058
00059
00060 script << "<form id='uiForm' name='uiForm'><input type='hidden' id='xmldirections'></form>" << endl;
00061 return true;
00062 }
00063
00064
00065 int main(int argc, char ** argv)
00066 {
00067 baseUrl = "reportListing.meta";
00068
00069 cgiScript script("text/html",false);
00070 bool isSignedOn = check(script);
00071 script.closeHeader();
00072
00073
00074
00075 script.ScriptName() =
00076 ocString( script.ScriptName().c_str()).replace("ReportListing.meta","reports").c_str();
00077
00078 page pg(script);
00079
00080 writelog( "load page" );
00081 if( pg.load() )
00082 {
00083 writelog( "instance of page control" );
00084 page_control ctrl(pg);
00085 ctrl.addOp ( "servicelist", new servicelist_functor(pg,script,isSignedOn) );
00086 ctrl.addOp ( "userinterface", new form_functor(pg,script,isSignedOn) );
00087 writelog( "page control emit" );
00088 ctrl.emit();
00089 }
00090 else
00091 {
00092 script << "<html><head><title>Page Unavailable</title></head>" << endl
00093 << "<body><h1>Sorry</h1>" << endl
00094 << "<p>The page you requested is not available</p></body></html>";
00095 }
00096 return 0;
00097 }
00098
00099
00100 #include "read_write_base.cpp"
00101 #include "forms_base.cpp"