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