5 [% USE AuthorisedValues %]
8 [% INCLUDE 'doc-head-open.inc' %]
11 Contents of [% shelf.shelfname | html %] › [% END %]
13 [% IF op == 'add_form' %]
14 Create new list › [% END %]
16 [% IF op == 'edit_form' %]
17 Edit list [% shelf.shelfname | html %] › [% END %]
20 [% INCLUDE 'doc-head-close.inc' %]
21 <style>textarea { width: 100%; }</style>
23 [% BLOCK list_permissions %]
25 <label for="allow_changes_from">Allow changes to contents from: </label>
26 <select name="allow_changes_from" id="allow_changes_from" onchange="AdjustRemark()">
28 [% IF shelf.allow_change_from_owner %]
29 <option value="0">Nobody</option>
31 <option value="0" selected="selected">Nobody</option>
34 [% IF shelf.allow_change_from_owner && (( !shelf.is_public && !shelf.is_shared ) || !shelf.allow_change_from_others ) %]
35 <option value="1" selected="selected">Owner only</option>
37 <option value="1">Owner only</option>
40 [% IF shelf.allow_change_from_permitted_staff %]
41 <option value="4" selected="selected">Permitted staff only</option>
43 <option value="4">Permitted staff only</option>
45 [% IF shelf.allow_change_from_staff %]
46 <option value="3" selected="selected">Staff only</option>
48 <option value="3">Staff only</option>
51 [% IF shelf.allow_change_from_others %]
52 <option value="2" selected="selected">Anyone seeing this list</option>
54 <option value="2">Anyone seeing this list</option>
58   <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>
59   <span id="staff_remark" style="display:none;color:red;">The Staff only permission has no actual effect while this list is strictly private.</span>
60   <span id="anyone_remark" style="display:none;color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
65 <body id="lists_shelves" class="lists">
66 [% WRAPPER 'header.inc' %]
67 [% INCLUDE 'cat-search.inc' %]
70 [% WRAPPER 'sub-header.inc' %]
71 [% WRAPPER breadcrumbs %]
73 [% WRAPPER breadcrumb_item %]
74 <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a>
77 [% WRAPPER breadcrumb_item bc_active= 1 %]
82 [% IF shelf AND shelf.is_private %]
83 [% IF op == 'view' OR op == 'edit_form' %]
84 [% WRAPPER breadcrumb_item %]
85 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0">Your lists</a>
88 [% WRAPPER breadcrumb_item bc_active= 1 %]
89 <span>Your lists</span>
93 [% ELSIF shelf AND shelf.is_public %]
95 [% WRAPPER breadcrumb_item %]
96 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1">Public lists</a>
99 [% WRAPPER breadcrumb_item bc_active= 1 %]
100 <span>Public lists</span>
105 [% IF op == 'view' %]
106 [% WRAPPER breadcrumb_item bc_active= 1 %]
107 <span>Contents of <em>[% shelf.shelfname | html %]</em></span>
111 [% IF op == 'add_form' %]
112 [% WRAPPER breadcrumb_item bc_active= 1 %]
113 <span>Create new list</span>
117 [% IF op == 'edit_form' %]
118 [% WRAPPER breadcrumb_item bc_active= 1 %]
119 <span>Edit list <em>[% shelf.shelfname | html %]</em></span>
123 [% IF op == 'transfer' %]
124 [% WRAPPER breadcrumb_item bc_active= 1 %]
125 <span>Transfer list <em>[% shelf.shelfname | html %]</em></span>
128 [% END #/ WRAPPER breadcrumbs %]
129 [% END #/ WRAPPER sub-header.inc %]
131 <div class="main container-fluid">
133 <div class="col-sm-10 col-sm-push-1">
136 [% IF op != 'transfer' %][% INCLUDE 'virtualshelves-toolbar.inc' %][% END %]
138 [% FOR m IN messages %]
139 <div class="dialog [% m.type | html %]">
141 [% CASE 'error_on_update' %]
142 <span>An error occurred when updating this list.</span>
143 [% CASE 'error_on_insert' %]
144 <span>An error occurred when creating this list.</span>
145 [% CASE 'error_on_delete' %]
146 <span>An error occurred when deleting this list.</span>
147 [% CASE 'error_on_add_biblio' %]
148 [% IF m.item_barcode %]
149 <span>The item ([% m.item_barcode | html %]) has not been added to the list. Please verify it is not already in the list.</span>
151 <span>The record ([% m.bibnum | html %]) has not been added to the list. Please verify it is not already in the list.</span>
153 [% CASE 'success_on_update' %]
154 <span>List updated.</span>
155 [% CASE 'success_on_insert' %]
156 <span>List created.</span>
157 [% CASE 'success_on_delete' %]
158 <span>List deleted.</span>
159 [% CASE 'success_on_add_biblio' %]
160 [% IF m.item_barcode %]
161 <span>The item ([% m.item_barcode | html %]) has been added to the list.</span>
163 <span>The record ([% m.bibnum | html %]) has been added to the list.</span>
165 [% CASE 'success_on_remove_biblios' %]
166 <span>The item has been removed from the list.</span>
167 [% CASE 'does_not_exist' %]
168 <span>This list does not exist.</span>
169 [% CASE 'item_does_not_exist' %]
170 [% IF m.item_barcode %]
171 <span>The item ([% m.item_barcode | html %]) does not exist.</span>
173 <span>The record ([% m.bibnum | html %]) does not exist.</span>
175 [% CASE 'unauthorized_on_view' %]
176 <span>You do not have permission to view this list.</span>
177 [% CASE 'unauthorized_on_update' %]
178 <span>You do not have permission to update this list.</span>
179 [% CASE 'unauthorized_on_delete' %]
180 <span>You do not have permission to delete this list.</span>
181 [% CASE 'unauthorized_on_add_biblio' %]
182 <span>You do not have permission to add a record to this list.</span>
183 [% CASE 'unauthorized_transfer' %]
184 <span>You do not have permission to transfer ownership of this list.</span>
185 [% CASE 'new_owner_not_found' %]
186 <span>The new owner could not be found anymore.</span>
187 [% CASE 'no_biblio_removed' %]
188 <span>No record was removed.</span>
190 [% CASE 'Koha::Exceptions::Virtualshelf::DuplicateObject' %]
191 <span>An error occurred when creating this list. The name [% shelfname | html %] already exists.</span>
192 [% CASE 'Koha::Exceptions::Virtualshelf::UseDbAdminAccount' %]
193 <span>List could not be created. (Do not use the database administrator account.)</span>
194 [% CASE 'DBIx::Class::Exception' %]
198 [% m.code | html %] [% m.msg | html %]
201 [% END # /FOR m IN messages %]
203 [% IF op == 'transfer' %]
204 <h1>Transfer ownership of public list [% shelf.shelfname | html %]</h1>
206 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="transferform" method="post">
207 [% INCLUDE 'csrf-token.inc' %]
209 <input type="hidden" name="op" value="transfer" />
210 <input type="hidden" name="public" value="1" />
211 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
214 <label for="find_patron">Search for new owner: </label>
215 <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
220 <label for="find_patron">New owner: </label>
221 <span id="new_owner_name"></span>
222 <input type="hidden" id="new_owner" name="new_owner" value="" />
226 <fieldset class="action">
227 <input type="submit" class="btn btn-primary" value="Transfer" />
228 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1" class="cancel">Cancel</a>
233 [% END # /IF op == transfer %]
235 [% IF op == 'view' %]
236 <h1>Contents of <em>[% shelf.shelfname | html %]</em></h1>
238 [% SET contents = shelf.get_contents %]
239 [% IF ( contents.count ) %]<p>This list contains [% contents.count | html %] titles</p>[% END %]
240 <div class="pages">[% pagination_bar | $raw %]</div>
241 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post">
242 [% INCLUDE 'csrf-token.inc' %]
243 <input type="hidden" name="op" value="remove_biblios" />
244 <input type="hidden" name="referer" value="view" />
245 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
247 [% IF direction == 'asc' %]
248 [% SET new_direction = 'desc' %]
250 [% SET direction = 'desc' %]
251 [% SET new_direction = 'asc' %]
255 <div id="searchheader" class="searchheader noprint">
256 <div id="selection_ops">
257 <span class="checkall"></span> |
258 <span class="clearall"></span>
260 <span class="addto">| </span>
262 [% IF CAN_user_reserveforothers && Koha.Preference('DisplayMultiPlaceHold') %]
263 <div class="btn-group"><button class="btn btn-default btn-xs placehold"><i class="fa-solid fa-bookmark"></i> Place hold</button></div>
265 [% IF can_remove_biblios %]
266 <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>
268 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
269 <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>
275 <div class="page-section">
276 <table id="searchresults" class="dataTable">
279 [% IF ( itemsloop ) %]
280 <th class="checkall"> </th>
282 [% UNLESS ( item_level_itypes ) %]
285 [% IF sortfield == 'title' %]
286 <th class="sorting_[% direction | html %]">
290 <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>
292 [% IF sortfield == 'author' %]
293 <th class="sorting_[% direction | html %]">
297 <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>
299 [% IF sortfield == 'dateadded' %]
300 <th class="sorting_[% direction | html %]">
304 <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>
306 [% IF sortfield == 'itemcallnumber' %]
307 <th class="sorting_[% direction | html %]">
311 <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>
315 [% FOREACH itemsloo IN itemsloop %]
319 <input type="checkbox" class="selection" value="[% itemsloo.biblionumber | html %]" name="biblionumber" />
322 [% UNLESS ( item_level_itypes ) %]
324 [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]
325 <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
327 <span class="itypetext">[% itemsloo.description | html %]</span>
331 [% IF ( itemsloo.XSLTBloc ) %]
332 [% itemsloo.XSLTBloc | $raw %]
334 [% INCLUDE 'biblio-title.inc' biblio=itemsloo link = 1 %]
338 [% IF ( itemsloo.notforloan ) %]
339 <span class="noholdstext">No holds allowed</span>
341 [% IF ( itemsloo.ITEM_RESULTS.count ) %]
342 <a id="reserve_[% itemsloo.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | html %]">Holds</a>
344 <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>
347 <span class="noholdstext">No holds allowed</span>
350 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
351 | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit record</a>
353 [% IF ( CAN_user_editcatalogue_edit_items ) %]
354 | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit items</a>
359 [% itemsloo.author | html %]
362 [% itemsloo.dateadded | $KohaDates%]
366 [% FOREACH item IN itemsloo.ITEM_RESULTS %]
368 [% Branches.GetName(item.holdingbranch) | html %]
369 [% IF ( item.location ) %]
370 <span class="shelvingloc">
371 [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]
374 [% IF ( item.itemcallnumber ) %]
375 [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=%22[% item.itemcallnumber | uri %]%22">[% item.itemcallnumber | html %]</a>]
378 [% END # /FOREACH item %]
382 [% END #/FOREACH itemsloo %]
383 </table> <!-- /#searchresults -->
384 </div> <!-- /.page-section -->
386 <div class="pages">[% pagination_bar | $raw %]</div>
388 [% END # /IF itemsloop %]
389 [% END # /IF op == 'view' %]
391 [% IF op == 'add_form' OR op == 'edit_form' %]
393 <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl" class="validated">
394 [% INCLUDE 'csrf-token.inc' %]
395 <fieldset class="rows">
396 [% IF op == 'add_form' %]
397 <legend><h1>Create a new list</h1></legend>
398 <input type="hidden" name="op" value="add" />
400 <legend><h1>Edit list <em>[% shelf.shelfname | html %]</em></h1></legend>
401 <input type="hidden" name="op" value="edit" />
403 <input type="hidden" name="referer" value="[% referer | html %]" />
404 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
407 <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" />
408 <span class="required">Required</span>
411 <span class="label">Owner: </span>
412 [% IF op == 'add_form' %]
413 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />[% logged_in_user.userid | html %]
416 <input type="hidden" id="owner" name="owner" value="[% owner.borrowernumber | html %]" />[% owner.firstname _ ' ' _ owner.surname | html %]
418 <input type="hidden" id="owner" name="owner" value="[% loggedinusernumber | html %]" />[% logged_in_user.userid | html %]
423 <label for="sortfield" >Sort this list by: </label>
424 <select name="sortfield">
425 [% IF shelf.sortfield == "title" %]
426 <option value="title" selected="selected">Title</option>
428 <option value="title">Title</option>
430 [% IF shelf.sortfield == "author" %]
431 <option value="author" selected="selected">Author</option>
433 <option value="author">Author</option>
435 [% IF shelf.sortfield == "copyrightdate" %]
436 <option value="copyrightdate" selected="selected">Copyrightdate</option>
438 <option value="copyrightdate">Copyrightdate</option>
440 [% IF shelf.sortfield == "itemcallnumber" %]
441 <option value="itemcallnumber" selected="selected">Call number</option>
443 <option value="itemcallnumber">Call number</option>
445 [% IF shelf.sortfield == "dateadded" %]
446 <option value="dateadded" selected="selected">Date added</option>
448 <option value="dateadded">Date added</option>
453 <label for="public">Public: </label>
454 <select id="public" name="public" onchange="AdjustRemark()">
455 [% IF shelf.is_private %]
456 <option value="0" selected="selected">Private</option>
458 <option value="0">Private</option>
460 [% IF shelf.is_public %]
461 <option value="1" selected="selected">Public</option>
463 <option value="1">Public</option>
467 [% INCLUDE list_permissions %]
471 <fieldset class="action">
472 <input type="submit" class="btn btn-primary" value="Save" />
473 [% IF referer == 'view' %]
474 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
477 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1" class="cancel">Cancel</a>
479 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0" class="cancel">Cancel</a>
484 [% END # /IF op == 'add_form'... %]
486 [% IF op == 'list' %]
489 [% WRAPPER tabs id= "tabs" %]
490 [% WRAPPER tabs_nav %]
491 [% WRAPPER tab_item tabname= "privateshelves_tab" bt_active= 1 %] <span>Your lists</span> [% END %]
492 [% WRAPPER tab_item tabname= "publicshelves_tab" %] <span>Public lists</span> [% END %]
493 [% END # /WRAPPER tabs_nav %]
495 [% WRAPPER tab_panels %]
496 [% WRAPPER tab_panel tabname="shelves_tab" bt_active= 1 %]
497 <table id="listresultst">
500 <th class="NoVisible">Type</th>
506 <th>Creation date</th>
507 <th>Modification date</th>
508 <th class="noExport">Actions</th>
510 <tr class="filters_row">
512 <th><input class="filter text_filter" id="searchshelfname_filter" placeholder="List name"></th>
515 <th><input class="filter text_filter" id="searchowner_filter" placeholder="Owner"></th>
517 <select class="filter text_filter" id="searchsortby_filter">
518 <option value=""></option>
519 <option value="title">Title</option>
520 <option value="author">Author</option>
521 <option value="copyrightdate">Copyrightdate</option>
522 <option value="itemcallnumber">Call number</option>
523 <option value="dateadded">Date added</option>
532 </table> <!-- /#listresultst -->
534 [% END # /WRAPPER tab_panels %]
535 [% END # /WRAPPER tabs %]
537 [% END # /IF op == 'list' %]
539 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
540 <!-- Values will be set here by placeHold() -->
544 </div> <!-- /.col-sm-10.col-sm-push-2 -->
545 </div> <!-- /.row -->
547 [% IF ( can_add_biblios ) %]
549 <div class="modal" id="addToList" tabindex="-1" role="dialog" aria-labelledby="addToListLabel">
550 <div class="modal-dialog" role="document">
551 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
552 [% INCLUDE 'csrf-token.inc' %]
553 <div class="modal-content">
554 <div class="modal-header">
555 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
556 <h4 class="modal-title" id="addToListLabel">Add items</h4>
558 <div class="modal-body">
559 <fieldset class="brief">
562 <label for="barcodes">Barcodes:</label>
563 <textarea name="barcodes" id="barcodes" rows="5"></textarea>
564 <input type="hidden" name="op" value="add_biblio" />
565 <input type="hidden" name="referer" value="view" />
566 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
569 <label for="biblionumbers">Biblio numbers:</label>
570 <textarea name="biblionumbers" id="biblionumbers" rows="5"></textarea>
571 <input type="hidden" name="op" value="add_biblio" />
572 <input type="hidden" name="referer" value="view" />
573 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
577 </div> <!-- /.modal-body -->
578 <div class="modal-footer">
579 <button type="submit" class="btn btn-default">Save</button>
580 <a href="#" data-dismiss="modal" class="cancel">Cancel</a>
584 </div> <!-- /.modal-dialog -->
585 </div> <!-- /#addToList -->
586 [% END # IF /( can_add_biblios ) %]
588 [% MACRO jsinclude BLOCK %]
589 [% INCLUDE 'datatables.inc' %]
590 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
593 $( document ).ready(function() {
595 window.onafterprint = function () {
598 setTimeout('window.close()', 1000); // Hack for Chrome < 63
603 [% IF op == 'view' %]
604 [% Asset.js("lib/hc-sticky.js") | $raw %]
607 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
608 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
609 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to remove this list?");
611 [% IF op == 'list' %]
612 $(document).ready(function(){
613 var public = [% public | html %];
615 var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
616 "aaSorting": [[ 5, "asc" ]],
618 'sAjaxSource': "/cgi-bin/koha/svc/virtualshelves/search",
619 'fnServerData': function(sSource, aoData, fnCallback) {
625 'value': $("#searchshelfname_filter").val(),
628 'value': $("#searchowner_filter").val(),
631 'value': $("#searchsortby_filter").val(),
633 'name': 'template_path',
634 'value': 'virtualshelves/tables/shelves_results.tt',
636 'name': 'allow_transfer',
637 'value': '[% allow_transfer | html %]',
639 'name': 'shelfname_sorton',
640 'value': 'vs.shelfname',
642 'name': 'is_shared_sorton',
643 'value': 'vs.public',
645 'name': 'owner_sorton',
648 'name': 'sortby_sorton',
649 'value': 'vs.sortfield',
651 'name': 'created_on_sorton',
652 'value': 'vs.created_on',
654 'name': 'modification_time_sorton',
655 'value': 'vs.lastmodified',
662 'success': function(json){
668 { 'mDataProp': 'dt_public' },
669 { 'mDataProp': 'dt_shelfname' },
670 { 'mDataProp': 'dt_count' },
671 { 'mDataProp': 'dt_is_shared' },
672 { 'mDataProp': 'dt_owner' },
673 { 'mDataProp': 'dt_sortby' },
674 { 'mDataProp': 'dt_created_on' },
675 { 'mDataProp': 'dt_modification_time' },
676 { 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' }
679 { "bVisible": false, "aTargets": [ 'NoVisible' ] }
682 'sPaginationType': 'full_numbers',
685 "bSortCellsTop": true
688 dtListResults.fnAddFilters("filter", 750);
690 /* Select correct tab based on URL parameter */
692 $('a[href="#privateshelves_tab_panel"]').tab('show');
694 $('a[href="#publicshelves_tab_panel"]').tab("show");
697 $('a[data-toggle="tab"]').on("click", function(e){
698 let target = $(this).attr("href");
699 if( target == "#publicshelves_tab_panel" ){
705 .on('shown.bs.tab', function (e) {
706 dtListResults.fnDraw();
709 $("body").on("click", ".deleteshelf", function(){
710 return confirmDelete(MSG_CONFIRM_DELETE_LIST);
713 [% END # /IF op == 'list' %]
715 [% IF shelf AND op == 'view' %]
717 $(document).ready(function(){
718 Sticky = $("#searchheader");
720 stickTo: "#listform",
721 stickyClass: "floating"
723 $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-times\"></i>"+_(" Clear all")+"<\/a>");
724 $("span.checkall").html("<a id=\"CheckAll\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-check\"></i>"+_(" Select all")+"<\/a>");
725 $("#CheckAll").click(function(e){
727 $(".selection").each(function(){
728 $(this).prop("checked", true);
732 $("#CheckNone").click(function(e){
734 $(".selection").each(function(){
735 $(this).prop("checked", false);
738 $(".placehold").on("click",function(e){
742 $(".addtocart").show();
743 var param1 = "| <label for=\"addto\">"+_("Add to:")+"<\/label><select name=\"addto\" id=\"addto\"><option value=\"\"><\/option>";
744 [% IF (Koha.Preference("intranetbookbag")) %]
745 param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>";
747 [% IF Koha.Preference('virtualshelves') %]
748 [% IF add_to_some_private_shelves.count %]
749 param1 += "<optgroup label=\""+_("Your lists:")+"\">";
750 [% SET number_of_private_shelves = 0 %]
751 [% FOREACH s IN add_to_some_private_shelves %]
752 [% IF shelfnumber != s.shelfnumber %]
753 param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
754 [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
755 [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
758 param1 += "<\/optgroup>";
760 [% IF add_to_some_public_shelves.count %]
761 param1 += "<optgroup label=\""+_("Public lists:")+"\">";
762 [% SET number_of_public_shelves = 0 %]
763 [% FOREACH s IN add_to_some_public_shelves %]
764 [% IF shelfnumber != s.shelfnumber %]
765 param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
766 [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
767 [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
770 param1 += "<\/optgroup>";
772 [% IF add_to_some_private_shelves.count > 10 or add_to_some_public_shelves.count > 10 %]
773 param1 += "<option value=\"morelists\">[ "+_("More lists")+" ]<\/option>";
775 param1 +="<option value=\"newlist\">"+_("[ New list ]")+"<\/option>"
777 param1 += "<\/select> <button id=\"cartsubmit\" type=\"submit\" class=\"btn btn-default btn-xs\">"+_("Save")+"</button>";
778 $("span.addto").html(param1);
779 $("#cartsubmit").on("click",function(e){
783 $("#addto").change(function(){
786 $(".addto").find("input:submit").click(function(e){
790 $("#selection_ops").show();
791 $(".merge-items").on("click",function(e){
795 $("#listform").on("submit",function(e){
798 $(".list-remove").on("click",function(e){
799 if($(".selection").filter(":checked").length > 0){
800 return confirm(MSG_REMOVE_FROM_LIST);
802 alert(MSG_NO_ITEM_SELECTED);
806 $("#addToList").on("shown.bs.modal", function(e){
807 $("#barcodes").focus();
810 [% END # /IF shelf %]
812 [% IF shelf AND op == 'edit_form' %]
813 $(document).ready(function(){
819 * This function checks if the adequate number of records are checked for merging
821 function MergeItems() {
822 var checkboxes = $("input:checkbox:checked");
823 if (checkboxes.length < 2) {
824 alert(_("At least two records must be selected for merging."));
827 $(checkboxes).each(function() {
828 params.push('biblionumber=' + $(this).val());
830 var url = '/cgi-bin/koha/cataloguing/merge.pl?' + params.join('&');
837 * This function checks all checkboxes if all are empty,
838 * or unchecks all if any already checked.
841 var checkboxes = document.getElementsByTagName('input');
842 var nbCheckbox = checkboxes.length;
843 var check = areAllChecked();
844 for(var i=0;i<nbCheckbox;i++){
845 if(checkboxes[i].getAttribute('type') == "checkbox" ){
846 checkboxes[i].checked = (check) ? 0 : 1;
851 * This function returns true if ALL checkboxes are checked
853 function areAllChecked(){
854 var checkboxes = document.getElementsByTagName('input');
855 var nbCheckbox = checkboxes.length;
856 for(var i=0;i<nbCheckbox;i++){
857 if(checkboxes[i].getAttribute('type') == "checkbox" ){
858 if(checkboxes[i].checked == 0){
866 function placeHold () {
867 var checkedItems = $(".selection:checked");
868 if ($(checkedItems).size() == 0) {
869 alert(MSG_NO_ITEM_SELECTED);
872 $(checkedItems).each(function() {
873 var bib_param = $("<input>").attr("type", "hidden").attr("name", "biblionumber").val($(this).val());
874 $('#hold_form').append(bib_param);
876 $("#hold_form").submit();
881 var checkboxes = $("#searchresults").find(":checkbox");
882 var vshelf = vShelfAdd(checkboxes);
883 if($("#addto").find("option:selected").val() == "addtolist"){
884 var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
886 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf,'popup',500,500);
889 } else if($("#addto").find("option:selected").val() == "newlist"){
891 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf,'popup',500,500);
894 } else if($("#addto").find("option:selected").val() == "morelists"){
896 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf,'popup',500,500);
900 if($("#addto").find("option:selected").val() == "addtocart"){
901 addMultiple(checkboxes);
906 function AdjustRemark() {
907 var public = $("#public").val();
908 var perms = $("#allow_changes_from").val();
911 $("#anyone_remark").hide();
912 $("#staff_remark").hide();
913 $("#permitted_staff_remark").hide();
914 } else if( public==0 ) {
915 // If we move to Private (without shares), show Anyone remark
916 // Note: the number of shares is not tested real-time
917 [% IF !shelf.is_shared %]
919 $("#anyone_remark").show();
920 $("#staff_remark").hide();
921 $("#permitted_staff_remark").hide();
922 } else if ( perms==3 ) {
923 $("#anyone_remark").hide();
924 $("#staff_remark").show();
925 $("#permitted_staff_remark").hide();
926 } else if ( perms==4 ) {
927 $("#anyone_remark").hide();
928 $("#staff_remark").hide();
929 $("#permitted_staff_remark").show();
932 $("#anyone_remark").hide();
933 $("#staff_remark").hide();
934 $("#permitted_staff_remark").hide();
936 } else { // public==1
937 $("#anyone_remark").hide();
938 $("#staff_remark").hide();
939 $("#permitted_staff_remark").hide();
942 [% IF op == 'view' %]
945 open(CGIBIN+'virtualshelves/sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
948 $(document).ready(function() {
949 $("#sendlist").click(function(){
953 $("#deleteshelf").click(function(e){
954 if(confirm(_("Are you sure you want to delete this list?"))){
964 [% IF op == 'transfer' %]
965 $(document).ready(function() {
966 patron_autocomplete( $("#find_patron"), { 'on-select-callback': function( event, ui ) {
967 $('#new_owner_name').html( ui.item.firstname + " " + ui.item.surname );
968 $('#new_owner').val( ui.item.patron_id );
969 $('#find_patron').val('').focus();
973 $('#transferform').submit(function() {
974 if( $('#new_owner').val() == '' ) {
975 alert( _("Please select a new owner first") );
986 [% INCLUDE 'intranet-bottom.inc' %]