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