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