Bug 18980: Show distinction between shared and private lists in staff
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / virtualshelves / shelves.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% SET PRIVATE = 1 %]
4 [% SET PUBLIC = 2 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; [% IF op == 'view' %]Lists &rsaquo; Contents of [% shelf.shelfname | html %][% ELSE %]Lists[% END %][% IF op == 'add_form' %] &rsaquo; Create new list[% END %][% IF op == 'edit_form' %] &rsaquo; Edit list [% shelf.shelfname | html %][% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
9 [% INCLUDE 'datatables.inc' %]
10 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
11
12 [% BLOCK list_permissions %]
13     <li>
14         <label for="allow_changes_from">Allow changes to contents from: </label>
15         <select name="allow_changes_from" id="allow_changes_from" onchange="AdjustRemark()">
16
17             [% IF shelf.allow_change_from_owner %]<option value="0">Nobody</option>[% ELSE %]<option value="0" selected="selected">Nobody</option>[% END %]
18
19             [% IF shelf.allow_change_from_owner && (( !shelf.is_public && !shelf.is_shared ) || !shelf.allow_change_from_others ) %]
20                 <option value="1" selected="selected">Owner only</option>
21             [% ELSE %]
22                 <option value="1">Owner only</option>
23             [% END %]
24
25             [% IF shelf.allow_change_from_others %]<option value="2" selected="selected">Anyone seeing this list</option>[% ELSE %]<option value="2">Anyone seeing this list</option>[% END %]
26
27         </select>
28         &emsp; <span id="anyone_remark" style="display:none;color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
29     </li>
30 [% END %]
31
32 [% IF print %]
33 <script type="text/javascript">
34     $( document ).ready(function() {
35         window.print();
36         setTimeout('window.close()', 1);
37     });
38 </script>
39 [% END %]
40
41 [% IF op == 'view' %]
42     <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
43     <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
44 [% END %]
45 <script type="text/javascript">
46 //<![CDATA[ 
47
48 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
49 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
50 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to remove this list?");
51
52 [% IF op == 'list' %]
53 $(document).ready(function(){
54     [% IF category == PUBLIC %]
55         var type = [% PUBLIC %];
56     [% ELSE %]
57         var type = [% PRIVATE %];
58     [% END %]
59     var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
60
61         "aaSorting": [[ 5, "asc" ]],
62         'bServerSide': true,
63         'sAjaxSource': "/cgi-bin/koha/svc/virtualshelves/search",
64         'fnServerData': function(sSource, aoData, fnCallback) {
65             aoData.push({
66                 'name': 'type',
67                 'value': type,
68             },{
69                 'name': 'shelfname',
70                 'value': $("#searchshelfname_filter").val(),
71             },{
72                 'name': 'owner',
73                 'value': $("#searchowner_filter").val(),
74             },{
75                 'name': 'sortby',
76                 'value': $("#searchsortby_filter").val(),
77             },{
78                 'name': 'template_path',
79                 'value': 'virtualshelves/tables/shelves_results.tt',
80             });
81             $.ajax({
82                 'dataType': 'json',
83                 'type': 'POST',
84                 'url': sSource,
85                 'data': aoData,
86                 'success': function(json){
87                     fnCallback(json);
88                 }
89             });
90         },
91         'aoColumns':[
92             { 'mDataProp': 'dt_type' },
93             { 'mDataProp': 'dt_shelfname' },
94             { 'mDataProp': 'dt_count' },
95             { 'mDataProp': 'dt_is_shared' },
96             { 'mDataProp': 'dt_owner' },
97             { 'mDataProp': 'dt_sortby' },
98             { 'mDataProp': 'dt_created_on' },
99             { 'mDataProp': 'dt_modification_time' },
100             { 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' }
101         ],
102         "aoColumnDefs": [
103             { "bVisible": false, "aTargets": [ 'NoVisible' ] }
104         ],
105         'bAutoWidth': false,
106         'sPaginationType': 'full_numbers',
107         'bFilter': false,
108         "bProcessing": true,
109         "bSortCellsTop": true
110     }));
111
112     dtListResults.fnAddFilters("filter", 750);
113
114     var tabs = $("#tabs").tabs({
115         [% IF category == PUBLIC %]
116             active: 1,
117         [% ELSE %]
118             active: 0,
119         [% END %]
120         activate: function(e, ui) {
121             var active = tabs.tabs("option", "active" );
122             if ( active == 0 ) {
123                 type = [% PRIVATE %];
124                 dtListResults.fnDraw();
125             } else if ( active == 1 ) {
126                 type = [% PUBLIC %];
127                 dtListResults.fnDraw();
128             }
129         }
130     });
131     $("body").on("click", ".deleteshelf", function(){
132         return confirmDelete(MSG_CONFIRM_DELETE_LIST);
133     });
134 });
135 [% END %]
136
137 [% IF shelf AND op == 'view' %]
138 $(document).ready(function(){
139     [% IF ( itemsloop ) %]$('#searchheader').fixFloat();[% END %]
140     $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-remove\"></i>"+_(" Clear all")+"<\/a>");
141     $("span.checkall").html("<a id=\"CheckAll\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-check\"></i>"+_(" Select all")+"<\/a>");
142     $("#CheckAll").click(function(){
143         $(".checkboxed").checkCheckboxes();
144         return false;
145     });
146     $("#CheckNone").click(function(){
147         $(".checkboxed").unCheckCheckboxes();
148         return false;
149     });
150     $(".placehold").on("click",function(e){
151         placeHold();
152         e.preventDefault();
153     });
154     $(".addtocart").show();
155     var param1 = "| <label for=\"addto\">"+_("Add to:")+"<\/label><select name=\"addto\" id=\"addto\"><option value=\"\"><\/option>";
156     [% IF ( intranetbookbag ) %]
157          param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>";
158     [% END %]
159     [% IF Koha.Preference('virtualshelves') %]
160         [% IF add_to_some_private_shelves.count %]
161             param1 += "<optgroup label=\""+_("Your lists:")+"\">";
162             [% SET number_of_private_shelves = 0 %]
163             [% FOREACH s IN add_to_some_private_shelves %]
164                 [% IF shelfnumber != s.shelfnumber %]
165                     param1 += "<option id=\"s[% s.shelfnumber %]\" value=\"addtolist\">[% s.shelfname |html %]<\/option>";
166                     [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
167                     [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
168                 [% END %]
169             [% END %]
170             param1 += "<\/optgroup>";
171         [% END %]
172         [% IF add_to_some_public_shelves.count %]
173             param1 += "<optgroup label=\""+_("Public lists:")+"\">";
174             [% SET number_of_public_shelves = 0 %]
175             [% FOREACH s IN add_to_some_public_shelves %]
176                 [% IF shelfnumber != s.shelfnumber %]
177                     param1 += "<option id=\"s[% s.shelfnumber %]\" value=\"addtolist\">[% s.shelfname |html %]<\/option>";
178                     [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
179                     [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
180                 [% END %]
181             [% END %]
182             param1 += "<\/optgroup>";
183         [% END %]
184         [% IF add_to_some_private_shelves.count > 10 or add_to_some_public_shelves.count > 10 %]
185             param1 += "<option value=\"morelists\">[ "+_("More lists")+" ]<\/option>";
186         [% END %]
187         param1 +="<option value=\"newlist\">"+_("[ New list ]")+"<\/option>"
188     [% END %]
189     param1 += "<\/select> <button id=\"cartsubmit\" type=\"submit\" class=\"btn btn-default btn-xs\">"+_("Save")+"</button>";
190     $("span.addto").html(param1);
191     $("#cartsubmit").on("click",function(e){
192         cartList();
193         e.preventDefault();
194     });
195     $("#addto").change(function(){
196         cartList();
197     });
198     $(".addto").find("input:submit").click(function(e){
199         e.preventDefault();
200         cartList();
201     });
202     $("#selection_ops").show();
203     $(".merge-items").on("click",function(e){
204         e.preventDefault();
205         MergeItems();
206     });
207     $("#listform").on("submit",function(e){
208
209     });
210     $(".list-remove").on("click",function(e){
211         if($(".selection").filter(":checked").length > 0){
212             return confirm(MSG_REMOVE_FROM_LIST);
213         } else {
214             alert(MSG_NO_ITEM_SELECTED);
215             e.preventDefault();
216         }
217     });
218 });
219 [% END %]
220
221 [% IF shelf AND op == 'edit_form' %]
222 $(document).ready(function(){
223     AdjustRemark();
224 });
225 [% END %]
226
227     /**
228      * This function checks if the adequate number of records are checked for merging
229      */
230     function MergeItems() {
231         var checkboxes = $("input:checkbox:checked");
232         if (checkboxes.length < 2) {
233             alert(_("At least two records must be selected for merging."));
234         } else {
235             var params = [];
236             $(checkboxes).each(function() {
237                 params.push('biblionumber=' + $(this).val());
238             });
239             var url = '/cgi-bin/koha/cataloguing/merge.pl?' + params.join('&');
240             location.href = url;
241         }
242         return false;
243     }
244
245     /**
246      * This function checks all checkboxes if all are empty,
247      * or unchecks all if any already checked.
248      */
249     function CheckAll(){
250         var checkboxes = document.getElementsByTagName('input');
251         var nbCheckbox = checkboxes.length;
252         var check = areAllChecked();
253         for(var i=0;i<nbCheckbox;i++){
254             if(checkboxes[i].getAttribute('type') == "checkbox" ){
255                 checkboxes[i].checked = (check) ? 0 : 1;
256             }
257         }
258     }
259     /**
260      * This function returns true if ALL checkboxes are checked
261      */
262     function areAllChecked(){
263         var checkboxes = document.getElementsByTagName('input');
264         var nbCheckbox = checkboxes.length;
265         for(var i=0;i<nbCheckbox;i++){
266             if(checkboxes[i].getAttribute('type') == "checkbox" ){
267                 if(checkboxes[i].checked == 0){
268                     return false;
269                 }
270             }
271         }
272         return true;
273     }
274
275 function placeHold () {
276     var checkedItems = $(".selection:checked");
277     if ($(checkedItems).size() == 0) {
278         alert(MSG_NO_ITEM_SELECTED);
279         return false;
280     }
281     var bibs = "";
282     $(checkedItems).each(function() {
283         bibs += $(this).val() + "/";
284     });
285     $("#hold_form_biblios").val(bibs);
286     $("#hold_form").submit();
287     return false;
288 }
289
290     function cartList(){
291         var checkboxes = $("#searchresults").find(":checkbox");
292         var vshelf = vShelfAdd(checkboxes);
293         if($("#addto").find("option:selected").attr("value") == "addtolist"){
294             var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
295             if (vshelf) {
296                  openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf,'popup',500,500);
297             }
298             return false;
299         } else if($("#addto").find("option:selected").attr("value") == "newlist"){
300             if (vshelf) {
301                 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf,'popup',500,500);
302             }
303             return false;
304         } else if($("#addto").find("option:selected").attr("value") == "morelists"){
305             if (vshelf) {
306                 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf,'popup',500,500);
307             }
308             return false;
309         }
310         if($("#addto").find("option:selected").attr("value") == "addtocart"){
311             addMultiple(checkboxes);
312             return false;
313         }
314     }
315
316 function AdjustRemark() {
317     var category = $("#category").val();
318     var perms = $("#allow_changes_from").val();
319
320     if( perms < 2 ) {
321         $("#anyone_remark").hide();
322     } else if( category==1 ) {
323         // If we move to Private (without shares), show Anyone remark
324         // Note: the number of shares is not tested real-time
325         [% IF !shelf.is_shared %]
326             $("#anyone_remark").show();
327         [% ELSE %]
328             $("#anyone_remark").hide();
329         [% END %]
330     } else { // category==2
331         $("#anyone_remark").hide();
332     }
333 }
334 //]]>
335 </script>
336 </head>
337 <body id="lists_shelves" class="lists">
338 [% INCLUDE 'header.inc' %]
339 [% INCLUDE 'cat-search.inc' %]
340
341 <div id="breadcrumbs">
342     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
343     [% IF op != 'list' %]
344         <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a>
345     [% ELSE %]
346         Lists
347     [% END %]
348     [% IF shelf AND shelf.is_private %] &rsaquo;
349         [% IF op == 'view' OR op == 'edit_form' %]
350             <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&amp;category=[% PRIVATE %]">Your lists</a>
351         [% ELSE %]
352             Your lists
353         [% END %]
354     [% ELSIF shelf AND shelf.is_public %] &rsaquo;
355         [% IF op == 'view' %]
356             <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&amp;category=[% PUBLIC %]">Public lists</a>
357         [% ELSE %]
358             Public lists
359         [% END %]
360     [% END %]
361
362 [% IF op == 'view' %]&rsaquo; Contents of <i>[% shelf.shelfname | html %]</i>[% END %][% IF op == 'add_form' %] &rsaquo; Create new list[% END %][% IF op == 'edit_form' %] &rsaquo; Edit list <i>[% shelf.shelfname | html %]</i>[% END %]</div>
363
364 <div id="doc3" class="yui-t2">
365 <div id="bd">
366 <div id="yui-main">
367 <div class="yui-b">
368
369    <div class="yui-g">[% INCLUDE 'virtualshelves-toolbar.inc' %]
370    </div>
371
372 [% FOR m IN messages %]
373     <div class="dialog [% m.type %]">
374         [% SWITCH m.code %]
375         [% CASE 'error_on_update' %]
376             <span>An error occurred when updating this list.</span>
377         [% CASE 'error_on_insert' %]
378             <span>An error occurred when creating this list.</span>
379         [% CASE 'error_on_delete' %]
380             <span>An error occurred when deleting this list.</span>
381         [% CASE 'error_on_add_biblio' %]
382            <span>The item ([% m.item_barcode %]) has not been added to the list. Please verify it is not already in the list.</span>
383         [% CASE 'success_on_update' %]
384             <span>List updated.</span>
385         [% CASE 'success_on_insert' %]
386             <span>List created.</span>
387         [% CASE 'success_on_delete' %]
388             <span>List deleted.</span>
389         [% CASE 'success_on_add_biblio' %]
390             <span>The item ([% m.item_barcode %]) has been added to the list.</span>
391         [% CASE 'success_on_remove_biblios' %]
392             <span>The item has been removed from the list.</span>
393         [% CASE 'does_not_exist' %]
394             <span>This list does not exist.</span>
395         [% CASE 'item_does_not_exist' %]
396             <span>The item ([% m.item_barcode %]) does not exist.</span>
397         [% CASE 'unauthorized_on_view' %]
398             <span>You do not have permission to view this list.</span>
399         [% CASE 'unauthorized_on_update' %]
400             <span>You do not have permission to update this list.</span>
401         [% CASE 'unauthorized_on_delete' %]
402            <span>You do not have permission to delete this list.</span>
403         [% CASE 'unauthorized_on_add_biblio' %]
404             <span>You do not have permission to add a record to this list.</span>
405         [% CASE 'no_biblio_removed' %]
406             <span>No record was removed.</span>
407         [% CASE 'Koha::Exceptions::Virtualshelves::DuplicateObject' %]
408             <span>An error occurred when creating this list. The name [% shelfname %] already exists.</span>
409         [% CASE 'Koha::Exceptions::Virtualshelves::UseDbAdminAccount' %]
410             <span>List could not be created. (Do not use the database administrator account.)</span>
411         [% CASE 'DBIx::Class::Exception' %]
412             [% m.msg %]
413         [% CASE %]
414             [% m.code %]
415         [% END %]
416     </div>
417 [% END %]
418
419 [% IF op == 'view' %]
420    <div class="yui-g">
421     [% IF itemsloop %]
422
423     <h3>Contents of <i>[% shelf.shelfname | html %]</i></h3>
424     <div class="pages">[% pagination_bar %]</div>
425     <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post" class="checkboxed">
426         <input type="hidden" name="op" value="remove_biblios" />
427         <input type="hidden" name="referer" value="view" />
428         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
429
430 [% IF direction == 'asc' %]
431     [% SET new_direction = 'desc' %]
432 [% ELSE %]
433     [% SET direction = 'desc' %]
434     [% SET new_direction = 'asc' %]
435 [% END %]
436
437 <div id="searchheader" class="noprint">
438     [% IF itemsloop %]
439         <div id="selection_ops"><span class="checkall"></span> |
440         <span class="clearall"></span>
441
442         <span class="addto">| </span>
443         &nbsp;
444         [% IF CAN_user_reserveforothers && Koha.Preference('DisplayMultiPlaceHold') %]
445             <div class="btn-group"><button class="btn btn-default btn-xs placehold"><i class="fa fa-sticky-note-o"></i> Place hold</button></div>
446         [% END %]
447         [% IF can_remove_biblios %]
448             <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>
449         [% END %]
450         [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]<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>[% END %]
451         </div>
452     [% END %]
453 </div>
454
455     <table id="searchresults">
456             <tr>
457                 [% IF ( itemsloop ) %]<th class="checkall">&nbsp;</th>[% END %]
458
459                 [% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %]
460                 <th>
461                     <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]&amp;sortfield=title&amp;direction=[% IF sortfield != 'title' %]asc[% ELSE %][% new_direction %][% END %]">Title</a>
462                     [% IF sortfield == 'title' %]
463                         <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
464                     [% ELSE %]
465                         <img src="[% interface %]/[% theme %]/img/ascdesc.gif" alt="" />
466                     [% END %]
467                 </th>
468                 <th>
469                     <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]&amp;sortfield=author&amp;direction=[% IF sortfield != 'author' %]asc[% ELSE %][% new_direction %][% END %]">Author</a>
470                    [% IF sortfield == 'author' %]
471                         <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
472                    [% ELSE %]
473                        <img src="[% interface %]/[% theme %]/img/ascdesc.gif" alt="" />
474                    [% END %]
475                  </th>
476                 <th>Date added</th>
477                 <th>
478                     <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]&amp;sortfield=itemcallnumber&amp;direction=[% IF sortfield != 'itemcallnumber' %]asc[% ELSE %][% new_direction %][% END %]">Call number</a>
479                    [% IF sortfield == 'itemcallnumber' %]
480                         <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
481                    [% ELSE %]
482                        <img src="[% interface %]/[% theme %]/img/ascdesc.gif" alt="" />
483                    [% END %]
484                  </th>
485             </tr>
486         [% FOREACH itemsloo IN itemsloop %]
487                 <tr>
488             [% IF itemsloop %]
489                 <td>
490                     <input type="checkbox" class="selection" value="[% itemsloo.biblionumber %]" name="biblionumber" />
491                 </td>
492             [% END %]
493                         [% UNLESS ( item_level_itypes ) %]<td>
494                 [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]<img src="[% itemsloo.imageurl %]" alt="[% itemsloo.description %]" title="[% itemsloo.description %]" />[% END %][% itemsloo.description %]
495                         </td>[% END %]
496                         <td>
497                 [% IF ( itemsloo.XSLTBloc ) %]
498                     [% itemsloo.XSLTBloc %]
499                 [% ELSE %]
500                     [% INCLUDE 'biblio-default-view.inc' biblionumber = itemsloo.biblionumber %]
501                     [% itemsloo.title |html %][% FOREACH subtitl IN itemsloo.subtitle %] [% subtitl.subfield %][% END %]</a>
502                 [% END %]
503                     <p class="hold">
504                         [% IF ( itemsloo.notforloan ) %]
505                             <span class="noholdstext">No holds allowed</span>
506                         [% ELSE %]
507                             [% IF ( itemsloo.ITEM_RESULTS.size ) %]
508                                 <a id="reserve_[% itemsloo.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber %]">Holds</a>
509                                 [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
510                             [% ELSE %]
511                                 <span class="noholdstext">No holds allowed</span>
512                             [% END %]
513                         [% END %]
514                         [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
515                             | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% itemsloo.biblionumber %]">Edit record</a>
516                         [% END %]
517                         [% IF ( CAN_user_editcatalogue_edit_items ) %]
518                             | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber %]">Edit items</a>
519                         [% END %]
520                     </p>
521             </td>
522             <td>[% itemsloo.author %]</td>
523             <td>[% itemsloo.dateadded | $KohaDates%]</td>
524             <td>
525                 <ul>
526                 [% FOREACH result IN itemsloo.ITEM_RESULTS %]
527                     <li>[% result.holdingbranch %] [% IF ( result.location_intranet ) %] ([% result.location_intranet %]) [% END %]
528                         [% IF ( result.itemcallnumber ) %]
529                             [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% result.itemcallnumber |uri %]%22">[% result.itemcallnumber %]</a>]
530                         [% END %]
531                     </li>
532                 [% END %]
533                 </ul>
534             </td>
535                         </tr>
536                 [% END %]<!-- /itemsloop -->
537     </table>
538     <div class="pages">[% pagination_bar %]</div>
539 </form>
540
541         [% END %]
542    </div>
543 [% END %]
544
545 [% IF op == 'add_form' OR op == 'edit_form' %]
546 <div class="yui-ge">
547     <div class="yui-u first">
548     <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl" class="validated">
549         <fieldset class="rows">
550
551         [% IF op == 'add_form' %]
552             <legend>Create a new list</legend>
553             <input type="hidden" name="op" value="add" />
554         [% ELSE %]
555             <legend>Edit list <i>[% shelf.shelfname | html %]</i></legend>
556             <input type="hidden" name="op" value="edit" />
557         [% END %]
558         <input type="hidden" name="referer" value="[% referer | html %]" />
559         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
560         <ol>
561             <li>
562                 <label for="shelfname" class="required">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value="[% shelf.shelfname |html %]" required="required" class="required" />
563             <span class="required">Required</span>
564             </li>
565             <li>
566                 <span class="label">Owner: </span>
567                 [% IF op == 'add_form' %]
568                     <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber %]" />[% loggedinusername %]</li>
569                 [% ELSE %]
570                     [% IF owner %]
571                         <input type="hidden" id="owner" name="owner" value="[% owner.borrowernumber %]" />[% owner.firstname _ ' ' _ owner.surname %]
572                     [% ELSE %]
573                         <input type="hidden" id="owner" name="owner" value="[% loggedinusernumber %]" />[% loggedinusername %]
574                     [% END %]
575                 [% END %]
576             </li>
577             <li><label for="sortfield" >Sort this list by: </label>
578             <select name="sortfield">
579             [% IF shelf.sortfield == "title" %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
580             [% IF shelf.sortfield == "author" %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
581             [% IF shelf.sortfield == "copyrightdate" %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
582             [% IF shelf.sortfield == "itemcallnumber" %]<option value="itemcallnumber" selected="selected">Call number</option>[% ELSE %]<option value="itemcallnumber">Call number</option>[% END %]
583             </select></li>
584             <li><label for="category">Category: </label>
585                 <select id="category" name="category" onchange="AdjustRemark()">
586                 [% IF shelf.is_private %]
587                     <option value="1" selected="selected">Private</option>
588                 [% ELSE %]
589                     <option value="1">Private</option>
590                 [% END %]
591                 [% IF shelf.is_public %]
592                     <option value="2" selected="selected">Public</option>
593                 [% ELSE %]
594                     <option value="2">Public</option>
595                 [% END %]
596                            </select></li>
597
598             [% INCLUDE list_permissions %]
599
600         </ol>
601     </fieldset>
602
603     <fieldset class="action">
604         <input type="submit" value="Save" class="submit" />
605         [% IF referer == 'view' %]
606            <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]" class="cancel">Cancel</a>
607        [% ELSE %]
608             [% IF category == PUBLIC %]
609                 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&amp;category=[% PUBLIC %]" class="cancel">Cancel</a>
610             [% ELSE %]
611                 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&amp;category=[% PRIVATE %]" class="cancel">Cancel</a>
612             [% END %]
613         [% END %]
614     </fieldset>
615     </form>
616     </div>
617     <div class="yui-u">
618         <div class="help"><ul>
619             <li><b>Private list:</b> Is managed by you and can be seen only by you.</li>
620             <li><b>Public list:</b> Can be seen by everybody, but managed only by you.</li>
621         </ul>
622         </div>
623     </div>
624 </div>
625 [% END %]
626
627 [% IF op == 'list' %]
628     <h2>Lists</h2>
629     <div id="tabs" class="toptabs">
630         <ul>
631             <li id="privateshelves_tab" class="active"><a href="#tab_content">Your lists</a></li>
632             <li id="publicshelves_tab" class="active"><a href="#tab_content">Public lists</a></li>
633         </ul>
634
635         <div id="tab_content">
636             <table id="listresultst">
637                 <thead>
638                     <tr>
639                         <th class="NoVisible">Type</th>
640                         <th>List name</th>
641                         <th>Contents</th>
642                         <th>Type</th>
643                         <th>Owner</th>
644                         <th>Sort by</th>
645                         <th>Creation date</th>
646                         <th>Modification date</th>
647                         <th>Actions</th>
648                     </tr>
649                     <tr class="filters_row">
650                         <th></th>
651                         <th><input class="filter text_filter" id="searchshelfname_filter" placeholder="List name"></th>
652                         <th></th>
653                         <th></th>
654                         <th><input class="filter text_filter" id="searchowner_filter" placeholder="Owner"></th>
655                         <th>
656                             <select class="filter text_filter" id="searchsortby_filter">
657                                 <option value=""></option>
658                                 <option value="title">Title</option>
659                                 <option value="author">Author</option>
660                                 <option value="copyrightdate">Copyrightdate</option>
661                                 <option value="itemcallnumber">Call number</option>
662                             </select>
663                         </th>
664                         <th></th>
665                         <th></th>
666                         <th></th>
667                     </tr>
668                 </thead>
669                 <tbody></tbody>
670             </table>
671         </div>
672     </div>
673 [% END %]
674
675 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
676     <!-- Value will be set here by placeHold() -->
677     <input id="hold_form_biblios" type="hidden" name="biblionumbers" value="" />
678     <input type="hidden" name="multi_hold" value="1"/>
679 </form>
680
681 </div>
682 </div>
683
684 [% IF ( can_add_biblios ) %]
685 <div class="yui-b">
686   <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
687     <fieldset class="brief noprint">
688       <legend>Add items</legend>
689       <ol>
690         <li>
691           <label for="barcodes">Barcodes:</label>
692           <textarea name="barcodes" id="barcodes" class="focus" autocomplete="off" rows="5"></textarea>
693           <input type="hidden" name="op" value="add_biblio" />
694           <input type="hidden" name="referer" value="view" />
695           <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
696         </li>
697       </ol>
698       <fieldset class="action">
699         <input type="submit" value="Add" />
700       </fieldset>
701     </fieldset>
702   </form>
703 </div>
704 [% END %]
705
706 </div>
707 [% INCLUDE 'intranet-bottom.inc' %]