Changeset 32460 for main


Ignore:
Timestamp:
2018-09-17T14:40:12+12:00 (6 years ago)
Author:
kjdon
Message:

beginnings of google tracking code. editingLink in menu to only appear when the user is in correct group. more work still to do on this

File:
1 edited

Legend:

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

    r32385 r32460  
    2222      </xsl:otherwise>
    2323    </xsl:choose>
     24  </xsl:variable>
     25
     26  <xsl:variable name="isEditingAvailable">
     27    <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:groupsContains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">1</xsl:if>
    2428  </xsl:variable>
    2529 
     
    6064    </xsl:if>
    6165
     66   <!-- <xsl:call-template name="addGoogleTracking"/>-->
    6267    <xsl:choose>
    6368      <xsl:when test="/page/pageResponse/interfaceOptions/option[@name = 'cssTheme']/@value">
     
    100105      <script type="text/javascript" src="interfaces/{$interface_name}/js/visual-xml-editor.js"><xsl:text> </xsl:text></script>
    101106    </xsl:if>
    102    
     107
    103108    <xsl:call-template name="setup-gs-variable"/>
    104109    <xsl:if test="/page/pageRequest/@action ='p' and /page/pageRequest/@subaction='pref'">
     
    111116
    112117    <xsl:call-template name="additionalHeaderContent"/>
     118  </xsl:template>
     119
     120  <xsl:template name="addGoogleTracking">
     121    <xsl:variable name="trackid">UA-xxx-1</xsl:variable>
     122    <!-- Global site tag (gtag.js) - Google Analytics -->
     123    <script async="async" src="https://www.googletagmanager.com/gtag/js?id={$google_tracking_id}"><xsl:text> </xsl:text></script>
     124    <script>
     125      <xsl:text disable-output-escaping="yes">
     126      window.dataLayer = window.dataLayer || [];
     127      function gtag(){dataLayer.push(arguments);}
     128      gtag('js', new Date());
     129     
     130      gtag('config', '</xsl:text><xsl:value-of select="$google_tracking_id"/><xsl:text disable-output-escaping="yes">');</xsl:text>
     131    </script>
    113132  </xsl:template>
    114133
     
    323342 
    324343  <xsl:template name="toggleUserMenuScript">
     344 
    325345    <script type="text/javascript">
    326346      <xsl:text disable-output-escaping="yes">
     
    364384    .addClass("ui-state-default");
    365385    settingsLink.append(settingsButton);
     386    menu.append(settingsLink);
    366387   
     388    </xsl:text><xsl:if test="$isEditingAvailable = '1'"><xsl:text disable-output-escaping="yes">
    367389    var editingLink = $("&lt;a&gt;")
    368390    .attr("href", "javascript:;");
     
    381403    });
    382404    editingLink.append(editingButton);
    383 
     405    menu.append(editingLink);
     406      </xsl:text></xsl:if><xsl:text disable-output-escaping="yes">
    384407    var url = document.URL;
    385408    var hasQueryString = (url.indexOf("?") != -1);
     
    400423    .addClass("ui-state-default");
    401424    logoutLink.append(logoutButton);
    402 
    403     menu.append(settingsLink);
    404     menu.append(editingLink);
    405425    menu.append(logoutLink);
    406426
Note: See TracChangeset for help on using the changeset viewer.