Changeset 37023


Ignore:
Timestamp:
2022-12-12T16:51:56+13:00 (15 months ago)
Author:
davidb
Message:

Fix for the 'google' not defined JS error, caused by the fact that the Google map API JS file had not been included earlier with a <script> tag.

Location:
main/trunk/greenstone3/web/interfaces/default/transform
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl

    r36908 r37023  
    4545    <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteAdmin']"/>
    4646  </xsl:variable>
     47
     48  <xsl:template name="opt-google-maps-api">
     49    <xsl:if test="/page/pageResponse/format/gsf:option[@name='mapEnabled']/@value = 'true'] or /page/pageResponse/format/gsf:option[@name='allowMapGPSEditing']/@value = 'true']">
     50     
     51      <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCofVTps3xHfMvIcTMHqYMMxe3xXfkAxnI&amp;libraries=drawing" type="text/javascript"><xsl:text> </xsl:text></script>
     52      <script src="interfaces/{$interface_name}/js/map-scripts-shapes-util.js" type="text/javascript"><xsl:text> </xsl:text></script>
     53     
     54    </xsl:if>
     55  </xsl:template>
     56 
    4757  <!-- Creates a header for the html page -->
    4858  <xsl:template name="create-html-header">
     
    125135    <script type="text/javascript" src="interfaces/{$interface_name}/js/jquery.blockUI.js"><xsl:text> </xsl:text></script>
    126136    <script type="text/javascript" src="interfaces/{$interface_name}/js/ace/ace.js"><xsl:text> </xsl:text></script>
    127    
     137
     138    <xsl:call-template name="opt-google-maps-api"/>
     139
    128140    <!-- Cookie Consent Manager -->
    129141    <xsl:choose>
     
    827839    </xsl:if>
    828840  </xsl:template>
     841
    829842 
    830843  <xsl:template name="map-scripts">
    831844    <meta content="initial-scale=1.0, user-scalable=no" name="viewport"/>
    832     <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCofVTps3xHfMvIcTMHqYMMxe3xXfkAxnI&amp;libraries=drawing" type="text/javascript"><xsl:text> </xsl:text></script>
    833     <script src="interfaces/{$interface_name}/js/map-scripts-shapes-util.js" type="text/javascript"><xsl:text> </xsl:text></script>
    834845    <script src="interfaces/{$interface_name}/js/map-scripts.js" type="text/javascript"><xsl:text> </xsl:text></script>
    835846    <gsf:script type="text/javascript">$(window).on("load", initializeMapScripts);</gsf:script>
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl

    r37005 r37023  
    356356            <script type="text/javascript" src="interfaces/{$interface_name}/js/documentedit_scripts.js"><xsl:text> </xsl:text></script>
    357357            <script type="text/javascript" src="interfaces/{$interface_name}/js/documentedit_scripts_util.js"><xsl:text> </xsl:text></script>
    358             <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-shapes-util.js"><xsl:text> </xsl:text></script>
    359             <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-history.js"><xsl:text> </xsl:text></script>
    360             <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-themes.js"><xsl:text> </xsl:text></script>
    361             <!-- LEAVE THIS NEXT LINE IN, IF USING CUSTOM OVERLAYS TO SHOW LABELS ON THE MAP -->
    362             <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/label-overlay-class.js"><xsl:text> </xsl:text></script>-->
    363             <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor.js"><xsl:text> </xsl:text></script>     
     358
     359            <xsl:if test="/page/pageResponse/format/gsf:option[@name='allowMapGPSEditing']/@value = 'true']">
     360              <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-history.js"><xsl:text> </xsl:text></script>
     361              <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor-themes.js"><xsl:text> </xsl:text></script>
     362              <!-- LEAVE THIS NEXT LINE IN, IF USING CUSTOM OVERLAYS TO SHOW LABELS ON THE MAP -->
     363              <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/label-overlay-class.js"><xsl:text> </xsl:text></script>-->
     364              <script type="text/javascript" src="interfaces/{$interface_name}/js/map-scripts-editor.js"><xsl:text> </xsl:text></script>
     365              <link rel="stylesheet" href="interfaces/{$interface_name}/style/map-editors.css" type="text/css"/>                       
     366            </xsl:if>
     367           
    364368            <script type="text/javascript" src="interfaces/{$interface_name}/js/hierarchy.js"><xsl:text> </xsl:text></script>
    365369           
    366             <link rel="stylesheet" href="interfaces/{$interface_name}/style/map-editors.css" type="text/css"/>
    367370           
    368371            <script type="text/javascript">
Note: See TracChangeset for help on using the changeset viewer.