Bug 22952: Markup error in OPAC suggestions template
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-suggestions.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE KohaDates %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
9 [% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
10 [% IF ( op_else ) %]Purchase Suggestions[% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% BLOCK cssinclude %][% END %]
13 </head>
14 [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-usersuggestions' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-suggestions' bodyclass='scrollto' %][% END %]
15 [% INCLUDE 'masthead.inc' %]
16
17     <div class="main">
18         <ul class="breadcrumb">
19             <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
20             <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
21             <li><a href="#">Your purchase suggestions</a></li>
22         </ul>
23
24         <div class="container-fluid">
25             <div class="row-fluid">
26                 <div class="span2">
27                     <div id="navigation">
28                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
29                     </div>
30                 </div>
31                 <div class="span10">
32                     <div id="usersuggestions" class="maincontent">
33                         [% IF ( op_add ) %]
34                             [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
35                                     <h1 class="TooManySuggestions">You cannot place any more suggestions</h1>
36                                     <h2 class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]). Once the library has processed those suggestions you will be able to place more.</h2>
37                             [% ELSE %]
38                             <h1>Enter a new purchase suggestion</h1>
39
40                             <p>Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion.</p>
41                             <p>Only certain fields (marked in red) are required, but the more information you enter the easier it will be for the librarians to find the title you're requesting. The "Notes" field can be used to provide any additional information.</p>
42
43                             <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
44                                 <fieldset class="rows">
45                                     <ol>
46                                         <li>
47                                             [% IF ( title_required ) %]
48                                                 <label for="title" class="required">Title:</label>
49                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" required="required" />
50                                                 <span class="required">Required</span>
51                                             [% ELSE %]
52                                                 <label for="title">Title:</label>
53                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" />
54                                             [% END %]
55                                         </li>
56                                         <li>
57                                             [% IF ( author_required ) %]
58                                                 <label for="author" class="required">Author:</label>
59                                                 <input type="text" id="author" name="author" class="span6" maxlength="80" required="required" />
60                                                 <span class="required">Required</span>
61                                             [% ELSE %]
62                                                 <label for="author">Author:</label>
63                                                 <input type="text" id="author" name="author" class="span6" maxlength="80" />
64                                             [% END %]
65                                         </li>
66                                         <li>
67                                             <div title="Copyright or publication year, for example: 2016">
68                                                 [% IF ( copyrightdate_required ) %]
69                                                     <label for="copyrightdate" class="required">Copyright date:</label>
70                                                     <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" required="required" />
71                                                 <span class="required">Required</span>
72                                                 [% ELSE %]
73                                                     <label for="copyrightdate">Copyright date:</label>
74                                                     <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" />
75                                                 [% END %]
76                                             </div>
77                                         </li>
78                                         <li>
79                                             [% IF ( isbn_required ) %]
80                                                 <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
81                                                 <input type="text" id="isbn" name="isbn"  maxlength="80" required="required" />
82                                                 <span class="required">Required</span>
83                                             [% ELSE %]
84                                                 <label for="isbn">Standard number (ISBN, ISSN or other):</label>
85                                                 <input type="text" id="isbn" name="isbn"  maxlength="80" />
86                                             [% END %]
87                                         </li>
88                                         <li>
89                                             [% IF ( publishercode_required ) %]
90                                                 <label for="publishercode" class="required">Publisher:</label>
91                                                 <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" required="required" />
92                                                 <span class="required">Required</span>
93                                             [% ELSE %]
94                                                 <label for="publishercode">Publisher:</label>
95                                                 <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" />
96                                             [% END %]
97                                         </li>
98                                         <li>
99                                             [% IF ( collectiontitle_required ) %]
100                                                 <label for="collectiontitle" class="required">Collection title:</label>
101                                                 <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" required="required" />
102                                                 <span class="required">Required</span>
103                                             [% ELSE %]
104                                                 <label for="collectiontitle">Collection title:</label>
105                                                 <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" />
106                                             [% END %]
107                                         </li>
108                                         <li>
109                                             [% IF ( place_required ) %]
110                                                 <label for="place" class="required">Publication place:</label>
111                                                 <input type="text" id="place" name="place" required="required" maxlength="80" />
112                                                 <span class="required">Required</span>
113                                             [% ELSE %]
114                                                 <label for="place">Publication place:</label>
115                                                 <input type="text" id="place" name="place"  maxlength="80" />
116                                             [% END %]
117                                         </li>
118                                         <li id="opac-suggestion-quantity">
119                                             [% IF ( quantity_required ) %]
120                                                 <label for="quantity" class="required">Quantity:</label>
121                                                 <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
122                                                 <span class="required">Required</span>
123                                             [% ELSE %]
124                                                 <label for="quantity">Quantity:</label>
125                                                 <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
126                                             [% END %]
127                                         </li>
128                                         <li>
129                                             [% IF ( itemtype_required ) %]
130                                                 <label for="itemtype" class="required">Item type:</label>
131                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
132                                                 <span class="required">Required</span>
133                                             [% ELSE %]
134                                                 <label for="itemtype">Item type:</label>
135                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
136                                             [% END %]
137                                         </li>
138                                         [% IF branchcode %]
139                                             <li>
140                                                 [% IF ( branchcode_required ) %]
141                                                     <label for="branch" class="required">Library:</label>
142                                                     <select name="branchcode" id="branch" required="required">
143                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
144                                                     </select>
145                                                     <span class="required">Required</span>
146                                                 [% ELSE %]
147                                                     <label for="branch">Library:</label>
148                                                     <select name="branchcode" id="branch">
149                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
150                                                     </select>
151                                                 [% END %]
152                                             </li>
153                                         [% END %]
154                                         [% IF ( patron_reason_loop ) %]
155                                             <li>
156                                                 [% IF ( patronreason_required ) %]
157                                                     <label for="patronreason" class="required">Reason for suggestion: </label>
158                                                     <select name="patronreason" id="patronreason" required="required">
159                                                         <option value="">-- Choose --</option>
160                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
161                                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
162                                                         [% END %]
163                                                     </select>
164                                                     <span class="required">Required</span>
165                                                 [% ELSE %]
166                                                     <label for="patronreason">Reason for suggestion: </label>
167                                                     <select name="patronreason" id="patronreason">
168                                                         <option value="">-- Choose --</option>
169                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
170                                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
171                                                         [% END %]
172                                                     </select>
173                                                 [% END %]
174                                             </li>
175                                         [% END %]
176                                         <li>
177                                             [% IF ( note_required ) %]
178                                                 <label for="note" class="required">Notes:</label>
179                                                 <textarea name="note" id="note" rows="5" cols="40" required="required"></textarea>
180                                                 <span class="required">Required</span>
181                                             [% ELSE %]
182                                                 <label for="note">Notes:</label>
183                                                 <textarea name="note" id="note" rows="5" cols="40"></textarea>
184                                             [% END %]
185                                         </li>
186
187                                         <!--  Add a hidden 'negcap' field -->
188                                         <li id="negcap" style="position: absolute; left: -2000px;">
189                                             negcap <input type="text" name="negcap"/>
190                                         </li>
191
192                                     </ol>
193                                 </fieldset>
194                                 <fieldset class="action">
195                                     <input type="hidden" name="suggested_by_anyone" value="[% suggested_by_anyone | html %]" />
196                                     <input type="hidden" name="op" value="add_confirm" />
197                                     <input type="submit" class="btn" value="Submit your suggestion" /> <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a>
198                                 </fieldset>
199                             </form>
200                             [% END %]
201                         [% END #  IF op_add %]
202
203                         [% IF ( op_else ) %]
204                             <h1>
205                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
206                                     Purchase suggestions
207                                 [% ELSE %]
208                                     [% IF ( loggedinusername ) %]
209                                         Your purchase suggestions
210                                     [% ELSE %]
211                                         Purchase suggestions
212                                     [% END %]
213                                 [% END %]
214                             </h1>
215                             [% FOR m IN messages %]
216                                 <div class="alert alert-[% m.type | html %]">
217                                     [% SWITCH m.code %]
218                                     [% CASE 'too_many' %]
219                                         The suggestion has not been added. You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]). Once the library has processed those suggestions you will be able to place more.
220                                     [% CASE 'already_exists' %]
221                                         The suggestion has not been added. A suggestion with this title already exists.
222                                     [% CASE 'success_on_inserted' %]
223                                         Your suggestion has been submitted.
224                                     [% CASE %]
225                                         [% m.code | html %]
226                                     [% END %]
227                                 </div>
228                             [% END %]
229
230                             [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %]
231
232                             [% IF ( suggestions_loop ) %]
233                                 <form action="/cgi-bin/koha/opac-suggestions.pl" class="form-inline" method="get">
234                                     <fieldset>
235                                         <label for="title">Search for:</label>
236                                         <input type="text" name="title" id="title" value="[% title | html %]" />
237                                         [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
238                                             [% IF loggedinusername %]
239                                                 <label for="suggested_by_anyone">Suggested by:</label>
240                                                 <div class="input-append">
241                                                     <select name="suggested_by_anyone" id="suggested_by_anyone">
242                                                         [% IF suggested_by_anyone %]
243                                                             <option value="0">Me</option>
244                                                             <option value="1" selected="selected">Anyone</option>
245                                                         [% ELSE %]
246                                                             <option value="0" selected="selected">Me</option>
247                                                             <option value="1">Anyone</option>
248                                                         [% END %]
249                                                     </select>
250                                                     <button type="submit" class="btn">Go</button>
251                                                 </div>
252                                             [% END %]
253                                         [% END %]
254                                     </fieldset>
255                                 </form>
256                                 <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="myform">
257                                     <input type="hidden" name="op" value="delete_confirm" />
258                                     [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
259                                         <div id="toolbar" class="toolbar clearfix">
260                                         [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
261                                                 <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]).</br>Once the library has processed those suggestions you will be able to place more.</p>
262                                         [% ELSE %]
263                                                 <a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>
264                                         [% END %]
265                                         </div>
266                                     [% END %]
267
268                                     [% IF ( loggedinusername ) %]
269                                         <div id="selections-toolbar" class="toolbar">
270                                             <span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
271                                             <span class="links">
272                                                 <span id="selections">Select suggestions to: </span>
273                                                 <span id="removeitems"></span>
274                                             </span>
275                                         </div>
276                                     [% END %]
277
278                                     <table id="suggestt" class="checkboxed table table-bordered table-striped">
279                                         <thead>
280                                             <tr>
281                                                 [% IF ( loggedinusername ) %]<th>&nbsp;</th>[% END %]
282                                                 <th>Summary</th>
283                                                 <th>Suggested on</th>
284                                                 <th>Note</th>
285                                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]<th>Suggested for</th>[% END %]
286                                                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]<th>Managed by</th>[% END %]
287                                                 <th>Status</th>
288                                             </tr>
289                                         </thead>
290                                         <tbody>
291                                             [% FOREACH suggestions_loo IN suggestions_loop %]
292                                                 <tr>
293                                                     [% IF ( loggedinusername ) %]
294                                                         <td>
295                                                             [% IF ( suggestions_loo.showcheckbox ) %]
296                                                                 <input type="checkbox" class="cb" name="delete_field" value="[% suggestions_loo.suggestionid | html %]" />
297                                                             [% END %]
298                                                         </td>
299                                                     [% END %]
300                                                     <td>
301                                                         <p><strong>[% suggestions_loo.title | html %]</strong></p>
302                                                             <p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author | html %],[% END %]
303                                                                 [% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate | html %],[% END %]
304                                                                 [% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode | html %][% END %]
305                                                                 [% IF ( suggestions_loo.place ) %]([% suggestions_loo.place | html %])[% END %]
306                                                                 [% IF ( suggestions_loo.collectiontitle ) %] , [% suggestions_loo.collectiontitle | html %][% END %]
307                                                                 [% IF ( suggestions_loo.itemtype ) %] - [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 1 ) | html %][% END %]
308                                                         </p>
309                                                     </td>
310                                                     <td>
311                                                         [% IF ( suggestions_loo.suggesteddate ) %][% suggestions_loo.suggesteddate |$KohaDates %][% END %]
312                                                     </td>
313                                                     <td>
314                                                         [% IF ( suggestions_loo.note ) %]
315                                                             <span class="tdlabel">Note: </span>
316                                                             [% suggestions_loo.note | html %]
317                                                         [% END %]
318                                                     </td>
319                                                     [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
320                                                         <td>
321                                                             [% IF ( suggestions_loo.branchcodesuggestedby ) %]
322                                                                 <span class="tdlabel">Suggested for:</span>
323                                                                 [% suggestions_loo.branchcodesuggestedby | html %]
324                                                             [% END %]
325                                                         </td>
326                                                     [% END %]
327                                                     [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]
328                                                     <td>
329                                                         [% IF ( suggestions_loo.surnamemanagedby ) %]
330                                                             <span class="tdlabel">Managed by:</span>
331                                                             [% suggestions_loo.surnamemanagedby | html %]
332                                                             [% IF ( suggestions_loo.firstnamemanagedby ) %]    , [% suggestions_loo.firstnamemanagedby | html %]
333                                                             [% END %]
334                                                         [% END %]
335                                                     </td>
336                                                     [% END %]
337                                                     <td>
338                                                         <span class="tdlabel">Status:</span>
339                                                         [% IF ( suggestions_loo.ASKED ) %]Requested
340                                                         [% ELSIF ( suggestions_loo.CHECKED ) %]Checked by the library
341                                                         [% ELSIF ( suggestions_loo.ACCEPTED ) %]Accepted by the library
342                                                         [% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library
343                                                         [% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined
344                                                         [% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library
345                                                         [% ELSE %] [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) | html %] [% END %]
346                                                         [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason | html %])[% END %]
347                                                     </td>
348                                                 </tr>
349                                             [% END # / FOREACH suggestions_loo %]
350                                         </tbody>
351                                     </table>
352
353                                     [% IF ( loggedinusername ) %]
354                                         <fieldset class="action">
355                                             <input type="submit" class="btn btn-danger" value="Delete selected" />
356                                         </fieldset>
357                                     [% END %]
358                                 </form>
359                             [% ELSE %]
360                                 [% UNLESS Koha.Preference( 'OPACViewOthersSuggestions' ) or loggedinusername %]
361                                     <p>You are not authorized to see pending purchase suggestions.</p>
362                                 [% ELSE %]
363                                     <p>There are no pending purchase suggestions.</p>
364                                 [% END %]
365                                 [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
366                                     [% IF ( Koha.Preference('MaxOpenSuggestions') != ''  && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
367                                         <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time.</br>Once the library has processed those suggestions you will be able to place more.</p>
368                                     [% ELSE %]
369                                         <p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>
370                                     [% END %]
371                                 [% END %]
372                             [% END # / IF suggestions_loop %]
373
374                         [% END # IF op_else %]
375                     </div> <!-- / #usersuggestions -->
376                 </div> <!-- / .span10 -->
377             </div> <!-- / .row-fluid -->
378         </div> <!-- / .container-fluid -->
379     </div> <!-- / .main -->
380
381 [% INCLUDE 'opac-bottom.inc' %]
382 [% BLOCK jsinclude %]
383 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
384 [% INCLUDE 'datatables.inc' %]
385 <script>
386     //<![CDATA[
387     [% IF ( loggedinusername ) %]
388         function enableCheckboxActions(){
389             // Enable/disable controls if checkboxes are checked
390             var checkedBoxes = $(".checkboxed input:checkbox:checked");
391             if ($(checkedBoxes).size()) {
392               $("#selections").html(_("With selected suggestions: "));
393               $("#selections-toolbar .links a").removeClass("disabled");
394             } else {
395               $("#selections").html(_("Select suggestions to: "));
396               $("#selections-toolbar .links a").addClass("disabled");
397             }
398         }
399     [% END %]
400
401     $(function() {
402         $("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, {
403             "order": [[ 1, "asc" ]],
404             "columnDefs": [
405               [% IF ( loggedinusername ) %]{ "targets": [ 0 ], "sortable": false, "searchable": false }[% END %]
406             ],
407             "columns": [
408                 [% IF ( loggedinusername ) %]null,[% END %]
409                 { "type": "anti-the" },
410                 null,
411                 null,
412                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]null,[% END %]
413                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %]
414                 null
415             ]
416         }));
417         [% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
418         $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
419         $("#CheckAll").click(function(){
420             $(".checkboxed").checkCheckboxes();
421             enableCheckboxActions();
422             return false;
423         });
424         $("#CheckNone").click(function(){
425             $(".checkboxed").unCheckCheckboxes();
426             enableCheckboxActions();
427             return false;
428         });
429         $(".cb").click(function(){
430           enableCheckboxActions();
431         });
432         $("#removeitems").html("<a href=\"#\" class=\"removeitems tag_hides disabled\">"+_("Delete")+"</a>")
433         .click(function(e){
434           e.preventDefault();
435           $("#myform").submit();
436           return false;
437         });
438         enableCheckboxActions();
439         $("#myform").on('submit', function() {
440           if ( $("input:checked").size() < 1 ) {
441             alert(MSG_NO_SUGGESTION_SELECTED);
442             return false;
443           }
444           return true;
445         });
446         [% END %]
447     });
448 //]]>
449 </script>
450 [% END %]