]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/reporter/templates/stage1.ttk
82c8f15ab29ab1cfd92902d69829712388b5bfca
[working/Evergreen.git] / Open-ILS / src / reporter / templates / stage1.ttk
1 [%
2
3 PROCESS inputs;
4 PROCESS class_manip;
5 PROCESS widget_manip;
6 PROCESS logic_header.ttk;
7 INCLUDE logout.ttk;
8
9 WRAPPER html/html;
10         INCLUDE header.ttk + navbar.ttk title="Basic Report Types";
11         WRAPPER html/body html.body.onload=
12                                                                 "if (document.getElementById('templatename')) {" _
13                                                                 "document.getElementById('templatename').focus();" _
14                                                                 "document.getElementById('templatename').select();}";
15                 IF !CGI.param('id');
16                         IF CGI.param('detail');
17                                 %]<a href="?detail=0">No Details (All)</a>[%
18                         ELSE;
19                                 %]<a href="?detail=1">Details (All)</a>[%
20                         END;
21                         INCLUDE all_stage1;
22                 ELSE;
23                         INCLUDE one_stage1;
24                 END;
25         END;
26         INCLUDE footer.ttk;
27 END;
28
29
30
31
32 #=============================================================================
33
34
35 BLOCK one_stage1;
36         %]<a href="[%
37         CGI.url('-absolute',1,'-path_info',1,'-query',1)
38                 .replace('[&\?;]?id=[\w\.]+','')
39                 .replace('[&\?;]?create_stage2=1','');
40         %]">Show all</a>[%
41
42         table_xpath =
43                 '/reporter/tables/table[@id="' _
44                 CGI.param('id') _ '"]';
45         table = config.findnodes(table_xpath);
46
47         fact_table = table.findvalue('@id');
48         logme(fact_table);
49
50         INCLUDE class_table class=table;
51
52         INCLUDE stage2_new IF CGI.param('create_stage2') == 1;
53
54 END;
55
56
57
58
59 BLOCK all_stage1;
60         '<ul>';
61
62         FOR tab IN config.findnodes("//tables/table[@fact-table='true']");
63
64                 fact_table = tab.findvalue("@id");
65                 logme("Fact Table is $fact_table");
66
67                 '<li>';
68
69                 INCLUDE class_table class=tab;
70
71                 IF loop.count != loop.size;
72                 '<hr>';
73                 END;
74         END;
75         '</ul>';
76 END;
77
78
79
80
81
82 BLOCK stage2_new;
83         col_xpath = "/reporter/tables/table[@id='" _ fact_table _ "']/fields/field[@core='true']";
84         logme(col_xpath);
85
86         %]<br/><form id="stage2_new" name="stage2_new" action="stage2" method="POST">
87                 <input type="hidden" name="action" value="save">
88                         <input type="hidden" name="stage1" value="[% CGI.param('id') %]">
89                         <input type="text" name="templatename" id="templatename"
90                                 size="40" value="Template name (required)"><br/>
91                         <input type="checkbox" name="publictemplate" value="t">
92                                 Public template<br><br>[%
93
94         
95         WRAPPER html/table width="100%" style='border-top: 1px solid black';
96                 WRAPPER html/row;
97                         WRAPPER html/cell;
98                                 WRAPPER html/table + html/row width='100%';
99                                         INCLUDE html/cell content='<b>Report Base</b>';
100                                 END;
101                                 WRAPPER html/table + html/row width='100%';
102                                         INCLUDE html/cell content='<b>Attribute</b>' align='right';
103                                 END;
104                         END;
105                         INCLUDE html/cell content='<b>Widget</b>' align='center';
106                 END;
107                 WRAPPER html/row;
108                         WRAPPER html/cell colspan=2;
109                                 # hidden input here ...
110                                 table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
111                                 INCLUDE hidden name="filter" value=fact_table;
112                                 table.findvalue('label');
113                                 ' Core Columns';
114                         END;
115                 END;
116                 INCLUDE widget_selector tableid=fact_table columns=config.findnodes(col_xpath) force=1;
117         END;
118
119         dim_xpath = "/reporter/tables/table[@id='$fact_table']/links/link/@table";
120         FOR dim_table IN config.findnodes(dim_xpath);
121                 dim_table = dim_table.value();
122                 dimension = config.findnodes("/reporter/tables/table[@id='$dim_table']");
123
124                 '<br/><br/>';
125
126                 WRAPPER html/table width="100%" style='border-top: 1px solid black';
127                         WRAPPER html/row;
128                                 WRAPPER html/cell;
129                                         WRAPPER html/table + html/row width='100%';
130                                                 INCLUDE html/cell content='<b>Dimension</b>';
131                                         END;
132                                         WRAPPER html/table + html/row width='100%';
133                                                 INCLUDE html/cell content='<b>Attribute</b>' align='right';
134                                         END;
135                                 END;
136                                 INCLUDE html/cell content='<b>Widget</b>' align='center';
137                         END;
138                         WRAPPER html/row;
139                                 WRAPPER html/cell colspan=2;
140                                         # checkbox input here ...
141                                         INCLUDE checkbox name="filter" value=dim_table checked=1;
142                                         dimension.findvalue('label');
143                                         ' Dimension';
144                                 END;
145                         END;
146                         INCLUDE widget_selector tableid=dim_table;
147                 END;
148         END;
149
150         INCLUDE submit name='button' value='Save';
151
152         %]</form>[%
153
154 END;
155
156 %]
157