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