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_others %]
41 <option value="2" selected="selected">Anyone seeing this list</option>
43 <option value="2">Anyone seeing this list</option>
46 [% IF shelf.allow_change_from_staff %]
47 <option value="3" selected="selected">Staff only</option>
49 <option value="3">Staff only</option>
52   <span id="anyone_remark" style="display:none;color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
53   <span id="staff_remark" style="display:none;color:red;">The Staff only permission has no actual effect while this list is strictly private.</span>
58 <body id="lists_shelves" class="lists">
59 [% WRAPPER 'header.inc' %]
60 [% INCLUDE 'cat-search.inc' %]
63 [% WRAPPER 'sub-header.inc' %]
64 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
67 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
72 <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a>
76 <a href="#" aria-current="page">
82 [% IF shelf AND shelf.is_private %]
83 [% IF op == 'view' OR op == 'edit_form' %]
85 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0">Your lists</a>
89 <a href="#" aria-current="page">
95 [% ELSIF shelf AND shelf.is_public %]
98 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1">Public lists</a>
102 <a href="#" aria-current="page">
109 [% IF op == 'view' %]
111 <a href="#" aria-current="page">
112 Contents of <em>[% shelf.shelfname | html %]</em>
117 [% IF op == 'add_form' %]
119 <a href="#" aria-current="page">
125 [% IF op == 'edit_form' %]
127 <a href="#" aria-current="page">
128 Edit list <em>[% shelf.shelfname | html %]</em>
133 [% IF op == 'transfer' %]
135 <a href="#" aria-current="page">Transfer list <em>[% shelf.shelfname | html %]</em></a>
142 <div class="main container-fluid">
144 <div class="col-sm-10 col-sm-push-1">
147 [% IF op != 'transfer' %][% INCLUDE 'virtualshelves-toolbar.inc' %][% END %]
149 [% FOR m IN messages %]
150 <div class="dialog [% m.type | html %]">
152 [% CASE 'error_on_update' %]
153 <span>An error occurred when updating this list.</span>
154 [% CASE 'error_on_insert' %]
155 <span>An error occurred when creating this list.</span>
156 [% CASE 'error_on_delete' %]
157 <span>An error occurred when deleting this list.</span>
158 [% CASE 'error_on_add_biblio' %]
159 [% IF m.item_barcode %]
160 <span>The item ([% m.item_barcode | html %]) has not been added to the list. Please verify it is not already in the list.</span>
162 <span>The record ([% m.bibnum | html %]) has not been added to the list. Please verify it is not already in the list.</span>
164 [% CASE 'success_on_update' %]
165 <span>List updated.</span>
166 [% CASE 'success_on_insert' %]
167 <span>List created.</span>
168 [% CASE 'success_on_delete' %]
169 <span>List deleted.</span>
170 [% CASE 'success_on_add_biblio' %]
171 [% IF m.item_barcode %]
172 <span>The item ([% m.item_barcode | html %]) has been added to the list.</span>
174 <span>The record ([% m.bibnum | html %]) has been added to the list.</span>
176 [% CASE 'success_on_remove_biblios' %]
177 <span>The item has been removed from the list.</span>
178 [% CASE 'does_not_exist' %]
179 <span>This list does not exist.</span>
180 [% CASE 'item_does_not_exist' %]
181 [% IF m.item_barcode %]
182 <span>The item ([% m.item_barcode | html %]) does not exist.</span>
184 <span>The record ([% m.bibnum | html %]) does not exist.</span>
186 [% CASE 'unauthorized_on_view' %]
187 <span>You do not have permission to view this list.</span>
188 [% CASE 'unauthorized_on_update' %]
189 <span>You do not have permission to update this list.</span>
190 [% CASE 'unauthorized_on_delete' %]
191 <span>You do not have permission to delete this list.</span>
192 [% CASE 'unauthorized_on_add_biblio' %]
193 <span>You do not have permission to add a record to this list.</span>
194 [% CASE 'unauthorized_transfer' %]
195 <span>You do not have permission to transfer ownership of this list.</span>
196 [% CASE 'new_owner_not_found' %]
197 <span>The new owner could not be found anymore.</span>
198 [% CASE 'no_biblio_removed' %]
199 <span>No record was removed.</span>
201 [% CASE 'Koha::Exceptions::Virtualshelf::DuplicateObject' %]
202 <span>An error occurred when creating this list. The name [% shelfname | html %] already exists.</span>
203 [% CASE 'Koha::Exceptions::Virtualshelf::UseDbAdminAccount' %]
204 <span>List could not be created. (Do not use the database administrator account.)</span>
205 [% CASE 'DBIx::Class::Exception' %]
209 [% m.code | html %] [% m.msg | html %]
212 [% END # /FOR m IN messages %]
214 [% IF op == 'transfer' %]
215 <h1>Transfer ownership of public list [% shelf.shelfname | html %]</h1>
217 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="transferform" method="post">
219 <input type="hidden" name="op" value="transfer" />
220 <input type="hidden" name="public" value="1" />
221 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
224 <label for="find_patron">Search for new owner: </label>
225 <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
230 <label for="find_patron">New owner: </label>
231 <span id="new_owner_name"></span>
232 <input type="hidden" id="new_owner" name="new_owner" value="" />
236 <fieldset class="action">
237 <input type="submit" value="Transfer" class="submit" />
238 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1" class="cancel">Cancel</a>
243 [% END # /IF op == transfer %]
245 [% IF op == 'view' %]
246 <h1>Contents of <em>[% shelf.shelfname | html %]</em></h1>
248 <div class="pages">[% pagination_bar | $raw %]</div>
249 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post">
250 <input type="hidden" name="op" value="remove_biblios" />
251 <input type="hidden" name="referer" value="view" />
252 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
254 [% IF direction == 'asc' %]
255 [% SET new_direction = 'desc' %]
257 [% SET direction = 'desc' %]
258 [% SET new_direction = 'asc' %]
262 <div id="searchheader" class="searchheader noprint">
263 <div id="selection_ops">
264 <span class="checkall"></span> |
265 <span class="clearall"></span>
267 <span class="addto">| </span>
269 [% IF CAN_user_reserveforothers && Koha.Preference('DisplayMultiPlaceHold') %]
270 <div class="btn-group"><button class="btn btn-default btn-xs placehold"><i class="fa fa-sticky-note-o"></i> Place hold</button></div>
272 [% IF can_remove_biblios %]
273 <div class="btn-group"><button type="submit" class="btn btn-default btn-xs list-remove"><i class="fa fa-trash"></i> Remove selected</button></div>
275 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
276 <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>
282 <table id="searchresults" class="dataTable">
285 [% IF ( itemsloop ) %]
286 <th class="checkall"> </th>
288 [% UNLESS ( item_level_itypes ) %]
291 [% IF sortfield == 'title' %]
292 <th class="sorting_[% direction | html %]">
296 <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>
298 [% IF sortfield == 'author' %]
299 <th class="sorting_[% direction | html %]">
303 <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>
305 [% IF sortfield == 'dateadded' %]
306 <th class="sorting_[% direction | html %]">
310 <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>
312 [% IF sortfield == 'itemcallnumber' %]
313 <th class="sorting_[% direction | html %]">
317 <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>
321 [% FOREACH itemsloo IN itemsloop %]
325 <input type="checkbox" class="selection" value="[% itemsloo.biblionumber | html %]" name="biblionumber" />
328 [% UNLESS ( item_level_itypes ) %]
330 [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]
331 <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
333 [% itemsloo.description | html %]
337 [% IF ( itemsloo.XSLTBloc ) %]
338 [% itemsloo.XSLTBloc | $raw %]
340 [% INCLUDE 'biblio-title.inc' biblio=itemsloo link = 1 %]
344 [% IF ( itemsloo.notforloan ) %]
345 <span class="noholdstext">No holds allowed</span>
347 [% IF ( itemsloo.ITEM_RESULTS.count ) %]
348 <a id="reserve_[% itemsloo.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | html %]">Holds</a>
350 <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>
353 <span class="noholdstext">No holds allowed</span>
356 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
357 | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit record</a>
359 [% IF ( CAN_user_editcatalogue_edit_items ) %]
360 | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit items</a>
365 [% itemsloo.author | html %]
368 [% itemsloo.dateadded | $KohaDates%]
372 [% FOREACH item IN itemsloo.ITEM_RESULTS %]
374 [% Branches.GetName(item.holdingbranch) | html %]
375 [% IF ( item.location ) %]
376 <span class="shelvingloc">
377 [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]
380 [% IF ( item.itemcallnumber ) %]
381 [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=%22[% item.itemcallnumber | uri %]%22">[% item.itemcallnumber | html %]</a>]
384 [% END # /FOREACH item %]
388 [% END #/FOREACH itemsloo %]
389 </table> <!-- /#searchresults -->
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 <fieldset class="rows">
399 [% IF op == 'add_form' %]
400 <legend><h1>Create a new list</h1></legend>
401 <input type="hidden" name="op" value="add" />
403 <legend><h1>Edit list <em>[% shelf.shelfname | html %]</em></h1></legend>
404 <input type="hidden" name="op" value="edit" />
406 <input type="hidden" name="referer" value="[% referer | html %]" />
407 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
410 <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" />
411 <span class="required">Required</span>
414 <span class="label">Owner: </span>
415 [% IF op == 'add_form' %]
416 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />[% logged_in_user.userid | html %]
419 <input type="hidden" id="owner" name="owner" value="[% owner.borrowernumber | html %]" />[% owner.firstname _ ' ' _ owner.surname | html %]
421 <input type="hidden" id="owner" name="owner" value="[% loggedinusernumber | html %]" />[% logged_in_user.userid | html %]
426 <label for="sortfield" >Sort this list by: </label>
427 <select name="sortfield">
428 [% IF shelf.sortfield == "title" %]
429 <option value="title" selected="selected">Title</option>
431 <option value="title">Title</option>
433 [% IF shelf.sortfield == "author" %]
434 <option value="author" selected="selected">Author</option>
436 <option value="author">Author</option>
438 [% IF shelf.sortfield == "copyrightdate" %]
439 <option value="copyrightdate" selected="selected">Copyrightdate</option>
441 <option value="copyrightdate">Copyrightdate</option>
443 [% IF shelf.sortfield == "itemcallnumber" %]
444 <option value="itemcallnumber" selected="selected">Call number</option>
446 <option value="itemcallnumber">Call number</option>
448 [% IF shelf.sortfield == "dateadded" %]
449 <option value="dateadded" selected="selected">Date added</option>
451 <option value="dateadded">Date added</option>
456 <label for="public">Public: </label>
457 <select id="public" name="public" onchange="AdjustRemark()">
458 [% IF shelf.is_private %]
459 <option value="0" selected="selected">Private</option>
461 <option value="0">Private</option>
463 [% IF shelf.is_public %]
464 <option value="1" selected="selected">Public</option>
466 <option value="1">Public</option>
470 [% INCLUDE list_permissions %]
474 <fieldset class="action">
475 <input type="submit" value="Save" class="submit" />
476 [% IF referer == 'view' %]
477 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
480 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1" class="cancel">Cancel</a>
482 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0" class="cancel">Cancel</a>
487 [% END # /IF op == 'add_form'... %]
489 [% IF op == 'list' %]
491 <div id="tabs" class="toptabs">
492 <ul class="nav nav-tabs" role="tablist">
493 <li id="privateshelves_tab" role="presentation" class="active">
494 <a href="#shelves_list" aria-controls="shelves_list" role="tab" data-toggle="tab" data-public="0">Your lists</a>
496 <li id="publicshelves_tab" role="presentation">
497 <a href="#shelves_list" aria-controls="shelves_list" role="tab" data-toggle="tab" data-public="1">Public lists</a>
501 <div class="tab-content">
502 <div role="tabpanel" class="tab-pane active" id="shelves_list">
503 <table id="listresultst">
506 <th class="NoVisible">Type</th>
512 <th>Creation date</th>
513 <th>Modification date</th>
514 <th class="noExport">Actions</th>
516 <tr class="filters_row">
518 <th><input class="filter text_filter" id="searchshelfname_filter" placeholder="List name"></th>
521 <th><input class="filter text_filter" id="searchowner_filter" placeholder="Owner"></th>
523 <select class="filter text_filter" id="searchsortby_filter">
524 <option value=""></option>
525 <option value="title">Title</option>
526 <option value="author">Author</option>
527 <option value="copyrightdate">Copyrightdate</option>
528 <option value="itemcallnumber">Call number</option>
529 <option value="dateadded">Date added</option>
538 </table> <!-- /#listresultst -->
539 </div> <!-- /#shelves_list -->
540 </div> <!-- #/.tab-content -->
541 </div> <!-- /#tabs -->
542 [% END # /IF op == 'list' %]
544 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
545 <!-- Values will be set here by placeHold() -->
549 </div> <!-- /.col-sm-10.col-sm-push-2 -->
550 </div> <!-- /.row -->
552 [% IF ( can_add_biblios ) %]
554 <div class="modal" id="addToList" tabindex="-1" role="dialog" aria-labelledby="addToListLabel">
555 <div class="modal-dialog" role="document">
556 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
557 <div class="modal-content">
558 <div class="modal-header">
559 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
560 <h4 class="modal-title" id="addToListLabel">Add items</h4>
562 <div class="modal-body">
563 <fieldset class="brief">
566 <label for="barcodes">Barcodes:</label>
567 <textarea name="barcodes" id="barcodes" rows="5"></textarea>
568 <input type="hidden" name="op" value="add_biblio" />
569 <input type="hidden" name="referer" value="view" />
570 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
573 <label for="biblionumbers">Biblio numbers:</label>
574 <textarea name="biblionumbers" id="biblionumbers" rows="5"></textarea>
575 <input type="hidden" name="op" value="add_biblio" />
576 <input type="hidden" name="referer" value="view" />
577 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
581 </div> <!-- /.modal-body -->
582 <div class="modal-footer">
583 <button type="submit" class="btn btn-default">Save</button>
584 <a href="#" data-dismiss="modal" class="cancel">Cancel</a>
588 </div> <!-- /.modal-dialog -->
589 </div> <!-- /#addToList -->
590 [% END # IF /( can_add_biblios ) %]
592 [% MACRO jsinclude BLOCK %]
593 [% INCLUDE 'datatables.inc' %]
594 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
597 $( document ).ready(function() {
599 window.onafterprint = function () {
602 setTimeout('window.close()', 1000); // Hack for Chrome < 63
607 [% IF op == 'view' %]
608 [% Asset.js("lib/hc-sticky.js") | $raw %]
611 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
612 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
613 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to remove this list?");
615 [% IF op == 'list' %]
616 $(document).ready(function(){
617 var public = [% public | html %];
619 var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
620 "aaSorting": [[ 5, "asc" ]],
622 'sAjaxSource': "/cgi-bin/koha/svc/virtualshelves/search",
623 'fnServerData': function(sSource, aoData, fnCallback) {
629 'value': $("#searchshelfname_filter").val(),
632 'value': $("#searchowner_filter").val(),
635 'value': $("#searchsortby_filter").val(),
637 'name': 'template_path',
638 'value': 'virtualshelves/tables/shelves_results.tt',
640 'name': 'allow_transfer',
641 'value': '[% allow_transfer | html %]',
643 'name': 'shelfname_sorton',
644 'value': 'vs.shelfname',
646 'name': 'is_shared_sorton',
647 'value': 'vs.public',
649 'name': 'owner_sorton',
652 'name': 'sortby_sorton',
653 'value': 'vs.sortfield',
655 'name': 'created_on_sorton',
656 'value': 'vs.created_on',
658 'name': 'modification_time_sorton',
659 'value': 'vs.lastmodified',
666 'success': function(json){
672 { 'mDataProp': 'dt_public' },
673 { 'mDataProp': 'dt_shelfname' },
674 { 'mDataProp': 'dt_count' },
675 { 'mDataProp': 'dt_is_shared' },
676 { 'mDataProp': 'dt_owner' },
677 { 'mDataProp': 'dt_sortby' },
678 { 'mDataProp': 'dt_created_on' },
679 { 'mDataProp': 'dt_modification_time' },
680 { 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' }
683 { "bVisible": false, "aTargets": [ 'NoVisible' ] }
686 'sPaginationType': 'full_numbers',
689 "bSortCellsTop": true
692 dtListResults.fnAddFilters("filter", 750);
694 /* Select correct tab based on URL parameter */
696 $('#privateshelves_tab').tab('show');
698 $("#publicshelves_tab").tab("show");
701 $('a[data-toggle="tab"]')
702 .on("click", function(){
703 public = $(this).data("public");
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-remove\"></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").attr("value") == "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").attr("value") == "newlist"){
891 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf,'popup',500,500);
894 } else if($("#addto").find("option:selected").attr("value") == "morelists"){
896 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf,'popup',500,500);
900 if($("#addto").find("option:selected").attr("value") == "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 } else if( public==0 ) {
914 // If we move to Private (without shares), show Anyone remark
915 // Note: the number of shares is not tested real-time
916 [% IF !shelf.is_shared %]
918 $("#anyone_remark").show();
919 $("#staff_remark").hide();
920 } else if ( perms==3 ) {
921 $("#anyone_remark").hide();
922 $("#staff_remark").show();
925 $("#anyone_remark").hide();
926 $("#staff_remark").hide();
928 } else { // public==1
929 $("#anyone_remark").hide();
930 $("#staff_remark").hide();
933 [% IF op == 'view' %]
936 open(CGIBIN+'virtualshelves/sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
939 $(document).ready(function() {
940 $("#sendlist").click(function(){
944 $("#deleteshelf").click(function(e){
945 if(confirm(_("Are you sure you want to delete this list?"))){
955 [% IF op == 'transfer' %]
956 $(document).ready(function() {
957 patron_autocomplete( $("#find_patron"), { 'on-select-callback': function( event, ui ) {
958 $('#new_owner_name').html( ui.item.firstname + " " + ui.item.surname );
959 $('#new_owner').val( ui.item.patron_id );
960 $('#find_patron').val('').focus();
964 $('#transferform').submit(function() {
965 if( $('#new_owner').val() == '' ) {
966 alert( _("Please select a new owner first") );
977 [% INCLUDE 'intranet-bottom.inc' %]