4 PROCESS logic_header.ttk;
7 INCLUDE header.ttk title="Basic Report Types";
8 WRAPPER html/body html.body.onload=
9 "if (document.getElementById('templatename')) {" _
10 "document.getElementById('templatename').focus();" _
11 "document.getElementById('templatename').select();}";
14 IF CGI.param('detail');
15 %]|<a href="?detail=0">No Details (All)</a>[%
17 %]|<a href="?detail=1">Details (All)</a>[%
30 #=============================================================================
35 CGI.url('-absolute',1,'-path_info',1,'-query',1).replace('[&\?;]?id=[\w\.]+','');
39 '/reporter/tables/table[@id="' _
40 CGI.param('id') _ '"]';
41 table = config.findnodes(table_xpath);
43 fact_table = table.findvalue('@id');
46 INCLUDE stage1_summary;
47 INCLUDE stage2_new IF CGI.param('create_stage2') == 1;
57 FOR tab IN config.findnodes("//tables/table[@fact-table='true']");
59 fact_table = tab.findvalue("@id");
60 logme("Fact Table is $fact_table");
64 INCLUDE stage1_summary links = 1 table = tab;
66 IF loop.count != loop.size;
76 BLOCK stage1_summary links=0;
77 fact_table = table.findvalue('@id');
78 WRAPPER html/table width="100%";
80 WRAPPER html/cell align="right";
84 table.findvalue('label');
88 WRAPPER html/cell align="right";
89 %]<b>Description:</b>[%
92 table.findvalue('description');
96 WRAPPER html/cell align="right";
100 IF CGI.param('detail');
101 %]<a href="?detail=0&id=[% fact_table %]">No Details</a>[%
103 %]<a href="?detail=1&id=[% fact_table %]">Details</a>[%
105 %]|<a href="?create_stage2=1&id=[% fact_table %]">New Report Template</a>[%
109 WRAPPER html/cell align="right" valign='top';
110 %]Report Templates:[%
113 q = 'select * from reporter.stage2 ' _
114 'where pub is true or owner = ' _ DBI.quote(user.id());
115 FOR r IN DBI.query(q);
117 href="stage2?id=" _ r.id
118 text=utils.JSON2perl(r.params).templatename;
124 PROCESS stage1_detail IF CGI.param('detail') == 1;
132 col_xpath = "/reporter/tables/table[@id='" _ fact_table _ "']/fields/field[@core='true']";
135 %]<br/><form id="stage2_new" name="stage2_new" action="stage2" method="POST">
136 <input type="hidden" name="action" value="save">
137 <input type="hidden" name="stage1" value="[% CGI.param('id') %]">
138 <input type="text" name="templatename" id="templatename"
139 size="40" value="Template name (required)"><br/>
140 <input type="checkbox" name="publictemplate" value="t">
141 Public template<br><br>[%
144 WRAPPER html/table width="100%" border=1;
146 WRAPPER html/cell colspan=2;
147 # hidden input here ...
148 table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
149 INCLUDE hidden name="filter" value=fact_table;
150 table.findvalue('label');
154 INCLUDE widget_selector tableid=fact_table columns=config.findnodes(col_xpath) force=1;
157 dim_xpath = "/reporter/tables/table[@id='$fact_table']/links/link/@table";
158 FOR dim_table IN config.findnodes(dim_xpath);
159 dim_table = dim_table.value();
160 dimension = config.findnodes("/reporter/tables/table[@id='$dim_table']");
162 WRAPPER html/table width="100%" border=1;
164 WRAPPER html/cell colspan=2;
165 # checkbox input here ...
166 INCLUDE checkbox name="filter" value=dim_table checked=1;
167 dimension.findvalue('label');
171 INCLUDE widget_selector tableid=dim_table;
175 INCLUDE submit name='button' value='Save';
182 BLOCK widget_selector;
184 logme("widget_selector called for table $tableid");
186 # if we got some columns, use them. if not, get all non-primary columns
189 '/reporter/tables/table[@id="' _ tableid _
190 '"]/fields/field[not(@primary) or @primary!="true"]'
191 columns = config.findnodes(columns_xpath);
192 logme("widget_selector had to grab columns for table $tableid!");
195 column_input_type="checkbox";
197 column_input_type="hidden";
200 FOR column IN columns;
201 column_name=column.findvalue('@name');
204 WRAPPER html/cell valign='top' align='right';
205 # checkbox for column filter here ...
206 INCLUDE $column_input_type
207 name="filter:$tableid"
210 column.findvalue('label');
214 col_widget_fams_xpath =
215 '/reporter/widgets/widget-family[@datatype="' _
216 column.findvalue('@datatype') _ '"]';
218 IF column.findnodes('@widget-family');
219 col_widget_fams_xpath =
220 '/reporter/widgets/widget-family[@name="' _
221 column.findvalue('@widget-family') _ '"]';
224 logme("finding widget families using $col_widget_fams_xpath");
226 widget_fams = config.findnodes(col_widget_fams_xpath);
229 FOR fam IN widget_fams;
233 fam_input = 'hidden';
241 fam_name = fam.findvalue('@name');
242 # radio for widget family here ...
245 name="filter:$tableid:$column_name"
247 fam.findvalue('label');
250 FOR widget IN fam.findnodes('widget');
254 fam_input = 'hidden';
262 widget_name = widget.findvalue('@name');
263 # radio for widget here ...
266 name="filter:$tableid:$column_name:$fam_name"
268 widget.findvalue('label');
290 %]<INPUT TYPE="text" NAME="[%
299 %]MAXLENGTH="[% mx %]" [%
305 %]<TEXTAREA NAME="[% name %]">[% value %]</TEXTAREA>[%
309 %]<INPUT TYPE="hidden" NAME="[% name %]" VALUE="[% value %]">[%
313 %]<INPUT TYPE="radio" NAME="[% name %]" VALUE="[% value %]" [% IF checked %]CHECKED[% END %]>[%
317 %]<INPUT TYPE="checkbox" NAME="[% name %]" VALUE="[% value %]" [% IF checked %]CHECKED[% END %]>[%
321 %]<INPUT TYPE="submit" NAME="[% name %]" VALUE="[% value %]">[%
330 onclick="[%onclick%]"
331 alt="[%alt%]">[%text%]</a>[%
337 BLOCK render_dimension;
338 INCLUDE checkbox checked = 1 name = 's2_dim_table' value = dim_object.findvalue('@id');
339 %]<b>[% dim_object.findvalue('name') %]</b><br>[%
341 WRAPPER html/table width="100%" ;
343 WRAPPER html/cell align="right";
353 BLOCK dim_description;
355 WRAPPER html/cell align="right";
359 dim.findvalue('label');
362 PROCESS table_fields table = dim;
371 FOR f IN table.findnodes('fields/field');
373 WRAPPER html/cell align="right";
377 f.findvalue('@name');
378 %] ([% f.findvalue('@datatype') %])[%
390 PROCESS table_fields table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
393 WRAPPER html/cell align="right";
394 %]Report Attributes<br/>(dimensions):[%
398 '/reporter/tables/table[@id="' _ fact_table _'"]'_
399 '/links/link/@field';
402 incs = config.findnodes(incs_xpath);
405 %]<table border=1 width="100%">[%
407 link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_
408 '/links/link[@field="' _ dim.value() _ '"]/@table';
411 dim_table = config.findvalue(link_xpath);
413 dim_xpath = '/reporter/tables/table[@id="' _ dim_table _ '"]';
416 dim_def = config.findnodes(dim_xpath);
418 PROCESS dim_description dim = dim_def;