MT 2051 : granular permissions for guided reports
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / guided_reports_start.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha &rsaquo; Reports &rsaquo; Guided Reports Wizard 
3 <!-- TMPL_IF    NAME="saved1"  -->&rsaquo; Saved Reports
4 <!-- TMPL_ELSIF NAME="create"  -->&rsaquo; Create from SQL
5 <!-- TMPL_ELSIF NAME="showsql" -->&rsaquo; Saved Reports &rsaquo; SQL View
6 <!-- TMPL_ELSIF NAME="execute" -->&rsaquo; Saved Reports &rsaquo; <!-- TMPL_VAR NAME="name" --> Report
7 <!-- TMPL_ELSIF NAME="buildx"  -->&rsaquo; Build A Report, Step <!-- TMPL_VAR NAME="buildx" --> of 6:
8   <!-- TMPL_IF    NAME="build1" -->Choose a Module
9   <!-- TMPL_ELSIF NAME="build2" -->Pick a Report Type
10   <!-- TMPL_ELSIF NAME="build3" -->Select Columns for Display
11   <!-- TMPL_ELSIF NAME="build4" -->Select Criteria to Limit on
12   <!-- TMPL_ELSIF NAME="build5" -->Pick which columns to total
13   <!-- TMPL_ELSIF NAME="build6" -->Select how you want the report ordered
14   <!-- /TMPL_IF -->
15 <!-- /TMPL_IF -->
16 </title>
17 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
18 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
19 <style type="text/css">
20         #sql { width: 90%; height: 9em; border: 1px solid #EEE; }
21 </style>
22 <script type="text/javascript">
23 //<![CDATA[
24 $(document).ready(function(){
25 <!-- TMPL_IF NAME="showsql" -->
26         $("#sql").focus(function() {
27                 $(this).select();
28     });
29 <!-- /TMPL_IF -->
30 <!-- TMPL_IF NAME="saved1" -->
31         $(".confirmdelete").click(function(){
32                 $(this).parents('tr').attr("class","warn");
33                 if(confirm("Are you sure you want to "+$(this).attr("title")+"?")){
34                         return true;
35                 } else {
36                         $(this).parents('tr').attr("class","");
37                         return false;
38                 }
39         });
40 <!-- /TMPL_IF -->
41 });
42 //]]>
43  </script>
44 </head>
45 <body>
46 <!-- TMPL_INCLUDE NAME="header.inc" -->
47 <!-- TMPL_INCLUDE NAME="circ-search.inc" -->
48
49 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
50 &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
51 &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a>
52 &rsaquo; 
53   <!-- TMPL_IF NAME="saved1"  --><strong>Saved Reports</strong>
54   <!-- TMPL_ELSIF NAME="create"  --><strong>Create from SQL</strong>
55   <!-- TMPL_ELSIF NAME="showsql" --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports</a> &rsaquo; <strong>SQL View</strong>
56   <!-- TMPL_ELSIF NAME="execute" --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports</a> &rsaquo; <em><!-- TMPL_VAR NAME="name" --></em> Report
57   <!-- TMPL_ELSIF NAME="buildx"  --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build A Report</a> &rsaquo; Step <!-- TMPL_VAR NAME="buildx" --> of 6:
58       <!-- TMPL_IF    NAME="build1" -->Choose a Module
59       <!-- TMPL_ELSIF NAME="build2" -->Pick a Report Type
60       <!-- TMPL_ELSIF NAME="build3" -->Select Columns for Display
61       <!-- TMPL_ELSIF NAME="build4" -->Select Criteria to Limit on
62       <!-- TMPL_ELSIF NAME="build5" -->Pick which columns to total
63       <!-- TMPL_ELSIF NAME="build6" -->Select how you want the report ordered
64       <!-- /TMPL_IF -->
65   <!-- /TMPL_IF -->
66 </div>
67
68 <div id="doc3" class="yui-t1">
69  <div id="bd">
70    <div id="yui-main">
71     <div class="yui-b">
72       <div class="details">
73
74 <!-- TMPL_IF NAME="start" -->
75      <h2>Guided Reports</h2>
76      <p>Use the guided reports engine to create non standard reports.
77 This feature aims to provide some middle ground between the built in
78 canned reports and writing custom SQL reports.</p>
79
80      <h3>Build And Run Reports</h3>
81             <!-- TMPL_IF NAME="CAN_user_reports_create_report" -->
82                 <form action="/cgi-bin/koha/reports/guided_reports.pl">
83                     <input type="hidden" name="phase" value="Build new" />
84                     <input type="submit" name="submit" value="Build new"/>
85                 </form>
86             <!-- /TMPL_IF -->
87             <!-- TMPL_IF NAME="CAN_user_reports_execute_report" -->
88                 <form action="/cgi-bin/koha/reports/guided_reports.pl">
89                     <input type="hidden" name="phase" value="Use saved"/>
90                     <input type="submit" name="submit" value="Use saved"/>
91                 </form>
92             <!-- /TMPL_IF -->
93             <!-- TMPL_IF NAME="CAN_user_reports_create_report" -->
94                 <form action="/cgi-bin/koha/reports/guided_reports.pl">
95                     <input type="hidden" name="phase" value="Create report from SQL"/>
96                     <input type="submit" name="submit" value="Create report from SQL"/>
97                 </form>
98             <!-- /TMPL_IF -->
99 <h3>Reports Dictionary</h3>
100 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
101 <form action="/cgi-bin/koha/reports/dictionary.pl">
102 <input type="hidden" name="phase" value="View Dictionary"/>
103 <input type="submit" name="submit" value="View Dictionary"/>
104 </form>
105 <!-- /TMPL_IF -->
106
107 <!-- TMPL_IF NAME="saved1" -->
108 <!-- TMPL_IF NAME="savedreports" --><h1>Saved Reports</h1>
109 <p>Choose the report to run from the list</p>
110 <form action="/cgi-bin/koha/reports/guided_reports.pl">
111 <table>
112 <tr><th>Report Name</th><th>Type</th><th>Notes</th><th>Author</th><th>Creation Date</th><th>Saved Results</th><th>Saved SQL</th><th colspan="3">&nbsp;</th></tr>
113 <!-- TMPL_LOOP NAME="savedreports" -->
114 <tr><td><!-- TMPL_VAR NAME="report_name" --></td>
115 <td><!-- TMPL_VAR NAME="type" --></td>
116 <td><!-- TMPL_VAR NAME="notes" --></td>
117 <td><!-- TMPL_VAR NAME="borrowersurname" --><!-- TMPL_IF NAME="borrowerfirstname" -->, <!-- TMPL_VAR NAME="borrowerfirstname" --><!-- /TMPL_IF --> (<!-- TMPL_VAR NAME="borrowernumber" -->)</td>
118 <td><!-- TMPL_VAR NAME="date_created" --></td>
119 <td><!-- TMPL_IF NAME="date_run" --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="date_run" --></a><!-- /TMPL_IF -->
120 </td>
121 <td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Show%20SQL">Show SQL</a> 
122 &nbsp; <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Edit%20SQL">Edit SQL</a></td>
123 <td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Run%20this%20report">Run</a></td>
124 <td><a href="/cgi-bin/koha/tools/scheduler.pl?id=<!-- TMPL_VAR NAME="id" -->">Schedule</a></td>
125 <td><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Delete%20Saved">Delete</a></td></tr>
126 <!-- /TMPL_LOOP -->
127 </table>
128 </form>
129 <!-- TMPL_ELSE --><h4>There are no saved reports. <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build new?</a></h4><!-- /TMPL_IF -->
130 <!-- /TMPL_IF -->
131
132
133 <!-- TMPL_IF NAME="build1" -->
134 <h1>Build A Report</h1>
135 <form action="/cgi-bin/koha/reports/guided_reports.pl">
136 <fieldset class="rows">
137 <legend>Step 1 of 6: Choose a Module to Report on</legend>
138 <ol><li><label for="areas">Choose: </label><select name="areas" id="areas">
139 <!-- TMPL_LOOP NAME="areas" -->
140 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option>
141 <!-- /TMPL_LOOP -->
142 </select></li></ol>
143 </fieldset>
144 <fieldset class="action">
145 <input type="hidden" name="phase" value="Report on this Area" />
146 <input type="submit" name="submit" value="Next &gt;&gt;" />
147
148 </fieldset>
149 </form>
150 <!-- /TMPL_IF -->
151
152
153 <!-- TMPL_IF NAME="build2" -->
154 <h1>Build A Report</h1>
155 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
156 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
157 <fieldset class="rows"><legend>Step 2 of 6: Pick a Report Type</legend>
158 <ol><li><label for="types">Choose: </label>
159     <select id="types" name="types">
160         <option value="1">Tabular</option>
161         <option value="2" disabled="disabled">Summary</option>
162         <option value="3" disabled="disabled">Matrix</option>
163     </select>
164 </li></ol></fieldset>
165
166 <fieldset class="action">
167     <input type="hidden" name="phase" value="Choose this type" />
168     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
169     <input type="submit" name="submit" value="Next &gt;&gt;" />
170 </fieldset>
171 </form>
172 </div>
173 <div class="yui-gb"><div class="yui-u first"></div>
174
175 <!--- Summary and Matrix reports have not yet been implemented-->
176 <!--<div class="yui-u">Summary:
177 <img src="/intranet-tmpl/prog/img/reports-summary-graphic.gif" /></div>
178 <div class="yui-u">Matrix:
179 <img src="/intranet-tmpl/prog/img/reports-matrix-graphic.gif" /></div>-->
180
181 <!-- /TMPL_IF -->
182
183 <!-- TMPL_IF NAME="build3" -->
184 <h3>Step 3 of 6: Select Columns for Display</h3>
185 <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>
186
187 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
188         <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
189         <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
190         <fieldset>
191 <div class="yui-g">
192 <div class="yui-u first">       <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
193 <!-- TMPL_LOOP NAME="columns" -->
194 <!-- TMPL_IF NAME="table" -->
195
196 <!-- TMPL_IF NAME="__first__" -->
197 <!-- TMPL_ELSE -->
198 </optgroup>
199 <!-- /TMPL_IF -->
200
201 <optgroup label="<!-- TMPL_VAR NAME="table"-->">
202 <!-- TMPL_ELSE -->
203 <option value="<!-- TMPL_VAR NAME="name" -->">
204 <!-- TMPL_IF NAME="description" --><!-- TMPL_VAR NAME="description" -->
205 <!-- TMPL_ELSE -->
206 <!-- TMPL_VAR NAME="name" -->
207 <!-- /TMPL_IF -->
208 </option>
209 <!-- /TMPL_IF -->
210 <!-- /TMPL_LOOP -->
211 </optgroup>
212 </select></div>
213 <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 />
214 <input type="button" name="delete" value="&lt;&lt; Delete" class="button" style="width: 6em; margin: 1em 0;" onclick="delColumn()" /></div>
215 </div>
216
217 <div class="yui-u">
218 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
219 </div>
220 </div>
221 </fieldset>
222 <div class="yui-g">
223 <fieldset class="action">
224     <input type="hidden" name="phase" value="Choose these columns" />
225     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
226     <input type="submit" name="submit" value="Next &gt;&gt;" />
227 </fieldset>
228 </div>
229 </form>
230
231 <!-- /TMPL_IF -->
232
233 <!-- TMPL_IF NAME="build4" -->
234 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
235     <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
236     <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
237     <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->" />
238     <fieldset><legend>Step 4 of 6: Select Criteria to Limit on</legend>
239         <table>
240             <!-- TMPL_LOOP NAME="criteria" -->
241             <tr>
242                 <td>
243                     <input type="checkbox" name="criteria_column" id="<!-- TMPL_VAR NAME="name" -->" value="<!-- TMPL_VAR NAME="name" -->" /> 
244                     <label for="<!-- TMPL_VAR NAME="name" -->"><!-- TMPL_VAR NAME="description" --> </label>
245                 </td>
246                 <!-- TMPL_IF NAME="date" -->
247                 <td>
248                     <input type="text" size="10" id="<!-- TMPL_VAR NAME="name" -->_value" name="<!-- TMPL_VAR NAME="name" -->_value" value="" />
249                     <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfrom<!-- TMPL_VAR NAME="name" -->" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
250                     <script type="text/javascript">   
251                         Calendar.setup({  
252                         inputField     : "<!-- TMPL_VAR NAME="name" -->_value",
253                         ifFormat       : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
254                         button         : "buttonfrom<!-- TMPL_VAR NAME="name" -->",
255                         align          : "Tl" 
256                         });     
257                     </script>          
258                 </td>
259             </tr>
260             <!-- TMPL_ELSE -->
261                 <!-- TMPL_IF NAME="textrange" -->
262                     <td>from
263                         <input type="text" size="10" id="<!-- TMPL_VAR NAME="from" -->_value" name="<!-- TMPL_VAR NAME="from" -->_value" value="" /> to 
264                         <input type="text" size="10" id="<!-- TMPL_VAR NAME="to" -->_value" name="<!-- TMPL_VAR NAME="to" -->_value" value="" />
265                     </td>
266                     </tr>
267                 <!-- TMPL_ELSE -->
268                     <!-- TMPL_IF NAME="daterange" -->
269                     <td>from 
270                         <input type="text" size="10" id="from_<!-- TMPL_VAR NAME="name" -->_value" name="from_<!-- TMPL_VAR NAME="name" -->_value" value="" />
271                         <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfromfrom_<!-- TMPL_VAR NAME="name" -->" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
272                         <script type="text/javascript">   
273                             Calendar.setup({  
274                             inputField     : "from_<!-- TMPL_VAR NAME="name" -->_value",
275                             ifFormat       : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
276                             button         : "buttonfromfrom_<!-- TMPL_VAR NAME="name" -->",
277                             align          : "Tl" 
278                             });     
279                         </script>         
280                         to
281                         <input type="text" size="10" id="to_<!-- TMPL_VAR NAME="name" -->_value" name="to_<!-- TMPL_VAR NAME="name" -->_value" value="" />
282                         <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfromto_<!-- TMPL_VAR NAME="name" -->" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
283                         <script type="text/javascript">   
284                             Calendar.setup({  
285                             inputField     : "to_<!-- TMPL_VAR NAME="name" -->_value",
286                             ifFormat       : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
287                             button         : "buttonfromto_<!-- TMPL_VAR NAME="name" -->",
288                             align          : "Tl" 
289                             });     
290                         </script>        
291                     </td>
292                 </tr>
293                     <!-- TMPL_ELSE -->
294                         <td>
295                             <select name="<!-- TMPL_VAR NAME="name" -->_value">
296                                 <!-- TMPL_LOOP NAME="values" -->
297                                 <option value="<!-- TMPL_VAR NAME="availablevalues"-->"><!-- TMPL_VAR NAME="availablevalues" --></option>
298                                 <!-- /TMPL_LOOP -->
299                             </select>
300                        </td>
301                        </tr>
302                     <!-- /TMPL_IF -->
303                 <!-- /TMPL_IF -->
304             <!-- /TMPL_IF -->
305         <!-- /TMPL_LOOP -->
306         </table>
307     </fieldset>
308
309 <!-- TMPL_IF NAME="definitions" -->
310 <fieldset><legend>Dictionary Definitions</legend><table>
311 <!-- TMPL_LOOP NAME="definitions" -->
312        <tr><td><input type="checkbox" name="definition" value="<!--
313 TMPL_VAR NAME="id" -->" /> <!-- TMPL_VAR NAME="name" --></td></tr>
314 <!-- /TMPL_LOOP -->
315 </table>
316 <!-- /TMPL_IF -->
317
318 <fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
319     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
320     <input type="submit" name="submit" value="Next &gt;&gt;" /> </fieldset>
321 </form>
322 <!-- /TMPL_IF -->
323
324
325 <!-- TMPL_IF NAME="build5" -->
326 <h3>Step 5 of 6: Pick which columns to total</h3>
327 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
328 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
329 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
330 <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->" />
331 <input type="hidden" name="definition" value="<!-- TMPL_VAR NAME="definition" -->" />
332 <input type="hidden" name="criteria" value="<!-- TMPL_VAR NAME="criteriastring" -->" />
333 <fieldset><table>
334 <!-- TMPL_LOOP NAME="total_by" -->
335 <tr><td><input type="checkbox" name="total_by" id="<!-- TMPL_VAR
336 NAME="name" -->" value="<!-- TMPL_VAR
337 NAME="name" -->" /> <label for="<!-- TMPL_VAR
338 NAME="name" -->"><!-- TMPL_VAR NAME="name" --></label></td>
339 <td><select name="<!-- TMPL_VAR NAME="name" -->_tvalue">
340
341 <!-- TMPL_LOOP NAME="select" -->
342 <option value="<!-- TMPL_VAR NAME="value"-->"><!-- TMPL_VAR NAME="value" --></option>
343 <!-- /TMPL_LOOP -->
344 </select>
345
346 </td></tr>
347 <!-- /TMPL_LOOP -->
348 </table></fieldset>
349
350 <fieldset class="action"><input type="hidden" name="phase" value="Choose These Operations" />
351     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
352     <input type="submit" name="submit" value="Next &gt;&gt;" /></fieldset>
353 </form>
354 <!-- /TMPL_IF -->
355
356
357 <!-- TMPL_IF NAME="build6" -->
358 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
359 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
360 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
361 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
362 <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->" />
363 <input type="hidden" name="criteria" value="<!-- TMPL_VAR NAME="criteriastring" -->" />
364 <input type="hidden" name="definition" value="<!-- TMPL_VAR NAME="definition" -->" />
365 <input type="hidden" name="totals" value="<!-- TMPL_VAR NAME="totals" -->" />
366 <fieldset><table><!-- TMPL_LOOP NAME="order_by" -->
367 <tr><td><input type="checkbox" id="<!-- TMPL_VAR
368 NAME="name" -->" name="order_by" value="<!-- TMPL_VAR
369 NAME="name" -->" /> <label for="<!-- TMPL_VAR
370 NAME="name" -->"><!-- TMPL_VAR NAME="name"--></label></td><td>
371 <select name="<!-- TMPL_VAR NAME="name" -->_ovalue">
372
373 <!-- TMPL_LOOP NAME="select" -->
374 <option value="<!-- TMPL_VAR NAME="value"-->"><!-- TMPL_VAR NAME="value" --></option>
375 <!-- /TMPL_LOOP -->
376 </select>
377 </td></tr>
378
379 <!-- /TMPL_LOOP -->
380 </table></fieldset>
381
382 <fieldset class="action">
383 <input type="hidden" name="phase" value="Build Report" />
384 <input type="submit" name="submit" value="Finish" /></fieldset>
385 </form>
386 <!-- /TMPL_IF -->
387
388
389 <!-- TMPL_IF NAME="showreport" -->
390 <h1>Confirm Custom Report</h1>
391 <p>Your report will be generated with the following SQL statement.</p>
392 <p> 
393 <!-- TMPL_VAR NAME="sql" -->
394 </p>
395
396 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
397 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" ESCAPE="html" -->" />
398 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
399 <p>You will need to save the report before you can execute it</p>
400 <fieldset class="action"><input type="hidden" name="phase" value="Save" />  
401 <input type="submit" name="submit" value="Save" />  </fieldset>
402 </form>
403 <!-- /TMPL_IF -->
404
405 <!-- TMPL_IF NAME="save" -->
406 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
407 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" ESCAPE="html" -->" />
408 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
409 <fieldset class="rows">
410 <legend>Save Your Custom Report</legend>
411 <ol>
412         <li><label for="reportname">Report Name: </label><input type="text" id="reportname" name="reportname" /></li>
413         <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
414 </ol></fieldset>
415 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
416 <input type="submit" name="submit" value="Save Report" /></fieldset>
417 </form>
418 <!-- /TMPL_IF -->
419
420 <!-- TMPL_IF NAME="execute" -->
421 <h1><!-- TMPL_VAR NAME="name" --></h1>
422 <!-- TMPL_IF NAME="notes" --><p><!-- TMPL_VAR NAME="notes" --></p><!-- /TMPL_IF -->
423 <!-- TMPL_IF NAME="unlimited_total" --><p>Total number of rows matching the (unlimited) query is <!-- TMPL_VAR NAME="unlimited_total" -->.</p><!-- /TMPL_IF -->
424 <!-- TMPL_VAR NAME='pagination_bar' DEFAULT="" -->
425 <!-- TMPL_UNLESS name="errors" -->
426 <table>
427 <tr><!-- TMPL_LOOP NAME="header_row" --><th><!-- TMPL_VAR NAME="cell" --></th><!-- /TMPL_LOOP --></tr>
428 <!-- TMPL_LOOP NAME="results" -->
429 <tr>
430     <!-- TMPL_LOOP NAME="cells" --><td><!-- TMPL_VAR NAME="cell" --></td><!-- /TMPL_LOOP -->
431 </tr>
432 <!-- /TMPL_LOOP -->
433 </table>
434 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
435 <fieldset class="action">
436 <label for="format">Download the report: </label>
437 <select name="format" id="format">
438 <option value="csv">Comma Separated Text</option>
439 <option value="tab">Tab Separated Text</option>
440 </select>
441 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" ESCAPE="html" -->" />
442 <input type="hidden" name="phase" value="Export" />
443 <input type="submit" name="submit" value="Download" /></fieldset>
444 </form>
445 <!-- /TMPL_UNLESS -->
446 <!-- /TMPL_IF -->
447
448 <!-- TMPL_IF NAME="create" -->
449 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
450 <fieldset class="rows">
451 <legend>Create Report From SQL</legend>
452 <ol>
453         <li><label for="reportname">Report Name:</label> <input type="text" id="reportname" name="reportname" <!-- TMPL_IF NAME="reportname" --> value="<!-- TMPL_VAR NAME="reportname" -->"<!-- /TMPL_IF --> /> </li>
454         <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2"><!-- TMPL_VAR NAME="notes" DEFAULT="" --></textarea></li>
455         <li><label for="types">Type:</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>
462         <li><label for="sql">SQL: </label><textarea  id="sql" name="sql" cols="50" rows="10"><!-- TMPL_VAR NAME="sql" DEFAULT="" --></textarea></li>
463 </ol>
464 </fieldset>
465
466 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
467 <input type="submit" name="submit" value="Save Report" /></fieldset>
468 </form>
469 <!-- /TMPL_IF -->
470
471 <!-- TMPL_IF NAME="compound" -->
472 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
473 Master: <select name="master">
474 <!-- TMPL_LOOP NAME="savedreports" -->
475 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="report_name"--></option>
476 <!-- /TMPL_LOOP -->
477 </select>
478  &nbsp;
479 Sub report:<select name="subreport">
480 <!-- TMPL_LOOP NAME="savedreports" -->
481 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="report_name"--></option>
482 <!-- /TMPL_LOOP -->
483 </select>
484 <br />
485 <input type="hidden" name="phase" value="Save Compound" />
486 <input type="submit" name="submit" value="Save Compound" />
487 </form>
488 <!-- /TMPL_IF -->
489
490 <!-- TMPL_IF NAME="save_compound" -->
491 <!-- TMPL_VAR NAME="master" --> <br />
492 <!-- TMPL_VAR NAME="subsql" -->
493 <!-- /TMPL_IF -->
494
495
496 <!-- TMPL_IF NAME="retresults" -->
497 <h1>Saved Report Results</h1>
498 <h2><!-- TMPL_VAR NAME="name" --></h2>
499 <p><!-- TMPL_VAR NAME="notes" --></p>
500 <table>
501 <!-- TMPL_LOOP NAME="results" -->
502 <!-- TMPL_VAR NAME="row" -->
503 <!-- /TMPL_LOOP -->
504 </table>
505 <!-- /TMPL_IF -->
506
507 <!-- TMPL_IF NAME="showsql" -->
508 <textarea id="sql"><!-- TMPL_VAR NAME="sql" --></textarea>
509 <!-- /TMPL_IF -->
510
511 <!-- TMPL_IF NAME="editsql" -->
512 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
513 <input type="hidden" name="phase" value="Update SQL" />
514 <input type="hidden" name="id" value="<!-- TMPL_VAR NAME="id" -->"/>
515 <fieldset class="rows">
516 <legend>Edit SQL</legend>
517 <ol>
518 <li><label for="reportname">Report Name:</label><input type="text" id="reportname" name="reportname" value="<!-- TMPL_VAR NAME="reportname" -->" /></li>
519 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2"><!-- TMPL_VAR NAME="notes" --></textarea></li>
520 <li><textarea id="sql" name="sql" rows="10" cols="60"><!-- TMPL_VAR NAME="sql" --></textarea></li>
521 </ol>
522 </fieldset>
523
524 <fieldset class="action">
525 <input type="submit" name="submit" value="Update SQL" /></fieldset>
526 </form>
527
528
529 <!-- /TMPL_IF -->
530
531 <!-- TMPL_IF NAME="save_successful" -->
532 <!-- TMPL_UNLESS NAME="errors" -->
533 <h2>Your report has been saved</h2>
534 <p>The report you have created has now been saved. You can now</p>
535 <ul>
536         <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports Page</a></li>
537         <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler Tool</a></li>
538         <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided Reports</a></li>
539 </ul>
540 <!-- /TMPL_UNLESS -->
541 <!-- /TMPL_IF -->
542
543 <!-- TMPL_IF NAME="errors" -->
544 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
545 <div class="dialog alert">
546 <b>The following error was encountered:</b><br />
547 <!-- TMPL_LOOP name="errors" -->
548     <!-- TMPL_IF NAME="sqlerr" -->This report contains the SQL keyword <b><!-- TMPL_VAR name="sqlerr" --></b>.
549     <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
550     <br />Please return to the &quot;Saved Reports&quot; screen and delete this report or retry creating a new one.
551     <!-- TMPL_ELSIF NAME="queryerr" -->The database returned the following error: <br /><!-- TMPL_VAR NAME="queryerr" --><br />Please check the log for further details.
552     <!-- TMPL_ELSE -->
553     <!-- /TMPL_IF -->
554 <!-- /TMPL_LOOP -->
555 </div>
556 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
557 <input type="submit" name="submit" value="Saved Reports" /></fieldset>
558 </form>
559 <!-- /TMPL_IF -->
560
561 </div>
562 </div>
563 </div>
564 <div class="yui-b">
565 <!-- TMPL_INCLUDE NAME="guided-reports-view.inc" -->
566 </div>
567 </div>
568 <script type="text/javascript">
569 //<![CDATA[
570 function addColumn() {
571     $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
572 }
573 function delColumn() {
574     $("#selectedColumns option:selected").remove();
575 }
576 $("#column_submit").submit(function() {
577     if ($("#selectedColumns option").size() < 1) {
578         alert(_("No columns selected!"));
579         return false;
580     }
581     $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
582     return true;
583 });
584 //]]>
585 </script>
586 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->