Changeset 33507

Show
Ignore:
Timestamp:
24.09.2019 13:24:07 (3 weeks ago)
Author:
kjdon
Message:

moved canDoEditing variable code to top, so can be used everywhere in the file. added editingTurnedOn variable too. so just use these variables when testing for editing status

Files:
1 modified

Legend:

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

    r33506 r33507  
    2525    </xsl:variable> 
    2626 
     27    <xsl:variable name="canDoEditing"> 
     28      <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> 
     29    </xsl:variable> 
     30    <xsl:variable name="editingTurnedOn"> 
     31      <xsl:if test="/page/pageRequest/paramList/param[@name='docEdit']/@value = '1'">true</xsl:if> 
     32    </xsl:variable> 
     33     
    2734    <!-- optional cgi-params for links to document pages --> 
    2835    <xsl:variable name="opt-doc-link-args"></xsl:variable> 
     
    210217         
    211218            <xsl:choose> 
    212               <xsl:when test="/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' and /page/pageRequest/paramList/param[@name='docEdit']/@value = '1'  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))"> 
     219              <xsl:when test="$canDoEditing = 'true' and $editingTurnedOn = 'true'">  
    213220                <table id="meta{@nodeID}"> 
    214221                    <xsl:attribute name="style"> 
     
    400407        </xsl:if> 
    401408      </xsl:if> 
    402       <xsl:variable name="canDoEditing"> 
    403         <xsl:if test="$isEditingTurnedOn = '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> 
    404       </xsl:variable> 
    405409      <xsl:if test="$canDoEditing = 'true'"> 
    406410        <xsl:call-template name="javascriptForDocumentEditing"/> 
     
    457461            <!-- we want to do this stuff even if docType is simple or paged. Don't want to just set dt=hierarchy as that gives other unnecessary stuff--> 
    458462            <!-- This is the first choice from wrappedDocument template--> 
    459             <xsl:when test="$canDoEditing = 'true' and /page/pageRequest/paramList/param[@name='docEdit']/@value = '1'"> 
     463            <xsl:when test="$canDoEditing = 'true' and $editingTurnedOn = 'true' "> 
    460464                <div id="gs-document" style="width: 67%"> 
    461465                  <xsl:call-template name="documentPre"/>