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 INCLUDE html/cell align="right" valign='top' content='Report Templates:';
111 q = 'select * from reporter.stage2 ' _
112 'where pub is true or owner = ' _ DBI.quote(user.id());
113 FOR r IN DBI.query(q);
115 href="stage2?id=" _ r.id
116 text=utils.JSON2perl(r.params).templatename;
122 PROCESS stage1_detail IF CGI.param('detail') == 1;
130 col_xpath = "/reporter/tables/table[@id='" _ fact_table _ "']/fields/field[@core='true']";
133 %]<br/><form id="stage2_new" name="stage2_new" action="stage2" method="POST">
134 <input type="hidden" name="action" value="save">
135 <input type="hidden" name="stage1" value="[% CGI.param('id') %]">
136 <input type="text" name="templatename" id="templatename"
137 size="40" value="Template name (required)"><br/>
138 <input type="checkbox" name="publictemplate" value="t">
139 Public template<br><br>[%
142 WRAPPER html/table width="100%" border=1;
144 WRAPPER html/cell colspan=2;
145 # hidden input here ...
146 table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
147 INCLUDE hidden name="filter" value=fact_table;
148 table.findvalue('label');
152 INCLUDE widget_selector tableid=fact_table columns=config.findnodes(col_xpath) force=1;
155 dim_xpath = "/reporter/tables/table[@id='$fact_table']/links/link/@table";
156 FOR dim_table IN config.findnodes(dim_xpath);
157 dim_table = dim_table.value();
158 dimension = config.findnodes("/reporter/tables/table[@id='$dim_table']");
160 WRAPPER html/table width="100%" border=1;
162 WRAPPER html/cell colspan=2;
163 # checkbox input here ...
164 INCLUDE checkbox name="filter" value=dim_table checked=1;
165 dimension.findvalue('label');
169 INCLUDE widget_selector tableid=dim_table;
173 INCLUDE submit name='button' value='Save';
180 BLOCK widget_selector;
182 logme("widget_selector called for table $tableid");
184 # if we got some columns, use them. if not, get all non-primary columns
187 '/reporter/tables/table[@id="' _ tableid _
188 '"]/fields/field[not(@primary) or @primary!="true"]'
189 columns = config.findnodes(columns_xpath);
190 logme("widget_selector had to grab columns for table $tableid!");
193 column_input_type="checkbox";
195 column_input_type="hidden";
198 FOR column IN columns;
199 column_name=column.findvalue('@name');
202 WRAPPER html/cell valign='top' align='right';
203 # checkbox for column filter here ...
204 INCLUDE $column_input_type
205 name="filter:$tableid"
208 column.findvalue('label');
212 col_widget_fams_xpath =
213 '/reporter/widgets/widget-family[@datatype="' _
214 column.findvalue('@datatype') _ '"]';
216 IF column.findnodes('@widget-family');
217 col_widget_fams_xpath =
218 '/reporter/widgets/widget-family[@name="' _
219 column.findvalue('@widget-family') _ '"]';
222 logme("finding widget families using $col_widget_fams_xpath");
224 widget_fams = config.findnodes(col_widget_fams_xpath);
227 FOR fam IN widget_fams;
231 fam_input = 'hidden';
239 fam_name = fam.findvalue('@name');
240 # radio for widget family here ...
243 name="filter:$tableid:$column_name"
245 fam.findvalue('label');
248 FOR widget IN fam.findnodes('widget');
252 fam_input = 'hidden';
260 widget_name = widget.findvalue('@name');
261 # radio for widget here ...
264 name="filter:$tableid:$column_name:$fam_name"
266 widget.findvalue('label');
288 %]<INPUT TYPE="text" NAME="[%
297 %]MAXLENGTH="[% mx %]" [%
303 %]<TEXTAREA NAME="[% name %]">[% value %]</TEXTAREA>[%
307 %]<INPUT TYPE="hidden" NAME="[% name %]" VALUE="[% value %]">[%
311 %]<INPUT TYPE="radio" NAME="[% name %]" VALUE="[% value %]" [% IF checked %]CHECKED[% END %]>[%
315 %]<INPUT TYPE="checkbox" NAME="[% name %]" VALUE="[% value %]" [% IF checked %]CHECKED[% END %]>[%
319 %]<INPUT TYPE="submit" NAME="[% name %]" VALUE="[% value %]">[%
328 onclick="[%onclick%]"
329 alt="[%alt%]">[%text%]</a>[%
335 BLOCK render_dimension;
336 INCLUDE checkbox checked = 1 name = 's2_dim_table' value = dim_object.findvalue('@id');
337 %]<b>[% dim_object.findvalue('name') %]</b><br>[%
339 WRAPPER html/table width="100%" ;
341 WRAPPER html/cell align="right";
351 BLOCK dim_description;
353 WRAPPER html/cell align="right";
357 dim.findvalue('label');
360 PROCESS table_fields table = dim;
369 FOR f IN table.findnodes('fields/field');
371 WRAPPER html/cell align="right";
375 f.findvalue('@name');
376 %] ([% f.findvalue('@datatype') %])[%
388 PROCESS table_fields table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
391 WRAPPER html/cell align="right";
392 %]Report Attributes<br/>(dimensions):[%
396 '/reporter/tables/table[@id="' _ fact_table _'"]'_
397 '/links/link/@field';
400 incs = config.findnodes(incs_xpath);
403 %]<table border=1 width="100%">[%
405 link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_
406 '/links/link[@field="' _ dim.value() _ '"]/@table';
409 dim_table = config.findvalue(link_xpath);
411 dim_xpath = '/reporter/tables/table[@id="' _ dim_table _ '"]';
414 dim_def = config.findnodes(dim_xpath);
416 PROCESS dim_description dim = dim_def;