00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <iostream>
00015 #include <iomanip>
00016 #include "cgiTemplates.h"
00017 #include "connectstring"
00018 #include "forms.h"
00019 #include "ocTypes.h"
00020 #include "ocString.h"
00021 #include "cgiTemplates.h"
00022 #include "read_write_base.hpp"
00023 #include "list_base.hpp"
00024 #include "forms_base.hpp"
00025
00026
00027 using namespace std;
00028
00029
00030 #include "Report_Parameters.hpp"
00031
00032 #include "InfoPoints.hpp"
00033
00034 class Report_Parameters_List: public list_base
00035 {
00036 public:
00037
00038 Report_Parameters_List(cgiScript&sc):list_base(sc){;}
00039 ~Report_Parameters_List(){;}
00040
00041 bool list_display( void )
00042 {
00043 bool breturn = true;
00044
00045 hotCol=-2;
00046 editLink = listTemplate.getParagraph("hotcolumn");
00047 editLink = editLink.replace("$prog$","Report_Parameters_ui.cgi");
00048 emitFilter( "Report_Parameters_ui.cgi",
00049 " <B>FILTER (by Display_Label)</B>" );
00050 string heading =
00051 "<a class='sortcol' href='Report_Parameters_ui.cgi?sort=p.Id'>Id</a>|"
00052 "<a class='sortcol' href='Report_Parameters_ui.cgi?sort=r.Name'>Report</a>|"
00053 "<a class='sortcol' href='Report_Parameters_ui.cgi?sort=p.Display_Label'>Display_Label</a>|"
00054 "<a class='sortcol' href='Report_Parameters_ui.cgi?sort=p.Data_Element'>Data_Element</a>|"
00055 "<a class='sortcol' href='Report_Parameters_ui.cgi?sort=p.Tag_Name'>Tag_Name</a>|"
00056 "<a class='sortcol' href='Report_Parameters_ui.cgi?sort=p.Choices_Query'>Choices_Query</a>|"
00057 "<a class='sortcol' href='Report_Parameters_ui.cgi?sort=p.List_Order'>List Order</a>"
00058 ;
00059 emitHeadings(heading);
00060 getFilteredData(
00061 "p.Id, "
00062 "r.Name, "
00063 "p.Display_Label, "
00064 "p.Data_Element, "
00065 "p.Tag_Name, "
00066 "p.Choices_Query, p.List_Order"
00067 ,"Report_Parameters p inner join Report r on p.Report_Id = r.Id",
00068 "p.Display_Label like '$filter$%'",
00069 "p.List_Order");
00070 emitData();
00071 emitNavigation("Report_Parameters_ui.cgi");
00072 emitEnd();
00073 return breturn;
00074 }
00075 };
00076
00077 class Report_Parameters_form: public Report_Parameters_Obj, public forms_base
00078 {
00079 string Parameter_Types;
00080 public:
00081 Report_Parameters_form(cgiScript & script):Report_Parameters_Obj(),forms_base(script)
00082 {
00083 setKey(*this);
00084 Parameter_Types = "STRING=STRING,DATE=DATE,SELECT=SELECT,AUTO=AUTO";
00085 }
00086 virtual ~Report_Parameters_form(){;}
00087
00088 void form_id_transfer( void )
00089 {
00090 llongFXfer( "Id", Id );
00091 }
00092 void form_data_transfer( void )
00093 {
00094 llongFXfer( "Report_Id", Report_Id);
00095 stringFXfer( "Display_Label", Display_Label);
00096 stringFXfer( "Data_Element", Data_Element);
00097 stringFXfer( "Tag_Name", Tag_Name);
00098 stringFXfer( "Choices_Query", Choices_Query);
00099 stringFXfer( "Parameter_Type", Parameter_Type);
00100 intFXfer( "List_Order", List_Order);
00101 stringFXfer( "Pre_Content", Pre_Content);
00102 stringFXfer( "Post_Content", Post_Content);
00103 }
00104
00105 bool dbf_action( string mode, changeMap & changes )
00106 {
00107 return db_action( mode, changes );
00108 }
00109
00110
00111 bool form_display( void )
00112 {
00113 bool breturn = true;
00114 ocString sql;
00115
00116 script << makeTop("Report_Parameters_ui.cgi", "Report_Parameters")
00117 << formTemplate.getParagraph("advanced_begin");
00118 script << makeStaticBox("Id", "Id", Id ,"8");
00119 script << "<br class='clearall'>" << endl;
00120 script << formTemplate.getParagraph("advanced_end");
00121
00122 sql = "select Id, Name from Report order by Name";
00123
00124 script << makeComboBox("Report_Id", "Report_Id", Report_Id ,sql);
00125 script << "<br class='clearall'>" << endl;
00126 script << makeTextBox("Display Label", "Display_Label", Display_Label ,"25") << " The Label";
00127 script << "<br class='clearall'>" << endl;
00128 script << makeTextBox("Data Element", "Data_Element", Data_Element ,"25") << " Name passed to the Query String";
00129 script << "<br class='clearall'>" << endl;
00130 script << makeTextBox("Tag_Name", "Tag_Name", Tag_Name ,"25") << " The tag in the composite query that is replaced";
00131 script << "<br class='clearall'>"
00132 "Choices Query is for combo box and auto type parameters.<br>"
00133 "For combo boxes it determines the range of values.<br>"
00134 "For auto it determines the value.<br>"
00135 "Note that valid replacement tags for the current login in the "
00136 "choices query are "
00137 "<b style='color:blue'> {{login}} {{group}} {{staff}} </b> "
00138 "for each of those Id's." << endl;
00139 script << makeTextArea("Choices_Query", "Choices_Query", Choices_Query ,"5","60");
00140 script << "<br class='clearall'>" << endl;
00141 script << makeManualComboBox("Parameter_Type", "Parameter_Type", Parameter_Type ,Parameter_Types.c_str() );
00142 script << "<br class='clearall'>" << endl;
00143 script << makeTextBox("List_Order", "List_Order", List_Order ,"8","8");
00144 script << "<br class='clearall'>" << endl;
00145 script << makeTextArea("Pre_Content", "Pre_Content", Pre_Content ,"3","60");
00146 script << "<br class='clearall'>" << endl;
00147 script << makeTextArea("Post_Content", "Post_Content", Post_Content ,"3","60");
00148 script << "<br class='clearall'>" << endl;
00149 script << makeButtons( key() );
00150 script << makeBottom( m_result ) << endl;
00151 return breturn;
00152 }
00153 };
00154
00155
00156 int main( int argcount, char ** args )
00157 {
00158 cgiScript script( "text/html", false );
00159 Report_Parameters_form myFrm(script);
00160 Report_Parameters_List mylist(script);
00161
00162
00163 infoPoints iPoints;
00164 if( iPoints.idToken.length() )
00165 {
00166 oLogin.token = iPoints.idToken;
00167 }
00168
00169 if( oLogin.testLoginStatus() )
00170 {
00171 script.closeHeader();
00172 cgiTemplates pgTemplate;
00173 pgTemplate.load("Templates/childPane.htmp");
00174
00175 script << ocString(pgTemplate.getParagraph("top"))
00176 .replaceAll("$heading$","Report_Parameters");
00177
00178 myFrm.loadControlTemplates("Templates/childdivform.htmp");
00179 myFrm.form_action();
00180 myFrm.form_display();
00181
00182 if( myFrm.Report_Id )
00183 {
00184
00185 ocString filt = "p.Report_Id = ";
00186 filt.append(myFrm.Report_Id);
00187 mylist.addedCriteria = filt;
00188 }
00189
00190 mylist.loadListTemplates("Templates/list.htmp");
00191 mylist.list_display();
00192
00193 ocString end = pgTemplate.getParagraph("bottom");
00194 script << end;
00195 }
00196 else
00197 {
00198 script.Redirect("/");
00199 }
00200 }
00201
00202 #include "read_write_base.cpp"
00203 #include "forms_base.cpp"
00204