Bug 24699: Split items.uri in OPAC detail view
[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                             [% FOR m IN messages %]
44                                 <div class="alert alert-[% m.type | html %]">
45                                     [% SWITCH m.code %]
46                                     [% CASE 'biblio_exists' %]
47                                         A similar document already exists: <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.
48                                     [% CASE %]
49                                         [% m.code | html %]
50                                     [% END %]
51                                 </div>
52                             [% END %]
53
54                             <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
55                                 <fieldset class="rows">
56                                     <ol>
57                                         <li>
58                                             [% IF ( title_required ) %]
59                                                 <label for="title" class="required">Title:</label>
60                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" />
61                                                 <span class="required">Required</span>
62                                             [% ELSE %]
63                                                 <label for="title">Title:</label>
64                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" />
65                                             [% END %]
66                                         </li>
67                                         <li>
68                                             [% IF ( author_required ) %]
69                                                 <label for="author" class="required">Author:</label>
70                                                 <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
71                                                 <span class="required">Required</span>
72                                             [% ELSE %]
73                                                 <label for="author">Author:</label>
74                                                 <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" />
75                                             [% END %]
76                                         </li>
77                                         <li>
78                                             <div title="Copyright or publication year, for example: 2016">
79                                                 [% IF ( copyrightdate_required ) %]
80                                                     <label for="copyrightdate" class="required">Copyright date:</label>
81                                                     <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" />
82                                                 <span class="required">Required</span>
83                                                 [% ELSE %]
84                                                     <label for="copyrightdate">Copyright date:</label>
85                                                     <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" />
86                                                 [% END %]
87                                             </div>
88                                         </li>
89                                         <li>
90                                             [% IF ( isbn_required ) %]
91                                                 <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
92                                                 <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" required="required" />
93                                                 <span class="required">Required</span>
94                                             [% ELSE %]
95                                                 <label for="isbn">Standard number (ISBN, ISSN or other):</label>
96                                                 <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" />
97                                             [% END %]
98                                         </li>
99                                         <li>
100                                             [% IF ( publishercode_required ) %]
101                                                 <label for="publishercode" class="required">Publisher:</label>
102                                                 <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
103                                                 <span class="required">Required</span>
104                                             [% ELSE %]
105                                                 <label for="publishercode">Publisher:</label>
106                                                 <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" />
107                                             [% END %]
108                                         </li>
109                                         <li>
110                                             [% IF ( collectiontitle_required ) %]
111                                                 <label for="collectiontitle" class="required">Collection title:</label>
112                                                 <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
113                                                 <span class="required">Required</span>
114                                             [% ELSE %]
115                                                 <label for="collectiontitle">Collection title:</label>
116                                                 <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" />
117                                             [% END %]
118                                         </li>
119                                         <li>
120                                             [% IF ( place_required ) %]
121                                                 <label for="place" class="required">Publication place:</label>
122                                                 <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
123                                                 <span class="required">Required</span>
124                                             [% ELSE %]
125                                                 <label for="place">Publication place:</label>
126                                                 <input type="text" id="place" name="place"  maxlength="80" value="[% place | html %]" />
127                                             [% END %]
128                                         </li>
129                                         <li id="opac-suggestion-quantity">
130                                             [% IF ( quantity_required ) %]
131                                                 <label for="quantity" class="required">Quantity:</label>
132                                                 <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
133                                                 <span class="required">Required</span>
134                                             [% ELSE %]
135                                                 <label for="quantity">Quantity:</label>
136                                                 <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
137                                             [% END %]
138                                         </li>
139                                         <li>
140                                             [% IF ( itemtype_required ) %]
141                                                 <label for="itemtype" class="required">Item type:</label>
142                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
143                                                 <span class="required">Required</span>
144                                             [% ELSE %]
145                                                 <label for="itemtype">Item type:</label>
146                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
147                                             [% END %]
148                                         </li>
149                                         [% IF branchcode %]
150                                             <li>
151                                                 [% IF ( branchcode_required ) %]
152                                                     <label for="branch" class="required">Library:</label>
153                                                     <select name="branchcode" id="branch" required="required">
154                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
155                                                     </select>
156                                                     <span class="required">Required</span>
157                                                 [% ELSE %]
158                                                     <label for="branch">Library:</label>
159                                                     <select name="branchcode" id="branch">
160                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
161                                                     </select>
162                                                 [% END %]
163                                             </li>
164                                         [% END %]
165                                         [% IF ( patron_reason_loop ) %]
166                                             <li>
167                                                 [% IF ( patronreason_required ) %]
168                                                     <label for="patronreason" class="required">Reason for suggestion: </label>
169                                                     <select name="patronreason" id="patronreason" required="required">
170                                                         <option value="">-- Choose --</option>
171                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
172                                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
173                                                         [% END %]
174                                                     </select>
175                                                     <span class="required">Required</span>
176                                                 [% ELSE %]
177                                                     <label for="patronreason">Reason for suggestion: </label>
178                                                     <select name="patronreason" id="patronreason">
179                                                         <option value="">-- Choose --</option>
180                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
181                                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
182                                                         [% END %]
183                                                     </select>
184                                                 [% END %]
185                                             </li>
186                                         [% END %]
187                                         <li>
188                                             [% IF ( note_required ) %]
189                                                 <label for="note" class="required">Notes:</label>
190                                                 <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea>
191                                                 <span class="required">Required</span>
192                                             [% ELSE %]
193                                                 <label for="note">Notes:</label>
194                                                 <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
195                                             [% END %]
196                                         </li>
197
198                                         <!--  Add a hidden 'negcap' field -->
199                                         <li id="negcap" style="position: absolute; left: -2000px;">
200                                             negcap <input type="text" name="negcap"/>
201                                         </li>
202
203                                     </ol>
204                                 </fieldset>
205                                 <fieldset class="action">
206                                     <input type="hidden" name="suggested_by_anyone" value="[% suggested_by_anyone | html %]" />
207                                     [% IF need_confirm # Confirm that we want a duplicate %]
208                                         <input type="hidden" name="op" value="add_confirm" />
209                                         <input type="submit" class="btn" value="Confirm your suggestion" />
210                                     [% ELSIF biblionumber # Create from an existing title %]
211                                         <input type="hidden" name="op" value="add_confirm" />
212                                         <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
213                                         <input type="submit" class="btn" value="Submit your suggestion" />
214                                     [% ELSE # Not created from an existing title, search for possible duplicate %]
215                                         <input type="hidden" name="op" value="add_validate" />
216                                         <input type="submit" class="btn" value="Submit your suggestion" />
217                                     [% END %]
218                                     <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a>
219                                 </fieldset>
220                             </form>
221                             [% END %]
222                         [% END #  IF op_add %]
223
224                         [% IF ( op_else ) %]
225                             <h1>
226                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
227                                     Purchase suggestions
228                                 [% ELSE %]
229                                     [% IF ( loggedinusername ) %]
230                                         Your purchase suggestions
231                                     [% ELSE %]
232                                         Purchase suggestions
233                                     [% END %]
234                                 [% END %]
235                             </h1>
236                             [% FOR m IN messages %]
237                                 <div class="alert alert-[% m.type | html %]">
238                                     [% SWITCH m.code %]
239                                     [% CASE 'too_many' %]
240                                         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.
241                                     [% CASE 'already_exists' %]
242                                         The suggestion has not been added. A suggestion with this title already exists.
243                                     [% CASE 'success_on_inserted' %]
244                                         Your suggestion has been submitted.
245                                     [% CASE %]
246                                         [% m.code | html %]
247                                     [% END %]
248                                 </div>
249                             [% END %]
250
251                             [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %]
252
253                             [% IF ( suggestions_loop ) %]
254                                 <form action="/cgi-bin/koha/opac-suggestions.pl" class="form-inline" method="get">
255                                     <fieldset>
256                                         <label for="title">Search for:</label>
257                                         <input type="text" name="title" id="title" value="[% title | html %]" />
258                                         [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
259                                             [% IF loggedinusername %]
260                                                 <label for="suggested_by_anyone">Suggested by:</label>
261                                                 <div class="input-append">
262                                                     <select name="suggested_by_anyone" id="suggested_by_anyone">
263                                                         [% IF suggested_by_anyone %]
264                                                             <option value="0">Me</option>
265                                                             <option value="1" selected="selected">Anyone</option>
266                                                         [% ELSE %]
267                                                             <option value="0" selected="selected">Me</option>
268                                                             <option value="1">Anyone</option>
269                                                         [% END %]
270                                                     </select>
271                                                     <button type="submit" class="btn">Go</button>
272                                                 </div>
273                                             [% END %]
274                                         [% END %]
275                                     </fieldset>
276                                 </form>
277                                 <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions">
278                                     <input type="hidden" name="op" value="delete_confirm" />
279                                     [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
280                                         <div id="toolbar" class="toolbar clearfix">
281                                         [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
282                                                 <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>
283                                         [% ELSE %]
284                                                 <a class="btn btn-link new" href="/cgi-bin/koha/opac-suggestions.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
285                                         [% END %]
286                                         </div>
287                                     [% END %]
288
289                                     [% IF ( loggedinusername ) %]
290                                         <div id="selections-toolbar" class="toolbar">
291                                             <span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
292                                             <span class="links">
293                                                 <span id="selections">Select suggestions to: </span>
294                                                 <span id="removeitems"></span>
295                                             </span>
296                                         </div>
297                                     [% END %]
298
299                                     <table id="suggestt" class="checkboxed table table-bordered table-striped">
300                                         <thead>
301                                             <tr>
302                                                 [% IF ( loggedinusername ) %]<th>&nbsp;</th>[% END %]
303                                                 <th>Summary</th>
304                                                 <th>Suggested on</th>
305                                                 <th>Note</th>
306                                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]<th>Suggested for</th>[% END %]
307                                                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]<th>Managed by</th>[% END %]
308                                                 <th>Status</th>
309                                             </tr>
310                                         </thead>
311                                         <tbody>
312                                             [% FOREACH suggestions_loo IN suggestions_loop %]
313                                                 <tr>
314                                                     [% IF ( loggedinusername ) %]
315                                                         <td>
316                                                             [% IF ( suggestions_loo.showcheckbox ) %]
317                                                                 <input type="checkbox" class="cb" id="id[% suggestions_loo.suggestionid | html %]" name="delete_field" data-title="[% suggestions_loo.title | html %]" value="[% suggestions_loo.suggestionid | html %]" />
318                                                             [% END %]
319                                                         </td>
320                                                     [% END %]
321                                                     <td>
322                                                         <p>
323                                                             <label for="id[% suggestions_loo.suggestionid | html %]">
324                                                                 [% IF suggestions_loo.biblionumber %]
325                                                                     <strong><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% suggestions_loo.biblionumber | uri %]">[% suggestions_loo.title | html %]</a></strong>
326                                                                 [% ELSE %]
327                                                                     <strong>[% suggestions_loo.title | html %]</strong>
328                                                                 [% END %]
329                                                             </label>
330                                                         </p>
331                                                             <p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author | html %],[% END %]
332                                                                 [% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate | html %],[% END %]
333                                                                 [% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode | html %][% END %]
334                                                                 [% IF ( suggestions_loo.place ) %]([% suggestions_loo.place | html %])[% END %]
335                                                                 [% IF ( suggestions_loo.collectiontitle ) %] , [% suggestions_loo.collectiontitle | html %][% END %]
336                                                                 [% IF ( suggestions_loo.itemtype ) %] - [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 1 ) | html %][% END %]
337                                                         </p>
338                                                     </td>
339                                                     <td>
340                                                         [% IF ( suggestions_loo.suggesteddate ) %][% suggestions_loo.suggesteddate |$KohaDates %][% END %]
341                                                     </td>
342                                                     <td>
343                                                         [% IF ( suggestions_loo.note ) %]
344                                                             <span class="tdlabel">Note: </span>
345                                                             [% suggestions_loo.note | html %]
346                                                         [% END %]
347                                                     </td>
348                                                     [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
349                                                         <td>
350                                                             [% IF ( suggestions_loo.branchcodesuggestedby ) %]
351                                                                 <span class="tdlabel">Suggested for:</span>
352                                                                 [% suggestions_loo.branchcodesuggestedby | html %]
353                                                             [% END %]
354                                                         </td>
355                                                     [% END %]
356                                                     [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]
357                                                     <td>
358                                                         [% IF ( suggestions_loo.surnamemanagedby ) %]
359                                                             <span class="tdlabel">Managed by:</span>
360                                                             [% suggestions_loo.surnamemanagedby | html %]
361                                                             [% IF ( suggestions_loo.firstnamemanagedby ) %]    , [% suggestions_loo.firstnamemanagedby | html %]
362                                                             [% END %]
363                                                         [% END %]
364                                                     </td>
365                                                     [% END %]
366                                                     <td>
367                                                         <span class="tdlabel">Status:</span>
368                                                         [% IF ( suggestions_loo.ASKED ) %]Requested
369                                                         [% ELSIF ( suggestions_loo.CHECKED ) %]Checked by the library
370                                                         [% ELSIF ( suggestions_loo.ACCEPTED ) %]Accepted by the library
371                                                         [% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library
372                                                         [% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined
373                                                         [% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library
374                                                         [% ELSE %] [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) | html %] [% END %]
375                                                         [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason | html %])[% END %]
376                                                     </td>
377                                                 </tr>
378                                             [% END # / FOREACH suggestions_loo %]
379                                         </tbody>
380                                     </table>
381
382                                     [% IF ( loggedinusername ) %]
383                                         <fieldset class="action">
384                                             <input type="submit" class="btn btn-danger removeitems" value="Delete selected" />
385                                         </fieldset>
386                                     [% END %]
387                                 </form>
388                             [% ELSE %]
389                                 [% UNLESS Koha.Preference( 'OPACViewOthersSuggestions' ) or loggedinusername %]
390                                     <p>You are not authorized to see pending purchase suggestions.</p>
391                                 [% ELSE %]
392                                     <p>There are no pending purchase suggestions.</p>
393                                 [% END %]
394                                 [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
395                                     [% IF ( Koha.Preference('MaxOpenSuggestions') != ''  && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
396                                         <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>
397                                     [% ELSE %]
398                                         <p><a class="btn btn-link new" href="/cgi-bin/koha/opac-suggestions.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a></p>
399                                     [% END %]
400                                 [% END %]
401                             [% END # / IF suggestions_loop %]
402
403                         [% END # IF op_else %]
404                     </div> <!-- / #usersuggestions -->
405                 </div> <!-- / .span10 -->
406             </div> <!-- / .row-fluid -->
407         </div> <!-- / .container-fluid -->
408     </div> <!-- / .main -->
409
410 [% INCLUDE 'opac-bottom.inc' %]
411 [% BLOCK jsinclude %]
412 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
413 [% INCLUDE 'datatables.inc' %]
414 <script>
415     [% IF ( loggedinusername ) %]
416         function enableCheckboxActions(){
417             // Enable/disable controls if checkboxes are checked
418             var checkedBoxes = $(".checkboxed input:checkbox:checked");
419             if ($(checkedBoxes).size()) {
420               $("#selections").html(_("With selected suggestions: "));
421               $("#selections-toolbar .links a").removeClass("disabled");
422             } else {
423               $("#selections").html(_("Select suggestions to: "));
424               $("#selections-toolbar .links a").addClass("disabled");
425             }
426         }
427     [% END %]
428
429     $(function() {
430         $("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, {
431             "order": [[ 1, "asc" ]],
432             "columnDefs": [
433               [% IF ( loggedinusername ) %]{ "targets": [ 0 ], "sortable": false, "searchable": false }[% END %]
434             ],
435             "columns": [
436                 [% IF ( loggedinusername ) %]null,[% END %]
437                 { "type": "anti-the" },
438                 null,
439                 null,
440                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]null,[% END %]
441                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %]
442                 null
443             ]
444         }));
445         [% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
446         $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
447         $("#CheckAll").click(function(){
448             $(".checkboxed").checkCheckboxes();
449             enableCheckboxActions();
450             return false;
451         });
452         $("#CheckNone").click(function(){
453             $(".checkboxed").unCheckCheckboxes();
454             enableCheckboxActions();
455             return false;
456         });
457         $(".cb").click(function(){
458           enableCheckboxActions();
459         });
460         $("#removeitems").html("<a href=\"#\" class=\"btn btn-link removeitems tag_hides btn-disabled\"><i class=\"fa fa-trash\"></i> "+_("Delete")+"</a>");
461
462         enableCheckboxActions();
463
464         $(".removeitems").on("click", function(e) {
465             e.preventDefault();
466             var selected_titles = $("input:checked");
467             var title;
468             var yes_label;
469             var no_label;
470             var message = "";
471             if ( selected_titles.size() < 1 ) {
472                 alert(MSG_NO_SUGGESTION_SELECTED);
473                 return false;
474             } else {
475                 if( selected_titles.size() > 1 ){
476                     message = $("<ul></ul>");
477                     title = _("Are you sure you want to delete these suggestions?");
478                     yes_label = _("Yes, delete suggestions");
479                     no_label = _("No, do not delete suggestions");
480                     selected_titles.each(function(){
481                         message.append( "<li>" +  $(this).data("title") + "</li>" );
482                     });
483                 } else {
484                     title = _("Are you sure you want to delete this suggestion?");
485                     yes_label = _("Yes, delete suggestion");
486                     no_label = _("No, do not delete suggestion");
487                     selected_titles.each(function(){
488                         message += $(this).data("title");
489                     });
490                 }
491                 confirmModal( message, title, yes_label, no_label, function( result ){
492                     if( result ){
493                         $("#delete_suggestions").submit();
494                     }
495                 });
496             }
497         });
498         [% END %]
499     });
500 </script>
501 [% END %]