Merge remote-tracking branch 'kc/new/bug_5868' into kcmaster
[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 %][% ELSE %]Lists[% END %][% IF ( shelves ) %] &rsaquo; Create New List[% END %][% IF ( edit ) %] &rsaquo; Edit List [% shelfname %][% END %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
5 <script type="text/javascript">
6 //<![CDATA[ 
7
8 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
9
10 $(document).ready(function(){
11         $("#addbarcode").focus();
12         $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\">"+_('Clear All')+"<\/a>");
13         $("span.checkall").html("<a id=\"CheckAll\" href=\"/cgi-bin/koha/shelves.pl\">"+_('Select All')+"<\/a>");
14     $("#CheckAll").click(function(){
15         $(".checkboxed").checkCheckboxes();
16         return false;
17     });
18     $("#CheckNone").click(function(){
19         $(".checkboxed").unCheckCheckboxes();
20         return false;
21     });
22     $("#placehold").show();
23 });
24
25         function confirmDelete(message){
26                 if (window.confirm(message)) {
27                         location.href="/cgi-bin/koha/virtualshelves/shelves.pl?[% IF ( showprivateshelves ) %]display=privateshelves&[% END %]shelves=1&DEL-[% shelfnumber %]=1";
28                 } else { 
29                         return false;
30                 }
31         }
32
33     /**
34      * This function checks if the adequate number of records are checked for merging
35      */
36     function MergeItems() {
37         var checkboxes = $("input:checkbox:checked");
38         var nbCheckbox = checkboxes.length;
39         if (nbCheckbox != 2) {
40             alert(_('Two records must be selected for merging.'));
41         } else {
42             location.href='/cgi-bin/koha/cataloguing/merge.pl?biblionumber=' + checkboxes[0].value + '&amp;biblionumber=' + checkboxes[1].value;
43         }
44         return false;
45     }
46
47     /**
48      * This function checks all checkboxes if all are empty,
49      * or unchecks all if any already checked.
50      */
51     function CheckAll(){
52         var checkboxes = document.getElementsByTagName('input');
53         var nbCheckbox = checkboxes.length;
54         var check = areAllChecked();
55         for(var i=0;i<nbCheckbox;i++){
56             if(checkboxes[i].getAttribute('type') == "checkbox" ){
57                 checkboxes[i].checked = (check) ? 0 : 1;
58             }
59         }
60     }
61     /**
62      * This function returns true if ALL checkboxes are checked
63      */
64     function areAllChecked(){
65         var checkboxes = document.getElementsByTagName('input');
66         var nbCheckbox = checkboxes.length;
67         for(var i=0;i<nbCheckbox;i++){
68             if(checkboxes[i].getAttribute('type') == "checkbox" ){
69                 if(checkboxes[i].checked == 0){
70                     return false;
71                 }
72             }
73         }
74         return true;
75     }
76     
77 function placeHold () {
78     var checkedItems = $(".selection:checked");
79     if ($(checkedItems).size() == 0) {
80         alert(MSG_NO_ITEM_SELECTED);
81         return false;
82     }
83     var bibs = "";
84     $(checkedItems).each(function() {
85         bibs += $(this).val() + "/";
86     });
87     $("#hold_form_biblios").val(bibs);
88     $("#hold_form").submit();
89     return false;
90 }
91     /**
92      * This function checks to make sure a list title is assigned
93      */
94       function Check(f) {
95                 var _alertString="";
96                 var alertString2;
97
98             if(f.addshelf.value.length ==0){
99                         _alertString += _("- You must enter a List Name") + "\n";
100                 }
101
102                 if (_alertString.length==0) {
103             f.submit();
104                 } else {
105                         alertString2 = _("Form not submitted because of the following problem(s)");
106                         alertString2 += "\n------------------------------------------------------------------------------------\n\n";
107                         alertString2 += _alertString;
108                         alert(alertString2);
109                 }
110         }
111 //]]>
112 </script>
113 </head>
114 <body>
115 [% INCLUDE 'header.inc' %]
116 [% INCLUDE 'cat-search.inc' %]
117
118 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a>
119 [% IF ( viewshelf ) %]&rsaquo; Contents of <i>[% shelfname %]</i>[% END %][% IF ( shelves ) %] &rsaquo; Create New List[% END %][% IF ( edit ) %] &rsaquo; Edit List <i>[% shelfname %]</i>[% END %]</div>
120
121 <div id="doc" class="yui-t7">
122  <div id="bd">
123   <div id="yui-main">
124    <div class="yui-g">[% INCLUDE 'virtualshelves-toolbar.inc' %]
125    </div>
126 [% IF ( paramsloop ) %]
127 [% FOREACH paramsloo IN paramsloop %]
128 <div class="yui-ge">
129     <div class="yui-u first">
130         [% IF ( paramsloo.already ) %]<div class="dialog alert">A List named [% paramsloo.already %] already exists!</div>[% END %]
131                 [% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %]
132                 [% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %] 
133                 [% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No shelfnumber given.</div>[% END %] 
134                 [% IF ( paramsloo.need_confirm ) %]
135                 <div class="dialog alert">The list <i>[% paramsloo.need_confirm %]</i> is not empty.
136                         <br />It has <b>[% paramsloo.count %]</b> entries.
137                         <br />Use the "Confirm" button below to confirm deletion.
138                 </div>
139                 [% END %]
140                 [% IF ( paramsloo.nopermission ) %]
141                 <div class="dialog alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission %].</div>
142                 [% END %]
143                 [% IF ( paramsloo.failgetitem ) %]
144                 <div class="dialog alert">ERROR: No item found with barcode [% paramsloo.failgetitem %].</div>
145                 [% END %] 
146                 [% IF ( paramsloo.duplicatebiblio ) %]
147                 <div class="dialog alert">A record matching barcode <b>[% paramsloo.duplicatebiblio %]</b> has already been added.</div>
148                 [% END %] 
149         </div>
150 </div>
151 [% END %]
152 [% END %] 
153
154 [% IF ( viewshelf ) %]
155    <div class="yui-g">
156     [% IF ( itemsloop ) %]
157
158         <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post" class="checkboxed">
159         <input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
160         <input type="hidden" name="modifyshelfcontents" value="1" />
161  <fieldset>
162   <legend>Contents of <i>[% shelfname %]</i></legend>
163    
164  [% IF ( manageshelf ) %]
165      <p><span class="checkall"></span> |
166      <span class="clearall"></span></p>
167  [% END %]
168         
169  <div class="pages">[% pagination_bar %]</div>
170     <table>
171             <tr>
172                 [% IF ( manageshelf ) %]<th class="checkall">&nbsp;</th>[% END %]
173                 [% UNLESS ( item_level_itypes ) %]<th>Item Type</th>[% END %]
174                 <th>Title</th>
175                 <th>Author</th>
176                 <th>Date Added</th>
177                 <th>&nbsp;</th>
178             </tr>
179                 [% FOREACH itemsloo IN itemsloop %]
180                         [% UNLESS ( loop.odd ) %]
181                         <tr class="highlight">
182                         [% ELSE %]
183                         <tr>
184                         [% END %]
185                         [% IF ( manageshelf ) %]
186                         <td>
187                                 [% IF ( itemsloo.confirm ) %]
188                                 <input type="hidden"   name="CONFIRM-[% itemsloo.confirm %]" />
189                                 <input type="checkbox" class="selection" value="[% itemsloo.biblionumber %]" name="REM-[% itemsloo.biblionumber %]" checked />
190                                 [% ELSE %]
191                                 <input type="checkbox" class="selection" value="[% itemsloo.biblionumber %]" name="REM-[% itemsloo.biblionumber %]" />
192                                 [% END %]
193                         </td>
194                         [% END %]
195                         [% UNLESS ( item_level_itypes ) %]<td>
196                 [% UNLESS ( noItemTypeImages ) %]<img src="[% itemsloo.imageurl %]" alt="[% itemsloo.description %]" title="[% itemsloo.description %]" />[% END %][% itemsloo.description %]
197                         </td>[% END %]
198                         <td>
199                         [% INCLUDE 'biblio-default-view.inc' biblionumber = itemsloo.biblionumber %]
200                         [% itemsloo.title |html %][% FOREACH subtitl IN itemsloo.subtitle %] [% subtitl.subfield %][% END %]</a>
201                         </td>
202                         <td>[% itemsloo.author %]</td>
203                         <td>[% itemsloo.dateadded %]</td>
204                         <td>
205                         [% UNLESS ( itemsloo.notforloan ) %]
206                         <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber %]">Holds</a>
207                         [% END %]
208                         </td>
209                         </tr>
210                 [% END %]<!-- /itemsloop -->
211     </table><fieldset class="action">
212         [% IF ( manageshelf ) %]
213             <input type="button" id="placehold" style="display:none" onclick="placeHold(); return false;" value="Place Holds" />
214             <input type="submit" value="Remove selected records" onclick="return confirm(_('Are you sure you want to remove these records from the shelf?'));" />
215             <input type="submit" value="Merge selected records" onclick="return MergeItems();" />
216         [% END %]
217  </fieldset>
218  </fieldset>
219  
220 </form>
221         [% END %]
222    </div>
223 [% END %]<!-- /viewshelf -->
224
225 [% IF ( manageshelf ) %]
226 <div class="yui-g">
227 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
228  <fieldset class="brief">
229     <legend>Add an item to <i>[% shelfname %]</i></legend>
230         <ol>
231             <li>
232                 <label for="addbarcode">Barcode:</label>
233                 <input name="addbarcode" type="text" id="addbarcode" size="14" />
234                 <input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
235                 <input type="hidden" name="modifyshelfcontents" value="1" />
236                 <input type="submit" value="Add" />
237             </li>
238         </ol>
239  </fieldset>
240 </form>
241 </div>
242 [% END %]<!-- /manageshelf -->
243
244 [% IF ( debug ) %]
245   [% IF ( edit ) %]<div>Edit is on ([% shelfname %])</div>[% END %]
246   [% IF ( seflag ) %]<div>seflag is on ([% seflag %])</div>[% END %]
247 [% END %]
248
249 [% IF ( seflag ) %]
250 <div class="yui-ge">
251     <div class="yui-u first">
252     <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl">
253         <fieldset class="rows">
254
255     [% IF ( shelves ) %]
256         <input type="hidden" name="shelves" value="1" />
257         <legend>Create a new List</legend>
258         <ol>
259         <li><label class="required" for="addshelf">List Name:</label><input id="addshelf" type="text" name="addshelf" size="25" /></li>
260         <li><span class="label">Owner: </span><input type="hidden" name="owner" id="owner" value="[% loggedinuser %]" />[% loggedinusername %]</li>
261                 <li><label for="sortfield" >Sort this list by: </label>
262                 <select name="sortfield" id="sortfield">
263                 [% IF ( sort_title ) %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
264                 [% IF ( sort_author ) %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
265                 [% IF ( sort_copyrightdate ) %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
266                 </select></li>
267         <li><label for="category">Category: </label>
268                         <select name="category" id="category">
269                   <option value="1">Private</option>
270                   <option value="2">Public</option>
271                   <option value="3">Open</option>
272                         </select></li></ol>
273     [% END %]
274
275     [% IF ( edit ) %]
276                 <input type="hidden" name="op" value="modifsave" />
277         [% IF ( showprivateshelves ) %]<input type="hidden" name="display" value="privateshelves" />[% END %]
278                 <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" />
279                 <legend>Edit List <i>[% shelfname %]</i></legend>
280                 <ol>
281                 <li><label for="shelfname">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value='[% shelfname |html %]' /></li>
282                 <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>
283                 <li><label for="sortfield" >Sort this list by: </label>
284                 <select name="sortfield">
285                 [% IF ( sort_title ) %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
286                 [% IF ( sort_author ) %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
287                 [% IF ( sort_copyrightdate ) %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
288                 </select></li>
289                 <li><label for="category">Category: </label>
290                         <select id="category" name="category">
291                         [% IF ( category1 ) %]
292                                 <option value="1" selected="selected">Private</option>
293                         [% ELSE %]
294                                 <option value="1">Private</option>
295                         [% END %]
296                         [% IF ( category2 ) %]
297                                 <option value="2" selected="selected">Public</option>
298                         [% ELSE %]
299                                 <option value="2">Public</option>
300                         [% END %]
301                         [% IF ( category3 ) %]
302                                 <option value="3" selected="selected">Open</option>
303                         [% ELSE %]
304                                 <option value="3">Open</option>
305                         [% END %]
306                         </select></li></ol>
307         [% END %]
308
309                 </fieldset>
310                 <fieldset class="action"><input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" />
311         [% IF ( showprivateshelves ) %]<a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves" class="cancel">Cancel</a>[% ELSE %]<a href="/cgi-bin/koha/virtualshelves/shelves.pl" class="cancel">Cancel</a>[% END %]
312     </fieldset>
313     </form>
314     </div>
315     <div class="yui-u">
316         <div class="help"><ul>
317             <li>A <b>Private</b> List is managed by you and can be seen only by you.</li>
318             <li> A <b>Public</b> List can be seen by everybody, but managed only by you.</li>
319             <li> A <b>Open</b> List can be seen and managed by everybody.</li>
320         </ul></div>
321     </div>
322 </div>
323 [% END %]<!-- /seflag -->
324
325 [% UNLESS ( vseflag ) %]
326         <h2>Lists</h2>
327                 <div class="toptabs">
328         <ul class="ui-tabs-nav">
329         [% IF ( showprivateshelves ) %]
330             <li id="privateshelves_tab" class="ui-tabs-selected"><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your Lists</a></li>
331         [% ELSE %]
332             <li id="privateshelves_tab" class=""><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your Lists</a></li>
333         [% END %]
334         [% IF ( showpublicshelves ) %]
335             <li id="publicshelves_tab" class="ui-tabs-selected"><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public Lists</a></li>
336         [% ELSE %]
337             <li id="publicshelves_tab" class=""><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public Lists</a></li>
338         [% END %]
339         </ul>
340         [% IF ( showprivateshelves ) %]
341                 <div id="privateshelves" class="ui-tabs-panel" style="display:block;">
342                 [% ELSE %]
343                 <div id="privateshelves" class="ui-tabs-panel" style="display:none;">
344                 [% END %]
345             [% IF ( shelveslooppriv ) %]
346                         [% pagination_bar %]
347                         <table>
348                         <tr><th>List Name</th><th>Contents</th><th>Sort by</th><th>Type</th><th>Options</th></tr>
349                 [% FOREACH shelveslooppri IN shelveslooppriv %]
350                     [% IF ( shelveslooppri.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
351         <td><a href="shelves.pl?[% IF ( shelveslooppri.showprivateshelves ) %]display=privateshelves&amp;[% END %]viewshelf=[% shelveslooppri.shelf %]">[% shelveslooppri.shelfname |html %]</a></td>
352         <td>[% shelveslooppri.count %] item(s)</td>
353         <td>[% IF ( shelveslooppri.authorsort ) %]Author[% ELSIF ( shelveslooppri.yearsort ) %]Year[% ELSE %]Title[% END %]</td>
354         <td>[% IF ( shelveslooppri.viewcategory1 ) %]Private[% END %]
355                         [% IF ( shelveslooppri.viewcategory2 ) %]Public[% END %]
356                         [% IF ( shelveslooppri.viewcategory3 ) %]Open[% END %]
357                 </td>
358         <td>
359             [% IF ( shelveslooppri.mine ) %]
360                                 <form action="merge.pl" method="get">
361                                         <input type="hidden" name="shelf" value="[% shelveslooppri.shelf %]" />
362                                 </form>
363                                 <form action="shelves.pl" method="get">
364                                         <input type="hidden" name="shelfnumber" value="[% shelveslooppri.shelf %]" />
365                                         <input type="hidden" name="op" value="modif" />
366                     <input type="hidden" name="display" value="privateshelves" />
367                                         <input type="submit" class="editshelf" value="Edit" />
368                                 </form>
369                                 <form action="shelves.pl" method="post">
370                                         <input type="hidden" name="shelves" value="1" />
371                     <input type="hidden" name="display" value="privateshelves" />
372                                         <input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" />
373                                         [% IF ( shelveslooppri.confirm ) %]
374                                         <input type="hidden" name="CONFIRM-[% shelveslooppri.confirm %]" value="1" />
375                                         <input type="submit" class="approve" value="Confirm" />
376                                         [% ELSE %]
377                                         <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
378                                         [% END %]
379                                 </form>
380                         [% ELSE %]
381                                 None
382                         [% END %]
383                 </td>
384                 </tr>
385                 [% END %]
386         </table>
387             [% ELSE %]
388             <p>No Private Lists.</p>
389             [% END %]<!-- /shelveslooppriv -->
390                 </div><!-- /privateshelves -->
391
392         [% IF ( showpublicshelves ) %]
393                 <div id="publicshelves" class="ui-tabs-panel" style="display:block;">
394                 [% ELSE %]
395                 <div id="publicshelves" class="ui-tabs-panel" style="display:none;">
396                 [% END %]
397         [% IF ( shelvesloop ) %]
398                 [% pagination_bar %]
399         <table>
400         <tr><th>List Name</th><th>Contents</th><th>Sort By</th><th>Type</th><th>Options</th></tr>
401             [% FOREACH shelvesloo IN shelvesloop %]
402                 [% IF ( shelvesloo.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
403                 <td><a href="shelves.pl?viewshelf=[% shelvesloo.shelf %]">[% shelvesloo.shelfname |html %]</a></td>
404                 <td>[% shelvesloo.count %] item(s)</td>
405         <td>[% IF ( shelvesloo.authorsort ) %]Author[% ELSIF ( shelvesloo.yearsort ) %]Year[% ELSE %]Title[% END %]</td>
406         <td>[% IF ( shelvesloo.viewcategory1 ) %]Private[% END %]
407                         [% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
408                         [% IF ( shelvesloo.viewcategory3 ) %]Open[% END %]
409                 </td>
410         <td>
411             [% IF ( shelvesloo.manageshelf ) %]
412                                 <form action="shelves.pl" method="get">
413                                         <input type="hidden" name="shelfnumber" value="[% shelvesloo.shelf %]" />
414                                         <input type="hidden" name="op" value="modif" />
415                                         <input type="submit" class="editshelf" value="Edit" />
416                                 </form>
417                                 <form action="shelves.pl" method="post">
418                                         <input type="hidden" name="shelves" value="1" />
419                                         <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
420                                         [% IF ( shelvesloo.confirm ) %]
421                                         <input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" />
422                                         <input type="submit" class="approve" value="Confirm" />
423                                         [% ELSE %]
424                                         <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
425                                         [% END %]
426                                 </form>
427                         [% ELSE %]
428                                 None
429                         [% END %]
430                 </td>
431                 </tr>
432             [% END %]
433         </table>
434         [% ELSE %]
435                 [% IF ( showpublicshelves ) %]No Public Lists.[% END %]
436         [% END %]<!-- /shelvesloop -->
437         </div><!-- /publicshelves -->
438                 </div>
439 [% END %]
440
441 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
442     <!-- Value will be set here by placeHold() -->
443     <input id="hold_form_biblios" type="hidden" name="biblionumbers" value="" />
444     <input type="hidden" name="multi_hold" value="1"/>
445 </form>
446
447 </div>
448 </div>
449 [% INCLUDE 'intranet-bottom.inc' %]