1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <xsl:stylesheet version="1.0"
|
---|
3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
4 | xmlns:java="http://xml.apache.org/xslt/java"
|
---|
5 | xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
|
---|
6 | xmlns:gslib="http://www.greenstone.org/skinning"
|
---|
7 | extension-element-prefixes="java util"
|
---|
8 | exclude-result-prefixes="java util">
|
---|
9 |
|
---|
10 | <!-- use the 'main' layout -->
|
---|
11 | <xsl:include href="layouts/main.xsl"/>
|
---|
12 |
|
---|
13 | <!-- set page title -->
|
---|
14 | <xsl:template name="pageTitle"><gslib:serviceName/></xsl:template>
|
---|
15 |
|
---|
16 | <!-- set page breadcrumbs -->
|
---|
17 | <xsl:template name="breadcrumbs"><gslib:siteLink/><gslib:rightArrow/> <gslib:collectionNameLinked/><gslib:rightArrow/></xsl:template>
|
---|
18 |
|
---|
19 | <!-- the page content -->
|
---|
20 | <xsl:template match="/page/pageResponse">
|
---|
21 | <xsl:call-template name="classifierLoadScript"/>
|
---|
22 | <!-- this right sidebar -->
|
---|
23 | <xsl:if test="$berryBasketOn">
|
---|
24 | <div id="rightSidebar">
|
---|
25 | <!-- show the berry basket if it's turned on -->
|
---|
26 | <gslib:berryBasket/>
|
---|
27 | <xsl:text> </xsl:text>
|
---|
28 | </div>
|
---|
29 | </xsl:if>
|
---|
30 |
|
---|
31 | <!--
|
---|
32 | show the clasifier results -
|
---|
33 | you can change the appearance of the results by editing
|
---|
34 | the two templates at the bottom of this file
|
---|
35 | -->
|
---|
36 | <table id="results">
|
---|
37 | <xsl:for-each select="classifier/*">
|
---|
38 | <tr>
|
---|
39 | <xsl:apply-templates select="."/>
|
---|
40 | </tr>
|
---|
41 | </xsl:for-each>
|
---|
42 | </table>
|
---|
43 | <div class="clear"><xsl:text> </xsl:text></div>
|
---|
44 | </xsl:template>
|
---|
45 |
|
---|
46 |
|
---|
47 | <!--
|
---|
48 | TEMPLATE FOR DOCUMENTS
|
---|
49 | -->
|
---|
50 |
|
---|
51 | <!--<xsl:template match="documentNode" priority="3">-->
|
---|
52 | <!-- show the document details -->
|
---|
53 | <!--<li class="document">
|
---|
54 | <a>
|
---|
55 | <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&d=<xsl:value-of select="@nodeID"/>&dt=<xsl:value-of select="@docType"/>&p.a=b&p.s=<xsl:value-of select="/page/pageResponse/service/@name"/>&ed=1</xsl:attribute><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
|
---|
56 | </a>
|
---|
57 | </li>
|
---|
58 | </xsl:template>-->
|
---|
59 |
|
---|
60 | <xsl:template match="documentNode" priority="3">
|
---|
61 | <!-- The book icon -->
|
---|
62 | <td>
|
---|
63 | <img>
|
---|
64 | <xsl:attribute name="src">
|
---|
65 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'book_image')"/>
|
---|
66 | </xsl:attribute>
|
---|
67 | </img>
|
---|
68 | </td>
|
---|
69 | <!-- The document link -->
|
---|
70 | <td>
|
---|
71 | <a>
|
---|
72 | <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&d=<xsl:value-of select="@nodeID"/>&dt=<xsl:value-of select="@docType"/>&p.a=b&p.s=<xsl:value-of select="/page/pageResponse/service/@name"/>&ed=1</xsl:attribute>
|
---|
73 | <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
|
---|
74 | </a>
|
---|
75 | </td>
|
---|
76 | <!-- The berry (optional) -->
|
---|
77 | <td>
|
---|
78 | <xsl:call-template name="documentBerryForClassifierOrSearchPage"/>
|
---|
79 | </td>
|
---|
80 | </xsl:template>-->
|
---|
81 |
|
---|
82 |
|
---|
83 | <!--
|
---|
84 | TEMPLATE FOR GROUPS OF DOCUMENTS
|
---|
85 | -->
|
---|
86 | <xsl:template match="classifierNode">
|
---|
87 |
|
---|
88 | <table id="title{@nodeID}"><tr>
|
---|
89 | <!-- Expand/collapse button -->
|
---|
90 | <td class="headerTD">
|
---|
91 | <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
|
---|
92 | <xsl:attribute name="src">
|
---|
93 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
|
---|
94 | </xsl:attribute>
|
---|
95 | </img>
|
---|
96 | </td>
|
---|
97 | <!-- Bookshelf icon -->
|
---|
98 | <td>
|
---|
99 | <img>
|
---|
100 | <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/></xsl:attribute>
|
---|
101 | </img>
|
---|
102 | </td>
|
---|
103 | <!-- Link title -->
|
---|
104 | <td>
|
---|
105 | <a href="javascript:toggleSection('{@nodeID}');">
|
---|
106 | <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
|
---|
107 | </a>
|
---|
108 | </td>
|
---|
109 | </tr></table>
|
---|
110 |
|
---|
111 | <!-- Show any documents or sub-groups in this group -->
|
---|
112 | <xsl:if test="documentNode|classifierNode">
|
---|
113 | <div id="div{@nodeID}" class="classifierContainer">
|
---|
114 | <table>
|
---|
115 | <xsl:for-each select="documentNode|classifierNode">
|
---|
116 | <tr>
|
---|
117 | <xsl:apply-templates select="."/>
|
---|
118 | </tr>
|
---|
119 | </xsl:for-each>
|
---|
120 | </table>
|
---|
121 | </div>
|
---|
122 | </xsl:if>
|
---|
123 | </xsl:template>
|
---|
124 |
|
---|
125 | <xsl:template name="classifierLoadScript">
|
---|
126 | <script type="text/javascript">
|
---|
127 | <xsl:text disable-output-escaping="yes">
|
---|
128 | var collapseImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/><xsl:text disable-output-escaping="yes">";
|
---|
129 | var expandImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/><xsl:text disable-output-escaping="yes">";
|
---|
130 | var loadingImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'loading_image')"/><xsl:text disable-output-escaping="yes">";
|
---|
131 | var berryBaskets = "</xsl:text><xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/><xsl:text disable-output-escaping="yes">";
|
---|
132 | var inProgress = new Array();
|
---|
133 |
|
---|
134 | function isExpanded(sectionID)
|
---|
135 | {
|
---|
136 | var divElem = document.getElementById("div" + sectionID);
|
---|
137 | if(!divElem.style.display || divElem.style.display == "block")
|
---|
138 | {
|
---|
139 | return true;
|
---|
140 | }
|
---|
141 | return false;
|
---|
142 | }
|
---|
143 |
|
---|
144 | function toggleSection(sectionID)
|
---|
145 | {
|
---|
146 | var section = document.getElementById("div" + sectionID);
|
---|
147 | var sectionToggle = document.getElementById("toggle" + sectionID);
|
---|
148 |
|
---|
149 | if(section)
|
---|
150 | {
|
---|
151 | if(isExpanded(sectionID))
|
---|
152 | {
|
---|
153 | section.style.display = "none";
|
---|
154 | sectionToggle.setAttribute("src", expandImageURL);
|
---|
155 | }
|
---|
156 | else
|
---|
157 | {
|
---|
158 | section.style.display = "block";
|
---|
159 | sectionToggle.setAttribute("src", collapseImageURL);
|
---|
160 | }
|
---|
161 | }
|
---|
162 | else
|
---|
163 | {
|
---|
164 | httpRequest(sectionID);
|
---|
165 | }
|
---|
166 | }
|
---|
167 |
|
---|
168 | function httpRequest(sectionID)
|
---|
169 | {
|
---|
170 | if(!inProgress[sectionID])
|
---|
171 | {
|
---|
172 | inProgress[sectionID] = true;
|
---|
173 | var httpRequest;
|
---|
174 | if (window.XMLHttpRequest) {
|
---|
175 | httpRequest = new XMLHttpRequest();
|
---|
176 | }
|
---|
177 | else if (window.ActiveXObject) {
|
---|
178 | httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
---|
179 | }
|
---|
180 |
|
---|
181 | var sectionToggle = document.getElementById("toggle" + sectionID);
|
---|
182 | sectionToggle.setAttribute("src", loadingImageURL);
|
---|
183 |
|
---|
184 | var url = document.URL;
|
---|
185 | url = url.replace(/(&|\?)cl=[a-z\.0-9]+/gi, "$1cl=" + sectionID + "&excerptid=div" + sectionID);
|
---|
186 |
|
---|
187 | if(berryBaskets == "on")
|
---|
188 | {
|
---|
189 | url = url + "&berrybasket=on";
|
---|
190 | }
|
---|
191 |
|
---|
192 | httpRequest.open('GET', url, true);
|
---|
193 | httpRequest.onreadystatechange = function()
|
---|
194 | {
|
---|
195 | if (httpRequest.readyState == 4)
|
---|
196 | {
|
---|
197 | if (httpRequest.status == 200)
|
---|
198 | {
|
---|
199 | var newDiv = document.createElement("div");
|
---|
200 | var sibling = document.getElementById("title" + sectionID);
|
---|
201 | var parent = sibling.parentNode;
|
---|
202 |
|
---|
203 | if(sibling.nextSibling)
|
---|
204 | {
|
---|
205 | parent.insertBefore(newDiv, sibling.nextSibling);
|
---|
206 | }
|
---|
207 | else
|
---|
208 | {
|
---|
209 | parent.appendChild(newDiv);
|
---|
210 | }
|
---|
211 |
|
---|
212 | newDiv.innerHTML = httpRequest.responseText;
|
---|
213 | sectionToggle.setAttribute("src", collapseImageURL);
|
---|
214 |
|
---|
215 | if(berryBaskets == "on")
|
---|
216 | {
|
---|
217 | checkout();
|
---|
218 | }
|
---|
219 | }
|
---|
220 | else
|
---|
221 | {
|
---|
222 | sectionToggle.setAttribute("src", expandImageURL);
|
---|
223 | }
|
---|
224 | inProgress[sectionID] = false;
|
---|
225 | }
|
---|
226 | }
|
---|
227 | httpRequest.send();
|
---|
228 | }
|
---|
229 | }
|
---|
230 | </xsl:text>
|
---|
231 | </script>
|
---|
232 | </xsl:template>
|
---|
233 |
|
---|
234 | </xsl:stylesheet>
|
---|
235 |
|
---|