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