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 [% WRAPPER breadcrumbs %]
66 [% WRAPPER breadcrumb_item %]
67 <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a>
70 [% WRAPPER breadcrumb_item bc_active= 1 %]
75 [% IF shelf AND shelf.is_private %]
76 [% IF op == 'view' OR op == 'edit_form' %]
77 [% WRAPPER breadcrumb_item %]
78 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0">Your lists</a>
81 [% WRAPPER breadcrumb_item bc_active= 1 %]
82 <span>Your lists</span>
86 [% ELSIF shelf AND shelf.is_public %]
88 [% WRAPPER breadcrumb_item %]
89 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1">Public lists</a>
92 [% WRAPPER breadcrumb_item bc_active= 1 %]
93 <span>Public lists</span>
99 [% WRAPPER breadcrumb_item bc_active= 1 %]
100 <span>Contents of <em>[% shelf.shelfname | html %]</em></span>
104 [% IF op == 'add_form' %]
105 [% WRAPPER breadcrumb_item bc_active= 1 %]
106 <span>Create new list</span>
110 [% IF op == 'edit_form' %]
111 [% WRAPPER breadcrumb_item bc_active= 1 %]
112 <span>Edit list <em>[% shelf.shelfname | html %]</em></span>
116 [% IF op == 'transfer' %]
117 [% WRAPPER breadcrumb_item bc_active= 1 %]
118 <span>Transfer list <em>[% shelf.shelfname | html %]</em></span>
121 [% END #/ WRAPPER breadcrumbs %]
122 [% END #/ WRAPPER sub-header.inc %]
124 <div class="main container-fluid">
126 <div class="col-sm-10 col-sm-push-1">
129 [% IF op != 'transfer' %][% INCLUDE 'virtualshelves-toolbar.inc' %][% END %]
131 [% FOR m IN messages %]
132 <div class="dialog [% m.type | html %]">
134 [% CASE 'error_on_update' %]
135 <span>An error occurred when updating this list.</span>
136 [% CASE 'error_on_insert' %]
137 <span>An error occurred when creating this list.</span>
138 [% CASE 'error_on_delete' %]
139 <span>An error occurred when deleting this list.</span>
140 [% CASE 'error_on_add_biblio' %]
141 [% IF m.item_barcode %]
142 <span>The item ([% m.item_barcode | html %]) has not been added to the list. Please verify it is not already in the list.</span>
144 <span>The record ([% m.bibnum | html %]) has not been added to the list. Please verify it is not already in the list.</span>
146 [% CASE 'success_on_update' %]
147 <span>List updated.</span>
148 [% CASE 'success_on_insert' %]
149 <span>List created.</span>
150 [% CASE 'success_on_delete' %]
151 <span>List deleted.</span>
152 [% CASE 'success_on_add_biblio' %]
153 [% IF m.item_barcode %]
154 <span>The item ([% m.item_barcode | html %]) has been added to the list.</span>
156 <span>The record ([% m.bibnum | html %]) has been added to the list.</span>
158 [% CASE 'success_on_remove_biblios' %]
159 <span>The item has been removed from the list.</span>
160 [% CASE 'does_not_exist' %]
161 <span>This list does not exist.</span>
162 [% CASE 'item_does_not_exist' %]
163 [% IF m.item_barcode %]
164 <span>The item ([% m.item_barcode | html %]) does not exist.</span>
166 <span>The record ([% m.bibnum | html %]) does not exist.</span>
168 [% CASE 'unauthorized_on_view' %]
169 <span>You do not have permission to view this list.</span>
170 [% CASE 'unauthorized_on_update' %]
171 <span>You do not have permission to update this list.</span>
172 [% CASE 'unauthorized_on_delete' %]
173 <span>You do not have permission to delete this list.</span>
174 [% CASE 'unauthorized_on_add_biblio' %]
175 <span>You do not have permission to add a record to this list.</span>
176 [% CASE 'unauthorized_transfer' %]
177 <span>You do not have permission to transfer ownership of this list.</span>
178 [% CASE 'new_owner_not_found' %]
179 <span>The new owner could not be found anymore.</span>
180 [% CASE 'no_biblio_removed' %]
181 <span>No record was removed.</span>
183 [% CASE 'Koha::Exceptions::Virtualshelf::DuplicateObject' %]
184 <span>An error occurred when creating this list. The name [% shelfname | html %] already exists.</span>
185 [% CASE 'Koha::Exceptions::Virtualshelf::UseDbAdminAccount' %]
186 <span>List could not be created. (Do not use the database administrator account.)</span>
187 [% CASE 'DBIx::Class::Exception' %]
191 [% m.code | html %] [% m.msg | html %]
194 [% END # /FOR m IN messages %]
196 [% IF op == 'transfer' %]
197 <h1>Transfer ownership of public list [% shelf.shelfname | html %]</h1>
199 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="transferform" method="post">
200 [% INCLUDE 'csrf-token.inc' %]
202 <input type="hidden" name="op" value="transfer" />
203 <input type="hidden" name="public" value="1" />
204 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
207 <label for="find_patron">Search for new owner: </label>
208 <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
213 <label for="find_patron">New owner: </label>
214 <span id="new_owner_name"></span>
215 <input type="hidden" id="new_owner" name="new_owner" value="" />
219 <fieldset class="action">
220 <input type="submit" class="btn btn-primary" value="Transfer" />
221 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1" class="cancel">Cancel</a>
226 [% END # /IF op == transfer %]
228 [% IF op == 'view' %]
229 <h1>Contents of <em>[% shelf.shelfname | html %]</em></h1>
231 [% SET contents = shelf.get_contents %]
232 [% IF ( contents.count ) %]<p>This list contains [% contents.count | html %] titles</p>[% END %]
233 <div class="pages">[% pagination_bar | $raw %]</div>
234 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post">
235 [% INCLUDE 'csrf-token.inc' %]
236 <input type="hidden" name="op" value="remove_biblios" />
237 <input type="hidden" name="referer" value="view" />
238 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
240 [% IF direction == 'asc' %]
241 [% SET new_direction = 'desc' %]
243 [% SET direction = 'desc' %]
244 [% SET new_direction = 'asc' %]
248 <div id="searchheader" class="searchheader noprint">
249 <div id="selection_ops">
250 <span class="checkall"></span> |
251 <span class="clearall"></span>
253 <span class="addto">| </span>
255 [% IF CAN_user_reserveforothers && Koha.Preference('DisplayMultiPlaceHold') %]
256 <div class="btn-group"><button class="btn btn-default btn-xs placehold"><i class="fa fa-sticky-note-o"></i> Place hold</button></div>
258 [% IF can_remove_biblios %]
259 <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>
261 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
262 <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>
268 <div class="page-section">
269 <table id="searchresults" class="dataTable">
272 [% IF ( itemsloop ) %]
273 <th class="checkall"> </th>
275 [% UNLESS ( item_level_itypes ) %]
278 [% IF sortfield == 'title' %]
279 <th class="sorting_[% direction | html %]">
283 <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>
285 [% IF sortfield == 'author' %]
286 <th class="sorting_[% direction | html %]">
290 <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>
292 [% IF sortfield == 'dateadded' %]
293 <th class="sorting_[% direction | html %]">
297 <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>
299 [% IF sortfield == 'itemcallnumber' %]
300 <th class="sorting_[% direction | html %]">
304 <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>
308 [% FOREACH itemsloo IN itemsloop %]
312 <input type="checkbox" class="selection" value="[% itemsloo.biblionumber | html %]" name="biblionumber" />
315 [% UNLESS ( item_level_itypes ) %]
317 [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]
318 <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
320 <span class="itypetext">[% itemsloo.description | html %]</span>
324 [% IF ( itemsloo.XSLTBloc ) %]
325 [% itemsloo.XSLTBloc | $raw %]
327 [% INCLUDE 'biblio-title.inc' biblio=itemsloo link = 1 %]
331 [% IF ( itemsloo.notforloan ) %]
332 <span class="noholdstext">No holds allowed</span>
334 [% IF ( itemsloo.ITEM_RESULTS.count ) %]
335 <a id="reserve_[% itemsloo.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | html %]">Holds</a>
337 <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>
340 <span class="noholdstext">No holds allowed</span>
343 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
344 | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit record</a>
346 [% IF ( CAN_user_editcatalogue_edit_items ) %]
347 | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit items</a>
352 [% itemsloo.author | html %]
355 [% itemsloo.dateadded | $KohaDates%]
359 [% FOREACH item IN itemsloo.ITEM_RESULTS %]
361 [% Branches.GetName(item.holdingbranch) | html %]
362 [% IF ( item.location ) %]
363 <span class="shelvingloc">
364 [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]
367 [% IF ( item.itemcallnumber ) %]
368 [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=%22[% item.itemcallnumber | uri %]%22">[% item.itemcallnumber | html %]</a>]
371 [% END # /FOREACH item %]
375 [% END #/FOREACH itemsloo %]
376 </table> <!-- /#searchresults -->
377 </div> <!-- /.page-section -->
379 <div class="pages">[% pagination_bar | $raw %]</div>
381 [% END # /IF itemsloop %]
382 [% END # /IF op == 'view' %]
384 [% IF op == 'add_form' OR op == 'edit_form' %]
386 <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl" class="validated">
387 [% INCLUDE 'csrf-token.inc' %]
388 <fieldset class="rows">
389 [% IF op == 'add_form' %]
390 <legend><h1>Create a new list</h1></legend>
391 <input type="hidden" name="op" value="add" />
393 <legend><h1>Edit list <em>[% shelf.shelfname | html %]</em></h1></legend>
394 <input type="hidden" name="op" value="edit" />
396 <input type="hidden" name="referer" value="[% referer | html %]" />
397 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
400 <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" />
401 <span class="required">Required</span>
404 <span class="label">Owner: </span>
405 [% IF op == 'add_form' %]
406 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />[% logged_in_user.userid | html %]
409 <input type="hidden" id="owner" name="owner" value="[% owner.borrowernumber | html %]" />[% owner.firstname _ ' ' _ owner.surname | html %]
411 <input type="hidden" id="owner" name="owner" value="[% loggedinusernumber | html %]" />[% logged_in_user.userid | html %]
416 <label for="sortfield" >Sort this list by: </label>
417 <select name="sortfield">
418 [% IF shelf.sortfield == "title" %]
419 <option value="title" selected="selected">Title</option>
421 <option value="title">Title</option>
423 [% IF shelf.sortfield == "author" %]
424 <option value="author" selected="selected">Author</option>
426 <option value="author">Author</option>
428 [% IF shelf.sortfield == "copyrightdate" %]
429 <option value="copyrightdate" selected="selected">Copyrightdate</option>
431 <option value="copyrightdate">Copyrightdate</option>
433 [% IF shelf.sortfield == "itemcallnumber" %]
434 <option value="itemcallnumber" selected="selected">Call number</option>
436 <option value="itemcallnumber">Call number</option>
438 [% IF shelf.sortfield == "dateadded" %]
439 <option value="dateadded" selected="selected">Date added</option>
441 <option value="dateadded">Date added</option>
446 <label for="public">Public: </label>
447 <select id="public" name="public" onchange="AdjustRemark()">
448 [% IF shelf.is_private %]
449 <option value="0" selected="selected">Private</option>
451 <option value="0">Private</option>
453 [% IF shelf.is_public %]
454 <option value="1" selected="selected">Public</option>
456 <option value="1">Public</option>
460 [% INCLUDE list_permissions %]
464 <fieldset class="action">
465 <input type="submit" class="btn btn-primary" value="Save" />
466 [% IF referer == 'view' %]
467 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
470 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=1" class="cancel">Cancel</a>
472 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&public=0" class="cancel">Cancel</a>
477 [% END # /IF op == 'add_form'... %]
479 [% IF op == 'list' %]
482 [% WRAPPER tabs id= "tabs" %]
483 [% WRAPPER tabs_nav %]
484 [% WRAPPER tab_item tabname= "privateshelves_tab" bt_active= 1 %] <span>Your lists</span> [% END %]
485 [% WRAPPER tab_item tabname= "publicshelves_tab" %] <span>Public lists</span> [% END %]
486 [% END # /WRAPPER tabs_nav %]
488 [% WRAPPER tab_panels %]
489 [% WRAPPER tab_panel tabname="shelves_tab" bt_active= 1 %]
490 <table id="listresultst">
493 <th class="NoVisible">Type</th>
499 <th>Creation date</th>
500 <th>Modification date</th>
501 <th class="noExport">Actions</th>
503 <tr class="filters_row">
505 <th><input class="filter text_filter" id="searchshelfname_filter" placeholder="List name"></th>
508 <th><input class="filter text_filter" id="searchowner_filter" placeholder="Owner"></th>
510 <select class="filter text_filter" id="searchsortby_filter">
511 <option value=""></option>
512 <option value="title">Title</option>
513 <option value="author">Author</option>
514 <option value="copyrightdate">Copyrightdate</option>
515 <option value="itemcallnumber">Call number</option>
516 <option value="dateadded">Date added</option>
525 </table> <!-- /#listresultst -->
527 [% END # /WRAPPER tab_panels %]
528 [% END # /WRAPPER tabs %]
530 [% END # /IF op == 'list' %]
532 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
533 <!-- Values will be set here by placeHold() -->
537 </div> <!-- /.col-sm-10.col-sm-push-2 -->
538 </div> <!-- /.row -->
540 [% IF ( can_add_biblios ) %]
542 <div class="modal" id="addToList" tabindex="-1" role="dialog" aria-labelledby="addToListLabel">
543 <div class="modal-dialog" role="document">
544 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
545 [% INCLUDE 'csrf-token.inc' %]
546 <div class="modal-content">
547 <div class="modal-header">
548 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
549 <h4 class="modal-title" id="addToListLabel">Add items</h4>
551 <div class="modal-body">
552 <fieldset class="brief">
555 <label for="barcodes">Barcodes:</label>
556 <textarea name="barcodes" id="barcodes" rows="5"></textarea>
557 <input type="hidden" name="op" value="add_biblio" />
558 <input type="hidden" name="referer" value="view" />
559 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
562 <label for="biblionumbers">Biblio numbers:</label>
563 <textarea name="biblionumbers" id="biblionumbers" 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 %]" />
570 </div> <!-- /.modal-body -->
571 <div class="modal-footer">
572 <button type="submit" class="btn btn-default">Save</button>
573 <a href="#" data-dismiss="modal" class="cancel">Cancel</a>
577 </div> <!-- /.modal-dialog -->
578 </div> <!-- /#addToList -->
579 [% END # IF /( can_add_biblios ) %]
581 [% MACRO jsinclude BLOCK %]
582 [% INCLUDE 'datatables.inc' %]
583 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
586 $( document ).ready(function() {
588 window.onafterprint = function () {
591 setTimeout('window.close()', 1000); // Hack for Chrome < 63
596 [% IF op == 'view' %]
597 [% Asset.js("lib/hc-sticky.js") | $raw %]
600 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
601 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
602 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to remove this list?");
604 [% IF op == 'list' %]
605 $(document).ready(function(){
606 var public = [% public | html %];
608 var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
609 "aaSorting": [[ 5, "asc" ]],
611 'sAjaxSource': "/cgi-bin/koha/svc/virtualshelves/search",
612 'fnServerData': function(sSource, aoData, fnCallback) {
618 'value': $("#searchshelfname_filter").val(),
621 'value': $("#searchowner_filter").val(),
624 'value': $("#searchsortby_filter").val(),
626 'name': 'template_path',
627 'value': 'virtualshelves/tables/shelves_results.tt',
629 'name': 'allow_transfer',
630 'value': '[% allow_transfer | html %]',
632 'name': 'shelfname_sorton',
633 'value': 'vs.shelfname',
635 'name': 'is_shared_sorton',
636 'value': 'vs.public',
638 'name': 'owner_sorton',
641 'name': 'sortby_sorton',
642 'value': 'vs.sortfield',
644 'name': 'created_on_sorton',
645 'value': 'vs.created_on',
647 'name': 'modification_time_sorton',
648 'value': 'vs.lastmodified',
655 'success': function(json){
661 { 'mDataProp': 'dt_public' },
662 { 'mDataProp': 'dt_shelfname' },
663 { 'mDataProp': 'dt_count' },
664 { 'mDataProp': 'dt_is_shared' },
665 { 'mDataProp': 'dt_owner' },
666 { 'mDataProp': 'dt_sortby' },
667 { 'mDataProp': 'dt_created_on' },
668 { 'mDataProp': 'dt_modification_time' },
669 { 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' }
672 { "bVisible": false, "aTargets": [ 'NoVisible' ] }
675 'sPaginationType': 'full_numbers',
678 "bSortCellsTop": true
681 dtListResults.fnAddFilters("filter", 750);
683 /* Select correct tab based on URL parameter */
685 $('a[href="#privateshelves_tab_panel"]').tab('show');
687 $('a[href="#publicshelves_tab_panel"]').tab("show");
690 $('a[data-toggle="tab"]').on("click", function(e){
691 let target = $(this).attr("href");
692 if( target == "#publicshelves_tab_panel" ){
698 .on('shown.bs.tab', function (e) {
699 dtListResults.fnDraw();
702 $("body").on("click", ".deleteshelf", function(){
703 return confirmDelete(MSG_CONFIRM_DELETE_LIST);
706 [% END # /IF op == 'list' %]
708 [% IF shelf AND op == 'view' %]
710 $(document).ready(function(){
711 Sticky = $("#searchheader");
713 stickTo: "#listform",
714 stickyClass: "floating"
716 $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-remove\"></i>"+_(" Clear all")+"<\/a>");
717 $("span.checkall").html("<a id=\"CheckAll\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-check\"></i>"+_(" Select all")+"<\/a>");
718 $("#CheckAll").click(function(e){
720 $(".selection").each(function(){
721 $(this).prop("checked", true);
725 $("#CheckNone").click(function(e){
727 $(".selection").each(function(){
728 $(this).prop("checked", false);
731 $(".placehold").on("click",function(e){
735 $(".addtocart").show();
736 var param1 = "| <label for=\"addto\">"+_("Add to:")+"<\/label><select name=\"addto\" id=\"addto\"><option value=\"\"><\/option>";
737 [% IF (Koha.Preference("intranetbookbag")) %]
738 param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>";
740 [% IF Koha.Preference('virtualshelves') %]
741 [% IF add_to_some_private_shelves.count %]
742 param1 += "<optgroup label=\""+_("Your lists:")+"\">";
743 [% SET number_of_private_shelves = 0 %]
744 [% FOREACH s IN add_to_some_private_shelves %]
745 [% IF shelfnumber != s.shelfnumber %]
746 param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
747 [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
748 [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
751 param1 += "<\/optgroup>";
753 [% IF add_to_some_public_shelves.count %]
754 param1 += "<optgroup label=\""+_("Public lists:")+"\">";
755 [% SET number_of_public_shelves = 0 %]
756 [% FOREACH s IN add_to_some_public_shelves %]
757 [% IF shelfnumber != s.shelfnumber %]
758 param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
759 [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
760 [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
763 param1 += "<\/optgroup>";
765 [% IF add_to_some_private_shelves.count > 10 or add_to_some_public_shelves.count > 10 %]
766 param1 += "<option value=\"morelists\">[ "+_("More lists")+" ]<\/option>";
768 param1 +="<option value=\"newlist\">"+_("[ New list ]")+"<\/option>"
770 param1 += "<\/select> <button id=\"cartsubmit\" type=\"submit\" class=\"btn btn-default btn-xs\">"+_("Save")+"</button>";
771 $("span.addto").html(param1);
772 $("#cartsubmit").on("click",function(e){
776 $("#addto").change(function(){
779 $(".addto").find("input:submit").click(function(e){
783 $("#selection_ops").show();
784 $(".merge-items").on("click",function(e){
788 $("#listform").on("submit",function(e){
791 $(".list-remove").on("click",function(e){
792 if($(".selection").filter(":checked").length > 0){
793 return confirm(MSG_REMOVE_FROM_LIST);
795 alert(MSG_NO_ITEM_SELECTED);
799 $("#addToList").on("shown.bs.modal", function(e){
800 $("#barcodes").focus();
803 [% END # /IF shelf %]
805 [% IF shelf AND op == 'edit_form' %]
806 $(document).ready(function(){
812 * This function checks if the adequate number of records are checked for merging
814 function MergeItems() {
815 var checkboxes = $("input:checkbox:checked");
816 if (checkboxes.length < 2) {
817 alert(_("At least two records must be selected for merging."));
820 $(checkboxes).each(function() {
821 params.push('biblionumber=' + $(this).val());
823 var url = '/cgi-bin/koha/cataloguing/merge.pl?' + params.join('&');
830 * This function checks all checkboxes if all are empty,
831 * or unchecks all if any already checked.
834 var checkboxes = document.getElementsByTagName('input');
835 var nbCheckbox = checkboxes.length;
836 var check = areAllChecked();
837 for(var i=0;i<nbCheckbox;i++){
838 if(checkboxes[i].getAttribute('type') == "checkbox" ){
839 checkboxes[i].checked = (check) ? 0 : 1;
844 * This function returns true if ALL checkboxes are checked
846 function areAllChecked(){
847 var checkboxes = document.getElementsByTagName('input');
848 var nbCheckbox = checkboxes.length;
849 for(var i=0;i<nbCheckbox;i++){
850 if(checkboxes[i].getAttribute('type') == "checkbox" ){
851 if(checkboxes[i].checked == 0){
859 function placeHold () {
860 var checkedItems = $(".selection:checked");
861 if ($(checkedItems).size() == 0) {
862 alert(MSG_NO_ITEM_SELECTED);
865 $(checkedItems).each(function() {
866 var bib_param = $("<input>").attr("type", "hidden").attr("name", "biblionumber").val($(this).val());
867 $('#hold_form').append(bib_param);
869 $("#hold_form").submit();
874 var checkboxes = $("#searchresults").find(":checkbox");
875 var vshelf = vShelfAdd(checkboxes);
876 if($("#addto").find("option:selected").val() == "addtolist"){
877 var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
879 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf,'popup',500,500);
882 } else if($("#addto").find("option:selected").val() == "newlist"){
884 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf,'popup',500,500);
887 } else if($("#addto").find("option:selected").val() == "morelists"){
889 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf,'popup',500,500);
893 if($("#addto").find("option:selected").val() == "addtocart"){
894 addMultiple(checkboxes);
899 function AdjustRemark() {
900 var public = $("#public").val();
901 var perms = $("#allow_changes_from").val();
904 $("#anyone_remark").hide();
905 $("#staff_remark").hide();
906 } else if( public==0 ) {
907 // If we move to Private (without shares), show Anyone remark
908 // Note: the number of shares is not tested real-time
909 [% IF !shelf.is_shared %]
911 $("#anyone_remark").show();
912 $("#staff_remark").hide();
913 } else if ( perms==3 ) {
914 $("#anyone_remark").hide();
915 $("#staff_remark").show();
918 $("#anyone_remark").hide();
919 $("#staff_remark").hide();
921 } else { // public==1
922 $("#anyone_remark").hide();
923 $("#staff_remark").hide();
926 [% IF op == 'view' %]
929 open(CGIBIN+'virtualshelves/sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
932 $(document).ready(function() {
933 $("#sendlist").click(function(){
937 $("#deleteshelf").click(function(e){
938 if(confirm(_("Are you sure you want to delete this list?"))){
948 [% IF op == 'transfer' %]
949 $(document).ready(function() {
950 patron_autocomplete( $("#find_patron"), { 'on-select-callback': function( event, ui ) {
951 $('#new_owner_name').html( ui.item.firstname + " " + ui.item.surname );
952 $('#new_owner').val( ui.item.patron_id );
953 $('#find_patron').val('').focus();
957 $('#transferform').submit(function() {
958 if( $('#new_owner').val() == '' ) {
959 alert( _("Please select a new owner first") );
970 [% INCLUDE 'intranet-bottom.inc' %]