4 "\n\t<!-- " _ x _ " -->\n";
7 MACRO logme(a) PROCESS logme_block x = a.list.join(', ');
15 USE config = XML.LibXML(config_xml);
19 dir = '/reporter/setup/files/' _ stage_dir;
20 dir = config.findvalue(dir);
22 dbname = config.findvalue('/reporter/setup/database/name');
23 dbhost = config.findvalue('/reporter/setup/database/host');
24 d_u = config.findvalue('/reporter/setup/database/user');
25 d_p = config.findvalue('/reporter/setup/database/password');
27 dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost;
31 DBI.connect(dsn,d_u,d_p);
36 [% PROCESS PRINT_STAGE1 %]
43 [% BLOCK PRINT_STAGE1 %]
45 [% FOR s1 IN DBI.query("select * from reporter.stage1 where pub is true;");
46 file = dir _ '/' _ s1.filename;
47 USE doc = XML.LibXML(file);
48 fact_table = doc.findvalue('//report/@fact-table');
57 [%doc.findvalue('/reporter/report/@name')%]
65 [%doc.findvalue('/reporter/report/description')%]
70 Visible Stage2 reports:
73 [% q = 'select count(*) as x from reporter.stage2 ' _
74 'where pub is true or owner = ' _ userid;
75 FOR r IN DBI.query(q);
80 [% INCLUDE table_fields table = config.findnodes("/reporter/tables/table[@id='$fact_table']") %]
83 Report Attributes<br/>(dimensions):
87 incs = doc.findnodes('//report/dims/dim/@include');
92 link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_
93 '/links/link[@field="' _ dim.value() _ '"]/@table';
96 dim_table = config.findvalue(link_xpath);
98 dim_xpath = '/reporter/tables/table[@id="' _ dim_table _'"]';
101 dim_def = config.findnodes(dim_xpath);
103 INCLUDE dim_description dim = dim_def;
114 [% BLOCK dim_description %]
118 <td>[% dim.findvalue('name') %]</td>
120 [% INCLUDE table_fields table = dim %]
123 [% BLOCK table_fields %]
124 [% FOR f IN table.findnodes('fields/field') %]
127 <td>[% f.findvalue('@name') %] ([% f.findvalue('@datatype') %])</td>