From ad2317120d33f4fd41bfe04aefd19add390e5bc6 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 22 Sep 2005 19:38:28 +0000 Subject: [PATCH] moved s1.ttk to stage1.ttk loading and displaying some more report info now (dimensions) git-svn-id: svn://svn.open-ils.org/ILS/trunk@1855 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/reporter/templates/s1.ttk | 63 ---------- Open-ILS/src/reporter/templates/stage1.ttk | 131 +++++++++++++++++++++ 2 files changed, 131 insertions(+), 63 deletions(-) delete mode 100644 Open-ILS/src/reporter/templates/s1.ttk create mode 100644 Open-ILS/src/reporter/templates/stage1.ttk diff --git a/Open-ILS/src/reporter/templates/s1.ttk b/Open-ILS/src/reporter/templates/s1.ttk deleted file mode 100644 index b28dbd91d1..0000000000 --- a/Open-ILS/src/reporter/templates/s1.ttk +++ /dev/null @@ -1,63 +0,0 @@ -[% - USE DBI; - USE WebSession; - USE utils = WebUtils; - USE testdoc = XML::LibXML(config_xml); - - userid = 1; - - dbname = testdoc.findvalue('/reporter/setup/database/name'); - dbhost = testdoc.findvalue('/reporter/setup/database/host'); - d_u = testdoc.findvalue('/reporter/setup/database/user'); - d_p = testdoc.findvalue('/reporter/setup/database/password'); - - dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost; - - ''; - - DBI.connect(dsn,d_u,d_p); -%] - - - -

Reports: yay!

- [% PROCESS PRINT_STAGE1 %] - - - - - - -[% BLOCK PRINT_STAGE1 %] - -[% FOR s1 IN DBI.query("select * from reporter.stage1 where pub is true;"); - USE doc = XML::LibXML(s1.filename); %] - - - - - - - - - - -[% END %] -
- Name: - - [%doc.findvalue('/reporter/report/@name')%] - - Description: - - [%doc.findvalue('/reporter/report/description')%] - - Visible Stage2 reports: - - [% q = 'select count(*) as x from reporter.stage2 ' _ - 'where pub is true or owner = ' _ userid; - FOR r IN DBI.query(q); - r.x; - END %] -
-[% END %] diff --git a/Open-ILS/src/reporter/templates/stage1.ttk b/Open-ILS/src/reporter/templates/stage1.ttk new file mode 100644 index 0000000000..fa770ea815 --- /dev/null +++ b/Open-ILS/src/reporter/templates/stage1.ttk @@ -0,0 +1,131 @@ +[% + +BLOCK logme_block; + "\n\t\n"; +END; + +MACRO logme(a) PROCESS logme_block x = a.list.join(', '); + +%] + +[% + USE DBI; + USE WebSession; + USE utils = WebUtils; + USE config = XML.LibXML(config_xml); + + userid = 1; + + dir = '/reporter/setup/files/' _ stage_dir; + dir = config.findvalue(dir); + + dbname = config.findvalue('/reporter/setup/database/name'); + dbhost = config.findvalue('/reporter/setup/database/host'); + d_u = config.findvalue('/reporter/setup/database/user'); + d_p = config.findvalue('/reporter/setup/database/password'); + + dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost; + + logme([dsn,d_u,d_p]); + + DBI.connect(dsn,d_u,d_p); +%] + + + + [% PROCESS PRINT_STAGE1 %] + + + + + + +[% BLOCK PRINT_STAGE1 %] + +[% FOR s1 IN DBI.query("select * from reporter.stage1 where pub is true;"); + file = dir _ '/' _ s1.filename; + USE doc = XML.LibXML(file); + fact_table = doc.findvalue('//report/@fact-table'); + logme(fact_table); +%] + + + + + + + + + + + + + +[% INCLUDE table_fields table = config.findnodes("/reporter/tables/table[@id='$fact_table']") %] + + + + + +[% END %] +
+ Name: + + [%doc.findvalue('/reporter/report/@name')%] +
+ Description: + + [%doc.findvalue('/reporter/report/description')%] +
+ Visible Stage2 reports: + + [% q = 'select count(*) as x from reporter.stage2 ' _ + 'where pub is true or owner = ' _ userid; + FOR r IN DBI.query(q); + r.x; + END %] +
+ Report Attributes
(dimensions): +
+[% + incs = doc.findnodes('//report/dims/dim/@include'); + + FOR dim IN incs; + ''; + + link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_ + '/links/link[@field="' _ dim.value() _ '"]/@table'; + logme(link_xpath); + + dim_table = config.findvalue(link_xpath); + + dim_xpath = '/reporter/tables/table[@id="' _ dim_table _'"]'; + logme(dim_xpath); + + dim_def = config.findnodes(dim_xpath); + + INCLUDE dim_description dim = dim_def; + '
'; + END +%] +
+[% END %] + +[% BLOCK dim_description %] + + + Name: + [% dim.findvalue('name') %] + +[% INCLUDE table_fields table = dim %] +[% END %] + +[% BLOCK table_fields %] +[% FOR f IN table.findnodes('fields/field') %] + + Field: + [% f.findvalue('@name') %] ([% f.findvalue('@datatype') %]) + +[% END %] + +[% END %] -- 2.43.2