Ticket 1014 : Added serial collections in opac
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / opac-full-serial-issues.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo;  Serials
2 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
3 <script type="text/javascript" language="javascript">
4 //<![CDATA[
5
6 $(document).ready(function(){
7     initFilters();
8         
9 });
10
11 // Filters initialization
12 function initFilters() {
13
14     // Deleting everything from the library filter
15     $("#libraryfilter option").remove();
16
17     // Getting each branchcode from the currently displayed tab
18     var subarray = [];      
19     $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.libraryfilterclass").each(function() {
20         if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
21     });
22
23     // Setting the option values with branchcodes 
24     $("#libraryfilter").append('<option value="all">(All)</option>');    
25     for (var i = 0; i < subarray.length; i++) {
26         $("#libraryfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');    
27     }
28 }
29
30 // Filter by Library
31 function filterByLibrary() {
32     
33     selectedStatus = $("#libraryfilter").val();
34
35     // Reset the filters but keeps the selected library
36     clearFilters(true);
37
38     if (selectedStatus != 'all') {
39
40         // We hide everything
41         $("table.subscriptionstclass tbody tr").hide();
42         
43         // Then show the lines that match the currently selected library 
44         $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedStatus + ")").parent().show();
45
46
47         // We then prepare the subscription filter :
48         
49         // Getting subscription id's for the selected library 
50         var subarray = [];      
51         $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.subscriptionidfilterclass").each(function() {
52             if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
53         });
54         // Setting the option values with subscription id's
55         $("#subscriptionidfilter").append('<option value="all">(All)</option>');    
56         for (var i = 0; i < subarray.length; i++) {
57             $("#subscriptionidfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');    
58         }
59
60         // Subscription filtering is now ready
61         $("#subscriptionidfilter").removeAttr("disabled");
62     }
63 }
64
65 // Filter by subscription id
66 function filterBySubscriptionId() {
67     
68     selectedSubscription = $("#subscriptionidfilter").val();
69     selectedLibrary      = $("#libraryfilter").val();
70     
71     if (selectedSubscription == "all") {
72         clearFilters(true);
73         filterByLibrary();
74     } else {
75
76         // We hide everything
77         $("table.subscriptionstclass tbody tr").hide();
78
79         // Then show the lines that match the currently selected library 
80         $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedLibrary + ")").parent().show();                
81         
82         // Then hide the lines where the subscription id does not match the selected one
83         $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass").not(
84             $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass:contains(" + selectedSubscription + ")")
85         ).parent().hide();                
86     }
87 }
88
89 // Clears filters : reset everything
90 // (Though preserves the selected library if the keeplibrary parameter is set to true)
91 function clearFilters(keeplibrary) {
92
93     // Show all content
94     $("table.subscriptionstclass tbody tr").show();
95     
96     // Remove old subscription options
97     $("#subscriptionidfilter option").remove();
98     $("#subscriptionidfilter option").append('<option value="all">(All)</option>');
99     $("#subscriptionidfilter").attr("disabled", "disabled");
100  
101     if (keeplibrary != true) { 
102         // Reinit library options
103         initFilters();
104         $("#libraryfilter option[@value=all]").attr("selected", "selected"); 
105     }
106 }
107
108 //]]>
109 </script>
110
111 </head>
112 <body>
113 <!-- TMPL_IF NAME="OpacNav" --><div id="doc3" class="yui-t1"><!-- TMPL_ELSE --><div id="doc3" class="yui-t7"><!-- /TMPL_IF -->
114    <div id="bd">
115 <!-- TMPL_INCLUDE name="masthead.inc" -->
116
117         <div id="yui-main">
118         <div class="yui-b"><div class="yui-g">
119 <div class="container">
120
121 <!-- TMPL_UNLESS name="popup" -->
122     <h1 class="catalogue">Subscription information for <!-- TMPL_VAR name="bibliotitle" --></h1>
123     <a href="opac-detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->" class="button catalogue">Back to biblio</a>
124 <!-- /TMPL_UNLESS -->
125     <div class="tabsubs">
126     <!-- TMPL_LOOP NAME="years" -->
127         <!-- TMPL_IF NAME="year" -->
128             <a  class="tabsubs" href="javascript:showlayer(<!-- TMPL_VAR NAME="year" -->)"><!-- TMPL_VAR NAME="year" --></a>
129         <!-- /TMPL_IF -->
130     <!-- /TMPL_LOOP -->
131     <a class="tabsubs" href="opac-serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->&selectview=small">Compact view</a>
132     </div>
133
134     <form action="opac-serial-issues.pl" onsubmit="filterByLibrary(); return false;">
135         <fieldset>
136             
137             <legend>Filters :</legend>
138
139             <label for="libraryfilter">Library : </label>
140             <select id="libraryfilter" onchange="filterByLibrary();">
141             </select>
142             
143             <label for="subscriptionidfilter">Subscription : </label>
144             <select id="subscriptionidfilter" disabled="disabled" onchange="filterBySubscriptionId();">
145             </select>
146             
147             <input type="reset" value="Clear Filters" onclick="clearFilters();" />
148         
149         </fieldset>
150     </form>
151     <!-- TMPL_LOOP NAME="years" -->
152   <!--TMPL_IF Name="first" -->  
153     <div name="yeardata" id="<!-- TMPL_VAR NAME="year" -->" class="tabsub" style="display:block"><!--TMPL_ELSE --><div name="yeardata" id="<!-- TMPL_VAR NAME="year" -->" class="tabsub" style="display:none"><!--/TMPL_IF -->
154         <table class="subscriptionstclass" width="400px">
155             <thead>
156                 <tr>
157                     <th>Date
158                     </th>
159                     <th>Library
160                     </th>
161                     <th>Notes
162                     </th>
163                     <th>Date received
164                     </th>
165                     <th>Number
166                     </th>
167                     <th>Status
168                     </th>
169                     <th>Subscription</th>
170                 </tr>
171             </thead>
172             <tbody>
173                 <!-- TMPL_LOOP Name="serials" -->
174                 <tr>
175                     <td>    <!-- TMPL_VAR Name="publisheddate" -->
176                     </td>
177                     <td class="libraryfilterclass">    <!-- TMPL_VAR name="branchcode" -->
178                     </td>
179                     <td>    <!-- TMPL_VAR name="notes" -->
180                     </td>
181                     <td>   <!-- TMPL_IF Name="status2" --> <!-- TMPL_VAR Name="planneddate" --> <!-- /TMPL_IF -->
182                     </td>
183                     <td>    <!-- TMPL_VAR Name="serialseq" -->
184                     </td>
185                     <td>    <!-- TMPL_IF Name="status1" -->Waiting<!-- /TMPL_IF -->
186                         <!-- TMPL_IF Name="status2" -->Arrived<!-- /TMPL_IF -->
187                         <!-- TMPL_IF Name="status3" -->Late<!-- /TMPL_IF -->
188                         <!-- TMPL_IF Name="status4" -->Missing<!-- /TMPL_IF -->
189                         <!-- TMPL_IF Name="status5" -->Not Published<!-- /TMPL_IF -->
190                         <!-- TMPL_IF name="notes" -->(<!-- TMPL_VAR name="notes" -->)<!-- /TMPL_IF -->
191                     </td>
192                     <td class="subscriptionidfilterclass">    <!-- TMPL_VAR Name="subscriptionid" -->
193                     </td>
194                 </tr>
195                 <!-- /TMPL_LOOP -->
196             </tbody>
197         </table>
198     </div>
199     <!--/TMPL_LOOP -->
200 <script language="JavaScript" type="text/javascript">
201 var currentYear;
202 showlayer(<!-- TMPL_VAR name="yearmin" -->);
203 function showlayer(numlayer)
204 {
205     var yeardata=document.getElementsByName("yeardata");
206     for (i=0; i<yeardata.length; i++ ) {
207         ong=yeardata[i].getAttribute('id');
208         if (numlayer==ong) {
209             yeardata[i].style.display="block";
210             currentYear = ong;
211         } else {
212             yeardata[i].style.display="none";
213         }
214     }
215
216     clearFilters();
217 }
218
219 </script>
220 </div></div>
221 </div>
222 </div>
223 <!-- TMPL_IF NAME="OpacNav" -->
224 <div class="yui-b">
225 <div class="container">
226 <!--TMPL_INCLUDE NAME="navigation.inc" -->
227 </div>
228 </div><!-- /TMPL_IF -->
229 </div>
230 <!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->