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