Index: main/trunk/greenstone3/web/interfaces/oran/transform/pages/classifier.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/pages/classifier.xsl	(revision 24996)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/pages/classifier.xsl	(revision 24997)
@@ -5,10 +5,11 @@
 	xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
 	xmlns:gslib="http://www.greenstone.org/skinning"
+	xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
 	extension-element-prefixes="java util"
-	exclude-result-prefixes="java util">
+	exclude-result-prefixes="java util gsf">
 	
 	<!-- use the 'main' layout -->
 	<xsl:import href="layouts/main.xsl"/>
-	<xsl:include href="classifiertools.xsl"/>
+	<xsl:import href="classifiertools.xsl"/>
 
 	<!-- set page title -->
@@ -16,9 +17,12 @@
 
 	<!-- set page breadcrumbs -->
-	<xsl:template name="breadcrumbs"><gslib:siteLink/><gslib:rightArrow/> <gslib:collectionNameLinked/><gslib:rightArrow/></xsl:template>
+	<xsl:template name="breadcrumbs"><gslib:siteLink/><gslib:rightArrow/><gslib:collectionNameLinked/><gslib:rightArrow/></xsl:template>
 
 	<!-- the page content -->
 	<xsl:template match="/page/pageResponse">
+		<xsl:call-template name="classifierPre"/>
+		
 		<script type="text/javascript" src="interfaces/{$interface_name}/js/classifier_scripts.js"><xsl:text> </xsl:text></script>
+		<script type="text/javascript">$(window).load(openStoredClassifiers);</script>
 		
 		<!-- this right sidebar -->
@@ -47,4 +51,6 @@
 			<xsl:variable name="serviceName"><xsl:value-of select="service/@name"/></xsl:variable>
 
+			<xsl:call-template name="classifierResultsPre"/>
+			
 			<xsl:apply-templates select="classifier">
 				<xsl:with-param name="collName" select="$collName"/>
@@ -52,5 +58,5 @@
 			</xsl:apply-templates>
 		</div>
-		<script type="text/javascript">openStoredClassifiers();</script>
+
 		<div class="clear"><xsl:text> </xsl:text></div>
 	</xsl:template>
@@ -59,5 +65,4 @@
 	TEMPLATE FOR DOCUMENTS
 	-->
-
 	<xsl:template match="documentNode"><!-- priority="3"-->
 		<!-- The book icon -->
@@ -72,5 +77,12 @@
 		<td>
 			<a>
-				<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>
+				<xsl:choose>
+					<xsl:when test="@docType = 'paged'">
+						<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>
+					</xsl:when>
+					<xsl:otherwise>
+						<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>
+					</xsl:otherwise>
+				</xsl:choose>
 				<xsl:value-of disable-output-escaping="yes"  select="metadataList/metadata[@name='Title']"/>
 			</a>
@@ -82,5 +94,4 @@
 	</xsl:template>
 
-
 	<!--
 	TEMPLATE FOR GROUPS OF DOCUMENTS
@@ -90,5 +101,5 @@
 		<table id="title{@nodeID}"><tbody><tr>
 			<!-- Expand/collapse button -->
-			<td class="headerTD">
+			<!--<td class="headerTD">
 				<img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">			
 					<xsl:attribute name="src">
@@ -96,5 +107,5 @@
 					</xsl:attribute>
 				</img>
-			</td>
+			</td>-->
 			<!-- Bookshelf icon -->
 			<td>
@@ -124,4 +135,44 @@
 		</xsl:if>
 	</xsl:template>
+	
+	<xsl:template name="classifierPre">
+		<xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
+			<xsl:call-template name="mapFeaturesJSONNodes"/>
+		</xsl:if>
+	</xsl:template>
+	
+	<xsl:template name="classifierResultsPre">
+		<xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
+			<xsl:call-template name="mapFeaturesMap"/>
+		</xsl:if>
+	</xsl:template>
+	
+	<xsl:template name="mapFeaturesJSONNodes">
+		<div id="jsonNodes" style="display:none;">
+			<xsl:text>[</xsl:text>
+			<xsl:for-each select="//documentNode">
+				<xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
+					<xsl:text>{</xsl:text>
+					<xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
+					<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>
+					<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>
+					<xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
+					<xsl:text>}</xsl:text>
+					<xsl:if test="not(position() = count(//documentNode))">
+						<xsl:text>,</xsl:text>
+					</xsl:if>
+				</xsl:if>
+			</xsl:for-each>
+			<xsl:text>]</xsl:text>
+		</div>
+		
+		<!-- Although these aren't visible, they are necessary because it forces Greenstone to include this metadata in the page xml -->
+		<gsf:metadata name="Latitude"/>
+		<gsf:metadata name="Longitude"/>
+	</xsl:template>
+	
+	<xsl:template name="mapFeaturesMap">
+		<div id="map_canvas" style="margin:0px auto; width:450px; height:500px; float:right;"><xsl:text> </xsl:text></div>
+	</xsl:template>
 </xsl:stylesheet>
 
