making the module name match apache2s requirements
[Evergreen.git] / Open-ILS / src / reporter / templates / dashboard.ttk
1 [%
2
3 PROCESS inputs;
4 PROCESS class_manip;
5 PROCESS widget_manip;
6 PROCESS logic_header.ttk;
7
8 pagetype = CGI.param('detail');
9
10
11 SWITCH pagetype;
12         CASE 'myreports';
13                 INCLUDE header.ttk title="Reporter Dashboard -- My Recent Reports";
14                 INCLUDE navbar.ttk + my_reports;
15         CASE 'mytemplates';
16                 INCLUDE header.ttk title="Reporter Dashboard -- My Recent Templates";
17                 INCLUDE navbar.ttk + my_templates;
18         CASE 'othersreports';
19                 INCLUDE header.ttk title="Reporter Dashboard -- Others Recent Public Reports";
20                 INCLUDE navbar.ttk + public_reports;
21         CASE 'otherstemplates';
22                 INCLUDE header.ttk title="Reporter Dashboard -- Others Recent Public Templates";
23                 INCLUDE navbar.ttk + public_templates;
24         CASE 'facttables';
25                 INCLUDE header.ttk title="Reporter Dashboard -- Core Fact Tables";
26                 INCLUDE navbar.ttk + fact_tables;
27         CASE;
28                 INCLUDE header.ttk title="Reporter Dashboard";
29                 INCLUDE navbar.ttk + summary;
30 END;
31
32 PROCESS logout.ttk;
33
34 BLOCK summary; 
35         WRAPPER html/table border=0 width='100%';
36                 WRAPPER html/row;
37                         INCLUDE html/cell
38                                 width='50%'
39                                 content=link(content='My Recent Reports',href='dashboard?detail=myreports')
40                                 align='center'
41                                 style='border-bottom:1px solid black';
42                         INCLUDE html/cell
43                                 content=link(content='Others Recent Public Reports',href='dashboard?detail=othersreports')
44                                 align='center'
45                                 style='border-bottom:1px solid black';
46                 END;
47                 WRAPPER html/row;
48                         WRAPPER html/cell valign='top' style='height:200px';
49                                 INCLUDE my_reports limit=5;
50                         END;
51                         WRAPPER html/cell valign='top';
52                                 INCLUDE public_reports limit=5;
53                         END;
54                 END;
55                 WRAPPER html/row;
56                         INCLUDE html/cell
57                                 content=link(content='My Recent Templates',href='dashboard?detail=mytemplates')
58                                 align='center'
59                                 style='border-bottom:1px solid black';
60                         INCLUDE html/cell
61                                 content=link(content='Others Recent Public Templates',href='dashboard?detail=otherstemplates')
62                                 align='center'
63                                 style='border-bottom:1px solid black';
64                 END;
65                 WRAPPER html/row;
66                         WRAPPER html/cell valign='top' style='height:200px';
67                                 INCLUDE my_templates limit=5;
68                         END;
69                         WRAPPER html/cell valign='top';
70                                 INCLUDE public_templates limit=5;
71                         END;
72                 END;
73                 WRAPPER html/row;
74                         INCLUDE html/cell
75                                 colspan=2
76                                 align='center'
77                                 content=link(content='Core Fact Tables',href='dashboard?detail=facttables')
78                                 style='border-bottom:1px solid black';
79                 END;
80                 WRAPPER html/row;
81                         WRAPPER html/cell colspan=2 valign='top' style='height:200px';
82                                 INCLUDE fact_tables;
83                         END;
84                 END;
85         END;
86 END;
87
88 BLOCK my_reports;
89         q = "SELECT * FROM reporter.stage3 WHERE owner = " _ user.id() _
90                 " ORDER BY runtime DESC";
91         IF limit > 0;
92                 q = q _ ' LIMIT ' _ limit;
93         END;
94
95         logme(q);
96
97         INCLUDE show_reports;
98
99 END;
100
101 BLOCK public_reports;
102         q = "SELECT * FROM reporter.stage3 WHERE pub is true" _
103                 " and owner != " _ user.id() _ " ORDER BY runtime DESC";
104         IF limit > 0;
105                 q = q _ ' LIMIT ' _ limit;
106         END;
107
108         logme(q);
109
110         INCLUDE show_reports;
111
112 END;
113
114 BLOCK show_reports;
115         WRAPPER html/table width='100%';
116                 WRAPPER html/row;
117                         INCLUDE html/cell content='Public' nowrap='nowrap' col='lightgray';
118                         INCLUDE html/cell content='Report Name' nowrap='nowrap' col='lightgray';
119                         INCLUDE html/cell content='Created at' nowrap='nowrap' col='lightgray';
120                         INCLUDE html/cell content='Scheduled Run Date' nowrap='nowrap' col='lightgray';
121                         INCLUDE html/cell content='Recurrence' nowrap='nowrap' col='lightgray';
122                 END;
123                 FOR report = DBI.query(q);
124                         bg='lightblue';
125                         IF loop.count % 2;
126                                 bg='white';
127                         END;
128                         WRAPPER html/row;
129                                 p = utils.JSON2perl( report.params );
130                                 INCLUDE html/cell content=(report.pub ? 'Y' : 'N') col=bg;
131                                 INCLUDE html/cell content=p.reportname col=bg;
132                                 INCLUDE html/cell content=report.create_date.chunk(10).0 col=bg;
133                                 INCLUDE html/cell content=report.runtime.chunk(10).0 col=bg;
134                                 INCLUDE html/cell content=report.recurrence col=bg;
135                         END;
136                 END;
137         END;
138 END;
139
140 BLOCK my_templates;
141         q = "SELECT * FROM reporter.stage2 WHERE " _
142                 " owner = " _ user.id() _ " ORDER BY create_date DESC";
143         IF limit > 0;
144                 q = q _ ' LIMIT ' _ limit;
145         END;
146
147         logme(q);
148
149         INCLUDE show_templates;
150
151 END;
152
153 BLOCK public_templates;
154         q = "SELECT * FROM reporter.stage2 WHERE pub is true" _
155                 " and owner != " _ user.id() _ " ORDER BY create_date DESC";
156         IF limit > 0;
157                 q = q _ ' LIMIT ' _ limit;
158         END;
159
160         logme(q);
161
162         INCLUDE show_templates;
163
164 END;
165
166 BLOCK show_templates;
167         WRAPPER html/table width='100%';
168                 WRAPPER html/row;
169                         INCLUDE html/cell content='Public' nowrap='nowrap' col='lightgray';
170                         INCLUDE html/cell content='Template Name' nowrap='nowrap' col='lightgray';
171                         INCLUDE html/cell content='Created at' nowrap='nowrap' col='lightgray';
172                 END;
173                 FOR template = DBI.query(q);
174                         tid = template.id;
175                         bg='lightblue';
176                         IF loop.count % 2;
177                                 bg='white';
178                         END;
179                         WRAPPER html/row;
180                                 p = utils.JSON2perl( template.params );
181                                 INCLUDE html/cell content=(template.pub ? 'Y' : 'N') col=bg;
182                                 INCLUDE html/cell content=link(content=p.templatename,href="stage2?id=$tid") col=bg;
183                                 INCLUDE html/cell content=template.create_date.chunk(10).0 col=bg;
184                                 INCLUDE html/cell content=template.recurrence col=bg;
185                         END;
186                 END;
187         END;
188 END;
189
190 BLOCK fact_tables;
191         WRAPPER html/table width='100%';
192                 WRAPPER html/row;
193                         INCLUDE html/cell content='Fact table' nowrap='nowrap' col='lightgray';
194                         INCLUDE html/cell content='Description' nowrap='nowrap' col='lightgray';
195                 END;
196                 FOR tab IN config.findnodes("/reporter/tables/table[@fact-table='true']");
197                         tid = tab.findvalue('@id');
198                         bg='lightblue';
199                         IF loop.count % 2;
200                                 bg='white';
201                         END;
202                         WRAPPER html/row;
203                                 p = utils.JSON2perl( template.params );
204                                 INCLUDE html/cell
205                                         col=bg
206                                         content=link(content=tab.findvalue('tablename'),href="stage1?id=$tid");
207                                 INCLUDE html/cell content=tab.findvalue('description');
208                         END;
209                 END;
210    END;
211 END;
212
213 %]