Changeset 38992


Ignore:
Timestamp:
2024-05-03T20:06:35+12:00 (2 weeks ago)
Author:
anupama
Message:

Moved ugly long repetitive collage app specific template from classifier.xsl into webswing-collage.xsl. It made sense for the (now phased out) applet shim to be in classifier.xsl, when it was thought the user may want to edit it, but now there's nothing user-editable outside GLI/collConfig.xml file for the Collage app, the template replacing the applet shim can move be hidden away in webswing-collage.xsl

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

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/webswing-collage.xsl

    r38991 r38992  
    347347
    348348  </xsl:template>
     349
     350    <xsl:template name="get-collage-settings">
     351    <!-- Creates gsf variables (which sets XSL and JavaScript vars) for any user configured
     352     Collage Classifier options coming through collectionConfig and then buildConfig,
     353     so that JavaScript can pass them to the webswing instance on starting it up. -->
     354    <xsl:choose>
     355        <xsl:when test="option[@name='geometry']/@value">
     356      <gsf:variable name="collagewidth">
     357        <xsl:value-of select="substring-before(option[@name='geometry']/@value, 'x')" />
     358      </gsf:variable>
     359      <gsf:variable name="collageheight">
     360        <xsl:value-of select="substring-after(option[@name='geometry']/@value, 'x')" />
     361      </gsf:variable>
     362    </xsl:when>
     363    </xsl:choose>
     364   
     365    <xsl:choose>
     366      <xsl:when test="option[@name='verbosity']/@value">
     367    <gsf:variable name="verbosity">
     368      <xsl:value-of select="option[@name='verbosity']/@value"/>
     369    </gsf:variable>
     370      </xsl:when>
     371    </xsl:choose>
     372    <xsl:choose>
     373      <xsl:when test="option[@name='imageMustNotHave']/@value">
     374    <gsf:variable name="imageMustNotHave">
     375      <xsl:value-of select="option[@name='imageMustNotHave']/@value"/>
     376    </gsf:variable>
     377      </xsl:when>
     378    </xsl:choose>
     379    <xsl:choose>
     380      <xsl:when test="option[@name='imageType']/@value">
     381    <gsf:variable name="imageType">
     382      <xsl:value-of select="option[@name='imageType']/@value"/>
     383    </gsf:variable>
     384      </xsl:when>
     385    </xsl:choose>
     386    <xsl:choose>
     387      <xsl:when test="option[@name='maxDepth']/@value">
     388    <gsf:variable name="maxDepth">
     389      <xsl:value-of select="option[@name='maxDepth']/@value"/>
     390    </gsf:variable>
     391      </xsl:when>
     392    </xsl:choose>
     393    <xsl:choose>
     394      <xsl:when test="option[@name='maxDisplay']/@value">
     395    <gsf:variable name="maxDisplay">
     396      <xsl:value-of select="option[@name='maxDisplay']/@value"/>
     397    </gsf:variable>
     398      </xsl:when>
     399    </xsl:choose>
     400    <xsl:choose>
     401      <xsl:when test="option[@name='refreshDelay']/@value">
     402    <gsf:variable name="refreshDelay">
     403      <xsl:value-of select="option[@name='refreshDelay']/@value"/>
     404    </gsf:variable>
     405      </xsl:when>
     406    </xsl:choose>
     407    <xsl:choose>
     408      <xsl:when test="option[@name='isJava2']/@value">
     409    <gsf:variable name="isJava2">
     410      <xsl:value-of select="option[@name='isJava2']/@value"/>
     411    </gsf:variable>
     412      </xsl:when>
     413    </xsl:choose>
     414    <xsl:choose>
     415      <xsl:when test="option[@name='bgcolor']/@value">
     416    <gsf:variable name="bgcolor">
     417      <xsl:value-of select="option[@name='bgcolor']/@value"/>
     418    </gsf:variable>
     419      </xsl:when>
     420    </xsl:choose>
     421   
     422    <!--
     423     Defaults to fall back on when there is no user customisation
     424     can be manually adjusted here. -->
     425    <!--   
     426    <xsl:call-template name="set-collage-gsfvar-if-exists">
     427      <xsl:with-param name="varName">imageMustNotHave</xsl:with-param>
     428    </xsl:call-template>   
     429    <xsl:call-template name="set-collage-gsfvar-if-exists">
     430      <xsl:with-param name="varName">imageType</xsl:with-param>
     431    </xsl:call-template>   
     432    <xsl:call-template name="set-collage-gsfvar-if-exists">
     433      <xsl:with-param name="varName">verbosity</xsl:with-param>
     434    </xsl:call-template>
     435    <xsl:call-template name="set-collage-gsfvar-if-exists">
     436      <xsl:with-param name="varName">maxDepth</xsl:with-param>
     437    </xsl:call-template>
     438    <xsl:call-template name="set-collage-gsfvar-if-exists">
     439      <xsl:with-param name="varName">maxDisplay</xsl:with-param>
     440    </xsl:call-template>
     441    <xsl:call-template name="set-collage-gsfvar-if-exists">
     442      <xsl:with-param name="varName">refreshDelay</xsl:with-param>
     443    </xsl:call-template>
     444    <xsl:call-template name="set-collage-gsfvar-if-exists">
     445      <xsl:with-param name="varName">isJava2</xsl:with-param>
     446    </xsl:call-template>
     447    <xsl:call-template name="set-collage-gsfvar-if-exists">
     448      <xsl:with-param name="varName">bgcolor</xsl:with-param>
     449    </xsl:call-template>
     450    -->   
     451  </xsl:template>
     452
     453  <!-- https://our.umbraco.com/forum/developers/xslt/9274-Return-Value-from-a-Template -->
     454  <xsl:template name="set-collage-gsfvar-if-exists">
     455    <xsl:param name="varName" />
     456    <!--<xsl:value-of select="$varName"/>-->
     457    <xsl:choose>
     458      <xsl:when test="option[@name=$varName]/@value">
     459    <gsf:variable name="$varName">
     460      <!--<xsl:attribute name="name"><xsl:value-of select="$varName" /></xsl:attribute>-->
     461      <xsl:value-of select="option[@name=$varName]/@value"/>
     462    </gsf:variable>
     463      </xsl:when>
     464    </xsl:choose>
     465  </xsl:template>
    349466 
    350467</xsl:stylesheet>
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/classifier.xsl

    r38991 r38992  
    148148  </xsl:template>
    149149
    150   <xsl:template name="get-collage-settings">
    151     <!-- Creates gsf variables (which sets XSL and JavaScript vars) for any user configured
    152      Collage Classifier options coming through collectionConfig and then buildConfig,
    153      so that JavaScript can pass them to the webswing instance on starting it up. -->
    154     <xsl:choose>
    155         <xsl:when test="option[@name='geometry']/@value">
    156       <gsf:variable name="collagewidth">
    157         <xsl:value-of select="substring-before(option[@name='geometry']/@value, 'x')" />
    158       </gsf:variable>
    159       <gsf:variable name="collageheight">
    160         <xsl:value-of select="substring-after(option[@name='geometry']/@value, 'x')" />
    161       </gsf:variable>
    162     </xsl:when>
    163     </xsl:choose>
    164    
    165     <xsl:choose>
    166       <xsl:when test="option[@name='verbosity']/@value">
    167     <gsf:variable name="verbosity">
    168       <xsl:value-of select="option[@name='verbosity']/@value"/>
    169     </gsf:variable>
    170       </xsl:when>
    171     </xsl:choose>
    172     <xsl:choose>
    173       <xsl:when test="option[@name='imageMustNotHave']/@value">
    174     <gsf:variable name="imageMustNotHave">
    175       <xsl:value-of select="option[@name='imageMustNotHave']/@value"/>
    176     </gsf:variable>
    177       </xsl:when>
    178     </xsl:choose>
    179     <xsl:choose>
    180       <xsl:when test="option[@name='imageType']/@value">
    181     <gsf:variable name="imageType">
    182       <xsl:value-of select="option[@name='imageType']/@value"/>
    183     </gsf:variable>
    184       </xsl:when>
    185     </xsl:choose>
    186     <xsl:choose>
    187       <xsl:when test="option[@name='maxDepth']/@value">
    188     <gsf:variable name="maxDepth">
    189       <xsl:value-of select="option[@name='maxDepth']/@value"/>
    190     </gsf:variable>
    191       </xsl:when>
    192     </xsl:choose>
    193     <xsl:choose>
    194       <xsl:when test="option[@name='maxDisplay']/@value">
    195     <gsf:variable name="maxDisplay">
    196       <xsl:value-of select="option[@name='maxDisplay']/@value"/>
    197     </gsf:variable>
    198       </xsl:when>
    199     </xsl:choose>
    200     <xsl:choose>
    201       <xsl:when test="option[@name='refreshDelay']/@value">
    202     <gsf:variable name="refreshDelay">
    203       <xsl:value-of select="option[@name='refreshDelay']/@value"/>
    204     </gsf:variable>
    205       </xsl:when>
    206     </xsl:choose>
    207     <xsl:choose>
    208       <xsl:when test="option[@name='isJava2']/@value">
    209     <gsf:variable name="isJava2">
    210       <xsl:value-of select="option[@name='isJava2']/@value"/>
    211     </gsf:variable>
    212       </xsl:when>
    213     </xsl:choose>
    214     <xsl:choose>
    215       <xsl:when test="option[@name='bgcolor']/@value">
    216     <gsf:variable name="bgcolor">
    217       <xsl:value-of select="option[@name='bgcolor']/@value"/>
    218     </gsf:variable>
    219       </xsl:when>
    220     </xsl:choose>
    221    
    222     <!--
    223      Defaults to fall back on when there is no user customisation
    224      can be manually adjusted here. -->
    225     <!--   
    226     <xsl:call-template name="set-collage-gsfvar-if-exists">
    227       <xsl:with-param name="varName">imageMustNotHave</xsl:with-param>
    228     </xsl:call-template>   
    229     <xsl:call-template name="set-collage-gsfvar-if-exists">
    230       <xsl:with-param name="varName">imageType</xsl:with-param>
    231     </xsl:call-template>   
    232     <xsl:call-template name="set-collage-gsfvar-if-exists">
    233       <xsl:with-param name="varName">verbosity</xsl:with-param>
    234     </xsl:call-template>
    235     <xsl:call-template name="set-collage-gsfvar-if-exists">
    236       <xsl:with-param name="varName">maxDepth</xsl:with-param>
    237     </xsl:call-template>
    238     <xsl:call-template name="set-collage-gsfvar-if-exists">
    239       <xsl:with-param name="varName">maxDisplay</xsl:with-param>
    240     </xsl:call-template>
    241     <xsl:call-template name="set-collage-gsfvar-if-exists">
    242       <xsl:with-param name="varName">refreshDelay</xsl:with-param>
    243     </xsl:call-template>
    244     <xsl:call-template name="set-collage-gsfvar-if-exists">
    245       <xsl:with-param name="varName">isJava2</xsl:with-param>
    246     </xsl:call-template>
    247     <xsl:call-template name="set-collage-gsfvar-if-exists">
    248       <xsl:with-param name="varName">bgcolor</xsl:with-param>
    249     </xsl:call-template>
    250     -->   
    251   </xsl:template>
    252 
    253   <!-- https://our.umbraco.com/forum/developers/xslt/9274-Return-Value-from-a-Template -->
    254   <xsl:template name="set-collage-gsfvar-if-exists">
    255     <xsl:param name="varName" />
    256     <!--<xsl:value-of select="$varName"/>-->
    257     <xsl:choose>
    258       <xsl:when test="option[@name=$varName]/@value">
    259     <gsf:variable name="$varName">
    260       <!--<xsl:attribute name="name"><xsl:value-of select="$varName" /></xsl:attribute>-->
    261       <xsl:value-of select="option[@name=$varName]/@value"/>
    262     </gsf:variable>
    263       </xsl:when>
    264     </xsl:choose>
    265   </xsl:template>
    266  
    267150  <xsl:template name="Collage_javascript_deprecated">
    268151    <script type="text/javascript" src="interfaces/{$interface_name}/js/collage_scripts.js"><xsl:text> </xsl:text></script>
Note: See TracChangeset for help on using the changeset viewer.