Changeset 32468 for main

Show
Ignore:
Timestamp:
18.09.2018 12:44:21 (9 months ago)
Author:
kjdon
Message:

finetuning when the ednable/disable edit mode option appears in the user menu. If editing has been enabled for the collection, but is unavailable for the user, now we'll show an 'editing unavailable...' option, clicking on it shows a popup

Files:
1 modified

Legend:

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

    r32466 r32468  
    2424  </xsl:variable> 
    2525 
    26   <xsl:variable name="isEditingAvailable"> 
     26  <!-- does this collection have editing turned on --> 
     27  <xsl:variable name="isEditingTurnedOn"> 
     28    <xsl:if test="/page/pageResponse/format[@type='display']/gsf:option[@name='AllowDocumentEditing']/@value='true'">1</xsl:if> 
     29  </xsl:variable> 
     30  <!-- is editing available for the collection? eg is there an archives folder? --> 
     31  <xsl:variable name="isEditingAvailable">1</xsl:variable> 
     32  <!-- is a user logged in, and do they have editing rights for this collection? --> 
     33  <xsl:variable name="userHasEditPermission"> 
    2734    <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> 
    2835  </xsl:variable> 
    29    
     36  <xsl:variable name="siteAdmin"> 
     37    <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteAdmin']"/> 
     38  </xsl:variable> 
    3039  <!-- Creates a header for the html page --> 
    3140  <xsl:template name="create-html-header"> 
     
    386395    menu.append(settingsLink); 
    387396     
    388     </xsl:text><xsl:if test="$isEditingAvailable = '1' and /page/pageRequest/@action = 'd'"><xsl:text disable-output-escaping="yes"> 
     397    </xsl:text><xsl:if test="/page/pageRequest/@action = 'd' and $isEditingTurnedOn = '1'"><xsl:text disable-output-escaping="yes"> 
    389398    var editingLink = $("&lt;a&gt;") 
    390399    .attr("href", "javascript:;"); 
    391400    var editingButton = $("&lt;LI&gt;") 
    392     .css("padding", "3px") 
     401    .addClass("ui-state-default") 
     402    .css("padding", "3px")</xsl:text> 
     403    <xsl:choose> 
     404    <xsl:when test="$isEditingAvailable = '1' and $userHasEditPermission = '1'"><xsl:text disable-output-escaping="yes"> 
    393405    .html((gs.userInformation.editEnabled == "true") ? "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.disable_edit_mode')"/><xsl:text disable-output-escaping="yes">" : "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.enable_edit_mode')"/><xsl:text disable-output-escaping="yes">") 
    394     .addClass("ui-state-default") 
    395406    .click(function() 
    396407    { 
     
    402413    }); 
    403414    }); 
     415    </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:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error.contact_admin', $siteAdmin)"/></xsl:variable><xsl:text disable-output-escaping="yes"> 
     416    .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error')"/><xsl:text disable-output-escaping='yes'>") 
     417    .click(function() 
     418    { 
     419    alert("</xsl:text><xsl:value-of select="$reason"/><xsl:text disable-output-escaping='yes'>"); 
     420    menu.hide(); 
     421    }); 
     422        </xsl:text> 
     423    </xsl:otherwise></xsl:choose><xsl:text disable-output-escaping="yes"> 
    404424    editingLink.append(editingButton); 
    405425    menu.append(editingLink);