4 "\n\t<!-- " _ x _ " -->\n";
7 MACRO logme(a) PROCESS logme_block x = a.list.join(', ');
16 USE config = XML.LibXML(config_xml);
20 dir = '/reporter/setup/files/' _ stage_dir;
21 dir = config.findvalue(dir);
23 dbname = config.findvalue('/reporter/setup/database/name');
24 dbhost = config.findvalue('/reporter/setup/database/host');
25 d_u = config.findvalue('/reporter/setup/database/user');
26 d_p = config.findvalue('/reporter/setup/database/password');
28 dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost;
32 DBI.connect(dsn,d_u,d_p);
37 [% PROCESS PRINT_STAGE1 %]
47 [% BLOCK PRINT_STAGE1 %]
49 [% FOR s1 IN DBI.query("select * from reporter.stage1 where pub is true;");
50 file = dir _ '/' _ s1.filename;
51 USE doc = XML.LibXML(file);
52 fact_table = doc.findvalue('//report/@fact-table');
61 [%doc.findvalue('/reporter/report/@name')%]
69 [%doc.findvalue('/reporter/report/description')%]
73 [% PROCESS stage1_detail IF CGI.param('detail') == 1 %]
79 [% PROCESS stage2_new IF CGI.param('create_stage2') == 1 %]
87 col_xpath = "/reporter/tables/table[@id='" _ fact_table _ "']/fields/field[@core='true']";
90 '<h3><u>Core report limiters</u></h3>';
92 FOR col IN config.findnodes(col_xpath);
93 logme(col.findvalue('@name'));
94 widget = col.findvalue('@widget') or col.findvalue('@datatype');
95 INCLUDE "draw_$widget" column = col;
104 [% BLOCK draw_timestamptz %]
106 <b>[% column.findvalue('label') %]</b><br/><br/>
107 <table border=1 width="100%">
110 <b>[% column.findvalue('description') %]</b>
119 name="[% column.parentNode.parentNode.findvalue('tablename') _ '.' _
120 column.findvalue('@name') _ ':range_size' %]" >
121 <option value="">User Selectable</option>
122 <option value="hour">Hour</option>
123 <option value="day">Day</option>
124 <option value="week">Week</option>
125 <option value="month">Month</option>
126 <option value="year">Year</option>
127 <option value="decade">Decade</option>
136 [% BLOCK dim_description %]
140 <td>[% dim.findvalue('name') %]</td>
142 [% PROCESS table_fields table = dim %]
150 [% BLOCK table_fields %]
151 [% FOR f IN table.findnodes('fields/field') %]
154 <td>[% f.findvalue('@name') %] ([% f.findvalue('@datatype') %])</td>
167 [% BLOCK stage1_detail %]
170 Visible Stage2 reports:
173 [% q = 'select count(*) as x from reporter.stage2 ' _
174 'where pub is true or owner = ' _ userid;
175 FOR r IN DBI.query(q);
181 [% PROCESS table_fields table = config.findnodes("/reporter/tables/table[@id='$fact_table']") %]
184 Report Attributes<br/>(dimensions):
188 incs = doc.findnodes('//report/dims/dim/@include');
191 '<table border=1 width="100%">';
193 link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_
194 '/links/link[@field="' _ dim.value() _ '"]/@table';
197 dim_table = config.findvalue(link_xpath);
199 dim_xpath = '/reporter/tables/table[@id="' _ dim_table _'"]';
202 dim_def = config.findnodes(dim_xpath);
204 PROCESS dim_description dim = dim_def;