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