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