Ignore:
Timestamp:
2023-03-02T23:09:46+13:00 (14 months ago)
Author:
davidb
Message:

Changes related to shifting to the new GoogleIdentity API; also some tweaks to whitespace and tag-name construction using lower-case rather than uppercase tag names

File:
1 edited

Legend:

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

    r37266 r37391  
    113113    function gslogout(logout_action_url) {
    114114      if (googlesignin_client_id != '') {
    115         googleLogout();
     115        //googleLogout();
     116        console.log("Need to implement new Google Identiy Logout function?????");
    116117      }
    117118      window.location = logout_action_url;
     
    208209
    209210  <xsl:template name="addGoogleSignOn">   
    210     <meta name="google-signin-client_id" content="{$googlesignin_client_id}" />
    211    
    212     <script>
    213       <xsl:text disable-output-escaping="yes">
    214    
    215     function googleSigninInit() {
    216       gapi.load('auth2', function() {
    217         var auth2 = gapi.auth2.init({
    218            client_id: googlesignin_client_id,
    219            //scope: 'email' // don't need to top up 'profile' with 'email' as not used client side (email is retrieved via GS3 Servlet)
    220          })
    221          .then(function() {     
    222            if (typeof optGoogleAuth2InitCallback === "function"){
    223              optGoogleAuth2InitCallback();
    224            }
    225          });
    226       });
    227     }
    228          
    229     function googleLogout() {
    230       var auth2 = gapi.auth2.getAuthInstance();
    231       // Use 'disconnect()' rather than 'signOut()' as this does a deeper logout
    232       // that revokes the user's "Google granted" permission.
    233       // This makes it easier, when using the same browser, to login into Greenstone3
    234       // using a differeng Google sign-in account
    235 
    236       auth2.disconnect().then(function () {
    237         console.log("Google-authenticated User signed out");
    238       });
    239       return false;
    240     }
    241       </xsl:text>
    242     </script>
    243     <script src="https://apis.google.com/js/platform.js?onload=googleSigninInit" async="async" defer="defer" ><xsl:text> </xsl:text></script>
     211    <meta name="google-signin-client_id--DEPRECATED" content="{$googlesignin_client_id}" />
     212    <script src="https://accounts.google.com/gsi/client" async="async" defer="defer" ><xsl:text> </xsl:text></script>
    244213   
    245214  </xsl:template>
     
    486455    else
    487456    {
    488     menu = $("&lt;UL&gt;")
     457    menu = $("&lt;ul&gt;")
    489458    .css("position", "absolute")
    490459    .css("display", "block")
     
    523492    var editingLink = $("&lt;a&gt;")
    524493    .attr("href", "javascript:;");
    525     var editingButton = $("&lt;LI&gt;")
     494    var editingButton = $("&lt;li&gt;")
    526495    .addClass("ui-state-default")
    527496    .css("padding", "3px")</xsl:text>
     
    558527      .attr("href", logout_javascript_call);
    559528   
    560     var logoutButton = $("&lt;LI&gt;")
     529    var logoutButton = $("&lt;li&gt;")
    561530      .css("padding", "3px")
    562531      .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.logout')"/><xsl:text disable-output-escaping="yes">")
     
    599568    <xsl:value-of select="@value"/>
    600569      </xsl:if>
    601     </xsl:for-each>
    602    
     570    </xsl:for-each>   
    603571  </xsl:template>
    604572
     
    609577    <xsl:variable name="url" select="/page/pageRequest/@fullURL"/>
    610578    <xsl:variable name="beforeLogout" select="substring-before($url, '&amp;amp;logout=')"/>
    611     <xsl:variable name="tmpAfter" select="substring-after($url, '&amp;amp;logout=')"/>
    612     <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;amp;')"/>
     579    <xsl:variable name="tmpAfter" select="substring-after($url, '&amp;amp;logout=')"/>
     580    <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;amp;')"/>
    613581    <xsl:variable name="beforeHash" select="substring-before($url, '#')"/>
    614582    <xsl:variable name="afterHash" select="substring-after($url, '#')"/>
Note: See TracChangeset for help on using the changeset viewer.