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