root/main/trunk/greenstone3/web/interfaces/default/transform/map-tools.xsl @ 33126

Revision 33126, 3.3 KB (checked in by wy59, 6 months ago)

Incremental changes following previous commit. This time the code is more backwards compatible with older collections that contain only Latitude and Longitude meta. In such cases, we now ADDITIONALLY add Coordinate (and Coordshort) meta, while still also outputting Lat and Lng meta. The JS and XSL code however now prefers to work with Coordinate meta where present.

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:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7    extension-element-prefixes="java util"
8    exclude-result-prefixes="java util gsf">
9
10
11  <xsl:template name="mapFeaturesIcon">
12    <td style="padding-left:5px; padding-right:5px;" valign="top">
13      <a href="javascript:focusDocument('{@nodeID}');">
14    <img src="interfaces/{$interface_name}/images/map_marker.png"/>
15      </a>
16    </td>
17  </xsl:template>
18 
19  <xsl:template name="mapFeaturesJSONNodes">
20    <div id="jsonNodes" style="display:none;">
21      <xsl:text>[</xsl:text>
22      <xsl:for-each select="//documentNode">
23    <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate']">
24      <xsl:text>{</xsl:text>
25      <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text>
26      <xsl:value-of select="@nodeID"/>
27      <xsl:text disable-output-escaping="yes">",</xsl:text>
28      <xsl:text disable-output-escaping="yes">"title":"</xsl:text>
29      <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
30      <xsl:text disable-output-escaping="yes">"</xsl:text>
31      <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
32          <xsl:text disable-output-escaping="yes">,</xsl:text>
33          <xsl:text disable-output-escaping="yes">"lat":</xsl:text>
34          <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/>
35          <xsl:text>,</xsl:text>
36          <xsl:text disable-output-escaping="yes">"lng":</xsl:text>
37          <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
38      </xsl:if>
39      <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
40        <xsl:text disable-output-escaping="yes">,</xsl:text>
41        <xsl:text disable-output-escaping="yes">"coord":"</xsl:text>       
42        <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Coordinate']"/>
43        <xsl:text disable-output-escaping="yes">"</xsl:text>
44      </xsl:if>
45      <xsl:text>}</xsl:text>
46      <xsl:if test="not(position() = count(//documentNode))">
47        <xsl:text>,</xsl:text>
48      </xsl:if>
49                </xsl:if>
50      </xsl:for-each>
51      <xsl:text>]</xsl:text>
52    </div>
53   
54    <!-- Although these aren't visible, they are necessary because it forces Greenstone to include this metadata in the page xml -->
55    <gsf:metadata name="Latitude" hidden="true"/>
56    <gsf:metadata name="Longitude" hidden="true"/>
57    <gsf:metadata name="Coordinate" hidden="true"/>
58    <gsf:metadata name="GPS.mapOverlay" hidden="true"/>
59<!--  these were included in version in query. don't think we need them...
60    <gsf:metadata name="Image" hidden="true"/>
61    <gsf:metadata name="SourceFile" hidden="true"/>
62    <gsf:metadata name="assocfilepath" hidden="true"/>
63    <gsf:metadata name="PhotoType" hidden="true"/>
64    <gsf:metadata name="cv.rotation" hidden="true"/>
65    <gsf:metadata name="Angle" hidden="true"/> -->
66   
67   
68  </xsl:template>
69
70  <xsl:template name="mapFeaturesMap">
71    <div id="map_canvas" class="map_canvas_half"><xsl:text> </xsl:text></div>
72  </xsl:template>
73
74
75</xsl:stylesheet>
76
Note: See TracBrowser for help on using the browser.