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