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