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