Bug 14128: Capitalization: Guided Reports - step 2 - Build A Report Title 'Build...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / guided_reports_start.tt
1 [% USE KohaDates %]
2
3 [%- BLOCK area_name -%]
4     [%- SWITCH area -%]
5         [%- CASE 'CIRC' -%]Circulation
6         [%- CASE 'CAT'  -%]Catalog
7         [%- CASE 'PAT'  -%]Patrons
8         [%- CASE 'ACQ'  -%]Acquisitions
9         [%- CASE 'ACC'  -%]Accounts
10     [%- END -%]
11 [%- END -%]
12
13 [% INCLUDE 'doc-head-open.inc' %]
14 <title>Koha &rsaquo; Reports &rsaquo; Guided reports wizard
15 [% IF ( saved1 ) %]&rsaquo; Saved reports
16 [% ELSIF ( create ) %]&rsaquo; Create from SQL
17 [% ELSIF ( showsql ) %]&rsaquo; Saved reports &rsaquo; SQL view
18 [% ELSIF ( execute ) %]&rsaquo; Saved reports &rsaquo; [% name %] Report
19 [% ELSIF ( editsql ) %]&rsaquo; Saved reports &rsaquo; Edit SQL report
20 [% ELSIF ( buildx ) %]&rsaquo; Build a report, step [% buildx %] of 6:
21 [% IF ( build1 ) %]Choose a module
22 [% ELSIF ( build2 ) %]Pick a report type
23 [% ELSIF ( build3 ) %]Select columns for display
24 [% ELSIF ( build4 ) %]Select criteria to limit on
25 [% ELSIF ( build5 ) %]Pick which columns to total
26 [% ELSIF ( build6 ) %]Select how you want the report ordered
27 [% END %]
28 [% END %]
29 </title>
30 [% INCLUDE 'doc-head-close.inc' %]
31 [% INCLUDE 'calendar.inc' %]
32 <style type="text/css">
33     #sql { width: 90%; height: 9em;}
34 </style>
35 [% IF ( saved1 ) %]
36 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
37 [% INCLUDE 'datatables.inc' %]
38 [% END %]
39
40 <script type="text/javascript">
41 //<![CDATA[
42 var group_subgroups = {};
43 [% FOREACH group IN groups_with_subgroups %]
44     var gid = "[% group.id %]"
45     group_subgroups[gid] = new Array();
46     [% FOREACH subgroup IN group.subgroups %]
47         var sgid = "[% subgroup.id %]";
48         var sgname = "[% subgroup.name %]";
49         group_subgroups[gid].push([sgid, sgname]);
50     [% END %]
51 [% END %]
52
53 function load_group_subgroups () {
54     var group = $("#group_select").val();
55     var sg = $("#subgroup");
56     $(sg).find('option[value!=""]').each(function() {
57         $(this).remove();
58     });
59     $(sg).hide();
60     if (group) {
61         var select = $(sg).find('select')[0];
62         $.each( group_subgroups[group], function(index, value) {
63             $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
64         } );
65         $("#subgroup, #subgroup *").show();
66     }
67 }
68
69 $(document).ready(function(){
70
71 [% IF (saved1) %]
72     var rtable = $("#table_reports").dataTable($.extend(true, {}, dataTablesDefaults, {
73         'bAutoWidth': false,
74         'sDom': 't<"bottom pager"ilpf>',
75         'sPaginationType': 'four_button',
76         'aaSorting': [[ 1, "asc" ]],
77         'aoColumnDefs': [
78             { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1] },
79             { 'bSearchable': false, 'aTargets': [3] },
80             { "aTargets": [ 1, 2 ], "sType": "natural"  }
81         ],
82         "aoColumns": [
83             null,null,null,null,null,null,null,null,{ "sType": "title-string" },null,[% IF (usecache) %]null,[% END %]null,null
84         ],
85         'oLanguage': {
86             'sZeroRecords': _("No matching reports found")
87         }
88     }));
89
90     var rtabs = $("#tabs").tabs();
91     rtabs.on("tabsactivate", function(e, ui) {
92         $("#subgroup_filter option").each(function() {
93             if($(this).val().length > 0) {
94                 $(this).remove();
95             }
96         });
97         rtable.fnFilter('', 4);
98         rtable.fnFilter('', 5);
99         rtable.fnSetColumnVis(4, true);
100         rtable.fnSetColumnVis(5, true);
101
102         var g_id = $(ui.newTab).children().attr('id');
103         var g_name = $(ui.newTab).text();
104         if ( g_name == _("All") ) {
105             g_id = "";
106             g_name = "";
107         }
108
109         if (g_id && g_id.length > 0) {
110             rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
111             rtable.fnSetColumnVis(4, false);
112             for(var i in group_subgroups[g_id]) {
113                 $("#subgroup_filter").append(
114                     '<option value="' + group_subgroups[g_id][i][0] + '">'
115                     + group_subgroups[g_id][i][1] + '</option>'
116                 );
117             }
118             $("#subgroup_filter_block").show();
119         } else {
120             $("#subgroup_filter_block").hide();
121         }
122     });
123     $("#subgroup_filter_block").hide();
124
125     $("#subgroup_filter").change(function() {
126         var selected = $(this).find('option:selected');
127         var sg_id = $(selected).val();
128         var sg_name = $(selected).text();
129         if (sg_id.length > 0) {
130             rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
131             rtable.fnSetColumnVis(5, false);
132         } else {
133             rtable.fnFilter('', 5);
134             rtable.fnSetColumnVis(5, true);
135         }
136     });
137
138     $("#reports_form").submit(function(){
139         var checkedItems = $("input[name=ids]:checked");
140         if ($(checkedItems).size() == 0) {
141             alert(_("You must select one or more reports to delete"));
142             return false;
143         }
144         $(checkedItems).parents('tr').addClass("warn");
145         if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
146             return true;
147         } else {
148             $(checkedItems).parents('tr').removeClass("warn");
149             return false;
150         }
151     });
152 [% END %]
153
154 [% IF ( showsql ) %]
155     $("#sql").focus(function() {
156         $(this).select();
157     });
158 [% END %]
159 [% IF ( saved1 ) %]
160     $(".confirmdelete").click(function(){
161         $(this).parents('tr').attr("class","warn");
162         if(confirm(_("Are you sure you want to delete this saved report?"))){
163             return true;
164         } else {
165             $(this).parents('tr').attr("class","");
166             return false;
167         }
168     });
169 [% END %]
170
171 [% IF (create || editsql || save) %]
172     $("#select_group").change(function() {
173         if($(this).attr('checked')) {
174             $("#group_input").attr('disabled', 'disabled');
175             $("#groupdesc_input").attr('disabled', 'disabled');
176             $("#group_select").attr('disabled', false);
177             if ($("#group_select").val().length > 0) {
178                 $("#select_subgroup").attr('checked', 'checked');
179                 $("#select_subgroup").change();
180                 $("#subgroup, #subgroup *").show();
181             } else {
182                 $("#subgroup").hide();
183             }
184         }
185     });
186     $("#create_group").change(function() {
187         if($(this).attr('checked')) {
188             $("#group_input").attr('disabled', false);
189             $("#groupdesc_input").attr('disabled', false);
190             $("#group_select").attr('disabled', 'disabled');
191             $("#create_subgroup").attr('checked', 'checked').change();
192             $("#subgroup_select").hide();
193             $("#subgroup input[type='radio']").hide();
194             $("#subgroup label[for]").hide();
195             $("#subgroup_input").show();
196             $("#subgroupdesc_input").show();
197             $("#subgroup").show();
198         }
199     });
200     $("#select_subgroup").change(function() {
201         if($(this).attr('checked')) {
202             $("#subgroup_select").attr('disabled', false);
203             $("#subgroup_input").attr('disabled', 'disabled');
204             $("#subgroupdesc_input").attr('disabled', 'disabled');
205         }
206     });
207     $("#create_subgroup").change(function() {
208         if($(this).attr('checked')) {
209             $("#subgroup_input").attr('disabled', false);
210             $("#subgroupdesc_input").attr('disabled', false);
211             $("#subgroup_select").attr('disabled', 'disabled');
212         }
213     });
214     $("#select_group").change();
215     $("#select_subgroup").change();
216 [% END %]
217 });
218 //]]>
219 </script>
220 </head>
221 <body id="rep_guided_reports_start" class="rep">
222 [% INCLUDE 'header.inc' %]
223 [% INCLUDE 'circ-search.inc' %]
224
225 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
226 &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
227 &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
228 &rsaquo; 
229 [% IF ( saved1 ) %]Saved reports
230 [% ELSIF ( create ) %]Create from SQL
231 [% ELSIF ( showsql ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; SQL view
232 [% ELSIF ( editsql ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; Edit SQL report
233 [% ELSIF ( execute ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; <em>[% name %]</em> Report
234 [% ELSIF ( buildx ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a> &rsaquo; Step [% buildx %] of 6:
235     [% IF ( build1 ) %]Choose a module
236     [% ELSIF ( build2 ) %]Pick a report type
237     [% ELSIF ( build3 ) %]Select columns for display
238     [% ELSIF ( build4 ) %]Select criteria to limit on
239     [% ELSIF ( build5 ) %]Pick which columns to total
240     [% ELSIF ( build6 ) %]Select how you want the report ordered
241     [% END %]
242 [% END %]
243 </div>
244
245 <div id="doc3" class="yui-t1">
246 <div id="bd">
247 <div id="yui-main">
248     <div class="yui-b">
249     [% INCLUDE "reports-toolbar.inc" %]
250
251 [% IF ( start ) %]
252     <h2>Guided reports</h2>
253     <p>Use the guided reports engine to create non standard reports.
254 This feature aims to provide some middle ground between the built in
255 canned reports and writing custom SQL reports.</p>
256
257     <h3>Build and run reports</h3>
258         [% IF ( CAN_user_reports_create_reports ) %]
259         <form action="/cgi-bin/koha/reports/guided_reports.pl">
260             <input type="hidden" name="phase" value="Build new" />
261             <input type="submit" name="submit" value="Build new"/>
262         </form>
263         [% END %]
264         [% IF ( CAN_user_reports_execute_reports ) %]
265         <form action="/cgi-bin/koha/reports/guided_reports.pl">
266             <input type="hidden" name="phase" value="Use saved"/>
267             <input type="submit" name="submit" value="Use saved"/>
268         </form>
269         [% END %]
270         [% IF ( CAN_user_reports_create_reports ) %]
271         <form action="/cgi-bin/koha/reports/guided_reports.pl">
272             <input type="hidden" name="phase" value="Create report from SQL"/>
273             <input type="submit" name="submit" value="Create report from SQL"/>
274         </form>
275         [% END %]
276 <h3>Reports Dictionary</h3>
277 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
278 <form action="/cgi-bin/koha/reports/dictionary.pl">
279 <input type="hidden" name="phase" value="View Dictionary"/>
280 <input type="submit" name="submit" value="View dictionary"/>
281 </form>
282 [% END %]
283
284 [% IF ( saved1 ) %]
285 [% IF ( savedreports ) %]<h1>Saved reports</h1>
286
287 <div id="tabs" class="toptabs">
288     <ul>
289         <li><a href="#reports">All</a></li>
290         [% FOREACH group IN groups_with_subgroups %]
291             <li><a id="[% group.id %]" href="#reports">[% group.name %]</a></li>
292         [% END %]
293     </ul>
294     <div id="reports">
295         <div id="subgroup_filter_block">
296             <label for="subgroup_filter">Subgroup:</label>
297             <select id="subgroup_filter">
298                 <option value="">All</option>
299             </select>
300         </div>
301 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
302 <input type="hidden" name="phase" value="Delete Multiple" />
303         <table id="table_reports">
304             <thead>
305                 <tr>
306                     <th>&nbsp;</th>
307                     <th>ID</th>
308                     <th>Report name</th>
309                     <th>Type</th>
310                     <th>Group</th>
311                     <th>Subgroup</th>
312                     <th>Notes</th>
313                     <th>Author</th>
314                     <th>Creation date</th>
315                     <th>Public</th>
316                     [% IF (usecache) %] <th>Cache expiry (seconds)</th> [% END %]
317                     <th>Saved results</th>
318                     <th>&nbsp;</th>
319                 </tr>
320             </thead>
321             <tbody>
322                 [% FOREACH savedreport IN savedreports %]
323                     [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
324                         <td><input type="checkbox" name="ids" value="[% savedreport.id %]" /></td>
325                         <td><label for="ids">[% savedreport.id %]</label></td>
326                         <td>
327                             [% IF ( savedreport.report_name ) %]
328                                 [% savedreport.report_name %]
329                             [% ELSE %]
330                                 [ no name ]
331                             [% END %]
332                         </td>
333                         <td>[% savedreport.type %]</td>
334                         <td>[% savedreport.groupname %]</td>
335                         <td>[% savedreport.subgroupname %]</td>
336                         <td>[% savedreport.notes %]</td>
337                         <td>[% savedreport.borrowersurname %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname %][% END %] ([% savedreport.borrowernumber %])</td>
338                         <td><span title="[% savedreport.date_created %]">[% savedreport.date_created | $KohaDates %]</span></td>
339                         [% IF (savedreport.public) %]
340                         <td>Yes</td>
341                         [% ELSE %]
342                         <td>No</td>
343                         [% END %]
344                         [% IF (usecache) %] <td>[% savedreport.cache_expiry %]</td> [% END %]
345                         <td>[% IF ( savedreport.date_run ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&amp;id=[% savedreport.id %]">[% savedreport.date_run %]</a>[% END %]
346                         </td>
347                         <td>
348                             <div class="dropdown">
349                                 <a class="btn btn-mini dropdown-toggle" id="reportactions[% savedreport.id %]" role="button" data-toggle="dropdown" href="#">
350                                    Actions <b class="caret"></b>
351                                 </a>
352                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id %]">
353                                     <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Show%20SQL"><i class="icon-search"></i> Show</a></li>
354                                     [% IF ( CAN_user_reports_create_reports ) %]
355                                         <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Edit%20SQL"><i class="icon-pencil"></i> Edit</a></li>
356                                         <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% savedreport.savedsql |uri %]&amp;reportname=[% savedreport.report_name |uri %]&amp;notes=[% savedreport.notes |uri %]"><i class="icon-copy"></i> Duplicate</a></li>
357                                     [% END %]
358                                     <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Run%20this%20report"><i class="icon-play"></i> Run</a></li>
359                                     <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id %]"><i class="icon-time"></i> Schedule</a></li>
360                                     [% IF ( CAN_user_reports_create_reports ) %]
361                                         <li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Delete%20Saved"><i class="icon-remove"></i> Delete</a></li>
362                                     [% END %]
363                                 </ul>
364                             </div>
365                         </td>
366                     </tr>
367                 [% END %]
368             </tbody>
369         </table>
370         <fieldset class="action">
371             <input type="submit" value="Delete selected" />
372         </fieldset>
373     </form>
374     </div>
375 </div>
376 [% ELSE %]<div class="dialog message">
377     [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
378     <h4>No saved reports match your criteria. </h4>
379     [% IF ( CAN_user_reports_create_reports ) %]
380     <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
381     <input type="hidden" name="phase" value="Build new" />
382     <input type="submit" class="edit" value="Build a new report" accesskey="y" />
383     </form>
384
385     <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
386     <input type="hidden" name="phase" value="Use saved" />
387     <input type="hidden" name="filter_set" value="1" />
388     <input type="hidden" name="filter_keyword" value="" />
389     <input type="submit" class="deny" value="Cancel filter" accesskey="n" />
390     </form>
391
392     [% END %]
393     [% ELSE %]
394     <h4>There are no saved reports. </h4>
395     [% IF ( CAN_user_reports_create_reports ) %]
396         <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
397     [% END %]
398     [% END %]
399     </div>
400 [% END %]
401 [% END %]
402
403
404 [% IF ( build1 ) %]
405 [% IF ( cache_error) %]
406 <div class="dialog alert">
407 <b> Please choose a cache_expiry less than 30 days </b>
408 </div>
409 [% END %]
410 <h1>Build a report</h1>
411 <form action="/cgi-bin/koha/reports/guided_reports.pl">
412 <fieldset class="rows">
413 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and Choose report visibility </legend>
414 <ol>
415   <li>
416     <label for="area">Choose: </label>
417       <select name="area" id="area">
418     [%- FOREACH area IN areas -%]
419       <option value="[% area %]">[%- PROCESS area_name area=area -%]</option>
420     [%- END -%]
421       </select>
422   </li>
423 [% IF (public) %]
424   <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
425 [% ELSE %]
426   <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
427 [% END %]
428 [% IF (usecache) %] <li>
429 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry %]"></input>
430 <select id="cache_expiry_units" name="cache_expiry_units">
431 <option value="seconds">Seconds (default)</option>
432 <option value="minutes">Minutes</option>
433 <option value="hours">Hours</option>
434 <option value="days">Days</option>
435 </select>
436 </li>[% END %]
437 </ol>
438 </fieldset>
439 <fieldset class="action">
440 <input type="hidden" name="phase" value="Report on this Area" />
441 <input type="submit" name="submit" value="Next &gt;&gt;" />
442
443 </fieldset>
444 </form>
445 [% END %]
446
447
448 [% IF ( build2 ) %]
449 <h1>Build a report</h1>
450 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
451 <input type="hidden" name="area" value="[% area %]" />
452 <input type="hidden" name="public" value="[% public %]" />
453 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
454 <fieldset class="rows"><legend>Step 2 of 6: Pick a report type</legend>
455 <ol><li><label for="types">Choose: </label>
456     <select id="types" name="types">
457         <option value="1">Tabular</option>
458         <option value="2" disabled="disabled">Summary</option>
459         <option value="3" disabled="disabled">Matrix</option>
460     </select>
461 </li></ol></fieldset>
462
463 <fieldset class="action">
464     <input type="hidden" name="phase" value="Choose this type" />
465     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
466     <input type="submit" name="submit" value="Next &gt;&gt;" />
467 </fieldset>
468 </form>
469 </div>
470 <div class="yui-gb"><div class="yui-u first"></div>
471
472 <!--- Summary and Matrix reports have not yet been implemented-->
473 <!--<div class="yui-u">Summary:
474 <img src="[% interface %]/[% theme %]/img/reports-summary-graphic.gif" /></div>
475 <div class="yui-u">Matrix:
476 <img src="[% interface %]/[% theme %]/img/reports-matrix-graphic.gif" /></div>-->
477
478 [% END %]
479
480 [% IF ( build3 ) %]
481 <h1>Build a report</h1>
482 <h3>Step 3 of 6: Select columns for display</h3>
483 <p>Note: Be careful selecting when selecting columns. If your choice is too broad it could result in a very large report that will either not complete, or slow your system down.</p>
484
485 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
486     <input type="hidden" name="area" value="[% area %]" />
487     <input type="hidden" name="type" value="[% type %]" />
488     <input type="hidden" name="public" value="[% public %]" />
489     <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
490     <fieldset>
491 <div class="yui-g">
492 <div class="yui-u first">       <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
493 [% FOREACH column IN columns %]
494 [% IF ( column.table ) %]
495
496 [% IF ( loop.first ) %]
497 [% ELSE %]
498 </optgroup>
499 [% END %]
500
501 <optgroup label="[% column.table %]">
502 [% ELSE %]
503 <option value="[% column.name %]">
504 [% IF ( column.description ) %][% column.description %] &nbsp; / &nbsp; [% column.name %]
505 [% ELSE %]
506 [% column.name %]
507 [% END %]
508 </option>
509 [% END %]
510 [% END %]
511 </optgroup>
512 </select></div>
513 <div style="width: 6.3em; float: right; margin-top: 100px"><input type="button" name="Add" value="Add" class="button" style="width:6em;" onclick="addColumn()" /><br />
514 <input type="button" name="delete" value="&lt;&lt; Delete" class="button" style="width: 6em; margin: 1em 0;" onclick="delColumn()" /></div>
515 </div>
516
517 <div class="yui-u">
518 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
519 </div>
520 </div>
521 </fieldset>
522 <div class="yui-g">
523 <fieldset class="action">
524     <input type="hidden" name="phase" value="Choose these columns" />
525     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
526     <input type="submit" name="submit" value="Next &gt;&gt;" />
527 </fieldset>
528 </div>
529 </form>
530
531 [% END %]
532
533 [% IF ( build4 ) %]
534 <h1>Build a report</h1>
535 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
536     <input type="hidden" name="area" value="[% area %]" />
537     <input type="hidden" name="type" value="[% type %]" />
538     <input type="hidden" name="column" value="[% column %]" />
539     <input type="hidden" name="public" value="[% public %]" />
540     <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
541     <fieldset><legend>Step 4 of 6: Select criteria to limit on</legend>
542     <table>
543         [% FOREACH criteri IN criteria %]
544         <tr>
545         <td>
546             <input type="checkbox" name="criteria_column" id="[% criteri.name %]" value="[% criteri.name %]" /> 
547             <label for="[% criteri.name %]">[% criteri.description %] </label>
548         </td>
549         [% IF ( criteri.date ) %]
550         <td>
551             <input type="text" size="10" id="[% criteri.name %]_value" name="[% criteri.name %]_value" value="" class="datepicker" />
552                 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
553         </td>
554         </tr>
555         [% ELSE %]
556         [% IF ( criteri.textrange ) %]
557             <td>from
558             <input type="text" size="10" id="[% criteri.from %]_value" name="[% criteri.from %]_value" value="" /> to 
559             <input type="text" size="10" id="[% criteri.to %]_value" name="[% criteri.to %]_value" value="" />
560             </td>
561             </tr>
562         [% ELSE %]
563             [% IF ( criteri.daterange ) %]
564             <td>from 
565             <input type="text" size="10" id="from_[% criteri.name %]_value" name="from_[% criteri.name %]_value" value="" class="datepickerfrom" />
566             to
567             <input type="text" size="10" id="to_[% criteri.name %]_value" name="to_[% criteri.name %]_value" value="" class="datepickerto" />
568                         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
569             </td>
570         </tr>
571             [% ELSE %]
572             <td>
573                 <select name="[% criteri.name %]_value">
574                 [% FOREACH value IN criteri.values %]
575                 <option value="[% value.availablevalues %]">[% IF ( value.default ) %]Default[% ELSE %][% value.availablevalues |html %][% END %]</option>
576                 [% END %]
577                 </select>
578             </td>
579             </tr>
580             [% END %]
581         [% END %]
582         [% END %]
583     [% END %]
584     </table>
585     </fieldset>
586
587 [% IF ( definitions ) %]
588 <fieldset><legend>Dictionary definitions</legend>
589 <table>
590 [% FOREACH definition IN definitions %]
591     <tr><td><input type="checkbox" name="definition" value="[% definition.id %]" /> [% definition.name %]</td></tr>
592 [% END %]
593 </table>
594 </fieldset>
595 [% END %]
596
597 <fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
598     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
599     <input type="submit" name="submit" value="Next &gt;&gt;" /> </fieldset>
600 </form>
601 [% END %]
602
603
604 [% IF ( build5 ) %]
605 <h1>Build a report</h1>
606 <h3>Step 5 of 6: Pick which columns to total</h3>
607 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
608 <input type="hidden" name="area" value="[% area %]" />
609 <input type="hidden" name="type" value="[% type %]" />
610 <input type="hidden" name="column" value="[% column %]" />
611 <input type="hidden" name="definition" value="[% definition %]" />
612 <input type="hidden" name="criteria" value="[% criteriastring %]" />
613 <input type="hidden" name="public" value="[% public %]" />
614 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
615 <fieldset><table>
616 [% FOREACH total_b IN total_by %]
617 <tr><td><input type="checkbox" name="total_by" id="[% total_b.name %]" value="[% total_b.name %]" /> <label for="[% total_b.name %]">[% total_b.name %]</label></td>
618 <td><select name="[% total_b.name %]_tvalue">
619
620 [% FOREACH selec IN total_b.select %]
621 <option value="[% selec.value %]">[% selec.value %]</option>
622 [% END %]
623 </select>
624
625 </td></tr>
626 [% END %]
627 </table></fieldset>
628
629 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
630     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
631     <input type="submit" name="submit" value="Next &gt;&gt;" /></fieldset>
632 </form>
633 [% END %]
634
635
636 [% IF ( build6 ) %]
637 <h1>Build a report</h1>
638 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
639 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
640 <input type="hidden" name="area" value="[% area %]" />
641 <input type="hidden" name="type" value="[% type %]" />
642 <input type="hidden" name="column" value="[% column %]" />
643 <input type="hidden" name="criteria" value="[% criteriastring %]" />
644 <input type="hidden" name="definition" value="[% definition %]" />
645 <input type="hidden" name="totals" value="[% totals %]" />
646 <input type="hidden" name="public" value="[% public %]" />
647 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
648 <fieldset><table>[% FOREACH order_b IN order_by %]
649 <tr><td><input type="checkbox" id="[% order_b.name %]" name="order_by" value="[% order_b.name %]" /> <label for="[% order_b.name %]">[% order_b.name %]</label></td><td>
650 <select name="[% order_b.name %]_ovalue">
651
652 [% FOREACH selec IN order_b.select %]
653 <option value="[% selec.value %]">[% selec.value %]</option>
654 [% END %]
655 </select>
656 </td></tr>
657
658 [% END %]
659 </table></fieldset>
660
661 <fieldset class="action">
662 <input type="hidden" name="phase" value="Build report" />
663 <input type="submit" name="submit" value="Finish" /></fieldset>
664 </form>
665 [% END %]
666
667
668 [% IF ( showreport ) %]
669 <h1>Confirm custom report</h1>
670 <p>Your report will be generated with the following SQL statement.</p>
671 <p> 
672 [% sql |html %]
673 </p>
674
675 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
676 <input type="hidden" name="sql" value="[% sql %]" />
677 <input type="hidden" name="type" value="[% type %]" />
678 <input type="hidden" name="public" value="[% public %]" />
679 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
680 <p>You will need to save the report before you can execute it</p>
681 <fieldset class="action"><input type="hidden" name="phase" value="Save" />  
682 <input type="submit" name="submit" value="Save" />  </fieldset>
683 </form>
684 [% END %]
685
686 [% IF ( save ) %]
687 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
688 <input type="hidden" name="sql" value="[% sql |html %]" />
689 <input type="hidden" name="type" value="[% type %]" />
690 <input type="hidden" name="area" value="[% area %]" />
691 <input type="hidden" name="public" value="[% public %]" />
692 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
693 <fieldset class="rows">
694 <legend>Save your custom report</legend>
695 <ol>
696     <li><label for="reportname" class="required">Report name: </label><input type="text" id="reportname" name="reportname" class="required" required="required" /> <span class="required">Required</span></li>
697     [% PROCESS group_and_subgroup_selection %]
698     <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
699 </ol></fieldset>
700 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
701 <input type="submit" name="submit" value="Save report" /></fieldset>
702 </form>
703 [% END %]
704
705 [% IF ( warn_authval_problem ) %]
706      <form action='/cgi-bin/koha/reports/guided_reports.pl'>
707         <!--Every parameter the user issued is provided as a hidden field for recovery-->
708         <input type='hidden' name='id' value='[% id %]' />
709         <input type='hidden' name='sql' value='[% sql %]' />
710         <input type='hidden' name='reportname' value='[% reportname %]' />
711         <input type='hidden' name='group' value='[% group %]' />
712         <input type='hidden' name='subgroup' value='[% subgroup %]' />
713         <input type='hidden' name='notes' value='[% notes %]' />
714         <input type='hidden' name='cache_expiry' value='[% cache_expiry %]' />
715         <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units %]' />
716         <input type='hidden' name='public' value='[% public %]' />
717
718         <div class="dialog alert">
719             <h3>Errors found when processing parameters for report: [% name %]</h3>
720             [% FOREACH problematic_authval IN problematic_authvals %]
721                 <p>
722                 <strong>[% problematic_authval.name %]:</strong> The authorized value category (<strong>[% problematic_authval.authval %]</strong>)
723                     you selected does not exist.
724                 </p>
725             [% END %]
726             <!-- Save Anyway Form -->
727             <form action='/cgi-bin/koha/reports/guided_reports.pl'>
728             <!--Every parameter the user issued is provided as a hidden field for recovery-->
729                 <input type='hidden' name='id' value='[% id %]' />
730                 <input type='hidden' name='sql' value='[% sql %]' />
731                 <input type='hidden' name='reportname' value='[% reportname %]' />
732                 <input type='hidden' name='group' value='[% group %]' />
733                 <input type='hidden' name='subgroup' value='[% subgroup %]' />
734                 <input type='hidden' name='notes' value='[% notes %]' />
735                 <input type='hidden' name='cache_expiry' value='[% cache_expiry %]' />
736                 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units %]' />
737                 <input type='hidden' name='public' value='[% public %]' />
738             [% IF ( phase_update) %]
739                 <input type='hidden' name='phase' value='Update SQL' />
740                 <input type="submit" name="save_anyway" class="approve" value="Save anyway" />
741             [% ELSIF ( phase_save) %]
742                 <input type='hidden' name='area' value='[% area %]' />
743                 <input type='hidden' name='phase' value='Save Report' />
744                 <input type="submit" name="save_anyway" class="approve" value="Save anyway" />
745             [% END %]
746             </form>
747             <!-- Go back to editing -->
748             <form action='/cgi-bin/koha/reports/guided_reports.pl'>
749                 <input type="button" name='back' class="deny" value="Edit SQL"
750                                     onclick="javascript:history.back()" />
751             </form>
752         </div>
753     </form>
754 [% END %]
755
756 [% IF ( enter_params ) %]
757     <form action='/cgi-bin/koha/reports/guided_reports.pl'>
758         <input type='hidden' name='reports' value="[% reports %]" />
759     [% IF ( auth_val_error ) %]
760         <input type='hidden' name='phase' value='Edit SQL' />
761         <div class="dialog alert">
762             <h3>Errors found when processing parameters for report: [% name %]</h3>
763             [% FOREACH auth_val_error IN auth_val_errors %]
764                 <p>
765                     <strong>[% auth_val_error.entry %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val %]</strong>)
766                     you selected does not exist.
767                 </p>
768             [% END %]
769         </div>
770         <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
771     [% ELSE %]
772         <input type='hidden' name='phase' value='Run this report' />
773         <h1>Enter parameters for report [% name %]:</h1>
774         [% IF ( notes ) %]<p>[% notes %]</p>[% END %]
775         <fieldset class="rows">
776             <ol>
777             [% FOREACH sql_param IN sql_params %]
778                 [% IF sql_param.input == 'date' %]
779                     <li>
780                     <label for="date_[% sql_param_entry %][% loop.count %]">[% sql_param.entry %]:</label> <input id="date_[% sql_param_entry %][% loop.count %]" type="text" value="" size="10" name="sql_params" class="datepicker" />
781                     </li>
782                 [% ELSIF ( sql_param.input == 'text' ) %]
783                     <li><label for="sql_params[% loop.count %]">[% sql_param.entry %]: </label><input id="sql_params[% loop.count %]" type="text" name="sql_params" /></li>
784                 [% ELSE %]
785                     <li><label for="sql_params_[% sql_param.labelid %]">[% sql_param.entry %]:</label> [% sql_param.input %]</li>
786                 [% END %]
787             [% END %]
788             </ol>
789         </fieldset>
790         <fieldset class="action"><input type="submit" value="Run the report" /></fieldset>
791     [% END %]
792     </form>
793 [% END %]
794
795 [% IF ( execute ) %]
796 <h1>[% name %]</h1>
797 [% IF ( notes ) %]<p>[% notes %]</p>[% END %]
798 [% IF ( unlimited_total ) %]<p>Total number of rows matching the (unlimited) query is [% unlimited_total %].</p>[% END %]
799 <pre id="sql_output">[% sql |html %]</pre>
800
801 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
802     <input type="hidden" name="phase" value="Run this report"/>
803     <input type="hidden" name="reports" value="[% report_id %]"/>
804
805     [% FOREACH p IN sql_params %]
806         <input type="hidden" name="sql_params" value="[% p %]"/>
807     [% END %]
808
809     <label for="limit">Rows per page: </label>
810     <select name="limit">
811         [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
812         [% FOREACH l IN limits %]
813                 [% IF l == limit %]
814                     <option value="[% l %]" selected="selected">[% l %]</option>
815                 [% ELSE %]
816                     <option value="[% l %]">[% l %]</option>
817                 [% END %]
818         [% END %]
819     </select>
820
821     <input type="submit" value="Update" />
822 </form>
823
824 <div class="pages">[% pagination_bar %]</div>
825 [% UNLESS ( errors ) %]
826 <table>
827 <tr>[% FOREACH header_ro IN header_row %]<th>[% header_ro.cell %]</th>[% END %]</tr>
828 [% FOREACH result IN results %]
829 <tr>
830     [% FOREACH cell IN result.cells %]<td>[% cell.cell %]</td>[% END %]
831 </tr>
832 [% END %]
833 </table>
834 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
835 <fieldset class="action">
836 <label for="format">Download the report: </label>
837 <select name="format" id="format">
838 <option value="csv">Comma separated text</option>
839 <option value="tab">Tab separated text</option>
840 <option value="ods">Open Document Spreadsheet</option>
841 </select>
842 <input type="hidden" name="sql" value="[% sql |html %]" />
843 <input type="hidden" name="phase" value="Export" />
844 <input type="submit" name="submit" value="Download" /></fieldset>
845 <input type="hidden" name="reportname" value="[% name %]" />
846 </form>
847 [% END %]
848 [% END %]
849
850 [% IF ( create ) %]
851 <script type="text/javascript">
852 $(document).ready(function() {
853     load_group_subgroups();
854 });
855 </script>
856 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
857 <fieldset class="rows">
858 <legend>Create report from SQL</legend>
859 <ol>
860     <li><label for="reportname" class="required">Report name:</label>
861         [% IF ( reportname ) %]<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname %]" size="50"/>
862         [% ELSE %]<input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />[% END %] <span class="required">Required</span>
863     </li>
864     [% PROCESS group_and_subgroup_selection %]
865
866 [% IF (public) %]
867   <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
868 [% ELSE %]
869   <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
870 [% END %]
871 [% IF (usecache) %] <li>
872 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry %]"></input>
873 <select id="cache_expiry_units" name="cache_expiry_units">
874 <option value="seconds" selected="selected">Seconds (default)</option>
875 <option value="minutes">Minutes</option>
876 <option value="hours">Hours</option>
877 <option value="days">Days</option>
878 </select>
879 </li>[% END %]
880     <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
881 </ol>
882 </fieldset>
883 <fieldset class="rows">
884 <legend>SQL:</legend>
885 <div style="margin:1em;">
886 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql %]</textarea> <span class="required">Required</span>
887 </div>
888 </fieldset>
889
890 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
891 <input type="submit" name="submit" value="Save report" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
892 </fieldset>
893 </form>
894 [% END %]
895
896 [% IF ( compound ) %]
897 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
898 Master: <select name="master">
899 [% FOREACH savedreport IN savedreports %]
900 <option value="[% savedreport.id %]">[% savedreport.report_name %]</option>
901 [% END %]
902 </select>
903 &nbsp;
904 Sub report:<select name="subreport">
905 [% FOREACH savedreport IN savedreports %]
906 <option value="[% savedreport.id %]">[% savedreport.report_name %]</option>
907 [% END %]
908 </select>
909 <br />
910 <input type="hidden" name="phase" value="Save Compound" />
911 <input type="submit" name="submit" value="Save compound" />
912 </form>
913 [% END %]
914
915 [% IF ( save_compound ) %]
916 [% master %] <br />
917 [% subsql %]
918 [% END %]
919
920
921 [% IF ( retresults ) %]
922 <h1>Saved report results</h1>
923 <h2>[% name %]</h2>
924 <p>[% notes %]</p>
925 <table>
926 [% FOREACH result IN results %]
927 [% result.row %]
928 [% END %]
929 </table>
930 [% END %]
931
932 [% IF ( showsql ) %]
933 <fieldset class="rows">
934     <legend>[% reportname %]</legend>
935     <ol>
936         [% IF ( notes ) %]<li><span class="label">Notes:</span> [% notes %]</li>[% ELSE %][% END %]
937         <li><textarea id="sql">[% sql %]</textarea></li>
938     </ol>
939 </fieldset>
940 [% END %]
941
942 [% IF ( editsql ) %]
943 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
944 <input type="hidden" name="phase" value="Update SQL" />
945 <input type="hidden" name="id" value="[% id %]"/>
946 <fieldset class="rows">
947 <legend>Edit SQL report</legend>
948 <ol>
949 <li><label for="reportname" class="required">Report name: </label><input type="text" id="reportname" name="reportname" value="[% reportname %]" size="50" class="required" required="required" /> <span class="required">Required</span></li>
950 [% PROCESS group_and_subgroup_selection %]
951 [% IF (public) %]
952   <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
953 [% ELSE %]
954   <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
955 [% END %]
956 [% IF (usecache) %] <li>
957 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry %]"></input>
958 <select id="cache_expiry_units" name="cache_expiry_units">
959 <option value="seconds">Seconds (default)</option>
960 <option value="minutes">Minutes</option>
961 <option value="hours">Hours</option>
962 <option value="days">Days</option>
963 </select>
964 </li>[% END %]
965 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
966 </ol>
967 </fieldset>
968
969 <fieldset class="rows">
970     <legend>SQL:</legend>
971     <div style="margin:1em;">
972         <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql %]</textarea> <span class="required">Required</span>
973     </div>
974 </fieldset>
975
976 <fieldset class="action">
977 <input type="submit" name="submit" value="Update SQL" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
978 </fieldset>
979 </form>
980
981
982 [% END %]
983
984 [% IF ( save_successful ) %]
985 [% UNLESS ( errors ) %]
986 <h2>Your report has been saved</h2>
987 <h4>[% reportname %]</h4>
988 <ul>
989     [% IF ( id ) %]
990     <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&amp;phase=Run%20this%20report">Run this report</a></li>
991     [% END %]
992     <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports page</a></li>
993     <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler tool</a></li>
994     <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided reports</a></li>
995 </ul>
996 [% END %]
997 [% END %]
998
999 [% IF ( errors ) %]
1000 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1001 <div class="dialog alert">
1002 <b>The following error was encountered:</b><br />
1003 [% FOREACH error IN errors %]
1004     [% IF ( error.sqlerr ) %]This report contains the SQL keyword <b>[% error.sqlerr %]</b>.
1005     <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
1006     <br />Please return to the &quot;Saved Reports&quot; screen and delete this report or retry creating a new one.
1007     [% ELSIF ( error.queryerr ) %]The database returned the following error: <br />[% error.queryerr %]<br />Please check the log for further details.
1008     [% ELSIF ( error.cache_expiry ) %]Please select a cache expiry less than 30 days.
1009     [% ELSE %]
1010     [% END %]
1011     <div id="onerror_actions">
1012         <a href="javascript:window.history.back()" class="button">Return to previous page</a>
1013     </div>
1014 [% END %]
1015 </div>
1016 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
1017 <input type="submit" name="submit" value="Saved reports" /></fieldset>
1018 </form>
1019 [% END %]
1020
1021 </div>
1022 </div>
1023 <div class="yui-b">
1024
1025 [% IF ( saved1 ) %]
1026 <div id="saved-reports-filter">
1027 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1028   <input type="hidden" name="phase" value="Use saved" />
1029   <input type="hidden" name="filter_set" value="1" />
1030   <fieldset class="brief">
1031   <h3>Filter</h3>
1032   <ol>
1033     <li><label for="filter_date">Date:</label> <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date %]" class="datepicker" />
1034     <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1035
1036     </li>
1037     <li><label for="filter_author">Author:</label> <input type="text" id="filter_author" name="filter_author" value="[% filters.author %]" /></li>
1038     <li><label for="filter_keyword">Keyword:</label> <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword %]" /></li>
1039   </ol>
1040   </fieldset>
1041   <fieldset class="action"><input type="submit" value="Apply filter" /></fieldset>
1042 </form>
1043 </div>
1044 [% END %]
1045
1046
1047 [% INCLUDE 'guided-reports-view.inc' %]
1048 </div>
1049 </div>
1050 <script type="text/javascript">
1051 //<![CDATA[
1052 function addColumn() {
1053     $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1054 }
1055 function delColumn() {
1056     $("#selectedColumns option:selected").remove();
1057 }
1058 $("#column_submit").submit(function() {
1059     if ($("#selectedColumns option").size() < 1) {
1060         alert(_("No columns selected!"));
1061         return false;
1062     }
1063     $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
1064     return true;
1065 });
1066 //]]>
1067 </script>
1068 [% INCLUDE 'intranet-bottom.inc' %]
1069
1070
1071 [% BLOCK group_and_subgroup_selection %]
1072     <li id="group">
1073         <label>Report group:</label>
1074         <input type="radio" name="select_or_create_group"
1075             id="select_group" checked="checked" />
1076         <label for="select_group" style="float:none">Select</label>
1077         <select name="group" onChange="load_group_subgroups();" id="group_select">
1078             <option value="">(None)</option>
1079             [% FOREACH group IN groups_with_subgroups %]
1080                 [% IF (group.selected) %]
1081                     <option value="[% group.id %]" selected="selected">
1082                 [% ELSE %]
1083                     <option value="[% group.id %]">
1084                 [% END %]
1085                     [% group.name %]
1086                 </option>
1087             [% END %]
1088         </select>
1089         <input type="radio" name="select_or_create_group" id="create_group" />
1090         <label for="create_group" style="float:none">or create</label>
1091         <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
1092         <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
1093     </li>
1094     <li id="subgroup">
1095         <label>Report subgroup:</label>
1096         <input type="radio" name="select_or_create_subgroup"
1097             id="select_subgroup" checked="checked" />
1098         <label for="select_subgroup" style="float:none">Select</label>
1099         <select name="subgroup" id="subgroup_select">
1100             <option value="">(None)</option>
1101             [% FOREACH group IN groups_with_subgroups %]
1102                 [% IF (group.selected) %]
1103                     [% FOREACH subgroup IN group.subgroups %]
1104                         [% IF (subgroup.selected) %]
1105                             <option value="[% subgroup.id %]" selected="selected">
1106                         [% ELSE %]
1107                             <option value="[% subgroup.id %]">
1108                         [% END %]
1109                             [% subgroup.name %]
1110                         </option>
1111                     [% END %]
1112                 [% END %]
1113             [% END %]
1114         </select>
1115         <input type="radio" name="select_or_create_subgroup"
1116             id="create_subgroup" />
1117         <label for="create_subgroup" style="float:none">or create</label>
1118         <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
1119         <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />
1120     </li>
1121 [% END %]