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

Last change on this file since 25462 was 25462, checked in by sjm84, 12 years ago

Fixes to map_scripts and also changed the on-page editing that it reloads the page with the expanded view. Later we will probably make the page reload unnecessary. Also fixed the preferences page.

File size: 7.1 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 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8 extension-element-prefixes="java util"
9 exclude-result-prefixes="java util gsf">
10
11 <!-- use the 'main' layout -->
12 <xsl:import href="layouts/main.xsl"/>
13 <xsl:import href="classifiertools.xsl"/>
14
15 <!-- set page title -->
16 <xsl:template name="pageTitle"><gslib:serviceName/></xsl:template>
17
18 <!-- set page breadcrumbs -->
19 <xsl:template name="breadcrumbs"><gslib:siteLink/><gslib:rightArrow/><gslib:collectionNameLinked/><gslib:rightArrow/></xsl:template>
20
21 <!-- the page content -->
22 <xsl:template match="/page/pageResponse">
23 <xsl:call-template name="classifierPre"/>
24
25 <script type="text/javascript" src="interfaces/{$interface_name}/js/classifier_scripts.js"><xsl:text> </xsl:text></script>
26 <script type="text/javascript">$(window).load(openStoredClassifiers);</script>
27
28 <!-- this right sidebar -->
29 <xsl:if test="$berryBasketOn or ($documentBasketOn and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))">
30 <div id="rightSidebar">
31 <xsl:if test="$berryBasketOn">
32 <!-- show the berry basket if it's turned on -->
33 <gslib:berryBasket/>
34 <xsl:text> </xsl:text>
35 </xsl:if>
36
37 <xsl:if test="$documentBasketOn">
38 <gslib:documentBasket/>
39 <xsl:text> </xsl:text>
40 </xsl:if>
41 </div>
42 </xsl:if>
43
44 <!--
45 show the clasifier results -
46 you can change the appearance of the results by editing
47 the two templates at the bottom of this file
48 -->
49 <div id="results">
50 <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
51 <xsl:variable name="serviceName"><xsl:value-of select="service/@name"/></xsl:variable>
52
53 <xsl:call-template name="classifierResultsPre"/>
54
55 <xsl:apply-templates select="classifier">
56 <xsl:with-param name="collName" select="$collName"/>
57 <xsl:with-param name="serviceName" select="$serviceName"/>
58 </xsl:apply-templates>
59 </div>
60
61 <div class="clear"><xsl:text> </xsl:text></div>
62 </xsl:template>
63
64 <!--
65 TEMPLATE FOR DOCUMENTS
66 -->
67 <xsl:template match="documentNode"><!-- priority="3"-->
68 <!-- The book icon -->
69 <td>
70 <img>
71 <xsl:attribute name="src">
72 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'book_image')"/>
73 </xsl:attribute>
74 </img>
75 </td>
76 <!-- The document link -->
77 <td>
78 <a>
79 <xsl:choose>
80 <xsl:when test="@docType = 'paged'">
81 <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"/></xsl:attribute>
82 </xsl:when>
83 <xsl:otherwise>
84 <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>
85 </xsl:otherwise>
86 </xsl:choose>
87 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
88 </a>
89 </td>
90 <!-- The berry (optional) -->
91 <td>
92 <xsl:call-template name="documentBerryForClassifierOrSearchPage"/>
93 </td>
94 </xsl:template>
95
96 <!--
97 TEMPLATE FOR GROUPS OF DOCUMENTS
98 -->
99 <xsl:template match="classifierNode"><!-- priority="3"-->
100
101 <table id="title{@nodeID}"><tbody><tr>
102 <!-- Expand/collapse button -->
103 <!--<td class="headerTD">
104 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
105 <xsl:attribute name="src">
106 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
107 </xsl:attribute>
108 </img>
109 </td>-->
110 <!-- Bookshelf icon -->
111 <td>
112 <img>
113 <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/></xsl:attribute>
114 </img>
115 </td>
116 <!-- Link title -->
117 <td>
118 <a href="javascript:toggleSection('{@nodeID}');">
119 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
120 </a>
121 </td>
122 </tr></tbody></table>
123
124 <!-- Show any documents or sub-groups in this group -->
125 <xsl:if test="documentNode|classifierNode">
126 <div id="div{@nodeID}" class="classifierContainer">
127 <table>
128 <xsl:for-each select="documentNode|classifierNode">
129 <tr>
130 <xsl:apply-templates select="."/>
131 </tr>
132 </xsl:for-each>
133 </table>
134 </div>
135 </xsl:if>
136 </xsl:template>
137
138 <xsl:template name="classifierPre">
139 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
140 <xsl:call-template name="mapFeaturesJSONNodes"/>
141 </xsl:if>
142 </xsl:template>
143
144 <xsl:template name="classifierResultsPre">
145 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
146 <xsl:call-template name="mapFeaturesMap"/>
147 </xsl:if>
148 </xsl:template>
149
150 <xsl:template name="mapFeaturesJSONNodes">
151 <div id="jsonNodes" style="display:none;">
152 <xsl:text>[</xsl:text>
153 <xsl:for-each select="//documentNode">
154 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
155 <xsl:text>{</xsl:text>
156 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
157 <xsl:text disable-output-escaping="yes">"title":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/><xsl:text disable-output-escaping="yes">",</xsl:text>
158 <xsl:text disable-output-escaping="yes">"lat":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/><xsl:text>,</xsl:text>
159 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
160 <xsl:text>}</xsl:text>
161 <xsl:if test="not(position() = count(//documentNode))">
162 <xsl:text>,</xsl:text>
163 </xsl:if>
164 </xsl:if>
165 </xsl:for-each>
166 <xsl:text>]</xsl:text>
167 </div>
168
169 <!-- Although these aren't visible, they are necessary because it forces Greenstone to include this metadata in the page xml -->
170 <gsf:metadata name="Latitude"/>
171 <gsf:metadata name="Longitude"/>
172 </xsl:template>
173
174 <xsl:template name="mapFeaturesMap">
175 <div id="map_canvas" class="map_canvas_half"><xsl:text> </xsl:text></div>
176 </xsl:template>
177</xsl:stylesheet>
178
Note: See TracBrowser for help on using the repository browser.