yay! the reporter spits out csv and excel now ... html tomorrow (with any luck)
[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                         INCLUDE all_stage1;
17                 ELSE;
18                         INCLUDE one_stage1;
19                 END;
20         END;
21         INCLUDE footer.ttk;
22 END;
23
24
25
26
27 #=============================================================================
28
29
30 BLOCK one_stage1;
31         table_xpath =
32                 '/reporter/tables/table[@id="' _
33                 CGI.param('id') _ '"]';
34         table = config.findnodes(table_xpath);
35
36         fact_table = table.findvalue('@id');
37         logme(fact_table);
38
39         INCLUDE class_table classname=table;
40
41         INCLUDE stage2_new IF CGI.param('create_stage2') == 1;
42
43 END;
44
45
46
47
48 BLOCK all_stage1;
49         '<ul>';
50
51         FOR tab = config.findnodes("/reporter/tables/table[@fact-table='true']");
52
53                 fact_table = tab.findvalue("@id");
54                 logme("Fact Table is $fact_table");
55
56                 '<li>';
57
58                 INCLUDE class_table classname=tab;
59
60                 IF loop.count != loop.size;
61                 '<hr>';
62                 END;
63         END;
64         '</ul>';
65 END;
66
67
68
69
70
71 BLOCK stage2_new;
72         col_xpath = "/reporter/tables/table[@id='" _ fact_table _ "']/fields/field[@core='true']";
73         logme(col_xpath);
74
75         %]<br/><form id="stage2_new" name="stage2_new" action="stage2" method="POST">
76                 <input type="hidden" name="action" value="save">
77                 <input type="hidden" name="stage1" value="[% CGI.param('id') %]">
78                 <center>
79                         <b>Template name (required):</b> <input type="text" name="templatename" id="templatename" size="40" ><br/><br><br>
80                 </center>
81                 <b>Select Filter Widgets</b><br>[%
82
83         
84         WRAPPER html/table width="100%" style='border-top: 1px solid black';
85                 WRAPPER html/row;
86                         WRAPPER html/cell colspan=2  align='center' style="border: solid black 1px; background: lightgray;";
87                                 # hidden input here ...
88                                 table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
89                                 INCLUDE hidden name="filter" value=fact_table;
90                                 table.findvalue('label');
91                                 ' Core Columns';
92                         END;
93                 END;
94                 #WRAPPER html/row;
95                 #       INCLUDE html/cell content='<b>Attribute</b>' align='right';
96                 #       INCLUDE html/cell content='<b>Widget</b>' align='center';
97                 #END;
98                 INCLUDE widget_selector tableid=fact_table columns=config.findnodes(col_xpath) force=1;
99         END;
100
101         dim_xpath = "/reporter/tables/table[@id='$fact_table']/links/link";
102         FOR dim_link = config.findnodes(dim_xpath);
103                 dim_table = dim_link.findvalue('@table');
104                 link_id = dim_link.findvalue('@id');
105                 dimension = config.findnodes("/reporter/tables/table[@id='$dim_table']");
106
107                 '<br/><br/>';
108
109                 WRAPPER html/table width="100%" style='border-top: 1px solid black';
110                         WRAPPER html/row;
111                                 WRAPPER html/cell colspan=2 align='center' style="border: solid black 1px; background: lightgray;";
112                                         # checkbox input here ...
113                                         INCLUDE checkbox name="filter" value=link_id checked=1;
114
115                                         link_label_xpath = '../../fields/field[@name="' _ dim_link.findvalue('@field') _ '"]/label';
116                                         dim_link.findvalue(link_label_xpath);
117
118                                         ' -- ';
119                                         dimension.findvalue('label');
120                                         ' Dimension';
121                                 END;
122                         END;
123                         INCLUDE widget_selector tableid=link_id;
124                 END;
125         END;
126
127         %]
128                 <input type="checkbox" name="publictemplate" value="t">Public template<br><br>
129         [%
130         INCLUDE submit name='button' value='Save';
131
132         '</form>';
133
134 END;
135
136 %]
137