Ignore:
Timestamp:
2019-06-06T20:53:13+12:00 (5 years ago)
Author:
wy59
Message:

Improvements to Coordinate support AND bugfixes. BUT not all the fixes may be ideal, many marked with TODO. 1. Now we support an Array of coordinates. At present these are only displayed as Markers, but in future shapes should appear as shapes. 2. Bugfixes include: (a) expanding sections wasn't working when we had hierarchical docs with Coordinate data, because map-scripts 'overrode' the toggleSection function but no longer did any of the doc expanding behaviour that document_scripts.js used to do. This was not a problem with the ImagesGPS collection, simply because that did not have hierarchical/sectionalised documents. (b) Perl: A previous commit output duplicate Coordinates into the index. Now this doesn't happen. Fix works but may not be ideal. 3. Perl: (a) Reserved index names CD, CS for Coordinate and CoordShort. Note however that LAT and LNG were never added to reserve list for index names. (b) Now doc.pm::processCoord() takes a section parameter and works out the section-ptr from that.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl

    r33126 r33128  
    140140            <xsl:if test="not(/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='sectionExpandCollapse']/@value) or /page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='sectionExpandCollapse']/@value = 'true'">
    141141                <td class="headerTD">
    142                     <img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">         
     142                    <img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
    143143                        <xsl:attribute name="src">
    144144                            <xsl:choose>
     
    856856                            <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
    857857                                <xsl:text disable-output-escaping="yes">,</xsl:text>
    858                                 <xsl:text disable-output-escaping="yes">"coord":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Coordinate']"/>
    859                                 <xsl:text disable-output-escaping="yes">"</xsl:text>
     858                                <xsl:text disable-output-escaping="yes">"coords":</xsl:text>
     859                                <xsl:text>[</xsl:text>
     860                                <xsl:for-each select="metadataList/metadata[@name = 'Coordinate']">
     861                                    <xsl:text disable-output-escaping="yes">"</xsl:text>
     862                                    <xsl:value-of disable-output-escaping="yes" select="current()"/>
     863                                    <xsl:text disable-output-escaping="yes">"</xsl:text>
     864                                    <xsl:text disable-output-escaping="yes">,</xsl:text>
     865                                </xsl:for-each>
     866                                <xsl:text>]</xsl:text>
    860867                            </xsl:if>
    861868                            <xsl:text>}</xsl:text>
     
    881888                            <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
    882889                                <xsl:text disable-output-escaping="yes">,</xsl:text>
    883                                 <xsl:text disable-output-escaping="yes">"coord":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Coordinate']"/>
    884                                 <xsl:text disable-output-escaping="yes">"</xsl:text>
     890                                <xsl:text disable-output-escaping="yes">"coords":</xsl:text>
     891                                <xsl:text>[</xsl:text>
     892                                <xsl:for-each select="metadataList/metadata[@name = 'Coordinate']">
     893                                    <xsl:text disable-output-escaping="yes">"</xsl:text>
     894                                    <xsl:value-of disable-output-escaping="yes" select="current()"/>
     895                                    <xsl:text disable-output-escaping="yes">"</xsl:text>
     896                                    <xsl:text disable-output-escaping="yes">,</xsl:text>
     897                                </xsl:for-each>
     898                                <xsl:text>]</xsl:text>
    885899                            </xsl:if>
    886900                            <xsl:text>}</xsl:text>
     
    891905            <xsl:text>]</xsl:text>
    892906        </div>
     907       
     908        <!-- TODO: Why do we have to do this to see Coordinate appear in extraMetadataList on o=xml page, when Lat and Lng appear without doing the same??? -->
     909        <gsf:metadata name="Coordinate" hidden="true"/>
    893910    </xsl:template>
    894911   
     
    914931        <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
    915932            <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
    916                 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
    917                 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
    918                     <xsl:attribute name="onclick">
    919                         <xsl:text>performDistanceSearchWithCoordinates('</xsl:text>
    920                         <xsl:value-of select="@nodeID"/>
    921                         <xsl:text>', '</xsl:text>
    922                         <gsf:metadata name="Coordinate"/>
    923                         <xsl:text>', 2);</xsl:text>
    924                     </xsl:attribute>
    925                 </img>
    926                 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
     933            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.map_nearby_docs')"/>
     934            <xsl:for-each select="metadataList/metadata[@name = 'Coordinate']">
     935           
     936                <xsl:variable name="coordinate"><xsl:value-of select="current()"/></xsl:variable>
     937           
     938               
     939                    <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
     940                        <xsl:attribute name="onclick">
     941                            <xsl:text>performDistanceSearchWithCoordinates('</xsl:text>
     942                            <xsl:value-of select="@nodeID"/>
     943                            <xsl:text>', '</xsl:text>
     944                            <xsl:value-of select="$coordinate"/><!--<gsf:metadata name="Coordinate"/>-->
     945                            <xsl:text>', 2);</xsl:text>
     946                        </xsl:attribute>
     947                    </img>                 
     948            </xsl:for-each>
     949            <div id="nearbyDocuments"><xsl:text> </xsl:text></div>             
    927950            </div>
    928951        </xsl:if>
Note: See TracChangeset for help on using the changeset viewer.