Bug 23227: Remove type attribute from script tags: Reports
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / dictionary.tt
1 [% SET footerjs = 1 %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Reports &rsaquo; Guided reports &rsaquo; Dictionary</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <style>fieldset.rows table { clear: none; margin: 0;}</style>
6 </head>
7
8 <body id="rep_dictionary" class="rep">
9 [% INCLUDE 'header.inc' %]
10 [% INCLUDE 'circ-search.inc' %]
11
12 [%- BLOCK area_name -%]
13     [%- SWITCH area -%]
14         [%- CASE 'CIRC' -%]Circulation
15         [%- CASE 'CAT'  -%]Catalog
16         [%- CASE 'PAT'  -%]Patrons
17         [%- CASE 'ACQ'  -%]Acquisitions
18         [%- CASE 'ACC'  -%]Accounts
19     [%- END -%]
20 [%- END -%]
21
22 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
23 [% IF ( new_dictionary ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Name the new definition</strong>
24 [% ELSIF ( step_2 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 2: Choose the area </strong> 
25 [% ELSIF ( step_3 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 3: Choose a column </strong>
26 [% ELSIF ( step_4 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 4: Specify a value </strong> 
27 [% ELSIF ( step_5 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 5: Confirm definition</strong> 
28 [% ELSE %] &rsaquo; <strong> Dictionary </strong>[% END %]</div>
29
30 <div class="main container-fluid">
31     <div class="row">
32         <div class="col-sm-10 col-sm-push-2">
33             <main>
34
35 [% IF ( start_dictionary ) %]
36     <div id="toolbar">
37         <a id="newdictionary" class="btn btn-default" href="/cgi-bin/koha/reports/dictionary.pl?phase=Add%20New%20Definition"><i class="fa fa-plus"></i> New definition</a>
38     </div>
39 [% END %]
40 <h1>Dictionary</h1>
41 [% IF ( start_dictionary ) %]
42         <p>Use the dictionary to define custom criteria for reporting.</p>
43
44                 [% IF ( definitions ) %]
45         <h2>Current terms</h2>
46                 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
47         <input type="hidden" name="phase" value="View Dictionary" />
48   [% IF ( areas ) %]
49         Filter by area
50         <select name="area">
51           <option value="">All</option>
52         [% FOREACH area IN areas %]
53           [%- IF ( area.selected ) -%]
54           <option value="[% area.id | html %]" selected="selected">[%- PROCESS area_name area=area.id -%]</option>
55           [%- ELSE -%]
56           <option value="[% area.id | html %]">[%- PROCESS area_name area=area.id -%]</option>
57           [%- END -%]
58         [% END %]
59         </select>
60       <input name="submit" value="Go" type="submit" />
61   [% END %]
62       </form>
63       <br />
64         <table>
65             <tr>
66                 <th>Name</th>
67                 <th>Description</th>
68                 <th>Area</th>
69                 <th>Definition</th>
70                 <th>Action</th>
71             </tr>
72             [% FOREACH definition IN definitions %]
73             <tr>
74                 <td>[% definition.name | html %]</td>
75                 <td>[% definition.description | html %]</td>
76                 <td>[% definition.areaname | html %]</td>
77                 <td>[% definition.saved_sql | html %]</td>
78                 <td class="actions"><form method="post" action="/cgi-bin/koha/reports/dictionary.pl">
79                     <input type="hidden" name="id" value="[% definition.id | html %]" />
80                     <input type="hidden" name="phase" value="Delete Definition" />
81                     <button type="submit" name="submit" class="btn btn-default btn-xs" id="delete"><i class="fa fa-trash"></i> Delete</button>
82                 </form></td>
83             </tr>
84             [% END %]
85         </table>
86                 [% ELSE %]
87                 <div class="dialog message">There are no saved definitions. <a id="newdictionary" href="/cgi-bin/koha/reports/dictionary.pl?phase=Add%20New%20Definition">Add a definition to the dictionary.</a></div>
88                 [% END %]
89 [% END %]
90
91 [% IF ( new_dictionary ) %]
92 <h3>Add new definition</h3>
93 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
94 <fieldset class="rows"><legend>Step 1 of 5: Name the new definition</legend><ol>
95 <li>
96 <label for="definition_name">Definition name:</label>
97 <input type="text" id="definition_name" name="definition_name" />
98 </li>
99 <li>
100 <label for="definition_description">Definition description:</label>
101 <textarea name="definition_description" id="definition_description" rows="3" cols="20"></textarea>
102 </li>
103 </ol></fieldset>
104
105 <fieldset class="action"><input type="hidden" name="phase" value="New Term step 2" />
106 <input name="submit" value="Next" type="submit" /></fieldset>
107 </form>
108 [% END %]
109
110 [%- IF ( step_2 ) -%]
111 <h3>Add new definition</h3>
112 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
113   <fieldset class="rows">
114     <legend>Step 2 of 5: Choose the area</legend>
115     <ol>
116       <li>
117         <input type="hidden" name="phase" value="New Term step 3" />
118         <input type="hidden" name="definition_name" value="[% definition_name | html %]" />
119         <input type="hidden" name="definition_description" value="[% definition_description | html %]" />
120         <label for="area">Select table:</label><select name="area" id="area">
121       [%- FOREACH area IN areas -%]
122         <option value="[%- area.id | html -%]">[%- PROCESS area_name area=area.id -%]</option>
123       [%- END -%]
124         </select>
125       </li>
126     </ol>
127   </fieldset>
128   <fieldset class="action"><input name="submit" value="Next" type="submit" /></fieldset>
129 </form>
130 [%- END -%]
131
132 [% IF ( step_3 ) %]
133 <h3>Add new definition</h3>
134 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">      
135 <fieldset class="rows">
136 <legend>Step 3 of 5: Choose a column</legend>
137 <input type="hidden" name="area" value="[% area | html %]" />
138 <input type="hidden" name="definition_name" value="[% definition_name | html %]" />
139 <input type="hidden" name="definition_description" value="[% definition_description | html %]" />
140
141 <select id="availableColumns" name="columns" size="25" style="width:200px;height:300px;margin:1em;">
142 [% FOREACH column IN columns %]
143 [% IF ( column.table ) %]
144 [% IF ( loop.first ) %]                              
145 [% ELSE %]               
146 </optgroup>        
147 [% END %]                                                         
148
149 <optgroup label="[% column.table | html %]">              
150 [% ELSE %]               
151 <option value="[% column.name | html %]">
152 [% IF ( column.description ) %][% column.description | html %]    
153 [% ELSE %]               
154 [% column.name | html %]                          
155 [% END %]              
156 </option>      
157 [% END %]              
158 [% END %]                
159 </optgroup>
160 </select>
161
162 <input type="hidden" name="phase" value="New Term step 4" />
163 </fieldset>
164 <fieldset class="action"><input type="submit" name="submit" value="Next" /></fieldset>
165 </form>
166 [% END %]
167
168 [% IF ( step_4 ) %]
169 <h3>Add new definition</h3>
170 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
171 <fieldset class="rows">
172 <legend>Step 4 of 5: Specify a value</legend>
173 <input type="hidden" name="area" value="[% area | html %]" />
174 <input type="hidden" name="definition_name" value="[% definition_name | html %]" />
175 <input type="hidden" name="definition_description" value="[% definition_description | html %]" />
176 <input type="hidden" name="columnstring" value="[% columnstring | html %]" />
177
178 [% FOREACH column IN columns %]
179 <input type="hidden" name="criteria_column" value="[% column.name | html %]" />
180 <ol><li><span class="label">Column: </span> [% column.name | html %]</li>
181 [% IF ( column.distinct ) %]
182     <li><label for="[% column.name | html %]_value">Choose: </label> <select id="[% column.name | html %]_value" name="[% column.name | html %]_value">
183         [% FOREACH value IN column.values %]
184             <option value="[% value.availablevalues | html %]">[% value.availablevalues | html %]</option>
185         [% END %]
186     </select></li>
187 [% END %]
188 [% IF ( column.date ) %]
189     <li class="radio">
190         <label for="all_dates">All dates</label>
191         <input type="radio" id="all_dates" name="[% column.name | html %]_date_type_value" value="all" checked="checked" />
192         <label for="date_range">Date range</label>
193         <input type="radio" id="date_range" name="[% column.name | html %]_date_type_value" value="range" />
194     </li>
195     <li class="radio">
196         Start of date range
197         <input type="text" size="10" id="from" name="[% column.name | html %]_start_value" value="" class="datepickerfrom" />
198         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
199         End of date range
200         <input type="text" size="10" id="to" name="[% column.name | html %]_end_value" value="" class="datepickerto" />
201         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
202     </li>
203 [% END %]
204 [% IF ( column.text ) %]
205         <li><label for="[% column.name | html %]_value">Search string matches: </label> <input type="text" size="13" name="[% column.name | html %]_value" /></li>
206 [% END %]
207
208 [% END %]
209 </ol>
210 <input type="hidden" name="phase" value="New Term step 5" />
211 </fieldset>
212 <fieldset class="action">
213 <input type="submit" name="submit" value="Next" />
214 </fieldset>
215 </form>
216 [% END %]
217
218 [% IF ( step_5 ) %]
219 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
220 <input type="hidden" name="area" value="[% area | html %]" />
221 <input type="hidden" name="definition_name" value="[% definition_name | html %]" />
222 <input type="hidden" name="definition_description" value="[% definition_description | html %]" />
223 <input type="hidden" name="columnstring" value="[% columnstring | html %]" />
224
225 <h3>Add new definition</h3>
226
227 <fieldset class="rows">
228   <legend>Step 5 of 5: Confirm details</legend>
229   <ol>
230     <li>
231       <span class="label">Name:</span>[%- definition_name | html -%]
232     </li>
233     <li>
234       <span class="label">Description:</span>[%- definition_description | html -%]
235     </li>
236     <li>
237       <span class="label">Area:</span>[%- PROCESS area_name area=area -%]
238     </li>
239     <li>
240       <span class="label">Data:</span>
241       <table>
242         <tr>
243           <th>Columns</th>
244           <th>Values</th>
245         </tr>
246       [%- FOREACH criteria_loo IN criteria_loop -%]
247         <tr>
248           <td>[%- criteria_loo.name | html -%]</td>
249           <td>[%- criteria_loo.value | html -%]</td>
250         </tr>
251       [%- END -%]
252       </table>
253     </li>
254   </ol>
255 </fieldset>
256
257 <fieldset class="action"><input type="hidden" name="sql" value="[% query | html %]" />
258 <input type="hidden" name="phase" value="New Term step 6" />
259 <input type="submit" name="submit" value="Save" />         </fieldset>
260
261 </form>
262 [% END %]
263
264             </main>
265         </div> <!-- /.col-sm-10.col-sm-push-2 -->
266
267         <div class="col-sm-2 col-sm-pull-10">
268             <aside>
269                 [% INCLUDE 'guided-reports-view.inc' %]
270             </aside>
271         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
272      </div> <!-- /.row -->
273
274 [% MACRO jsinclude BLOCK %]
275     [% INCLUDE 'calendar.inc' %]
276     <script>
277         var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this dictionary definition? This cannot be undone.");
278
279         $(document).ready(function() {
280             $("#delete").on("click",function(){
281                 return confirmDelete(MSG_CONFIRM_DELETE);
282             });
283
284             $("#date_range").change(function(){
285                 $("input#from").parents('li').show();
286             });
287             $("#all_dates").change(function(){
288                 $("input#from").parents('li').hide();
289             });
290             $("#all_dates").click().change();
291         });
292     </script>
293 [% END %]
294
295 [% INCLUDE 'intranet-bottom.inc' %]