Change to correct layout problem when OpacNav is empty.
[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;  Subscription information for <!-- TMPL_VAR name="bibliotitle" -->
2 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
3 <script type="text/javascript" language="javascript">
4 //<![CDATA[
5
6 $(document).ready(function(){
7         showlayer(<!-- TMPL_VAR name="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 <!-- TMPL_INCLUDE name="masthead.inc" -->
145
146         <div id="yui-main">
147         <div class="yui-b"><div class="yui-g">
148
149 <!-- TMPL_UNLESS name="popup" -->
150     <h2>Subscription information for <!-- TMPL_VAR name="bibliotitle" --></h2>
151         <div id="views">
152                 <span class="view"><a id="Normalview" href="opac-detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->">Normal view</a></span>
153                 <span class="view"><a id="Briefhistory" href="opac-serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->&amp;selectview=small">Brief history</a></span>
154                 <span class="view"><span id="Fullhistory">Full history</span></span>
155         </div>
156
157 <!-- /TMPL_UNLESS -->
158     <div id="subtabs"><strong>Show year: </strong>
159     <!-- TMPL_LOOP NAME="years" -->
160         <!-- TMPL_IF NAME="year" -->
161             <a class="tabsubs" href="#" onclick="showlayer(<!-- TMPL_VAR NAME="year" -->); return false;"><!-- TMPL_VAR NAME="year" --></a>
162         <!-- /TMPL_IF -->
163     <!-- /TMPL_LOOP -->
164     </div>
165
166     <!-- TMPL_LOOP NAME="years" -->
167   <!--TMPL_IF Name="first" -->  
168     <div class="yeardata tabsub" id="show<!-- TMPL_VAR NAME="year" -->" style="display:block"><!--TMPL_ELSE --><div class="yeardata tabsub" id="show<!-- TMPL_VAR NAME="year" -->" style="display:none"><!--/TMPL_IF -->
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                 <!-- TMPL_LOOP Name="serials" -->
183                 <tr>
184                     <td>    <!-- TMPL_VAR Name="publisheddate" -->
185                     </td>
186                     <td class="libraryfilterclass">    <!-- TMPL_VAR name="branchname" -->
187                     </td>
188                     <td>    <!-- TMPL_VAR name="notes" -->
189                     </td>
190                     <td>   <!-- TMPL_IF Name="status2" --> <!-- TMPL_VAR Name="planneddate" --> <!-- /TMPL_IF -->
191                     </td>
192                     <td>    <!-- TMPL_VAR Name="serialseq" -->
193                     </td>
194                     <td>    <!-- TMPL_IF Name="status1" -->Waiting<!-- /TMPL_IF -->
195                         <!-- TMPL_IF Name="status2" -->Arrived<!-- /TMPL_IF -->
196                         <!-- TMPL_IF Name="status3" -->Late<!-- /TMPL_IF -->
197                         <!-- TMPL_IF Name="status4" -->Missing<!-- /TMPL_IF -->
198                         <!-- TMPL_IF Name="status5" -->Not Available<!-- /TMPL_IF -->
199                         <!-- TMPL_IF Name="status7" -->Claimed<!-- /TMPL_IF -->
200                         <!-- TMPL_IF name="notes" -->(<!-- TMPL_VAR name="notes" -->)<!-- /TMPL_IF -->
201                     </td>
202                     <td class="subscriptionidfilterclass">    <!-- TMPL_VAR Name="subscriptionid" -->
203                     </td>
204                 </tr>
205                 <!-- /TMPL_LOOP -->
206             </tbody>
207         </table>
208     </div>
209     <!--/TMPL_LOOP -->
210
211 </div>
212 </div>
213 </div>
214 <div class="yui-b">
215 <div 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 <!-- TMPL_IF NAME="OpacNav" --><!--TMPL_INCLUDE NAME="navigation.inc" --><!-- /TMPL_IF -->
229 </div>
230 </div>
231 </div>
232 <!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->