4 "\n\t<!-- " _ x _ " -->\n";
7 MACRO logme(a) PROCESS logme_block x = a.list.join(', ');
13 USE config = XML.LibXML(config_xml, expand_xinclude => 1);
15 dir = '/reporter/setup/files/' _ stage_dir;
16 dir = config.findvalue(dir);
18 dbname = config.findvalue('/reporter/setup/database/name');
19 dbhost = config.findvalue('/reporter/setup/database/host');
20 d_u = config.findvalue('/reporter/setup/database/user');
21 d_p = config.findvalue('/reporter/setup/database/password');
23 dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost;
27 DBI.connect(dsn,d_u,d_p);
31 INCLUDE header.ttk title="Basic Report Types";
35 IF CGI.param('detail');
36 %]|<a href="?detail=0">No Details (All)</a>[%
38 %]|<a href="?detail=1">Details (All)</a>[%
51 #=============================================================================
56 CGI.url('-absolute',1,'-path_info',1,'-query',1).replace('[&\?;]?id=[\w\.]+','');
60 '/reporter/tables/table[@id="' _
61 CGI.param('id') _ '"]';
62 table = config.findnodes(table_xpath);
64 fact_table = table.findvalue('@id');
67 INCLUDE stage1_summary;
68 INCLUDE stage2_new IF CGI.param('create_stage2') == 1;
78 FOR tab IN config.findnodes("//tables/table[@fact-table='true']");
80 fact_table = tab.findvalue("@id");
81 logme("Fact Table is $fact_table");
85 INCLUDE stage1_summary links = 1 table = tab;
87 IF loop.count != loop.size;
97 BLOCK stage1_summary links=0;
98 fact_table = table.findvalue('@id');
99 WRAPPER html/table width="100%";
101 WRAPPER html/cell align="right";
105 table.findvalue('label');
109 WRAPPER html/cell align="right";
110 %]<b>Description:</b>[%
113 table.findvalue('description');
117 WRAPPER html/cell align="right";
121 IF CGI.param('detail');
122 %]<a href="?detail=0&id=[% fact_table %]">No Details</a>[%
124 %]<a href="?detail=1&id=[% fact_table %]">Details</a>[%
126 %]|<a href="?create_stage2=1&id=[% fact_table %]">New Report Template</a>[%
129 PROCESS stage1_detail IF CGI.param('detail') == 1;
137 col_xpath = "/reporter/tables/table[@id='" _ fact_table _ "']/fields/field[@core='true']";
140 WRAPPER html/table width="100%" border=1;
142 WRAPPER html/cell colspan=2;
143 # hidden input here ...
144 table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
145 INCLUDE hidden name="filtertable" value=fact_table;
146 table.findvalue('label');
150 INCLUDE widget_selector tableid=fact_table columns=config.findnodes(col_xpath) force=1;
153 dim_xpath = "/reporter/tables/table[@id='$fact_table']/links/link/@table";
154 FOR dim_table IN config.findnodes(dim_xpath);
155 dim_table = dim_table.value();
156 dimension = config.findnodes("/reporter/tables/table[@id='$dim_table']");
158 WRAPPER html/table width="100%" border=1;
160 WRAPPER html/cell colspan=2;
161 # checkbox input here ...
162 INCLUDE checkbox name="filtertable" value=dim_table checked=1;
163 dimension.findvalue('label');
167 INCLUDE widget_selector tableid=dim_table;
174 BLOCK widget_selector;
176 logme("widget_selector called for table $tableid");
178 # if we got some columns, use them. if not, get all non-primary columns
181 '/reporter/tables/table[@id="' _ tableid _
182 '"]/fields/field[not(@primary) or @primary!="true"]'
183 columns = config.findnodes(columns_xpath);
184 logme("widget_selector had to grab columns for table $tableid!");
187 column_input_type="checkbox";
189 column_input_type="hidden";
192 FOR column IN columns;
193 column_name=column.findvalue('@name');
196 WRAPPER html/cell valign='top';
197 # checkbox for column filter here ...
198 INCLUDE $column_input_type
199 name="filtercolumn:$tableid"
202 column.findvalue('label');
206 col_widget_fams_xpath =
207 '/reporter/widgets/widget-family[@datatype="' _
208 column.findvalue('@datatype') _ '"]';
210 IF column.findnodes('@widget-family');
211 col_widget_fams_xpath =
212 '/reporter/widgets/widget-family[@name="' _
213 column.findvalue('@widget-family') _ '"]';
216 logme("finding widget families using $col_widget_fams_xpath");
218 widget_fams = config.findnodes(col_widget_fams_xpath);
221 FOR fam IN widget_fams;
225 fam_input = 'hidden';
233 fam_name = fam.findvalue('@name');
234 # radio for widget family here ...
237 name="filterfamily:$tableid:$column_name"
239 fam.findvalue('label');
242 FOR widget IN fam.findnodes('widget');
246 fam_input = 'hidden';
254 widget_name = widget.findvalue('@name');
255 # radio for widget here ...
258 name="filter:$tableid:$column_name:$fam_name"
260 widget.findvalue('label');
282 %]<INPUT TYPE="text" NAME="[%
291 %]MAXLENGTH="[% mx %]" [%
297 %]<TEXTAREA NAME="[% name %]">[% value %]</TEXTAREA>[%
301 %]<INPUT TYPE="hidden" NAME="[% name %]" VALUE="[% value %]">[%
305 %]<INPUT TYPE="radio" NAME="[% name %]" VALUE="[% value %]" [% IF checked %]CHECKED[% END %]>[%
309 %]<INPUT TYPE="checkbox" NAME="[% name %]" VALUE="[% value %]" [% IF checked %]CHECKED[% END %]>[%
315 BLOCK render_dimension;
316 INCLUDE checkbox checked = 1 name = 's2_dim_table' value = dim_object.findvalue('@id');
317 %]<b>[% dim_object.findvalue('name') %]</b><br>[%
319 WRAPPER html/table width="100%" ;
321 WRAPPER html/cell align="right";
331 BLOCK dim_description;
333 WRAPPER html/cell align="right";
337 dim.findvalue('label');
340 PROCESS table_fields table = dim;
349 FOR f IN table.findnodes('fields/field');
351 WRAPPER html/cell align="right";
355 f.findvalue('@name');
356 %] ([% f.findvalue('@datatype') %])[%
369 WRAPPER html/cell align="right";
370 %]Visible Stage2 reports:[%
373 q = 'select count(*) as x from reporter.stage2 ' _
374 'where pub is true or owner = ' _ DBI.quote(user.id());
375 FOR r IN DBI.query(q);
381 PROCESS table_fields table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
384 WRAPPER html/cell align="right";
385 %]Report Attributes<br/>(dimensions):[%
389 '/reporter/tables/table[@id="' _ fact_table _'"]'_
390 '/links/link/@field';
393 incs = config.findnodes(incs_xpath);
396 %]<table border=1 width="100%">[%
398 link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_
399 '/links/link[@field="' _ dim.value() _ '"]/@table';
402 dim_table = config.findvalue(link_xpath);
404 dim_xpath = '/reporter/tables/table[@id="' _ dim_table _'"]';
407 dim_def = config.findnodes(dim_xpath);
409 PROCESS dim_description dim = dim_def;