Merge remote-tracking branch 'origin/new/bug_6199'
[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 <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&shelfoff=[% shelfoff %]";
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($("#shelfname").val() == ""){
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 id="lists_shelves" class="lists">
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> [% 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 %]
119
120 [% 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>
121
122 <div id="doc" class="yui-t7">
123  <div id="bd">
124   <div id="yui-main">
125    <div class="yui-g">[% INCLUDE 'virtualshelves-toolbar.inc' %]
126    </div>
127 [% IF ( paramsloop ) %]
128 [% FOREACH paramsloo IN paramsloop %]
129 <div class="yui-ge">
130     <div class="yui-u first">
131         [% IF ( paramsloo.already ) %]<div class="dialog alert">A List named [% paramsloo.already %] already exists!</div>[% END %]
132                 [% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %]
133                 [% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %] 
134                 [% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No shelfnumber given.</div>[% END %] 
135                 [% IF ( paramsloo.need_confirm ) %]
136                 <div class="dialog alert">The list <i>[% paramsloo.need_confirm %]</i> is not empty.
137                         <br />It has <b>[% paramsloo.count %]</b> entries.
138                         <br />Use the "Confirm" button below to confirm deletion.
139                 </div>
140                 [% END %]
141                 [% IF ( paramsloo.nopermission ) %]
142                 <div class="dialog alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission %].</div>
143                 [% END %]
144                 [% IF ( paramsloo.failgetitem ) %]
145                 <div class="dialog alert">ERROR: No item found with barcode [% paramsloo.failgetitem %].</div>
146                 [% END %] 
147                 [% IF ( paramsloo.duplicatebiblio ) %]
148                 <div class="dialog alert">A record matching barcode <b>[% paramsloo.duplicatebiblio %]</b> has already been added.</div>
149                 [% END %]
150                 [% IF ( paramsloo.nothingdeleted) %]
151                       <div class="dialog message">Warning: You could not delete any selected items from this shelf.</div>
152                 [% END %]
153                 [% IF ( paramsloo.somedeleted) %]
154                       <div class="dialog message">Warning: You could not delete all selected items from this shelf.</div>
155                 [% END %]
156         </div>
157 </div>
158 [% END %]
159 [% END %] 
160
161 [% IF ( viewshelf ) %]
162    <div class="yui-g">
163     [% IF ( itemsloop ) %]
164
165         <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post" class="checkboxed">
166         <input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
167         <input type="hidden" name="modifyshelfcontents" value="1" />
168  <fieldset>
169   <legend>Contents of <i>[% shelfname | html %]</i></legend>
170    
171  [% IF ( itemsloop ) %]
172      <p><span class="checkall"></span> |
173      <span class="clearall"></span></p>
174  [% END %]
175         
176  <div class="pages">[% pagination_bar %]</div>
177     <table>
178             <tr>
179                 [% IF ( itemsloop ) %]<th class="checkall">&nbsp;</th>[% END %]
180                 [% UNLESS ( item_level_itypes ) %]<th>Item Type</th>[% END %]
181                 <th>Title</th>
182                 <th>Author</th>
183                 <th>Date Added</th>
184                 <th>&nbsp;</th>
185             </tr>
186                 [% FOREACH itemsloo IN itemsloop %]
187                         [% UNLESS ( loop.odd ) %]
188                         <tr class="highlight">
189                         [% ELSE %]
190                         <tr>
191                         [% END %]
192                         [% IF ( itemsloop ) %]
193                         <td>
194                                 [% IF ( itemsloo.confirm ) %]
195                                 <input type="hidden"   name="CONFIRM-[% itemsloo.confirm %]" />
196                                 <input type="checkbox" class="selection" value="[% itemsloo.biblionumber %]" name="REM-[% itemsloo.biblionumber %]" checked />
197                                 [% ELSE %]
198                                 <input type="checkbox" class="selection" value="[% itemsloo.biblionumber %]" name="REM-[% itemsloo.biblionumber %]" />
199                                 [% END %]
200                         </td>
201                         [% END %]
202                         [% UNLESS ( item_level_itypes ) %]<td>
203                 [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]<img src="[% itemsloo.imageurl %]" alt="[% itemsloo.description %]" title="[% itemsloo.description %]" />[% END %][% itemsloo.description %]
204                         </td>[% END %]
205                         <td>
206                         [% INCLUDE 'biblio-default-view.inc' biblionumber = itemsloo.biblionumber %]
207                         [% itemsloo.title |html %][% FOREACH subtitl IN itemsloo.subtitle %] [% subtitl.subfield %][% END %]</a>
208                         </td>
209                         <td>[% itemsloo.author %]</td>
210                         <td>[% itemsloo.dateadded %]</td>
211                         <td>
212                         [% UNLESS ( itemsloo.notforloan ) %]
213                         <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber %]">Holds</a>
214                         [% END %]
215                         </td>
216                         </tr>
217                 [% END %]<!-- /itemsloop -->
218     </table><fieldset class="action">
219         [% IF ( itemsloop ) %]
220             <input type="button" id="placehold" style="display:none" onclick="placeHold(); return false;" value="Place Holds" />
221             [% IF ( allowremovingitems ) %]<input type="submit" value="Remove selected records" onclick="return confirm(_('Are you sure you want to remove these records from the shelf?'));" />[% END %]
222             <input type="submit" value="Merge selected records" onclick="return MergeItems();" />
223         [% END %]
224  </fieldset>
225  </fieldset>
226  
227 </form>
228         [% END %]
229    </div>
230 [% END %]<!-- /viewshelf -->
231
232 [% IF ( allowaddingitem ) %]
233 <div class="yui-g">
234 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
235  <fieldset class="brief">
236     <legend>Add an item to <i>[% shelfname | html %]</i></legend>
237         <ol>
238             <li>
239                 <label for="addbarcode">Barcode:</label>
240                 <input name="addbarcode" type="text" id="addbarcode" size="14" />
241                 <input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
242                 <input type="hidden" name="modifyshelfcontents" value="1" />
243                 <input type="submit" value="Add" />
244             </li>
245         </ol>
246  </fieldset>
247 </form>
248 </div>
249 [% END %]<!-- /allowaddingitem -->
250
251 [% IF ( debug ) %]
252   [% IF ( edit ) %]<div>Edit is on ([% shelfname | html %])</div>[% END %]
253   [% IF ( seflag ) %]<div>seflag is on ([% seflag %])</div>[% END %]
254 [% END %]
255
256 [% IF ( seflag ) %]
257 <div class="yui-ge">
258     <div class="yui-u first">
259     <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl">
260         <fieldset class="rows">
261
262     [% IF ( shelves ) %]
263         <input type="hidden" name="shelves" value="1" />
264         <legend>Create a new List</legend>
265         <ol>
266         <li><label class="required" for="addshelf">List Name:</label><input id="addshelf" type="text" name="addshelf" size="25" /></li>
267         <li><span class="label">Owner: </span><input type="hidden" name="owner" id="owner" value="[% loggedinuser %]" />[% loggedinusername %]</li>
268                 <li><label for="sortfield" >Sort this list by: </label>
269                 <select name="sortfield" id="sortfield">
270                 [% IF ( sort_title ) %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
271                 [% IF ( sort_author ) %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
272                 [% IF ( sort_copyrightdate ) %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
273                 </select></li>
274         <li><label for="category">Category: </label>
275                         <select name="category" id="category">
276                   <option value="1">Private</option>
277                   <option value="2">Public</option>
278                         </select></li></ol>
279     [% END %]
280
281     [% IF ( edit ) %]
282                 <input type="hidden" name="op" value="modifsave" />
283         [% IF ( showprivateshelves ) %]<input type="hidden" name="display" value="privateshelves" />[% END %]
284                 <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" />
285                 <legend>Edit List <i>[% shelfname | html %]</i></legend>
286                 <ol>
287                 <li><label for="shelfname">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value="[% shelfname |html %]" /></li>
288                 <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>
289                 <li><label for="sortfield" >Sort this list by: </label>
290                 <select name="sortfield">
291                 [% IF ( sort_title ) %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
292                 [% IF ( sort_author ) %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
293                 [% IF ( sort_copyrightdate ) %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
294                 </select></li>
295                 <li><label for="category">Category: </label>
296                         <select id="category" name="category">
297                         [% IF ( category1 ) %]
298                                 <option value="1" selected="selected">Private</option>
299                         [% ELSE %]
300                                 <option value="1">Private</option>
301                         [% END %]
302                         [% IF ( category2 ) %]
303                                 <option value="2" selected="selected">Public</option>
304                         [% ELSE %]
305                                 <option value="2">Public</option>
306                         [% END %]
307                         </select></li></ol>
308         [% END %]
309
310                 </fieldset>
311                 <fieldset class="action"><input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" />
312         [% 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 %]
313     </fieldset>
314     </form>
315     </div>
316     <div class="yui-u">
317         <div class="help"><ul>
318             <li>A <b>Private</b> List is managed by you and can be seen only by you.</li>
319             <li> A <b>Public</b> List can be seen by everybody, but managed only by you.</li>
320         </ul>
321         </div>
322     </div>
323 </div>
324 [% END %]<!-- /seflag -->
325
326 [% UNLESS ( vseflag ) %]
327         <h2>Lists</h2>
328                 <div class="toptabs">
329         <ul class="ui-tabs-nav">
330         [% IF ( showprivateshelves ) %]
331             <li id="privateshelves_tab" class="ui-tabs-selected"><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your Lists</a></li>
332         [% ELSE %]
333             <li id="privateshelves_tab" class=""><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your Lists</a></li>
334         [% END %]
335         [% IF ( showpublicshelves ) %]
336             <li id="publicshelves_tab" class="ui-tabs-selected"><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public Lists</a></li>
337         [% ELSE %]
338             <li id="publicshelves_tab" class=""><a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public Lists</a></li>
339         [% END %]
340         </ul>
341         [% IF ( showprivateshelves ) %]
342                 <div id="privateshelves" class="ui-tabs-panel" style="display:block;">
343                 [% ELSE %]
344                 <div id="privateshelves" class="ui-tabs-panel" style="display:none;">
345                 [% END %]
346             [% IF ( shelveslooppriv ) %]
347                         <div class="pages">[% pagination_bar %]</div>
348                         <table>
349                         <tr><th>List Name</th><th>Contents</th><th>Sort by</th><th>Type</th><th>Options</th></tr>
350                 [% FOREACH shelveslooppri IN shelveslooppriv %]
351                     [% IF ( shelveslooppri.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
352         <td><a href="shelves.pl?[% IF ( shelveslooppri.showprivateshelves ) %]display=privateshelves&amp;[% END %]viewshelf=[% shelveslooppri.shelf %]&amp;shelfoff=[% shelfoff %]">[% shelveslooppri.shelfname |html %]</a></td>
353         <td>[% shelveslooppri.count %] item(s)</td>
354         <td>[% IF ( shelveslooppri.authorsort ) %]Author[% ELSIF ( shelveslooppri.yearsort ) %]Year[% ELSE %]Title[% END %]</td>
355         <td>[% IF ( shelveslooppri.viewcategory1 ) %]Private[% END %]
356                         [% IF ( shelveslooppri.viewcategory2 ) %]Public[% 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="shelfoff" value="[% shelfoff %]" />
371                                         <input type="hidden" name="shelves" value="1" />
372                     <input type="hidden" name="display" value="privateshelves" />
373                                         <input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" />
374                                         [% IF ( shelveslooppri.confirm ) %]
375                                         <input type="hidden" name="CONFIRM-[% shelveslooppri.confirm %]" value="1" />
376                                         <input type="submit" class="approve" value="Confirm" />
377                                         [% ELSE %]
378                                         <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
379                                         [% END %]
380                                 </form>
381                         [% ELSE %]
382                                 None
383                         [% END %]
384                 </td>
385                 </tr>
386                 [% END %]
387         </table>
388             [% ELSE %]
389             <p>No private lists.</p>
390             [% END %]<!-- /shelveslooppriv -->
391                 </div><!-- /privateshelves -->
392
393         [% IF ( showpublicshelves ) %]
394                 <div id="publicshelves" class="ui-tabs-panel" style="display:block;">
395                 [% ELSE %]
396                 <div id="publicshelves" class="ui-tabs-panel" style="display:none;">
397                 [% END %]
398         [% IF ( shelvesloop ) %]
399                 <div class="pages">[% pagination_bar %]</div>
400         <table>
401         <tr><th>List Name</th><th>Created by</th><th>Contents</th><th>Sort By</th><th>Type</th><th>Options</th></tr>
402             [% FOREACH shelvesloo IN shelvesloop %]
403                 [% IF ( shelvesloo.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
404                 <td><a href="shelves.pl?viewshelf=[% shelvesloo.shelf %]">[% shelvesloo.shelfname |html %]</a></td>
405         <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% shelvesloo.owner %]">[% shelvesloo.ownername %]</td>
406                 <td>[% shelvesloo.count %] item(s)</td>
407         <td>[% IF ( shelvesloo.authorsort ) %]Author[% ELSIF ( shelvesloo.yearsort ) %]Year[% ELSE %]Title[% END %]</td>
408         <td>[% IF ( shelvesloo.viewcategory1 ) %]Private[% END %]
409                         [% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
410                 </td>
411         <td>
412             [% IF ( shelvesloo.manageshelf ) %]
413                                 <form action="shelves.pl" method="get">
414                                         <input type="hidden" name="shelfnumber" value="[% shelvesloo.shelf %]" />
415                                         <input type="hidden" name="op" value="modif" />
416                                         <input type="submit" class="editshelf" value="Edit" />
417                                 </form>
418                                 <form action="shelves.pl" method="post">
419                                         <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
420                                         <input type="hidden" name="shelves" value="1" />
421                                         <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
422                                         [% IF ( shelvesloo.confirm ) %]
423                                         <input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" />
424                                         <input type="submit" class="approve" value="Confirm" />
425                                         [% ELSE %]
426                                         <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
427                                         [% END %]
428                                 </form>
429                         [% ELSE %]
430                                 None
431                         [% END %]
432                 </td>
433                 </tr>
434             [% END %]
435         </table>
436         [% ELSE %]
437             [% IF ( showpublicshelves ) %]<p>No public lists.</p>[% END %]
438         [% END %]<!-- /shelvesloop -->
439         </div><!-- /publicshelves -->
440                 </div>
441 [% END %]
442
443 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
444     <!-- Value will be set here by placeHold() -->
445     <input id="hold_form_biblios" type="hidden" name="biblionumbers" value="" />
446     <input type="hidden" name="multi_hold" value="1"/>
447 </form>
448
449 </div>
450 </div>
451 [% INCLUDE 'intranet-bottom.inc' %]