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