source: main/trunk/greenstone3/web/interfaces/default/transform/map-tools.xsl@ 33125

Last change on this file since 33125 was 33125, checked in by wy59, 5 years ago

First commit to do with adding support for the Coordinate metadata newly introduced. It doesn't yet replace Latitude and Longitude meta, but coexists with that. For docs that only contain lat and lng meta, the code will still behave as before. For docs that contain the new coord meta, the changes in this commit will be able to display markers on the map based on this. Updates include: doc.pm perl code now stores Coordinate and Coordshort meta when it encounters GPS.mapOverlay metadata created by the doc editor. Update to JS code: update to the rawquery search performed to get all docs whose coord info occur within the bounds of the displayed map, and updates to all the js and xsl code that used to only work with lat and lng before now ADDITIONALLY work with coord meta.

File size: 3.2 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: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">"lat":</xsl:text>
33 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/>
34 <xsl:text>,</xsl:text>
35 <xsl:text disable-output-escaping="yes">"lng":</xsl:text>
36 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
37 </xsl:if>
38 <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
39 <xsl:text disable-output-escaping="yes">"coord":"</xsl:text>
40 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Coordinate']"/>
41 <xsl:text disable-output-escaping="yes">"</xsl:text>
42 </xsl:if>
43 <xsl:text>}</xsl:text>
44 <xsl:if test="not(position() = count(//documentNode))">
45 <xsl:text>,</xsl:text>
46 </xsl:if>
47 </xsl:if>
48 </xsl:for-each>
49 <xsl:text>]</xsl:text>
50 </div>
51
52 <!-- Although these aren't visible, they are necessary because it forces Greenstone to include this metadata in the page xml -->
53 <gsf:metadata name="Latitude" hidden="true"/>
54 <gsf:metadata name="Longitude" hidden="true"/>
55 <gsf:metadata name="Coordinate" hidden="true"/>
56 <gsf:metadata name="GPS.mapOverlay" hidden="true"/>
57<!-- these were included in version in query. don't think we need them...
58 <gsf:metadata name="Image" hidden="true"/>
59 <gsf:metadata name="SourceFile" hidden="true"/>
60 <gsf:metadata name="assocfilepath" hidden="true"/>
61 <gsf:metadata name="PhotoType" hidden="true"/>
62 <gsf:metadata name="cv.rotation" hidden="true"/>
63 <gsf:metadata name="Angle" hidden="true"/> -->
64
65
66 </xsl:template>
67
68 <xsl:template name="mapFeaturesMap">
69 <div id="map_canvas" class="map_canvas_half"><xsl:text> </xsl:text></div>
70 </xsl:template>
71
72
73</xsl:stylesheet>
74
Note: See TracBrowser for help on using the repository browser.