Changeset 37469 for main


Ignore:
Timestamp:
2023-03-13T10:08:53+13:00 (13 months ago)
Author:
davidb
Message:

Set of changes that include links at various points to bring out access to our new webswing GLI capability

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

Legend:

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

    r37410 r37469  
    419419  <xsl:template name="webswingGLILink">
    420420    <div class="paramLabel">
    421       <a href="/webswing-server/gli"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'webswinggli.title')"/></a>
     421      <a href="{$library_name}/page/gli"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'webswinggli.title')"/></a>
    422422  </div>
    423423  <div class="paramValue">
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl

    r37448 r37469  
    1919  <xsl:param name="cookie_consent"/>
    2020 
     21  <!-- does this collection allow webswing-based GLI editing? it's turned on by default, can turn off in config file-->
     22  <xsl:variable name="isGLIEditingAllowed">
     23    <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='allowGLIEditing']) or /page/pageResponse/format[@type='display']/gsf:option[@name='allowGLIEditing']/@value='true'">1</xsl:if>
     24  </xsl:variable>
    2125 
    2226  <!-- does this collection have editing allowed? it's turned on by default, can turn off in config file-->
    23   <xsl:variable name="isEditingAllowed">
     27  <xsl:variable name="isDocumentEditingAllowed">
    2428    <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='allowDocumentEditing']) or /page/pageResponse/format[@type='display']/gsf:option[@name='allowDocumentEditing']/@value='true'">1</xsl:if>
    2529  </xsl:variable>
     
    3640    <xsl:if test="/page/pageRequest/userInformation and (util:csvContains(/page/pageRequest/userInformation/@groups, 'administrator') or util:csvContains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:csvContains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">1</xsl:if>
    3741  </xsl:variable>
     42 
    3843  <xsl:variable name="siteAdmin">
    3944    <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteAdmin']"/>
     
    177182        </xsl:if>
    178183   
    179       </xsl:if>
    180       <script type="text/javascript" src="interfaces/{$interface_name}/js/debug_scripts.js"><xsl:text> </xsl:text></script>
    181       <script type="text/javascript" src="interfaces/{$interface_name}/js/visual-xml-editor.js"><xsl:text> </xsl:text></script>
     184      </xsl:if>
     185
     186      <xsl:variable name="allowGreenbugEditing"><xsl:value-of select="/page/pageResponse/format/gsf:option[@name='allowGreenbugEditing']/@value"/></xsl:variable>
     187
     188      <xsl:if test="$allowGreenbugEditing != 'false'">
     189    <!-- TLDR: explicitly set this option to false in your collection if you don't want it enabled -->
     190   
     191    <!-- For backwards compatibility, testing this way means that if <gsf:option name="greenbugEnable"/>
     192         isn't set at all, then it default to on ... the way things used to work before the option
     193         was introduced -->
     194   
     195    <script type="text/javascript" src="interfaces/{$interface_name}/js/debug_scripts.js"><xsl:text> </xsl:text></script>
     196    <script type="text/javascript" src="interfaces/{$interface_name}/js/visual-xml-editor.js"><xsl:text> </xsl:text></script>
     197      </xsl:if>
     198     
    182199    </xsl:if>
    183200
     
    497514    menu.append(settingsLink);
    498515   
    499     </xsl:text><xsl:if test="/page/pageRequest/@action = 'd' and $isEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
     516    </xsl:text><xsl:if test="/page/pageRequest/@action = 'd' and $isDocumentEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
    500517    var editingLink = $("&lt;a&gt;")
    501518    .attr("href", "javascript:;");
     
    508525    .on("click", function()
    509526    {
    510     var c_url = gs.xsltParams.library_name + "?a=g&amp;rt=ro&amp;s=ChangeUserEditMode&amp;s1.username=" + gs.userInformation.username + "&amp;s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true");
    511     $.ajax(c_url)
    512     .done(function(response)
    513     {
    514     //location.reload(true); // need to set docEdit=0 if we have just disabled editing
    515     location.href= url + (hasQueryString ? "&amp;" : "?") + ((gs.userInformation.editEnabled == "true") ? "docEdit=0&amp;ed=0":"") + (hashPart ? hashPart : "");
    516     });
     527      var c_url = gs.xsltParams.library_name + "?a=g&amp;rt=ro&amp;s=ChangeUserEditMode&amp;s1.username=" + gs.userInformation.username + "&amp;s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true");
     528      $.ajax(c_url)
     529      .done(function(response)
     530      {
     531        //location.reload(true); // need to set docEdit=0 if we have just disabled editing
     532        location.href= url + (hasQueryString ? "&amp;" : "?") + ((gs.userInformation.editEnabled == "true") ? "docEdit=0&amp;ed=0":"") + (hashPart ? hashPart : "");
     533      });
    517534    });
    518535    </xsl:text></xsl:when><xsl:otherwise><xsl:variable name="reason"><xsl:choose><xsl:when test="$isEditingAvailable != '1'"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error_unavailable')"/></xsl:when><xsl:when test="$userHasEditPermission != '1'"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error_wrong_group')"/></xsl:when></xsl:choose><xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error_contact_admin', $siteAdmin)"/></xsl:variable><xsl:text disable-output-escaping="yes">
     
    520537    .on("click", function()
    521538    {
    522     alert("</xsl:text><xsl:value-of select="$reason"/><xsl:text disable-output-escaping='yes'>");
    523     menu.hide();
     539      alert("</xsl:text><xsl:value-of select="$reason"/><xsl:text disable-output-escaping='yes'>");
     540      menu.hide();
    524541    });
    525542        </xsl:text>
     
    527544    editingLink.append(editingButton);
    528545    menu.append(editingLink);
    529       </xsl:text></xsl:if><xsl:text disable-output-escaping="yes">
     546
     547      </xsl:text></xsl:if>
     548
     549      <xsl:if test="$isGLIEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
     550    var gliLink = $("&lt;a&gt;");
     551    if (gs.cgiParams["c"]) {
     552      gliLink.attr("href", gs.xsltParams.library_name + "/collection/"+gs.cgiParams["c"]+"/page/gli");
     553    }
     554    else {
     555      gliLink.attr("href", gs.xsltParams.library_name + "/page/gli");
     556    }
     557    var gliButton = $("&lt;li&gt;")
     558    .css("padding", "3px")
     559    .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.webswing_gli')"/><xsl:text disable-output-escaping="yes">")
     560    .addClass("ui-state-default");
     561    gliLink.append(gliButton);
     562    menu.append(gliLink);
     563      </xsl:text></xsl:if>
     564
     565      <xsl:text disable-output-escaping="yes">
    530566
    531567        // Need to check for the situation where the user immediately logs out, having just logged in
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl

    r37409 r37469  
    4646
    4747    <xsl:variable name="canDoEditing">
    48       <xsl:if test="$isEditingAllowed = '1' and (/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))">true</xsl:if>
     48      <xsl:if test="$isDocumentEditingAllowed = '1' and (/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))">true</xsl:if>
    4949    </xsl:variable>
    5050    <xsl:variable name="editingTurnedOn">
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/home.xsl

    r37019 r37469  
    6969        -->
    7070
    71         <!--
    7271        <gslib:webswingGLILink/><br/><br/>
    73         -->
    7472
    7573        <gslib:aboutGreenstoneLink/><br/>
Note: See TracChangeset for help on using the changeset viewer.