adding first round of stage one display template
[Evergreen.git] / Open-ILS / src / reporter / templates / s1.ttk
1 [%
2         USE DBI;
3         USE WebSession;
4         USE utils = WebUtils;
5         USE testdoc = XML::LibXML(config_xml);
6
7         userid = 1;
8
9         dbname = testdoc.findvalue('/reporter/setup/database/name');
10         dbhost = testdoc.findvalue('/reporter/setup/database/host');
11         d_u = testdoc.findvalue('/reporter/setup/database/user');
12         d_p = testdoc.findvalue('/reporter/setup/database/password');
13
14         dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost;
15
16         '<!-- ' _ dsn _ ', ' _ d_u _ ', ' _ d_p _ ' -->';
17         
18         DBI.connect(dsn,d_u,d_p);
19 %]
20
21 <html>
22         <body>
23                 <h1>Reports: yay!</h1>
24                 [% PROCESS PRINT_STAGE1 %]
25         </body>
26 </html>
27
28
29
30
31 [% BLOCK PRINT_STAGE1 %]
32                 <table border=1>
33 [%                      FOR s1 IN DBI.query("select * from reporter.stage1 where pub is true;");
34                                 USE doc = XML::LibXML(s1.filename); %]
35
36                                 <tr>
37                                         <td>
38                                                 Name:
39                                         </td>
40                                         <td>
41                                                 [%doc.findvalue('/reporter/report/@name')%]
42                                         </td>
43                                         <td>
44                                                 Description:
45                                         </td>
46                                         <td>
47                                                 [%doc.findvalue('/reporter/report/description')%]
48                                         </td>
49                                         <td>
50                                                 Visible Stage2 reports:
51                                         </td>
52                                         <td>
53                                                 [% q = 'select count(*) as x from reporter.stage2 ' _
54                                                                 'where pub is true or owner = ' _ userid;
55                                                 FOR r IN DBI.query(q);
56                                                         r.x;
57                                                 END %]
58                                         </td>
59                                 </tr>
60
61 [%                      END %]
62                 </table>
63 [% END %]