00001 /* 00002 00003 Report_ui.cpp 00004 00005 User Interface Definition and Implementation 00006 for Report. 00007 00008 Copyright (C) 2005 by D.K. McCombs. 00009 W3 Systems Design 00010 00011 Specialized for Mohawk 00012 00013 */ 00014 00015 // itnerface class (list) 00016 #include "Reports.hpp" 00017 00018 int main( int argcount, char ** args ) 00019 { 00020 00021 if( oLogin.testLoginStatus() ) 00022 { 00023 cgiEnvironment cenv; 00024 00025 cgiInput & args = cenv.ClientArguments(); 00026 cgiTemplates pgTemplate; 00027 if( args.count("Id")==0 ) 00028 { 00029 cgiScript script( "text/html", false ); 00030 Report_List mylist(script); 00031 script.closeHeader(); 00032 pgTemplate.load("Templates/adminPane.htmp"); 00033 00034 script << ocString(pgTemplate.getParagraph("top")) 00035 .replaceAll("$heading$","Report"); 00036 00037 mylist.loadListTemplates("Templates/list.htmp"); 00038 mylist.list_display(); 00039 00040 ocString end = pgTemplate.getParagraph("bottom"); 00041 // dummy form to satisfy cleint scripts 00042 script << "<form id='uiForm' name='uiForm'><input type='hidden' id='xmldirections'></form>" << endl; 00043 script << end; 00044 } 00045 else 00046 { 00047 Report_Obj report; 00048 report.key( atoll(args["Id"].c_str()) ); 00049 report.Id = report.key(); 00050 if( report.get_data() ) 00051 { 00052 cgiScript script(report.getMediaType().c_str()); 00053 00054 string path = "reportTemplates/" + report.getTemplatePath(); 00055 string sql = report.getQuery(); 00056 // rep_base rpt(script); 00057 col_handling_rep rpt(script); 00058 rpt.loadTemplates(path); 00059 rpt.addColumnHandlers( report.Id ); 00060 if( rpt.getData(sql) ) 00061 { 00062 rpt.emitTop(report.Name); 00063 rpt.emitHeader(); 00064 rpt.emitData(); 00065 rpt.emitEnd(); 00066 } 00067 else 00068 { 00069 script << "No data! " << sql; 00070 } 00071 } 00072 } 00073 } 00074 else 00075 { 00076 cgiScriptLite script; 00077 script.Redirect("signIn.html"); 00078 } 00079 } 00080 // compile implementations here 00081 #include "read_write_base.cpp" 00082 #include "forms_base.cpp" 00083
1.5.5