You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2006/03/06 00:02:07 UTC

svn commit: r383431 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html: branding-logo.ft helper-render-image.ft

Author: thorsten
Date: Sun Mar  5 15:02:05 2006
New Revision: 383431

URL: http://svn.apache.org/viewcvs?rev=383431&view=rev
Log:
Added rollover feature to the render-image contract. Enables to use a different image when roll-over, demonstrated on the branding-logo contract.

Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft
    forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft?rev=383431&r1=383430&r2=383431&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft Sun Mar  5 15:02:05 2006
@@ -26,6 +26,7 @@
   <forrest:property name="branding-logo-description">Apache Forrest</forrest:property>
   <forrest:property name="branding-logo-url">http://forrest.apache.org/</forrest:property>
   <forrest:property name="branding-logo-logo">images/project-logo.gif</forrest:property>
+  [<forrest:property name="branding-logo-over">images/project-logo_over.gif</forrest:property>]
 </forrest:contract>]]></usage>
 
   <forrest:template
@@ -40,6 +41,7 @@
         <xsl:param name="branding-logo-description"/>
         <xsl:param name="branding-logo-url"/>
         <xsl:param name="branding-logo-logo"/>
+        <xsl:param name="branding-logo-over"/>
         <xsl:variable name="root" select="$defaultVariables/*/*[@name='root']/@value"/>
       <xsl:template match="/">
         <forrest:content>
@@ -51,6 +53,7 @@
               <xsl:with-param name="name" select="normalize-space($branding-logo-name)"/>
               <xsl:with-param name="url" select="normalize-space($branding-logo-url)"/>
               <xsl:with-param name="logo" select="normalize-space($branding-logo-logo)"/>
+              <xsl:with-param name="rollover" select="normalize-space($branding-logo-over)"/>
               <xsl:with-param name="root" select="$root"/>
               <xsl:with-param name="description" 
                 select="normalize-space($branding-logo-description)"/>

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft?rev=383431&r1=383430&r2=383431&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft Sun Mar  5 15:02:05 2006
@@ -34,19 +34,43 @@
         <xsl:param name="name"/>
         <xsl:param name="url"/>
         <xsl:param name="logo"/>
+        <xsl:param name="rollover"/>
         <xsl:param name="width"/>
         <xsl:param name="height"/>
         <xsl:param name="root"/>
         <xsl:param name="description"/>
+        <xsl:variable name="logoSrc">
+          <xsl:if test="not(starts-with($logo, 'http://'))">
+            <xsl:value-of select="$root"/>
+          </xsl:if>
+          <xsl:value-of select="$logo"/>
+        </xsl:variable>
+        <xsl:variable name="overSrc">
+          <xsl:if test="not(starts-with($rollover, 'http://'))">
+            <xsl:value-of select="$root"/>
+          </xsl:if>
+          <xsl:value-of select="$rollover"/>
+        </xsl:variable>
+        <xsl:if test="$rollover">
+          <script language="javascript" type="text/javascript" > function 
+            swapImage(name,src){ document[name].src=src; } </script>
+          <!--tricking the cli to request the overSrc image-->
+          <a href="{$overSrc}"><xsl:text> </xsl:text></a>
+        </xsl:if>
         <a href="{$url}">
+          <xsl:if test="$rollover">
+            <xsl:attribute name="onMouseOver">swapImage('<xsl:value-of 
+              select="$name"/>','<xsl:value-of 
+              select="$overSrc"/>');</xsl:attribute>
+            <xsl:attribute name="onMouseOut">swapImage('<xsl:value-of 
+              select="$name"/>','<xsl:value-of 
+              select="$logoSrc"/>');</xsl:attribute>
+          </xsl:if>
           <xsl:choose>
             <xsl:when test="$logo and not($logo = '')">
               <img alt="{$name}" class="logoImage">
                 <xsl:attribute name="src">
-                  <xsl:if test="not(starts-with($logo, 'http://'))">
-                    <xsl:value-of select="$root"/>
-                  </xsl:if>
-                  <xsl:value-of select="$logo"/>
+                  <xsl:value-of select="$logoSrc"/>
                 </xsl:attribute>
                 <xsl:if test="$width">
                   <xsl:attribute name="width">
@@ -61,6 +85,11 @@
                 <xsl:if test="$description">
                   <xsl:attribute name="title">
                     <xsl:value-of select="$description"/>
+                  </xsl:attribute>
+                </xsl:if>
+                <xsl:if test="$rollover">
+                  <xsl:attribute name="name">
+                    <xsl:value-of select="$name"/>
                   </xsl:attribute>
                 </xsl:if>
               </img>