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

Revision 33317, 4.7 KB (checked in by ak19, 13 months ago)

Incorporated request for GPS.mapOverlay for children of a section, following Kathy's explanation from last Thursday. map-scripts then adds the overlays for each child to its parent section's doc.mapoverlay. That seems to work for the solr-haminfo GPS map data demo collection. But Solr faceted searching still doesn't work the way I understand it should. And of course, we don't just want children of a section but all descendants and the section itself.

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'] or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'children_GPS.mapOverlay']">
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      <!--
40      <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
41        <xsl:text disable-output-escaping="yes">,</xsl:text>
42        <xsl:text disable-output-escaping="yes">"coords":</xsl:text>
43        <xsl:text>[</xsl:text>
44        <xsl:for-each select="metadataList/metadata[@name = 'Coordinate']">
45            <xsl:text disable-output-escaping="yes">"</xsl:text>
46            <xsl:value-of disable-output-escaping="yes" select="current()"/>
47            <xsl:text disable-output-escaping="yes">"</xsl:text>
48            <xsl:text disable-output-escaping="yes">,</xsl:text>
49        </xsl:for-each>
50        <xsl:text>]</xsl:text>
51      </xsl:if>
52      -->
53      <xsl:if test="metadataList/metadata[@name = 'GPS.mapOverlay']">
54        <xsl:text disable-output-escaping="yes">,</xsl:text>
55        <xsl:text disable-output-escaping="yes">"mapoverlay":</xsl:text>
56        <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'GPS.mapOverlay']"/>
57      </xsl:if>
58     
59      <xsl:if test="metadataList/metadata[@name = 'children_GPS.mapOverlay']">
60        <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'children_GPS.mapOverlay'])"/></xsl:variable>
61        <xsl:text disable-output-escaping="yes">,</xsl:text>
62        <xsl:text disable-output-escaping="yes">"childrenMapoverlays":[</xsl:text>
63        <xsl:for-each select="metadataList/metadata[@name = 'children_GPS.mapOverlay']">
64            <xsl:value-of disable-output-escaping="yes" select="current()"/>
65            <xsl:if test="not(position() = $count)">
66                <xsl:text disable-output-escaping="yes">,</xsl:text>
67            </xsl:if>
68        </xsl:for-each>
69        <xsl:text disable-output-escaping="yes">]</xsl:text>
70      </xsl:if>
71                           
72      <xsl:text>}</xsl:text>
73      <xsl:if test="not(position() = count(//documentNode))">
74        <xsl:text>,</xsl:text>
75      </xsl:if>
76                </xsl:if>
77      </xsl:for-each>
78      <xsl:text>]</xsl:text>
79    </div>
80   
81    <!-- Although these aren't visible, they are necessary because it forces Greenstone to include this metadata in the page xml -->
82    <gsf:metadata name="Latitude" hidden="true"/>
83    <gsf:metadata name="Longitude" hidden="true"/>
84    <gsf:metadata name="Coordinate" hidden="true"/>
85    <gsf:metadata name="GPS.mapOverlay" hidden="true"/>
86    <gsf:metadata name="GPS.mapOverlay" select="children" hidden="true"/>
87<!--  these were included in version in query. don't think we need them...
88    <gsf:metadata name="Image" hidden="true"/>
89    <gsf:metadata name="SourceFile" hidden="true"/>
90    <gsf:metadata name="assocfilepath" hidden="true"/>
91    <gsf:metadata name="PhotoType" hidden="true"/>
92    <gsf:metadata name="cv.rotation" hidden="true"/>
93    <gsf:metadata name="Angle" hidden="true"/> -->
94   
95   
96  </xsl:template>
97
98  <xsl:template name="mapFeaturesMap">
99    <div id="map_canvas" class="map_canvas_half"><xsl:text> </xsl:text></div>
100  </xsl:template>
101
102
103</xsl:stylesheet>
104
Note: See TracBrowser for help on using the browser.