Ignore:
Timestamp:
2019-05-31T20:02:40+12:00 (5 years ago)
Author:
wy59
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/map-tools.xsl

    r31550 r33125  
    1212    <td style="padding-left:5px; padding-right:5px;" valign="top">
    1313      <a href="javascript:focusDocument('{@nodeID}');">
    14     <img src="interfaces/default/images/map_marker.png"/>
     14    <img src="interfaces/{$interface_name}/images/map_marker.png"/>
    1515      </a>
    1616    </td>
     
    2121      <xsl:text>[</xsl:text>
    2222      <xsl:for-each select="//documentNode">
    23     <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
     23    <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate']">
    2424      <xsl:text>{</xsl:text>
    2525      <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text>
     
    2929      <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
    3030      <xsl:text disable-output-escaping="yes">",</xsl:text>
    31       <xsl:text disable-output-escaping="yes">"lat":</xsl:text>
    32       <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/>
    33       <xsl:text>,</xsl:text>
    34       <xsl:text disable-output-escaping="yes">"lng":</xsl:text>
    35       <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
     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>
    3643      <xsl:text>}</xsl:text>
    3744      <xsl:if test="not(position() = count(//documentNode))">
     
    4653    <gsf:metadata name="Latitude" hidden="true"/>
    4754    <gsf:metadata name="Longitude" hidden="true"/>
     55    <gsf:metadata name="Coordinate" hidden="true"/>
     56    <gsf:metadata name="GPS.mapOverlay" hidden="true"/>
    4857<!--  these were included in version in query. don't think we need them...
    4958    <gsf:metadata name="Image" hidden="true"/>
Note: See TracChangeset for help on using the changeset viewer.