Bug 14423: Multiple XSS bugs in suggestion.pl
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / suggestion.tt
1 [% USE Branches %]
2 [% USE AuthorisedValues %]
3 [% USE KohaDates %]
4 [% USE Price %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Acquisitions  &rsaquo;
7     [% IF ( op_save ) %]
8         [% IF ( suggestionid ) %]
9             Suggestions &rsaquo;  Edit suggestion #[% suggestionid %]
10         [% ELSE %]
11             Suggestions &rsaquo; Add suggestion
12         [% END %]
13     [% ELSIF ( op == 'show' ) %]
14            Suggestions &rsaquo; Show suggestion #[% suggestionid %]
15     [% ELSE %]
16         Suggestions management
17     [% END %]
18 </title>
19 [% INCLUDE 'doc-head-close.inc' %]
20 [% INCLUDE 'calendar.inc' %]
21 [% IF ( op == 'show' ) %]
22 <script type="text/javascript">
23     // <![CDATA[
24     $(document).ready(function(){
25         $("#deletesuggestion").on("click",function(){
26             return confirm(_("Are you sure you want to delete this suggestion?"));
27         });
28     });
29     // ]]>
30 </script>
31 [% END %]
32 [% IF ( op_else ) %]
33 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
34 [% INCLUDE 'datatables.inc' %]
35 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
36 <script type="text/javascript">
37 // <![CDATA[
38 /**
39 *  displayOther.
40 *  This function display the select or an textaera to write a reason.
41 */
42 function displayOther(id,show,hide){
43         $("#"+hide+id).hide();
44         $("#"+show+id).show();
45 }
46 $(document).ready(function() {
47     $('#suggestiontabs').tabs({
48         // Correct table sizing for tables hidden in tabs
49         // http://www.datatables.net/examples/api/tabs_and_scrolling.html
50         "activate": function(event, ui) {
51             $( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust();
52         }
53     });
54     $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
55         "aoColumnDefs": [
56             { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
57             { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
58         ],
59         "sPaginationType": "four_button"
60     }));
61 [% FOREACH suggestion IN suggestions %]
62 // functions for [% suggestion.suggestiontype %] interactions
63     $("#CheckAll[% suggestion.suggestiontype %]").click(function(e){
64                 $("#[% suggestion.suggestiontype %]t").checkCheckboxes();
65         e.preventDefault();
66     });
67     $("#UncheckAll[% suggestion.suggestiontype %]").click(function(e){
68                 $("#[% suggestion.suggestiontype %]t").unCheckCheckboxes();
69         e.preventDefault();
70         });
71         $("#other_reason[% suggestion.suggestiontype %]").hide();
72     $("#reason[% suggestion.suggestiontype %]").change(function(){
73             if($(this).val() == "other"){
74                         $(this).hide();
75                         $("#other_reason[% suggestion.suggestiontype %]").show();
76     }
77     });
78         $("#[% suggestion.suggestiontype %]delete").change(function(){
79                 if(this.checked){
80                         $("form[name='f[% suggestion.suggestiontype %]'] input[name=op]").attr("value","delete");
81                 } else {
82                         $("form[name='f[% suggestion.suggestiontype %]'] input[name=op]").attr("value","change");
83                 }
84         });
85
86 [% END %]
87     $("a[href*=back]").click(function(){
88     var sid = $(this).attr("href").replace(/#back/,"");
89             $("#reason"+sid).show().find("option[value='']").attr("selected","selected");
90                 $("#other_reason"+sid).hide();
91     });
92     $("h4.local_collapse a").click(function(){
93         $(this).parent().parent().find("ol").toggle();
94         return false;
95     });
96     // http://jqueryui.com/demos/datepicker/#date-range
97     var dates = $( "#suggesteddate_from, #suggesteddate_to" ).datepicker({
98         changeMonth: true,
99         numberOfMonths: 1,
100         onSelect: function( selectedDate ) {
101             var option = this.id == "suggesteddate_from" ? "minDate" : "maxDate",
102                 instance = $( this ).data( "datepicker" );
103                 date = $.datepicker.parseDate(
104                     instance.settings.dateFormat ||
105                     $.datepicker._defaults.dateFormat,
106                     selectedDate, instance.settings );
107             dates.not( this ).datepicker( "option", option, date );
108         }
109     });
110     var datesMD = $( "#manageddate_from, #manageddate_to" ).datepicker({
111         changeMonth: true,
112         numberOfMonths: 1,
113         onSelect: function( selectedDate ) {
114             var option = this.id == "manageddate_from" ? "minDate" : "maxDate",
115                 instance = $( this ).data( "datepicker" );
116                 date = $.datepicker.parseDate(
117                     instance.settings.dateFormat ||
118                     $.datepicker._defaults.dateFormat,
119                     selectedDate, instance.settings );
120             datesMD.not( this ).datepicker( "option", option, date );
121         }
122     });
123     var datesAD = $( "#accepteddate_from, #accepteddate_to" ).datepicker({
124         changeMonth: true,
125         numberOfMonths: 1,
126         onSelect: function( selectedDate ) {
127             var option = this.id == "accepteddate_from" ? "minDate" : "maxDate",
128                 instance = $( this ).data( "datepicker" );
129                 date = $.datepicker.parseDate(
130                     instance.settings.dateFormat ||
131                     $.datepicker._defaults.dateFormat,
132                     selectedDate, instance.settings );
133             datesAD.not( this ).datepicker( "option", option, date );
134         }
135     });
136
137     $("form.update_suggestions").on("submit", function(e){
138         var form = this;
139         var action_delete_selected = $(this).find("input[value='delete']").is(":checked");
140         if ( action_delete_selected ) {
141             var suggestions_to_delete = $(this).find("input[name='edit_field']:checked");
142             if ( suggestions_to_delete.length == 0 ) {
143                 alert(_("Please select at least one suggestion to delete"));
144                 e.preventDefault();
145                 return false;
146             } else if ( suggestions_to_delete.length == 1 ) {
147                 if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
148                     e.preventDefault();
149                     return false;
150                 }
151             } else if ( suggestions_to_delete.length > 1 ) {
152                 if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
153                     e.preventDefault();
154                     return false;
155                 }
156             }
157         }
158         return true;
159     });
160 });
161 // ]]>
162 </script>
163 <style type="text/css">
164 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { display : none; }
165 .overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding: .5em; color: #000; } .note { -moz-border-radius: 3px; border-radius:3px; background: transparent url("[% interface %]/[% theme %]/img/famfamfam/silk/comment.png") top left no-repeat; padding : 1px 3px 1px 18px; font-size : 90%; }
166 </style>[% END %]
167 [% IF ( op_save )  %]
168     <script type="text/javascript">
169         // <![CDATA[
170         $(document).ready(function() { calcNewsuggTotal(); });
171         // ]]>
172     </script>
173 [% END %]
174 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
175 </head>
176 <body id="acq_suggestion" class="acq">
177 [% INCLUDE 'header.inc' %]
178 [% INCLUDE 'cat-search.inc' %]
179 <div id="breadcrumbs">
180     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
181     [% IF ( op_save ) %]
182         [% IF ( suggestionid ) %]
183             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo;  Edit suggestion #[% suggestionid %]
184         [% ELSE %]
185             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Add suggestion
186         [% END %]
187     [% ELSIF ( op == 'show' ) %]
188            <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Show suggestion #[% suggestionid %]
189     [% ELSE %]
190         Suggestions management
191     [% END %]
192 </div>
193
194 [% IF ( op == 'show' ) %]
195 <div id="doc" class="yui-t7"> <!-- <div id="doc3" class="yui-t2"> -->
196 <div id="bd">
197     <div id="yui-main">
198     <div class="yui-b">
199
200     <div id="toolbar" class="btn-toolbar">
201         <a class="btn btn-small" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid %]"><i class="icon-pencil"></i> Edit</a>
202         <a class="btn btn-small" id="deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestionid %]"><i class="icon-remove"></i> Delete</a>
203     </div>
204
205     <fieldset class="rows">
206       <legend>Bibliographic information</legend>
207       <ol>
208         <li><span class="label">Title:</span>[% title |html %]</li>
209         <li><span class="label">Author:</span>[% author |html %]</li>
210         <li><span class="label">Copyright date:</span>[% copyrightdate |html %]</li>
211         <li><span class="label">ISBN or ISSN or other standard number:</span>[% isbn |html %]</li>
212         <li><span class="label">Publisher:</span>[% publishercode |html %]</li>
213         <li><span class="label">Publication place:</span>[% place |html %]</li>
214         <li><span class="label">Collection title:</span>[% collectiontitle |html %]</li>
215         <li><span class="label">Document type:</span>
216             [% FOREACH itemtypeloo IN itemtypeloop %]
217                 [% IF ( itemtypeloo.selected ) %][% itemtypeloo.description %][% END %]
218             [% END %]
219         </li>
220         [% IF ( patron_reason_loop ) %]
221           <li><span class="label">Reason for suggestion: </span>
222             [% FOREACH patron_reason_loo IN patron_reason_loop %]
223               [% IF ( patron_reason_loo.selected ) %][% patron_reason_loo.lib %][% END %]
224             [% END %]
225           </li>
226         [% END %]
227         <li><span class="label">Notes:</span>[% note |html %]</li>
228       </ol>
229     </fieldset>
230     <fieldset class="rows"> <legend>Suggestion management</legend>
231       <ol>
232         <li>
233           <span class="label">Status:</span>
234           [% SET status_found = 0 %]
235           [% IF ( STATUS == 'ASKED' ) %]
236               Pending
237               [% SET status_found = 1 %]
238           [% ELSIF ( STATUS == 'ACCEPTED' ) %]
239               Accepted
240               [% SET status_found = 1 %]
241           [% ELSIF ( STATUS == 'CHECKED' ) %]
242               Checked
243               [% SET status_found = 1 %]
244           [% ELSIF ( STATUS == 'REJECTED' ) %]
245               Rejected
246               [% SET status_found = 1 %]
247           [% ELSE %]
248               [% FOREACH s IN SuggestionStatuses %]
249                   [% IF STATUS == s.authorised_value %]
250                       [% s.lib %]
251                       [% SET status_found = 1 %]
252                   [% END %]
253               [% END %]
254           [% END %]
255
256         </li>
257         <li>
258           <table>
259             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
260             <tbody>
261             <tr>
262                 <th><span class="label">Suggestion creation</span> </th>
263                 <td>[% suggesteddate | $KohaDates %]</td>
264                 <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %]
265                 </td>
266             </tr>
267             <tr>
268                 <th><span class="label">Suggestion management</span> </th>
269                 <td>[% manageddate | $KohaDates %]</td>
270                 <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td>
271             </tr>
272             <tr>
273                 <th><span class="label">Suggestion accepted</span> </th>
274                 <td>[% accepteddate | $KohaDates %]</td>
275                 <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td>
276             </tr>
277             </tbody>
278         </table></li></ol>
279     </fieldset>
280     <fieldset class="rows"> <legend>Acquisition information</legend>
281       <ol>
282         <li>
283           <span class="label">Library:</span> [% branchname %]
284         </li>
285         <li>
286           <span class="label">Fund:</span> [% budgetname %]
287         </li>
288         <li>
289           <span class="label">Copies:</span>[% quantity %]
290         </li>
291         <li>
292           <span class="label">Currency:</span>[% currency %]
293         </li>
294         <li>
295           <span class="label">Price:</span>[% price | $Price %]
296         </li>
297         <li>
298           <span class="label">Total</span>[% total | $Price %]
299         </li>
300       </ol>
301     </fieldset>
302
303     <fieldset class="action">
304         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
305     </fieldset>
306
307     </div>
308     </div>
309 </div>
310 [% ELSE %]
311
312 [% IF ( op_save ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
313 <div id="bd">
314     <div id="yui-main">
315     <div class="yui-b">
316 [% IF ( op_save ) %]
317     <form id="add_edit" action="suggestion.pl" method="post" class="validated">
318     <input type="hidden" name="redirect" id="redirect" value="[% redirect %]" />
319     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
320     [% IF ( suggestionid ) %]
321         <h1>Edit purchase suggestion #[% suggestionid %]</h1>
322         <input type="hidden" name="suggestionid" value="[% suggestionid %]"/>
323     [% ELSE %]
324         <h1>Enter a new purchase suggestion</h1>
325     [% END %]
326     <fieldset class="rows"> <legend>Bibliographic information</legend><ol>
327         <li>
328             <label for="title" class="required">Title:</label>
329             <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title |html %]" required="required" class="required" />
330             <span class="required">Required</span>
331         </li>
332         <li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]"/></li>
333         <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" /></li>
334         <li><label for="isbn">ISBN or ISSN or other standard number:</label><input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% isbn | html %]"/></li>
335         <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]"/></li>
336         <li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]"/></li>
337         <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]"/></li>
338         <li><label for="itemtype">Document type:</label>
339             <select id="itemtype" name="itemtype" >
340             [% FOREACH itemtypeloo IN itemtypeloop %]
341                 [% IF ( itemtypeloo.selected ) %]<option selected="selected" value="[% itemtypeloo.itemtype %]">[% ELSE %]<option value="[% itemtypeloo.itemtype %]">[% END %]
342                 [% itemtypeloo.description %]</option>
343             [% END %]
344             </select>
345         </li>
346         [% IF ( patron_reason_loop ) %]<li><label for="patronreason">Reason for suggestion: </label><select name="patronreason" id="patronreason"><option value=""> -- Choose -- </option>[% FOREACH patron_reason_loo IN patron_reason_loop %]
347                 [% IF ( patron_reason_loo.selected ) %]<option value="[% patron_reason_loo.authorised_value %]" selected="selected">[% patron_reason_loo.lib %]</option>[% ELSE %]<option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>[% END %]
348            [% END %]</select></li>[% END %]
349         <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note %]</textarea></li>
350         </ol>
351     </fieldset>
352     <fieldset class="rows"> <legend>Suggestion management</legend>
353        <ol>
354             [% IF ( suggestionid ) %]
355                 <li>
356                     <label for="STATUS">Status:</label>
357                     <select id="STATUS" name="STATUS">
358                         <option value="">No Status</option>
359
360                         [% IF (statusselected_ASKED ) %]
361                             <option value="ASKED" selected="selected">Pending</option>
362                         [% ELSE %]
363                             <option value="ASKED">Pending</option>
364                         [% END %]
365
366                         [% IF (statusselected_ACCEPTED ) %]
367                             <option value="ACCEPTED" selected="selected">Accepted</option>
368                         [% ELSE %]
369                             <option value="ACCEPTED">Accepted</option>
370                         [% END %]
371
372                         [% IF (statusselected_CHECKED ) %]
373                             <option value="CHECKED" selected="selected">Checked</option>
374                         [% ELSE %]
375                             <option value="CHECKED">Checked</option>
376                         [% END %]
377
378                         [% IF ( statusselected_REJECTED ) %]
379                             <option value="REJECTED" selected="selected">Rejected</option>
380                         [% ELSE %]
381                             <option value="REJECTED">Rejected</option>
382                         [% END %]
383
384                         [% FOREACH s IN SuggestionStatuses %]
385                             [% IF s.authorised_value == selected_status %]
386                                 <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
387                             [% ELSE %]
388                                 <option value="[% s.authorised_value %]">[% s.lib %]</option>
389                             [% END %]
390                         [% END %]
391                     </select>
392                 </li>
393             [% END %]
394         <li><table>
395             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
396             <tbody>
397             <tr>
398                 <th><label for="suggesteddate">Suggestion creation</label> </th>
399                 <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/></td>
400                 <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %]
401                 </td>
402             </tr>
403             <tr>
404                 <th><label for="managedon">Suggestion management</label> </th>
405                 <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" /></td>
406                 <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td>
407             </tr>
408             <tr>
409                 <th><label for="accepteddate">Suggestion accepted</label> </th>
410                 <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" /></td>
411                 <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td>
412             </tr>
413             </tbody>
414         </table></li></ol>
415     </fieldset>
416     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
417         <li><label for="branchcode">Library:</label>
418             <select name="branchcode" id="branchcode">
419                 <option value="">Any</option>[% FOREACH branchloo IN branchloop %]
420                 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %][% END %]
421             </select>
422         </li>
423         <li><label for="budgetid">Fund:</label>
424             <select name="budgetid" id="budgetid">
425                 <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
426                 [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id %]" selected="selected">[% budgetsloo.budget_name %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id %]">[% budgetsloo.budget_name %]</option>[% END %][% END %]
427             </select>
428                 </li><li><label for="quantity">Copies:</label>
429                         <input type="text" size="10" id="quantity" name="quantity" value="[% quantity %]" onchange="calcNewsuggTotal();" />
430                 </li><li><label for="currency">Currency:</label>
431                         [% FOREACH loop_currenc IN loop_currency %]
432                     <input type="hidden" value="[% loop_currenc.rate %]" id="currency_rate_[% loop_currenc.currcode %]" name="currency_rate_[% loop_currenc.currcode %]" />
433                             <input type="hidden" id="[% loop_currenc.currcode %]" name="[% loop_currenc.currcode %]" value="[% loop_currenc.rate %]" />
434                         [% END %]
435             <select name="currency" id="currency" onchange="calcNewsuggTotal();">
436                 [% FOREACH loop_currenc IN loop_currency %]
437                 [% IF ( loop_currenc.selected ) %]<option value="[% loop_currenc.currcode %]" selected="selected">[% loop_currenc.currcode %]</option>[% ELSE %]<option value="[% loop_currenc.currcode %]">[% loop_currenc.currcode %]</option>[% END %][% END %]
438             </select>
439                 </li><li><label for="price">Price:</label>
440                         <input type="text" size="20" name="price" id="price" value="[% price %]" onchange="calcNewsuggTotal();" />
441                 </li><li><label for="total">Total: </label>
442                         <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total %]"/>
443                 </li></ol>
444     </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby %][% ELSE %]noone[% END %]"/>
445     <fieldset class="action"><input type="hidden" name="op" value="[% op %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit your suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %]
446     </fieldset>
447     </form>
448 [% END %]
449
450 [% IF ( op_else ) %]
451 <div id="toolbar" class="btn-toolbar">
452     <a class="btn btn-small" id="newsuggestion" href="suggestion.pl?op=add"><i class="icon-plus"></i> New purchase suggestion</a>
453 </div>
454
455 <h1>Suggestions management</h1>
456
457
458 [% FOR m IN messages %]
459     <div class="dialog [% m.type %]">
460         [% SWITCH m.code %]
461         [% CASE 'already_exists' %]
462             The suggestion has not been added. A suggestion with this title already exists (<a href='/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% m.id %]&op=show'>suggestion #[% m.id %]</a>)
463         [% CASE %]
464             [% m.code %]
465         [% END %]
466     </div>
467 [% END %]
468
469 [% UNLESS ( notabs ) %]
470     <div id="suggestiontabs" class="toptabs">
471     <ul class="ui-tabs-nav">
472         [% FOREACH suggestion IN suggestions %]
473                 <li>
474             <a href="#[% suggestion.suggestiontype %]">
475             [% IF ( suggestion.suggestiontypelabel ) %]
476                 [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
477                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
478                 [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked
479                 [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected
480                 [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available
481                 [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered
482                 [% ELSE %][% suggestion.suggestiontypelabel %][% END %]
483             [% ELSE %]
484                 [% IF ( suggestion.suggestiontype ) %]
485                     [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
486                 [% ELSE %]
487                     No name
488                 [% END %]
489             [% END %]
490             ([% suggestion.suggestions_loop.size %])</a></li>
491
492         [% END %]
493     </ul>
494 [% END %]
495
496 [% FOREACH suggestion IN suggestions %]
497 <div id="[% suggestion.suggestiontype %]">
498 <form class="update_suggestions" name="f[% suggestion.suggestiontype %]" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype %]">
499
500 [% IF ( suggestion.suggestions_loop ) %]
501 <p><a id="CheckAll[% suggestion.suggestiontype %]" href="#">Check all</a> | <a id="UncheckAll[% suggestion.suggestiontype %]" href="#">Uncheck all</a></p>
502     <table id="[% suggestion.suggestiontype %]t" class="sorted">
503         <thead>
504             <tr><th>&nbsp;</th>
505             <th>No.</th>
506             <th class="anti-the">Suggestion</th>
507             <th>Suggested by - on</th>
508             <th>Managed by - on</th>
509             <th>Library</th>
510             <th>Fund</th>
511             <th>Status</th></tr>
512     </thead>
513         <tbody>
514             [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
515             [% IF ( suggestions_loo.even ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
516                 <td>
517                     <input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid %]" />
518                 </td>
519                 <td>
520                     [% suggestions_loo.suggestionid %]
521                 </td>
522                 <td>
523                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&amp;op=show" title="suggestion" >
524                         [% suggestions_loo.title |html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author %][% END %]</a>
525                     [<a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&amp;op=edit" title="suggestion" >edit</a>]
526                     <br />
527                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate |html %] [% END %]
528                         [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc |html %]</i> [% END %]
529                         [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn |html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode |html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear |html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place |html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle |html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% suggestions_loo.itemtype |html %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<span class="note">[% suggestions_loo.note |html%]</span>[% END %]
530                 </td>
531                 <td>
532                     [% IF ( suggestions_loo.emailsuggestedby ) %]<a href="mailto:[% suggestions_loo.emailsuggestedby %]">[% END %][% suggestions_loo.surnamesuggestedby %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby %])[% END %] [% IF ( suggestions_loo.emailsuggestedby ) %]</a>[% END %]
533                     [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate | $KohaDates %][% END %]
534                 </td>
535                 <td>
536                     [% IF ( suggestions_loo.emailmanagedby ) %]<a href="mailto:[% suggestions_loo.emailmanagedby %]">[% END %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby %][% END %] [% IF ( suggestions_loo.emailmanagedby ) %]</a>[% END %]
537                     [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %]
538                 </td>
539                 <td>
540                     [% Branches.GetName( suggestions_loo.branchcode ) %]
541                 </td>
542                 <td>
543                     [% suggestions_loo.budget_name %]
544                 </td>
545                 <td>
546                     [% IF ( suggestions_loo.ASKED ) %]
547                         Pending
548                     [% ELSIF ( suggestions_loo.ACCEPTED ) %]
549                         Accepted
550                     [% ELSIF ( suggestions_loo.ORDERED ) %]
551                         Ordered
552                     [% ELSIF ( suggestions_loo.REJECTED ) %]
553                         Rejected
554                     [% ELSIF ( suggestions_loo.CHECKED ) %]
555                         Checked
556                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
557                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
558                     [% END %]
559
560                     [% IF ( suggestions_loo.reason ) %]
561                         <br />([% suggestions_loo.reason %])
562                     [% END %]
563                 </td>
564         </tr>
565         [% END %]</tbody>
566         </table>  <fieldset>
567     <div id="select-reason[% suggestion.suggestiontype %]">
568         <div id="status[% suggestion.suggestiontype %]">
569             <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label>
570             <select name="STATUS" id="STATUS[% suggestion.suggestiontype %]">
571                 <option value=""> -- Choose a status --</option>
572
573                 [% IF (statusselected_ASKED ) %]
574                     <option value="ASKED" selected="selected">Pending</option>
575                 [% ELSE %]
576                     <option value="ASKED">Pending</option>
577                 [% END %]
578
579                 [% IF (statusselected_ACCEPTED ) %]
580                     <option value="ACCEPTED" selected="selected">Accepted</option>
581                 [% ELSE %]
582                     <option value="ACCEPTED">Accepted</option>
583                 [% END %]
584
585                 [% IF (statusselected_CHECKED ) %]
586                     <option value="CHECKED" selected="selected">Checked</option>
587                 [% ELSE %]
588                     <option value="CHECKED">Checked</option>
589                 [% END %]
590
591                 [% IF ( statusselected_REJECTED ) %]
592                     <option value="REJECTED" selected="selected">Rejected</option>
593                 [% ELSE %]
594                     <option value="REJECTED">Rejected</option>
595                 [% END %]
596
597                 [% FOREACH s IN SuggestionStatuses %]
598                     <option value="[% s.authorised_value %]">[% s.lib %]</option>
599                 [% END %]
600             </select>
601
602             <label for="reason[% suggestion.suggestiontype %]">with this reason:</label>
603             <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]">
604                 <option value=""> -- Choose a reason -- </option>
605                 [% FOREACH reasonsloo IN suggestion.reasonsloop %]
606                     <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option>
607                 [% END %]
608                 <option value="other">Others...</option>
609             </select>
610
611             <span id="other_reason[% suggestion.suggestiontype %]">
612                 <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype %]" name="other_reason[% suggestion.suggestiontype %]" placeholder="please note your reason here..." />
613                 <a href="#back[% suggestion.suggestiontype %]">Cancel</a>
614             </span>
615
616             <strong style="padding: 0 1em;">OR:</strong>
617
618             <label for="[% suggestion.suggestiontype %]delete">Delete selected</label>
619             <input type="checkbox" name="op" id="[% suggestion.suggestiontype %]delete" />
620         </div>
621     </div>
622
623
624     <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype %]" />
625     <input type="hidden" name="op" value="change" />
626 </fieldset>
627         <fieldset class="action">
628     <input type="submit" value="Submit" /></fieldset>
629 </form>
630 [% ELSE %]
631     <b>No results.</b>
632 [% END %]
633 </div>
634 [% END %]
635     </div>
636 [% END %]
637 </div>
638 </div>
639
640       [% UNLESS ( op_save ) %] [% UNLESS ( op == 'show' ) %]<div class="yui-b">
641 <form name="suggestionfilter" action="suggestion.pl" method="get">
642 <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
643                 <select name="displayby" id="displayby" style="width:auto;">
644                     [% IF ( displayby == "STATUS" ) %]
645                         <option value="STATUS" selected="selected">Status</option>
646                     [% ELSE %]
647                         <option value="STATUS">Status</option>
648                     [% END %]
649                     [% IF ( displayby == "branchcode" ) %]
650                         <option value="branchcode" selected="selected">Library</option>
651                     [% ELSE %]
652                         <option value="branchcode">Library</option>
653                     [% END %]
654                     [% IF ( displayby == "itemtype" ) %]
655                         <option value="itemtype" selected="selected">Item type</option>
656                     [% ELSE %]
657                         <option value="itemtype">Item type</option>
658                     [% END %]
659                     [% IF ( displayby == "managedby" ) %]
660                         <option value="managedby" selected="selected">Managed by</option>
661                     [% ELSE %]
662                         <option value="managedby">Managed by</option>
663                     [% END %]
664                     [% IF ( displayby == "acceptedby" ) %]
665                         <option value="acceptedby" selected="selected">Accepted by</option>
666                     [% ELSE %]
667                         <option value="acceptedby">Accepted by</option>
668                     [% END %]
669                 </select> <input type="submit" value="Go" /></li></ol></fieldset>
670 <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
671                 <div style="display:block;" id="limits">
672
673                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
674                    <ol> <li><label for="title"> Title:</label><input type="text" id="title" name="title" value="[% title |html %]" /></li>
675                     <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author | html %]" /></li>
676                     <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" /></li>
677                     <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" /></li>
678                     <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" /></li>
679                     <li><label for="collectiontitle"> Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" /></li><li><input type="submit" value="Go" /></li></ol>
680                 </fieldset>
681                                  <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
682                     <ol>
683                       <li>
684                           <label for="STATUS"> Status:</label>
685                           <select name="STATUS" id="STATUS">
686                               <option value="">Any</option>
687
688                               [% IF (statusselected_ASKED ) %]
689                                   <option value="ASKED" selected="selected">Pending</option>
690                               [% ELSE %]
691                                   <option value="ASKED">Pending</option>
692                               [% END %]
693
694                               [% IF (statusselected_ACCEPTED ) %]
695                                   <option value="ACCEPTED" selected="selected">Accepted</option>
696                               [% ELSE %]
697                                   <option value="ACCEPTED">Accepted</option>
698                               [% END %]
699
700                               [% IF (statusselected_CHECKED ) %]
701                                   <option value="CHECKED" selected="selected">Checked</option>
702                               [% ELSE %]
703                                   <option value="CHECKED">Checked</option>
704                               [% END %]
705
706                               [% IF ( statusselected_REJECTED ) %]
707                                   <option value="REJECTED" selected="selected">Rejected</option>
708                               [% ELSE %]
709                                   <option value="REJECTED">Rejected</option>
710                               [% END %]
711
712                               [% FOREACH s IN SuggestionStatuses %]
713                                   [% IF s.authorised_value == selected_status %]
714                                       <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
715                                   [% ELSE %]
716                                       <option value="[% s.authorised_value %]">[% s.lib %]</option>
717                                   [% END %]
718                               [% END %]
719                           </select>
720                       </li>
721
722                     <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
723 [% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %]
724                                                                      </select></li>
725                     <li>
726                         <label for="suggesteddate_from">Suggested date from:</label>
727                         <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from %]" />
728                     </li>
729                     <li>
730                         <label for="suggesteddate_to">To:</label>
731                         <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to %]" />
732                     </li>
733                     <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
734 [% FOREACH managedby_loo IN managedby_loop %][% IF ( managedby_loo.selected ) %]<option value="[% managedby_loo.code %]" selected="selected">[% managedby_loo.desc %]</option>[% ELSE %]<option value="[% managedby_loo.code %]">[% managedby_loo.desc %]</option>[% END %][% END %]
735                                                                      </select></li>
736                     <li>
737                         <label for="manageddate_from">Management date from:</label>
738                         <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from %]" />
739                     </li>
740                     <li>
741                         <label for="manageddate_to">To:</label>
742                         <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to %]" />
743                     </li>
744                     <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
745 [% FOREACH acceptedby_loo IN acceptedby_loop %][% IF ( acceptedby_loo.selected ) %] <option value="[% acceptedby_loo.code %]" selected="selected">[% acceptedby_loo.desc %]</option>[% ELSE %]<option value="[% acceptedby_loo.code %]">[% acceptedby_loo.desc %]</option>[% END %][% END %]
746                                                       </select></li>
747                     <li>
748                         <label for="accepteddate_from">Accepted date from:</label>
749                         <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from %]" />
750                     </li>
751                     <li>
752                         <label for="accepteddate_to">To:</label>
753                         <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to %]" />
754                     </li>
755                     <li><input type="submit" value="Go" /></li></ol>
756                 </fieldset>
757
758                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
759                     <ol><li><label for="budgetid"> Book fund:</label>
760                     <select name="budgetid" id="budgetid">
761                       <option value="__ANY__">Any</option>
762                       [% IF budgetid == '__NONE__' %]
763                           <option value="__NONE__" selected="selected">None</option>
764                       [% ELSE %]
765                           <option value="__NONE__">None</option>
766                       [% END %]
767                     [% FOREACH budgetid_loo IN budgetid_loop %]
768                         [% IF ( budgetid_loo.selected ) %] <option value="[% budgetid_loo.code %]" selected="selected">[% budgetid_loo.desc %]</option>[% ELSE %]<option value="[% budgetid_loo.code %]">[% budgetid_loo.desc %]</option>[% END %]
769                         [% END %]
770                     </select></li>
771                     <li><label for="branchcode"> For:</label>
772                     <select name="branchcode" id="branchcode">
773                         <option value="__ANY__">Any</option>[% FOREACH branchloo IN branchloop %]
774                             [% IF ( branchloo.selected ) %] <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %] <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
775                             [% END %]
776                     </select></li><li><input type="submit" value="Go" /></li></ol>
777                 </fieldset>
778     </div>
779             </form>
780         </div>
781     [% END %]
782     [% END %]
783 </div>
784 [% END %]
785 [% INCLUDE 'intranet-bottom.inc' %]
786