source: main/trunk/greenstone3/web/interfaces/oran/transform/pages/classifier.xsl@ 24009

Last change on this file since 24009 was 24009, checked in by sjm84, 13 years ago

Another round of improvements to the oran skin including a tree view of the classifiers

File size: 6.0 KB
Line 
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 <ul id="results">
37 <xsl:apply-templates select="classifier/*"/>
38 </ul>
39 <div class="clear"><xsl:text> </xsl:text></div>
40
41 </xsl:template>
42
43
44 <!--
45 TEMPLATE FOR DOCUMENTS
46 -->
47 <xsl:template match="documentNode" priority="3">
48
49 <!-- show the document details -->
50 <li class="document">
51
52 <a>
53 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&amp;d=<xsl:value-of select="@nodeID"/>&amp;dt=<xsl:value-of select="@docType"/>&amp;p.a=b&amp;p.s=<xsl:value-of select="/page/pageResponse/service/@name"/>&amp;ed=1</xsl:attribute>
54 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
55 </a>
56 <xsl:call-template name="documentBerryForClassifierOrSearchPage"/>
57
58 </li>
59
60 </xsl:template>
61
62
63 <!--
64 TEMPLATE FOR GROUPS OF DOCUMENTS
65 -->
66 <xsl:template match="classifierNode" priority="3">
67
68 <table id="title{@nodeID}"><tr>
69 <!-- Expand/collapse button -->
70 <td class="headerTD">
71 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
72 <xsl:attribute name="src">
73 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
74 </xsl:attribute>
75 </img>
76 </td>
77 <!-- Bookshelf icon -->
78 <td>
79 <img>
80 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/></xsl:attribute>
81 </img>
82 </td>
83 <!-- Link title -->
84 <td>
85 <a href="javascript:toggleSection('{@nodeID}');">
86 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
87 </a>
88 </td>
89 </tr></table>
90
91 <!-- Show any documents or sub-groups in this group -->
92 <xsl:if test="documentNode|classifierNode">
93 <div id="div{@nodeID}" class="classifierContainer" style="display:block;">
94 <xsl:apply-templates select="documentNode|classifierNode"/>
95 </div>
96 </xsl:if>
97 </xsl:template>
98
99 <xsl:template name="classifierLoadScript">
100 <script type="text/javascript">
101 <xsl:text disable-output-escaping="yes">
102 var collapseImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/><xsl:text disable-output-escaping="yes">";
103 var expandImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/><xsl:text disable-output-escaping="yes">";
104 var loadingImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'loading_image')"/><xsl:text disable-output-escaping="yes">";
105 var inProgress = new Array();
106
107 function isExpanded(sectionID)
108 {
109 var divElem = document.getElementById("div" + sectionID);
110 if(divElem.style.display == "block")
111 {
112 return true;
113 }
114 return false;
115 }
116
117 function toggleSection(sectionID)
118 {
119 var section = document.getElementById("div" + sectionID);
120 var sectionToggle = document.getElementById("toggle" + sectionID);
121
122 if(section)
123 {
124 if(isExpanded(sectionID))
125 {
126 section.style.display = "none";
127 sectionToggle.setAttribute("src", expandImageURL);
128 }
129 else
130 {
131 section.style.display = "block";
132 sectionToggle.setAttribute("src", collapseImageURL);
133 }
134 }
135 else
136 {
137 httpRequest(sectionID);
138 }
139 }
140
141 function httpRequest(sectionID)
142 {
143 if(!inProgress[sectionID])
144 {
145 inProgress[sectionID] = true;
146 var httpRequest;
147 if (window.XMLHttpRequest) {
148 httpRequest = new XMLHttpRequest();
149 }
150 else if (window.ActiveXObject) {
151 httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
152 }
153
154 var sectionToggle = document.getElementById("toggle" + sectionID);
155 sectionToggle.setAttribute("src", loadingImageURL);
156
157 var url = document.URL;
158 url = url.replace(/(&amp;|\?)cl=([a-z\.0-9]+)/gi, "$1cl=" + sectionID + "&amp;excerptid=div" + sectionID);
159
160 httpRequest.open('GET', url, true);
161 httpRequest.onreadystatechange = function()
162 {
163 if (httpRequest.readyState == 4)
164 {
165 if (httpRequest.status == 200)
166 {
167 var newDiv = document.createElement("div");
168 var sibling = document.getElementById("title" + sectionID);
169 var parent = sibling.parentNode;
170
171 if(sibling.nextSibling)
172 {
173 parent.insertBefore(newDiv, sibling.nextSibling);
174 }
175 else
176 {
177 parent.appendChild(newDiv);
178 }
179
180 newDiv.innerHTML = httpRequest.responseText;
181 sectionToggle.setAttribute("src", collapseImageURL);
182 }
183 else
184 {
185 sectionToggle.setAttribute("src", expandImageURL);
186 }
187 inProgress[sectionID] = false;
188 }
189 }
190 httpRequest.send();
191 }
192 }
193 </xsl:text>
194 </script>
195 </xsl:template>
196
197</xsl:stylesheet>
198
Note: See TracBrowser for help on using the repository browser.