2 [% USE AdditionalContents %]
6 [% USE AuthorisedValues %]
8 [% PROCESS 'i18n.inc' %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>[% FILTER collapse %]
13 [% tx("Contents of {list_name}", { list_name = shelf.shelfname }) | html %] ›
15 [% IF op == 'add_form' %]
16 [% t("Create new list") | html %] ›
18 [% IF op == 'edit_form' %]
19 [% tx("Edit list {list_name}", { list_name = shelf.shelfname }) | html %] ›
21 [% t("Lists") | html %] ›
22 [% t("Koha") | html %]
24 [% INCLUDE 'doc-head-close.inc' %]
25 <style>textarea { width: 100%; }</style>
27 [% BLOCK list_permissions %]
29 <label for="allow_changes_from">Allow changes to contents from: </label>
30 <select name="allow_changes_from" id="allow_changes_from" onchange="AdjustRemark()">
32 [% IF shelf.allow_change_from_owner %]
33 <option value="0">Nobody</option>
35 <option value="0" selected="selected">Nobody</option>
38 [% IF shelf.allow_change_from_owner && (( !shelf.is_public && !shelf.is_shared ) || !shelf.allow_change_from_others ) %]
39 <option value="1" selected="selected">Owner only</option>
41 <option value="1">Owner only</option>
44 [% IF shelf.allow_change_from_permitted_staff %]
45 <option value="4" selected="selected">Permitted staff only</option>
47 <option value="4">Permitted staff only</option>
49 [% IF shelf.allow_change_from_staff %]
50 <option value="3" selected="selected">Staff only</option>
52 <option value="3">Staff only</option>
55 [% IF shelf.allow_change_from_others %]
56 <option value="2" selected="selected">Anyone seeing this list</option>
58 <option value="2">Anyone seeing this list</option>
62   <span id="permitted_staff_remark" style="display:none;color:red;">The Permitted staff only permission has no actual effect while this list is strictly private.</span>
63   <span id="staff_remark" style="display:none;color:red;">The Staff only permission has no actual effect while this list is strictly private.</span>
64   <span id="anyone_remark" style="display:none;color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
69 <body id="lists_shelves" class="lists">
70 [% WRAPPER 'header.inc' %]
71 [% INCLUDE 'cat-search.inc' %]
74 [% WRAPPER 'sub-header.inc' %]
75 [% WRAPPER breadcrumbs %]
77 [% WRAPPER breadcrumb_item %]
78 <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a>
81 [% WRAPPER breadcrumb_item bc_active= 1 %]
86 [% IF shelf AND shelf.is_private %]
87 [% IF op == 'view' OR op == 'edit_form' %]
88 [% WRAPPER breadcrumb_item %]
89 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0">Your lists</a>
92 [% WRAPPER breadcrumb_item bc_active= 1 %]
93 <span>Your lists</span>
97 [% ELSIF shelf AND shelf.is_public %]
99 [% WRAPPER breadcrumb_item %]
100 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1">Public lists</a>
103 [% WRAPPER breadcrumb_item bc_active= 1 %]
104 <span>Public lists</span>
109 [% IF op == 'view' %]
110 [% WRAPPER breadcrumb_item bc_active= 1 %]
111 <span>Contents of <em>[% shelf.shelfname | html %]</em></span>
115 [% IF op == 'add_form' %]
116 [% WRAPPER breadcrumb_item bc_active= 1 %]
117 <span>Create new list</span>
121 [% IF op == 'edit_form' %]
122 [% WRAPPER breadcrumb_item bc_active= 1 %]
123 <span>Edit list <em>[% shelf.shelfname | html %]</em></span>
127 [% IF op == 'transfer' %]
128 [% WRAPPER breadcrumb_item bc_active= 1 %]
129 <span>Transfer list <em>[% shelf.shelfname | html %]</em></span>
132 [% END #/ WRAPPER breadcrumbs %]
133 [% END #/ WRAPPER sub-header.inc %]
135 <div class="main container-fluid">
137 <div class="col-sm-10 col-sm-push-1">
140 [% IF op != 'transfer' %][% INCLUDE 'virtualshelves-toolbar.inc' %][% END %]
142 [% FOR m IN messages %]
143 <div class="dialog [% m.type | html %]">
145 [% CASE 'error_on_update' %]
146 <span>An error occurred when updating this list.</span>
147 [% CASE 'error_on_insert' %]
148 <span>An error occurred when creating this list.</span>
149 [% CASE 'error_on_delete' %]
150 <span>An error occurred when deleting this list.</span>
151 [% CASE 'error_on_add_biblio' %]
152 [% IF m.item_barcode %]
153 <span>The item ([% m.item_barcode | html %]) has not been added to the list. Please verify it is not already in the list.</span>
155 <span>The record ([% m.bibnum | html %]) has not been added to the list. Please verify it is not already in the list.</span>
157 [% CASE 'success_on_update' %]
158 <span>List updated.</span>
159 [% CASE 'success_on_insert' %]
160 <span>List created.</span>
161 [% CASE 'success_on_delete' %]
162 <span>List deleted.</span>
163 [% CASE 'success_on_add_biblio' %]
164 [% IF m.item_barcode %]
165 <span>The item ([% m.item_barcode | html %]) has been added to the list.</span>
167 <span>The record ([% m.bibnum | html %]) has been added to the list.</span>
169 [% CASE 'success_on_remove_biblios' %]
170 <span>The item has been removed from the list.</span>
171 [% CASE 'does_not_exist' %]
172 <span>This list does not exist.</span>
173 [% CASE 'item_does_not_exist' %]
174 [% IF m.item_barcode %]
175 <span>The item ([% m.item_barcode | html %]) does not exist.</span>
177 <span>The record ([% m.bibnum | html %]) does not exist.</span>
179 [% CASE 'unauthorized_on_view' %]
180 <span>You do not have permission to view this list.</span>
181 [% CASE 'unauthorized_on_update' %]
182 <span>You do not have permission to update this list.</span>
183 [% CASE 'unauthorized_on_delete' %]
184 <span>You do not have permission to delete this list.</span>
185 [% CASE 'unauthorized_on_add_biblio' %]
186 <span>You do not have permission to add a record to this list.</span>
187 [% CASE 'unauthorized_transfer' %]
188 <span>You do not have permission to transfer ownership of this list.</span>
189 [% CASE 'new_owner_not_found' %]
190 <span>The new owner could not be found anymore.</span>
191 [% CASE 'no_biblio_removed' %]
192 <span>No record was removed.</span>
194 [% CASE 'Koha::Exceptions::Virtualshelf::DuplicateObject' %]
195 <span>An error occurred when creating this list. The name [% shelfname | html %] already exists.</span>
196 [% CASE 'Koha::Exceptions::Virtualshelf::UseDbAdminAccount' %]
197 <span>List could not be created. (Do not use the database administrator account.)</span>
198 [% CASE 'DBIx::Class::Exception' %]
202 [% m.code | html %] [% m.msg | html %]
205 [% END # /FOR m IN messages %]
207 [% IF op == 'transfer' %]
208 <h1>Transfer ownership of public list [% shelf.shelfname | html %]</h1>
210 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="transferform" method="post">
211 [% INCLUDE 'csrf-token.inc' %]
213 <input type="hidden" name="op" value="transfer" />
214 <input type="hidden" name="public" value="1" />
215 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
218 <label for="find_patron">Search for new owner: </label>
219 <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
224 <label for="find_patron">New owner: </label>
225 <span id="new_owner_name"></span>
226 <input type="hidden" id="new_owner" name="new_owner" value="" />
230 <fieldset class="action">
231 <input type="submit" class="btn btn-primary" value="Transfer" />
232 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1" class="cancel">Cancel</a>
237 [% END # /IF op == transfer %]
239 [% IF op == 'view' %]
240 <h1>Contents of <em>[% shelf.shelfname | html %]</em></h1>
242 [% SET contents = shelf.get_contents %]
243 [% IF ( contents.count ) %]<p>This list contains [% contents.count | html %] titles</p>[% END %]
244 <div class="pages">[% pagination_bar | $raw %]</div>
245 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post">
246 [% INCLUDE 'csrf-token.inc' %]
247 <input type="hidden" name="op" value="remove_biblios" />
248 <input type="hidden" name="referer" value="view" />
249 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
251 [% IF direction == 'asc' %]
252 [% SET new_direction = 'desc' %]
254 [% SET direction = 'desc' %]
255 [% SET new_direction = 'asc' %]
259 <div id="searchheader" class="searchheader noprint">
260 <div id="selection_ops">
261 <span class="checkall"></span> |
262 <span class="clearall"></span>
264 <span class="addto">| </span>
266 [% IF CAN_user_reserveforothers && Koha.Preference('DisplayMultiPlaceHold') %]
267 <div class="btn-group"><button class="btn btn-default btn-xs placehold"><i class="fa-solid fa-bookmark"></i> Place hold</button></div>
269 [% IF can_remove_biblios %]
270 <div class="btn-group"><button type="submit" class="btn btn-default btn-xs list-remove"><i class="fa fa-trash-can"></i> Remove selected</button></div>
272 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
273 <div class="btn-group"><button type="submit" class="btn btn-default btn-xs merge-items"><i class="fa fa-compress"></i> Merge selected</button></div>
279 <div class="page-section">
280 <table id="searchresults" class="dataTable">
283 [% IF ( itemsloop ) %]
284 <th class="checkall"> </th>
286 [% UNLESS ( item_level_itypes ) %]
289 [% IF sortfield == 'title' %]
290 <th class="sorting_[% direction | html %]">
294 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=title&direction=[% IF sortfield != 'title' %]asc[% ELSE %][% new_direction | uri %][% END %]">Title</a>
296 [% IF sortfield == 'author' %]
297 <th class="sorting_[% direction | html %]">
301 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=author&direction=[% IF sortfield != 'author' %]asc[% ELSE %][% new_direction | uri %][% END %]">Author</a>
303 [% IF sortfield == 'dateadded' %]
304 <th class="sorting_[% direction | html %]">
308 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=dateadded&direction=[% IF sortfield != 'dateadded' %]asc[% ELSE %][% new_direction | uri %][% END %]">Date added</a>
310 [% IF sortfield == 'itemcallnumber' %]
311 <th class="sorting_[% direction | html %]">
315 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=itemcallnumber&direction=[% IF sortfield != 'itemcallnumber' %]asc[% ELSE %][% new_direction | uri %][% END %]">Call number</a>
319 [% FOREACH itemsloo IN itemsloop %]
323 <input type="checkbox" class="selection" value="[% itemsloo.biblionumber | html %]" name="biblionumber" />
326 [% UNLESS ( item_level_itypes ) %]
328 [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]
329 <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
331 <span class="itypetext">[% itemsloo.description | html %]</span>
335 [% IF ( itemsloo.XSLTBloc ) %]
336 [% itemsloo.XSLTBloc | $raw %]
338 [% INCLUDE 'biblio-title.inc' biblio=itemsloo link = 1 %]
342 [% IF ( itemsloo.notforloan ) %]
343 <span class="noholdstext">No holds allowed</span>
345 [% IF ( itemsloo.ITEM_RESULTS.count ) %]
346 <a id="reserve_[% itemsloo.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | html %]">Holds</a>
348 <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | uri %]&findborrower=[% holdfor_patron.cardnumber | uri %]">Place hold for [% INCLUDE 'patron-title.inc' patron => holdfor_patron no_title => 1 %]</a></span>
351 <span class="noholdstext">No holds allowed</span>
354 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
355 | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit record</a>
357 [% IF ( CAN_user_editcatalogue_edit_items ) %]
358 | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit items</a>
363 [% itemsloo.author | html %]
366 [% itemsloo.dateadded | $KohaDates%]
370 [% FOREACH item IN itemsloo.ITEM_RESULTS %]
372 [% Branches.GetName(item.holdingbranch) | html %]
373 [% IF ( item.location ) %]
374 <span class="shelvingloc">
375 [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]
378 [% IF ( item.itemcallnumber ) %]
379 [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=%22[% item.itemcallnumber | uri %]%22">[% item.itemcallnumber | html %]</a>]
382 [% END # /FOREACH item %]
386 [% END #/FOREACH itemsloo %]
387 </table> <!-- /#searchresults -->
388 </div> <!-- /.page-section -->
390 <div class="pages">[% pagination_bar | $raw %]</div>
392 [% END # /IF itemsloop %]
393 [% END # /IF op == 'view' %]
395 [% IF op == 'add_form' OR op == 'edit_form' %]
397 <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl" class="validated">
398 [% INCLUDE 'csrf-token.inc' %]
399 <fieldset class="rows">
400 [% IF op == 'add_form' %]
401 <legend><h1>Create a new list</h1></legend>
402 <input type="hidden" name="op" value="add" />
404 <legend><h1>Edit list <em>[% shelf.shelfname | html %]</em></h1></legend>
405 <input type="hidden" name="op" value="edit" />
407 <input type="hidden" name="referer" value="[% referer | html %]" />
408 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
411 <label for="shelfname" class="required">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value="[% shelf.shelfname | html %]" required="required" class="focus required" />
412 <span class="required">Required</span>
415 <span class="label">Owner: </span>
416 [% IF op == 'add_form' %]
417 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />[% logged_in_user.userid | html %]
420 <input type="hidden" id="owner" name="owner" value="[% owner.borrowernumber | html %]" />[% owner.firstname _ ' ' _ owner.surname | html %]
422 <input type="hidden" id="owner" name="owner" value="[% loggedinusernumber | html %]" />[% logged_in_user.userid | html %]
427 <label for="sortfield" >Sort this list by: </label>
428 <select name="sortfield">
429 [% IF shelf.sortfield == "title" %]
430 <option value="title" selected="selected">Title</option>
432 <option value="title">Title</option>
434 [% IF shelf.sortfield == "author" %]
435 <option value="author" selected="selected">Author</option>
437 <option value="author">Author</option>
439 [% IF shelf.sortfield == "copyrightdate" %]
440 <option value="copyrightdate" selected="selected">Copyrightdate</option>
442 <option value="copyrightdate">Copyrightdate</option>
444 [% IF shelf.sortfield == "itemcallnumber" %]
445 <option value="itemcallnumber" selected="selected">Call number</option>
447 <option value="itemcallnumber">Call number</option>
449 [% IF shelf.sortfield == "dateadded" %]
450 <option value="dateadded" selected="selected">Date added</option>
452 <option value="dateadded">Date added</option>
457 <label for="public">Public: </label>
458 <select id="public" name="public" onchange="AdjustRemark()">
459 [% IF shelf.is_private %]
460 <option value="0" selected="selected">Private</option>
462 <option value="0">Private</option>
464 [% IF shelf.is_public %]
465 <option value="1" selected="selected">Public</option>
467 <option value="1">Public</option>
471 [% INCLUDE list_permissions %]
475 <fieldset class="action">
476 <input type="submit" class="btn btn-primary" value="Save" />
477 [% IF referer == 'view' %]
478 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
481 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1" class="cancel">Cancel</a>
483 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0" class="cancel">Cancel</a>
488 [% END # /IF op == 'add_form'... %]
490 [% IF op == 'list' %]
493 [% WRAPPER tabs id= "tabs" %]
494 [% WRAPPER tabs_nav %]
495 [% WRAPPER tab_item tabname= "privateshelves_tab" bt_active= 1 %] <span>Your lists</span> [% END %]
496 [% WRAPPER tab_item tabname= "publicshelves_tab" %] <span>Public lists</span> [% END %]
497 [% END # /WRAPPER tabs_nav %]
499 [% WRAPPER tab_panels %]
500 [% WRAPPER tab_panel tabname="shelves_tab" bt_active= 1 %]
501 <table id="listresultst">
504 <th class="NoVisible">Type</th>
510 <th>Creation date</th>
511 <th>Modification date</th>
512 <th class="noExport">Actions</th>
514 <tr class="filters_row">
516 <th><input class="filter text_filter" id="searchshelfname_filter" placeholder="List name"></th>
519 <th><input class="filter text_filter" id="searchowner_filter" placeholder="Owner"></th>
521 <select class="filter text_filter" id="searchsortby_filter">
522 <option value=""></option>
523 <option value="title">Title</option>
524 <option value="author">Author</option>
525 <option value="copyrightdate">Copyrightdate</option>
526 <option value="itemcallnumber">Call number</option>
527 <option value="dateadded">Date added</option>
536 </table> <!-- /#listresultst -->
538 [% END # /WRAPPER tab_panels %]
539 [% END # /WRAPPER tabs %]
541 [%- SET StaffListsHome = AdditionalContents.get( location => "StaffListsHome", lang => lang, library => logged_in_user.branchcode ) -%]
542 [%- FOREACH block IN StaffListsHome.content -%]
543 <div class="page-section">
544 [%- block.content | $raw -%]
547 [% END # /IF op == 'list' %]
549 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
550 <!-- Values will be set here by placeHold() -->
554 </div> <!-- /.col-sm-10.col-sm-push-2 -->
555 </div> <!-- /.row -->
557 [% IF ( can_add_biblios ) %]
559 <div class="modal" id="addToList" tabindex="-1" role="dialog" aria-labelledby="addToListLabel">
560 <div class="modal-dialog" role="document">
561 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
562 [% INCLUDE 'csrf-token.inc' %]
563 <div class="modal-content">
564 <div class="modal-header">
565 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
566 <h4 class="modal-title" id="addToListLabel">Add items</h4>
568 <div class="modal-body">
569 <fieldset class="brief">
572 <label for="barcodes">Barcodes:</label>
573 <textarea name="barcodes" id="barcodes" rows="5"></textarea>
574 <input type="hidden" name="op" value="add_biblio" />
575 <input type="hidden" name="referer" value="view" />
576 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
579 <label for="biblionumbers">Biblio numbers:</label>
580 <textarea name="biblionumbers" id="biblionumbers" rows="5"></textarea>
581 <input type="hidden" name="op" value="add_biblio" />
582 <input type="hidden" name="referer" value="view" />
583 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
587 </div> <!-- /.modal-body -->
588 <div class="modal-footer">
589 <button type="submit" class="btn btn-default">Save</button>
590 <a href="#" data-dismiss="modal" class="cancel">Cancel</a>
594 </div> <!-- /.modal-dialog -->
595 </div> <!-- /#addToList -->
596 [% END # IF /( can_add_biblios ) %]
598 [% MACRO jsinclude BLOCK %]
599 [% INCLUDE 'datatables.inc' %]
600 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
603 $( document ).ready(function() {
605 window.onafterprint = function () {
608 setTimeout('window.close()', 1000); // Hack for Chrome < 63
613 [% IF op == 'view' %]
614 [% Asset.js("lib/hc-sticky.js") | $raw %]
617 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
618 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
619 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to remove this list?");
621 [% IF op == 'list' %]
622 $(document).ready(function(){
623 var public = [% public | html %];
625 var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
626 "aaSorting": [[ 5, "asc" ]],
628 'sAjaxSource': "/cgi-bin/koha/svc/virtualshelves/search",
629 'fnServerData': function(sSource, aoData, fnCallback) {
635 'value': $("#searchshelfname_filter").val(),
638 'value': $("#searchowner_filter").val(),
641 'value': $("#searchsortby_filter").val(),
643 'name': 'template_path',
644 'value': 'virtualshelves/tables/shelves_results.tt',
646 'name': 'allow_transfer',
647 'value': '[% allow_transfer | html %]',
649 'name': 'shelfname_sorton',
650 'value': 'vs.shelfname',
652 'name': 'is_shared_sorton',
653 'value': 'vs.public',
655 'name': 'owner_sorton',
658 'name': 'sortby_sorton',
659 'value': 'vs.sortfield',
661 'name': 'created_on_sorton',
662 'value': 'vs.created_on',
664 'name': 'modification_time_sorton',
665 'value': 'vs.lastmodified',
672 'success': function(json){
678 { 'mDataProp': 'dt_public' },
679 { 'mDataProp': 'dt_shelfname' },
680 { 'mDataProp': 'dt_count' },
681 { 'mDataProp': 'dt_is_shared' },
682 { 'mDataProp': 'dt_owner' },
683 { 'mDataProp': 'dt_sortby' },
684 { 'mDataProp': 'dt_created_on' },
685 { 'mDataProp': 'dt_modification_time' },
686 { 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' }
689 { "bVisible": false, "aTargets": [ 'NoVisible' ] }
692 'sPaginationType': 'full_numbers',
695 "bSortCellsTop": true
698 dtListResults.fnAddFilters("filter", 750);
700 /* Select correct tab based on URL parameter */
702 $('a[href="#privateshelves_tab_panel"]').tab('show');
704 $('a[href="#publicshelves_tab_panel"]').tab("show");
707 $('a[data-toggle="tab"]').on("click", function(e){
708 let target = $(this).attr("href");
709 if( target == "#publicshelves_tab_panel" ){
715 .on('shown.bs.tab', function (e) {
716 dtListResults.fnDraw();
719 $("body").on("click", ".deleteshelf", function(){
720 return confirmDelete(MSG_CONFIRM_DELETE_LIST);
723 [% END # /IF op == 'list' %]
725 [% IF shelf AND op == 'view' %]
727 $(document).ready(function(){
728 Sticky = $("#searchheader");
730 stickTo: "#listform",
731 stickyClass: "floating"
733 $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-times\"></i>"+_(" Clear all")+"<\/a>");
734 $("span.checkall").html("<a id=\"CheckAll\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-check\"></i>"+_(" Select all")+"<\/a>");
735 $("#CheckAll").click(function(e){
737 $(".selection").each(function(){
738 $(this).prop("checked", true);
742 $("#CheckNone").click(function(e){
744 $(".selection").each(function(){
745 $(this).prop("checked", false);
748 $(".placehold").on("click",function(e){
752 $(".addtocart").show();
753 var param1 = "| <label for=\"addto\">"+_("Add to:")+"<\/label><select name=\"addto\" id=\"addto\"><option value=\"\"><\/option>";
754 [% IF (Koha.Preference("intranetbookbag")) %]
755 param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>";
757 [% IF Koha.Preference('virtualshelves') %]
758 [% IF add_to_some_private_shelves.count %]
759 param1 += "<optgroup label=\""+_("Your lists:")+"\">";
760 [% SET number_of_private_shelves = 0 %]
761 [% FOREACH s IN add_to_some_private_shelves %]
762 [% IF shelfnumber != s.shelfnumber %]
763 param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
764 [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
765 [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
768 param1 += "<\/optgroup>";
770 [% IF add_to_some_public_shelves.count %]
771 param1 += "<optgroup label=\""+_("Public lists:")+"\">";
772 [% SET number_of_public_shelves = 0 %]
773 [% FOREACH s IN add_to_some_public_shelves %]
774 [% IF shelfnumber != s.shelfnumber %]
775 param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
776 [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
777 [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
780 param1 += "<\/optgroup>";
782 [% IF add_to_some_private_shelves.count > 10 or add_to_some_public_shelves.count > 10 %]
783 param1 += "<option value=\"morelists\">[ "+_("More lists")+" ]<\/option>";
785 param1 +="<option value=\"newlist\">"+_("[ New list ]")+"<\/option>"
787 param1 += "<\/select> <button id=\"cartsubmit\" type=\"submit\" class=\"btn btn-default btn-xs\">"+_("Save")+"</button>";
788 $("span.addto").html(param1);
789 $("#cartsubmit").on("click",function(e){
793 $("#addto").change(function(){
796 $(".addto").find("input:submit").click(function(e){
800 $("#selection_ops").show();
801 $(".merge-items").on("click",function(e){
805 $("#listform").on("submit",function(e){
808 $(".list-remove").on("click",function(e){
809 if($(".selection").filter(":checked").length > 0){
810 return confirm(MSG_REMOVE_FROM_LIST);
812 alert(MSG_NO_ITEM_SELECTED);
816 $("#addToList").on("shown.bs.modal", function(e){
817 $("#barcodes").focus();
820 [% END # /IF shelf %]
822 [% IF shelf AND op == 'edit_form' %]
823 $(document).ready(function(){
829 * This function checks if the adequate number of records are checked for merging
831 function MergeItems() {
832 var checkboxes = $("input:checkbox:checked");
833 if (checkboxes.length < 2) {
834 alert(_("At least two records must be selected for merging."));
837 $(checkboxes).each(function() {
838 params.push('biblionumber=' + $(this).val());
840 var url = '/cgi-bin/koha/cataloguing/merge.pl?' + params.join('&');
847 * This function checks all checkboxes if all are empty,
848 * or unchecks all if any already checked.
851 var checkboxes = document.getElementsByTagName('input');
852 var nbCheckbox = checkboxes.length;
853 var check = areAllChecked();
854 for(var i=0;i<nbCheckbox;i++){
855 if(checkboxes[i].getAttribute('type') == "checkbox" ){
856 checkboxes[i].checked = (check) ? 0 : 1;
861 * This function returns true if ALL checkboxes are checked
863 function areAllChecked(){
864 var checkboxes = document.getElementsByTagName('input');
865 var nbCheckbox = checkboxes.length;
866 for(var i=0;i<nbCheckbox;i++){
867 if(checkboxes[i].getAttribute('type') == "checkbox" ){
868 if(checkboxes[i].checked == 0){
876 function placeHold () {
877 var checkedItems = $(".selection:checked");
878 if ($(checkedItems).size() == 0) {
879 alert(MSG_NO_ITEM_SELECTED);
882 $(checkedItems).each(function() {
883 var bib_param = $("<input>").attr("type", "hidden").attr("name", "biblionumber").val($(this).val());
884 $('#hold_form').append(bib_param);
886 $("#hold_form").submit();
891 var checkboxes = $("#searchresults").find(":checkbox");
892 var vshelf = vShelfAdd(checkboxes);
893 if($("#addto").find("option:selected").val() == "addtolist"){
894 var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
896 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf,'popup',500,500);
899 } else if($("#addto").find("option:selected").val() == "newlist"){
901 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf,'popup',500,500);
904 } else if($("#addto").find("option:selected").val() == "morelists"){
906 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf,'popup',500,500);
910 if($("#addto").find("option:selected").val() == "addtocart"){
911 addMultiple(checkboxes);
916 function AdjustRemark() {
917 var public = $("#public").val();
918 var perms = $("#allow_changes_from").val();
921 $("#anyone_remark").hide();
922 $("#staff_remark").hide();
923 $("#permitted_staff_remark").hide();
924 } else if( public==0 ) {
925 // If we move to Private (without shares), show Anyone remark
926 // Note: the number of shares is not tested real-time
927 [% IF !shelf.is_shared %]
929 $("#anyone_remark").show();
930 $("#staff_remark").hide();
931 $("#permitted_staff_remark").hide();
932 } else if ( perms==3 ) {
933 $("#anyone_remark").hide();
934 $("#staff_remark").show();
935 $("#permitted_staff_remark").hide();
936 } else if ( perms==4 ) {
937 $("#anyone_remark").hide();
938 $("#staff_remark").hide();
939 $("#permitted_staff_remark").show();
942 $("#anyone_remark").hide();
943 $("#staff_remark").hide();
944 $("#permitted_staff_remark").hide();
946 } else { // public==1
947 $("#anyone_remark").hide();
948 $("#staff_remark").hide();
949 $("#permitted_staff_remark").hide();
952 [% IF op == 'view' %]
955 openWindow( CGIBIN + 'virtualshelves/sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]' );
958 $(document).ready(function() {
959 $("#sendlist").click(function(){
963 $("#deleteshelf").click(function(e){
964 if(confirm(_("Are you sure you want to delete this list?"))){
970 $("#deleteshelf_toolbar").on('click',function(e){
971 if(confirm(_("Are you sure you want to delete this list?"))){
972 $("#deleteshelf_toolbar_form").submit();
982 [% IF op == 'transfer' %]
983 $(document).ready(function() {
984 patron_autocomplete( $("#find_patron"), { 'on-select-callback': function( event, ui ) {
985 $('#new_owner_name').html( ui.item.firstname + " " + ui.item.surname );
986 $('#new_owner').val( ui.item.patron_id );
987 $('#find_patron').val('').focus();
991 $('#transferform').submit(function() {
992 if( $('#new_owner').val() == '' ) {
993 alert( _("Please select a new owner first") );
1003 [% INCLUDE 'intranet-bottom.inc' %]