Show
Ignore:
Timestamp:
18.10.2007 14:56:29 (2 years ago)
Author:
sam
Message:

* passage à 3.4.002
* binaryXhtmlTransf :

  • ajout sm:WFreeBlock
  • ajout sm:WFlash
  • sur sm:WImage & sm:WFlash : implémentation de sm:size permetant de borner width et height de l'elt html en partant des dim de la res publié
  • ajout de sm:chooseOnBinary permetant d'ajouter des conditionnalités de génération en fonction de caractéristiques d'une resource transformé (dims seuls pour le moment)
  • sm:WLink :
    • ajout de sm:WImage à sm:link
    • si sm:link/sm:position/sm:centerScreen alors par défaut, pour les res de type image et flash, le popup prend les dimensions de la resource qu'il affiche.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_binaryXhtmlTransf/widgets.xsl.xsl

    r9762 r9844  
    4747        xmlns:java="http://xml.apache.org/xslt/java"  
    4848        xmlns:xalan="http://xml.apache.org/xalan" 
    49         exclude-result-prefixes="sm sc sp xsl java xalan"> 
     49        xmlns:xhtml="http://www.w3.org/1999/xhtml" 
     50        exclude-result-prefixes="sm sc sp xsl java xalan xhtml"> 
    5051         
    5152        <xsl0:import href="bsco:sm/web/sm_WLink.xml.xsl"/> 
     
    7172        <xsl0:template name="sizeAtts"> 
    7273                <xsl0:choose> 
    73                         <xsl0:when test="boolean(*/sm:fromPublishedImage)"> 
    74                                 <xsl:variable name="vInfosRes" select="parseXml(resultatAgent('//', concat('get:dest:', resultatAgent('//genResUri_{generate-id(sm:binaryUrl)}'), '?transform=img2props&amp;unit=px')))"/> 
    75                         </xsl0:when> 
    76                         <xsl0:when test="boolean(*/sm:fromPublishedObject/@type='flash')"> 
    77                                 <xsl:variable name="vInfosRes" select="parseXml(resultatAgent('//', concat('get:dest:', resultatAgent('//genResUri_{generate-id(sm:binaryUrl)}'), '?transform=swf2props')))"/> 
    78                         </xsl0:when> 
    79                 </xsl0:choose> 
    80                 <xsl0:call-template name="sizeAttWidth"/> 
    81                 <xsl0:call-template name="sizeAttHeight"/> 
     74                        <xsl0:when test="boolean(sm:size)"> 
     75                                <xsl:attribute name="width"><xsl:value-of select="java:getWidth($vResWebSize_{generate-id(.)})"/></xsl:attribute> 
     76                                <xsl:attribute name="height"><xsl:value-of select="java:getHeight($vResWebSize_{generate-id(.)})"/></xsl:attribute> 
     77                        </xsl0:when> 
     78                        <xsl0:otherwise> 
     79                                <xsl0:call-template name="sizeAttWidth"/> 
     80                                <xsl0:call-template name="sizeAttHeight"/> 
     81                        </xsl0:otherwise> 
     82                </xsl0:choose>   
    8283        </xsl0:template> 
    8384        <xsl0:template name="sizeAttWidth"> 
     
    9495                <xsl0:choose> 
    9596                        <xsl0:when test="boolean(sm:width/sm:fixedValue)"><xsl0:value-of select="sm:width/sm:fixedValue/@value"/></xsl0:when> 
    96                         <xsl0:when test="boolean(sm:width/sm:fromPublishedImage)"><xsl:value-of select="$vInfosRes/props/p[@cd='width']"/></xsl0:when> 
    97                         <xsl0:when test="boolean(sm:width/sm:fromPublishedObject/@type='flash')"><xsl:value-of select="($vInfosRes/swfHeader/@x2 - $vInfosRes/swfHeader/@x1) div 20"/></xsl0:when> 
    9897                </xsl0:choose> 
    9998        </xsl0:template> 
     
    101100                <xsl0:choose> 
    102101                        <xsl0:when test="boolean(sm:height/sm:fixedValue)"><xsl0:value-of select="sm:height/sm:fixedValue/@value"/></xsl0:when> 
    103                         <xsl0:when test="boolean(sm:height/sm:fromPublishedImage)"><xsl:value-of select="$vInfosRes/props/p[@cd='height']"/></xsl0:when> 
    104                         <xsl0:when test="boolean(sm:height/sm:fromPublishedObject/@type='flash')"><xsl:value-of select="($vInfosRes/swfHeader/@y2 - $vInfosRes/swfHeader/@y1) div 20"/></xsl0:when> 
    105102                </xsl0:choose> 
    106103        </xsl0:template> 
     
    131128        </xsl0:template> 
    132129 --> 
     130 
     131        <!-- chooseOnBinary --> 
     132        <xsl0:template match="sm:chooseOnBinary" mode="content"> 
     133                <xsl:variable name="vResType_{generate-id(sm:binary)}" select="'{si(sm:binary/@outputType, sm:binary/@outputType, 'unknown')}'"/> 
     134                <xsl:variable name="vResInfo_{generate-id(sm:binary)}" select="si($vResType_{generate-id(sm:binary)} = 'image' or $vResType_{generate-id(sm:binary)} = 'flash', parseXml(resultatAgent('//', concat(resultatAgent('//getResUri_{generate-id(sm:binary)}'), resultatAgent('//resUriHasTransf_{generate-id(sm:binary)}'), si($vResType_{generate-id(sm:binary)} = 'image', 'transform=img2props&amp;unit=px', 'transform=swf2props')))))"/> 
     135                <xsl0:if test="sm:when[@widthOver]"> 
     136                        <xsl:variable name="vResInfoWidth_{generate-id(sm:binary)}" select="si($vResType_{generate-id(sm:binary)} = 'image', $vResInfo_{generate-id(sm:binary)}/props/p[@cd='width'], si($vResType_{generate-id(sm:binary)} = 'flash', ($vResInfo_{generate-id(sm:binary)}/swfHeader/@x2 - $vResInfo_{generate-id(sm:binary)}/swfHeader/@x1) div 20, '0'))"/> 
     137                </xsl0:if> 
     138                <xsl0:if test="sm:when[@heightOver]"> 
     139                        <xsl:variable name="vResInfoHeight_{generate-id(sm:binary)}" select="si($vResType_{generate-id(sm:binary)} = 'image', $vResInfo_{generate-id(sm:binary)}/props/p[@cd='height'], si($vResType_{generate-id(sm:binary)} = 'flash', ($vResInfo_{generate-id(sm:binary)}/swfHeader/@y2 - $vResInfo_{generate-id(sm:binary)}/swfHeader/@y1) div 20, '0'))"/> 
     140                </xsl0:if> 
     141                <xsl:choose> 
     142                        <xsl0:apply-templates mode="content"/> 
     143                </xsl:choose> 
     144        </xsl0:template> 
     145        <xsl0:template match="sm:when" mode="content"> 
     146                <xsl:when test="{concat(si(@widthOver, concat('$vResInfoWidth_', generate-id(../sm:binary), '&gt;', @widthOver, ' or ')), si(@heightOver, concat('$vResInfoHeight_', generate-id(../sm:binary), '&gt;', @heightOver, ' or ')), 'false()')}"> 
     147                        <xsl0:apply-templates mode="content"/> 
     148                </xsl:when> 
     149        </xsl0:template> 
     150        <xsl0:template match="sm:otherwise" mode="content"> 
     151                <xsl:otherwise> 
     152                        <xsl0:apply-templates mode="content"/> 
     153                </xsl:otherwise> 
     154        </xsl0:template> 
    133155 
    134156        <!-- WObject --> 
     
    141163                        <xsl0:apply-templates select="sm:param[count(@type)=0 or @type!='url']" mode="content"/> 
    142164                        <embed pluginspage="{sm:pluginspage/@value}" src="{{resultatAgent('//url_{generate-id(sm:binaryUrl)}')}}{$vUrlParams}"> 
     165                                <xsl0:call-template name="classAtt"/> 
     166                                <xsl0:apply-templates select="sm:param[count(@type)=0 or @type!='url']" mode="contentEmbedAtts"/> 
     167                                <xsl0:call-template name="sizeAtts"/> 
     168                        </embed> 
     169                </object> 
     170        </xsl0:template> 
     171 
     172        <!-- WFlash --> 
     173        <xsl0:template match="sm:WFlash" mode="content"> 
     174                <xsl0:variable name="vUrlParams"><xsl0:apply-templates select="sm:param[@type='url']" mode="urlInlineParams"/></xsl0:variable> 
     175                <object codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> 
     176                        <xsl0:call-template name="classAtt"/> 
     177                        <xsl0:call-template name="sizeAtts"/> 
     178                        <param name="src" value="{{resultatAgent('//url_{generate-id(sm:binaryUrl)}')}}{$vUrlParams}"/> 
     179                        <xsl0:apply-templates select="sm:param[count(@type)=0 or @type!='url']" mode="content"/> 
     180                        <embed pluginspage="http://www.macromedia.com/go/getflash/" type="application/x-shockwave-flash" src="{{resultatAgent('//url_{generate-id(sm:binaryUrl)}')}}{$vUrlParams}"> 
    143181                                <xsl0:call-template name="classAtt"/> 
    144182                                <xsl0:apply-templates select="sm:param[count(@type)=0 or @type!='url']" mode="contentEmbedAtts"/> 
     
    516554        </xsl0:template> 
    517555 
    518         <!-- Common WObject,WVideo,WAudio templates --> 
     556        <!-- Common WFlash,WObject,WVideo,WAudio templates --> 
    519557        <xsl0:template match="sm:param" mode="content"> 
    520558                <param name="{@name}"> 
     
    572610        <xsl0:template match="sm:WLink" mode="content"> 
    573611                <xsl0:variable name="vOptions"> 
    574                         <xsl0:call-template name="linkOptions"/><!-- Dans bsco:sm/web/sm_WLink.xml.xsl --> 
     612                        <xsl0:call-template name="linkOptionsXsl"><!-- Dans bsco:sm/web/sm_WLink.xml.xsl --> 
     613                                <xsl0:with-param name="pWidthDefault"> 
     614                                        <xsl0:choose> 
     615                                                <xsl0:when test="sm:link/sm:WImage[sm:size]"> 
     616                                                        <xsl:value-of select="round(java:getWidth($vResWebSize_{generate-id(sm:link/sm:WImage)}))"/> 
     617                                                </xsl0:when> 
     618                                                <xsl0:when test="sm:link/sm:WFlash[sm:size]"> 
     619                                                        <xsl:value-of select="round(java:getWidth($vResWebSize_{generate-id(sm:link/sm:WFlash)}))"/> 
     620                                                </xsl0:when> 
     621                                        </xsl0:choose> 
     622                                </xsl0:with-param> 
     623                                <xsl0:with-param name="pHeightDefault"> 
     624                                        <xsl0:choose> 
     625                                                <xsl0:when test="sm:link/sm:WImage[sm:size]"> 
     626                                                        <xsl:value-of select="round(java:getHeight($vResWebSize_{generate-id(sm:link/sm:WImage)}))"/> 
     627                                                </xsl0:when> 
     628                                                <xsl0:when test="sm:link/sm:WFlash[sm:size]"> 
     629                                                        <xsl:value-of select="round(java:getHeight($vResWebSize_{generate-id(sm:link/sm:WFlash)}))"/> 
     630                                                </xsl0:when> 
     631                                        </xsl0:choose> 
     632                                </xsl0:with-param> 
     633                        </xsl0:call-template> 
    575634                </xsl0:variable> 
    576635                <a> 
     
    578637                        <xsl0:call-template name="linkHrefXsl"><!-- Dans bsco:sm/web/sm_WLink.xml.xsl --> 
    579638                                <xsl0:with-param name="pUrl"><xsl0:apply-templates select="sm:link/*" mode="pathNavXsl"/></xsl0:with-param> 
    580                                 <xsl0:with-param name="pOptions"><xsl0:value-of select="$vOptions"/></xsl0:with-param> 
     639                                <xsl0:with-param name="pOptions" select="$vOptions"/> 
    581640                                <xsl0:with-param name="pExtraOptions"><xsl0:if test="sm:link/@target='subWindow'">SUBWINTI:'<xsl:value-of select="chaineProtegeJs(si(resultatAgent('//fullTitleText')!='', resultatAgent('//fullTitleText'), java:hGetName(srcFileAgent()) ))"/>',</xsl0:if></xsl0:with-param> 
    582641                        </xsl0:call-template> 
     
    675734        </xsl0:template> 
    676735 
     736        <!-- sm:WFreeBlock --> 
     737        <xsl0:template match="sm:WFreeBlock" mode="content"> 
     738                <xsl0:apply-templates mode="content"/> 
     739        </xsl0:template> 
     740        <xsl0:template match="sm:WFreeBlock/sm:title" mode="content"> 
     741                <xsl0:apply-templates select="." mode="contentTitleIn"/> 
     742        </xsl0:template> 
     743        <xsl0:template match="xhtml:*/sm:title" mode="content"> 
     744                <xsl0:apply-templates select="." mode="contentTitleIn"/> 
     745        </xsl0:template> 
     746        <xsl0:template match="xhtml:*" mode="content"> 
     747                <xsl0:element name="{local-name()}"> 
     748                        <xsl0:apply-templates select="@*" mode="freeAtts"/> 
     749                        <xsl0:apply-templates select="node()" mode="content"/> 
     750                </xsl0:element > 
     751        </xsl0:template> 
     752        <xsl0:template match="xhtml:img" mode="content"> 
     753                <img src="[![agent=//;arguments=pubres:{resultatAgent('//', concat('res:src=wsp:', @sc:refUri, ';mutabledst=', resultatAgent('//agentGenerator', 'destPathLibInSiteFolder'), '/', extractFileNameFromPath(@sc:refUri) ))}]!]" alt="{@alt}"> 
     754                        <xsl0:apply-templates select="@*" mode="freeAtts"/> 
     755                </img> 
     756        </xsl0:template> 
     757        <xsl0:template match="sm:WFreeBlock//text()" mode="content"> 
     758                <xsl0:if test="string-length(normalize-space(.)) &gt; 0"><xsl0:value-of select="."/></xsl0:if> 
     759        </xsl0:template> 
     760        <xsl0:template match="@*" mode="freeAtts"> 
     761                <xsl0:copy/> 
     762        </xsl0:template> 
     763        <xsl0:template match="@sc:*" mode="freeAtts"/> 
     764 
    677765        <!-- sm:Widget --> 
    678766        <xsl0:template match="sm:Widget" mode="content"><xsl:value-of select="resultatAgent(concat('widget_{generate-id(.)}_',generate-id()))" disable-output-escaping="yes"/></xsl0:template>