You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by so...@apache.org on 2006/06/12 01:24:58 UTC
svn commit: r413547 [4/15] - in /lenya/branches/revolution/1.3.x: ./
src/java/org/apache/lenya/cms/cocoon/components/modules/input/
src/java/org/apache/lenya/cms/cocoon/components/source/
src/java/org/apache/lenya/cms/cocoon/components/source/impl/ src...
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources2.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources2.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources2.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources2.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+<!-- Group into flat structure -->
+
+<xsl:key name="ids" match="resource" use="@id" />
+
+<xsl:template match="/resources">
+<content>
+<xsl:for-each select="resource[generate-id() = generate-id(key('ids', @id)[1])]">
+ <xsl:sort select="@id" />
+<resource id="{@id}" type="{@type}">
+ <xsl:element name="translation">
+ <xsl:attribute name="language">en</xsl:attribute>
+ <xsl:for-each select="key('ids', @id)">
+ <file>
+ <xsl:apply-templates select="@*|node()" mode="resource"/>
+ </file>
+ </xsl:for-each>
+
+ </xsl:element>
+</resource>
+ </xsl:for-each>
+</content>
+</xsl:template>
+
+<xsl:template match="@type" mode="resource"/>
+<xsl:template match="@id" mode="resource"/>
+<xsl:template match="@idl" mode="resource"/>
+
+<xsl:template match="resource">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="resource"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" mode="resource">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="resource"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" priority="-1"/>
+
+</xsl:stylesheet>
\ No newline at end of file
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources2.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+<!-- Add attributes and index fields. Cleanup. -->
+
+<xsl:template match="/content">
+<resources>
+<xsl:apply-templates/>
+</resources>
+</xsl:template>
+
+<xsl:template match="resource">
+<xsl:copy><xsl:apply-templates select="@id"/><xsl:apply-templates select="@*"/>
+<xsl:attribute name="filename">/resource.xml</xsl:attribute>
+<xsl:choose>
+<xsl:when test="@id='/index'"><xsl:attribute name="doctype">homepage</xsl:attribute></xsl:when>
+<xsl:when test="@type='xml'"><xsl:attribute name="doctype">xhtml</xsl:attribute></xsl:when>
+</xsl:choose>
+
+<xsl:for-each select="translation/file">
+<xsl:element name="index">
+<xsl:attribute name="name"><xsl:value-of select="@area"/></xsl:attribute>
+<xsl:attribute name="position"><xsl:value-of select="@position"/></xsl:attribute>
+</xsl:element>
+<xsl:if test="@visible='true'">
+<xsl:element name="index">
+<xsl:attribute name="name"><xsl:value-of select="@area"/>menu</xsl:attribute>
+<xsl:attribute name="position"><xsl:value-of select="@position"/></xsl:attribute>
+</xsl:element>
+</xsl:if>
+</xsl:for-each>
+ <xsl:apply-templates select="translation"/>
+</xsl:copy>
+</xsl:template>
+
+<xsl:template match="translation">
+<xsl:variable name="editf"><xsl:value-of select="file[@area='authoring']/@time"/></xsl:variable>
+<xsl:variable name="edit"><xsl:choose>
+ <xsl:when test="string-length($editf) > 0"><xsl:value-of select="$editf"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+</xsl:choose></xsl:variable>
+
+<xsl:variable name="livef"><xsl:value-of select="file[@area='live']/@time"/></xsl:variable>
+<xsl:variable name="live"><xsl:choose>
+ <xsl:when test="string-length($livef) > 0"><xsl:value-of select="$livef"/></xsl:when>
+ <xsl:otherwise></xsl:otherwise>
+</xsl:choose></xsl:variable>
+
+ <xsl:copy><xsl:apply-templates select="@*"/>
+<xsl:attribute name="filename">/en/translation.xml</xsl:attribute>
+<xsl:attribute name="edit"><xsl:value-of select="$edit"/></xsl:attribute>
+<xsl:attribute name="live"><xsl:value-of select="$live"/></xsl:attribute>
+ <xsl:apply-templates select="file"/>
+</xsl:copy>
+</xsl:template>
+
+<xsl:template match="file">
+<xsl:variable name="time"><xsl:choose>
+<xsl:when test="@time"><xsl:value-of select="@time"/></xsl:when>
+<xsl:otherwise>1</xsl:otherwise>
+</xsl:choose></xsl:variable>
+<xsl:variable name="extension"><xsl:call-template name="extension">
+ <xsl:with-param name="filename" select="@filename"/>
+</xsl:call-template></xsl:variable>
+ <xsl:copy>
+<xsl:apply-templates select="@*"/>
+<xsl:attribute name="oldfilename"><xsl:value-of select="@metafilename"/></xsl:attribute>
+<xsl:attribute name="filename">/en/<xsl:value-of select="$time"/>.xml</xsl:attribute>
+<xsl:attribute name="binaryfilenameold"><xsl:value-of select="@filename"/></xsl:attribute>
+<xsl:attribute name="binaryfilenamenew">/en/<xsl:value-of select="$time"/>.<xsl:value-of select="$extension"/></xsl:attribute>
+<xsl:attribute name="extension"><xsl:value-of select="$extension"/></xsl:attribute>
+</xsl:copy>
+</xsl:template>
+
+<xsl:template name="extension"><xsl:param name="filename"/><xsl:variable name="extension"><xsl:value-of select="substring-after($filename, '.')"/></xsl:variable><xsl:choose>
+<xsl:when test="$extension = ''"><xsl:value-of select="$filename"/></xsl:when>
+<xsl:otherwise><xsl:call-template name="extension">
+ <xsl:with-param name="filename" select="$extension"/>
+</xsl:call-template></xsl:otherwise>
+</xsl:choose></xsl:template>
+
+<xsl:template match="file/@area"/>
+<xsl:template match="file/@filename"/>
+<xsl:template match="file/@language"/>
+<xsl:template match="file/@time"/>
+<xsl:template match="file/@visible"/>
+<xsl:template match="file/@position"/>
+
+<xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+<!-- Group into flat structure -->
+
+<xsl:key name="structure" match="resource" use="@structure" />
+
+<xsl:template match="/relations">
+ <xsl:variable name="home"><xsl:value-of select="@home"/></xsl:variable>
+<structures>
+<xsl:for-each select="resource[generate-id() = generate-id(key('structure', @structure)[1])]">
+ <xsl:sort select="@position" />
+ <xsl:variable name="structure"><xsl:value-of select="@structure"/></xsl:variable>
+ <structure name="{$structure}" home="{$home}">
+ <xsl:for-each select="key('structure', $structure)">
+ <resource>
+ <xsl:apply-templates select="@*|node()" mode="resource"/>
+ </resource>
+ </xsl:for-each>
+</structure>
+ </xsl:for-each>
+</structures>
+</xsl:template>
+
+<xsl:template match="@structure" mode="resource"/>
+
+<xsl:template match="resource" mode="resource">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="resource"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" mode="resource" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="resource"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" priority="-2"/>
+
+</xsl:stylesheet>
\ No newline at end of file
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure2.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure2.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure2.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure2.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+<!-- Group into flat structure -->
+
+<xsl:key name="parent" match="resource" use="@parent" />
+
+<xsl:template match="/resources">
+<resources>
+ <xsl:attribute name="structure"><xsl:value-of select="@name"/></xsl:attribute>
+ <xsl:for-each select="key('parent', '')">
+ <xsl:sort select="@position" data-type="number"/>
+ <xsl:call-template name="subresource">
+ <xsl:with-param name="parent" select="@unid"/>
+ </xsl:call-template>
+ </xsl:for-each>
+</resources>
+</xsl:template>
+
+<xsl:template match="@parent"/>
+<xsl:template match="@position"/>
+<xsl:template match="@structure"/>
+
+<xsl:template name="subresource">
+ <xsl:param name="parent"/>
+ <xsl:variable name="unid"><xsl:value-of select="@unid"/></xsl:variable>
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:for-each select="key('parent', $unid)">
+ <xsl:sort select="@position" data-type="number"/>
+ <xsl:call-template name="subresource">
+ <xsl:with-param name="parent" select="$unid"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="resource"/>
+ </xsl:copy>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/structure2.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/blank_btn.gif
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/blank_btn.gif?rev=413547&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/blank_btn.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/cal.gif
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/cal.gif?rev=413547&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/cal.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/close.gif
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/close.gif?rev=413547&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/close.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/def2binding.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/def2binding.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/def2binding.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/def2binding.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+ Transforms a form definition file into a binding file. This is an attempt at merging
+ these two files in only one.
+ To use it, simply load the form bindings from a cocoon: pipeline that applies this stylesheet
+ on a form definition. Next step will by to rewrite this directly into Cocoon Forms binding system.
+
+ The binding is created according to the following rules :
+ - fb:* attributes on widget definitions lead to the creation of
+ - <fb:context> if a @fb:context attribute is found
+ - <fb:simple-repeater> if a @fb:parent-path is found on a <fd:repeater>
+ - <fb:value> if a @fb:path is found on any fd:* element
+ - if a <fd:binding> is present, its content is copied as is with the @id of the enclosing widget
+
+ @author Sylvain Wallez
+ @version CVS $Id: def2binding.xsl 30932 2004-07-29 17:35:38Z vgritsenko $
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding">
+
+<xsl:template match="fd:*[@fb:context]">
+ <fb:context path="{@fb:context}">
+ <xsl:for-each select="@*[(local-name(.) != 'context') and (namespace-uri() = 'http://apache.org/cocoon/forms/1.0#binding')]">
+ <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </fb:context>
+</xsl:template>
+
+<xsl:template match="fd:*[@fb:path]">
+ <fb:value id="{@id}">
+ <xsl:for-each select="@*[namespace-uri() = 'http://apache.org/cocoon/forms/1.0#binding']">
+ <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </fb:value>
+</xsl:template>
+
+<xsl:template match="fd:repeater[@fb:parent-path]">
+ <fb:simple-repeater id="{@id}">
+ <xsl:for-each select="@*[namespace-uri() = 'http://apache.org/cocoon/forms/1.0#binding']">
+ <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </fb:simple-repeater>
+</xsl:template>
+
+<xsl:template match="fd:*[fd:binding]">
+ <!-- copy the binding element -->
+ <xsl:variable name="binding" select="fd:binding/fb:*[1]"/>
+ <xsl:element name="{local-name($binding)}" namespace="{namespace-uri($binding)}">
+ <xsl:copy-of select="$binding/@*"/>
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+ <xsl:copy-of select="$binding/node()"/>
+ <!-- and recurse in the widgets while in the binding element -->
+ <xsl:apply-templates/>
+ </xsl:element>
+</xsl:template>
+
+<!-- avoid copying text -->
+<xsl:template match="text()|@*"/>
+
+</xsl:stylesheet>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/def2binding.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/delete.gif
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/delete.gif?rev=413547&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/delete.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/formfixer.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/formfixer.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/formfixer.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/formfixer.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- solprovider.com -->
+<!-- Adds language to ACTION attributes -->
+<xsl:param name="language"/>
+<xsl:template match="/">
+ <xsl:apply-templates/>
+</xsl:template>
+<xsl:template match="@action">
+ <xsl:attribute name="action"><xsl:value-of select="substring-before(. ,'.')"/>_<xsl:value-of select="$language"/>.<xsl:value-of select="substring-after(. ,'.')"/></xsl:attribute>
+</xsl:template>
+<xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+</xsl:template>
+</xsl:stylesheet>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/formfixer.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-advanced-field-styling.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-advanced-field-styling.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-advanced-field-styling.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-advanced-field-styling.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ exclude-result-prefixes="fi">
+ <!--+
+ | This stylesheet is designed to be included by 'forms-samples-styling.xsl'.
+ | It extends the 'forms-field-styling.xsl' with additional stylings.
+ | The very specific advanced stylings as the calendar or htmlarea (both
+ | also need additional JS files) are separated out of this file.
+ +-->
+
+ <xsl:import href="forms-field-styling.xsl"/>
+ <xsl:include href="forms-calendar-styling.xsl"/>
+ <xsl:include href="forms-htmlarea-styling.xsl"/>
+ <!-- Location of the resources directory, where JS libs and icons are stored -->
+ <xsl:param name="resources-uri">resources</xsl:param>
+
+ <xsl:template match="head" mode="forms-field">
+ <xsl:apply-imports/>
+ <script src="{$resources-uri}/mattkruse-lib/AnchorPosition.js" type="text/javascript"/>
+ <script src="{$resources-uri}/mattkruse-lib/PopupWindow.js" type="text/javascript"/>
+ <script src="{$resources-uri}/mattkruse-lib/OptionTransfer.js" type="text/javascript"/>
+ <script src="{$resources-uri}/mattkruse-lib/selectbox.js" type="text/javascript"/>
+ <xsl:apply-templates select="." mode="forms-calendar"/>
+ <xsl:apply-templates select="." mode="forms-htmlarea"/>
+ </xsl:template>
+
+ <xsl:template match="body" mode="forms-field">
+ <xsl:apply-imports/>
+ <xsl:apply-templates select="." mode="forms-calendar"/>
+ <xsl:apply-templates select="." mode="forms-htmlarea"/>
+ </xsl:template>
+
+ <!--+ This template should not be necessary as this stylesheet "inherits"
+ | all templates from 'forms-field-styling.xsl', but without it, it does
+ | not work for me (using Xalan 2.5.1). It's like adding all methods of
+ | a superclass in a subclass and calling everywhere only the super
+ | implementation.
+ +-->
+ <xsl:template match="*">
+ <xsl:apply-imports/>
+ </xsl:template>
+
+ <!--+
+ | Add fi:help to the common stuff.
+ +-->
+ <xsl:template match="fi:*" mode="common">
+ <xsl:apply-imports/>
+ <xsl:apply-templates select="fi:help"/>
+ </xsl:template>
+
+ <!--+
+ |
+ +-->
+ <xsl:template match="fi:help">
+ <xsl:variable name="id" select="generate-id()"/>
+ <div class="forms-help" id="help{$id}" style="visibility:hidden; position:absolute;">
+ <span style="float:right"><a href="#" onClick="helpWin{$id}.hidePopup();return false;"><img align="top" alt="close" src="{$resources-uri}/close.gif" height="6" width="6"/></a></span>
+ <xsl:apply-templates select="node()"/>
+ </div>
+ <script type="text/javascript">
+ var helpWin<xsl:value-of select="$id"/> = forms_createPopupWindow('help<xsl:value-of select="$id"/>');
+ </script>
+ <a id="{$id}" name="{$id}" href="#" onclick="helpWin{$id}.showPopup('{$id}');return false;">
+ <!-- TODO: i18n key for helppopup -->
+ <img src="{$resources-uri}/help.gif" alt="helppopup"/>
+ </a>
+ </xsl:template>
+
+ <!--+
+ | fi:multivaluefield with list-type='double-listbox' styling
+ +-->
+ <xsl:template match="fi:multivaluefield[fi:styling/@list-type='double-listbox']">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+
+ <div class="forms-doubleList" title="{fi:hint}">
+ <table>
+ <xsl:if test="fi:styling/fi:available-label|fi:styling/fi:selected-label">
+ <tr>
+ <th>
+ <xsl:copy-of select="fi:styling/fi:available-label/node()"/>
+ </th>
+ <th> </th>
+ <th>
+ <xsl:copy-of select="fi:styling/fi:selected-label/node()"/>
+ </th>
+ </tr>
+ </xsl:if>
+ <tr>
+ <td>
+ <!-- select for the unselected values -->
+ <select id="{@id}.unselected" name="{@id}.unselected" multiple="multiple"
+ ondblclick="opt{generate-id()}.forms_transferRight()">
+ <xsl:apply-templates select="." mode="styling"/>
+ <xsl:for-each select="fi:selection-list/fi:item">
+ <xsl:variable name="value" select="@value"/>
+ <xsl:if test="not($values[. = $value])">
+ <option value="{$value}">
+ <xsl:copy-of select="fi:label/node()"/>
+ </option>
+ </xsl:if>
+ </xsl:for-each>
+ </select>
+ </td>
+ <td>
+ <!-- command buttons -->
+ <!-- strangely, IE adds an extra blank line if there only a button on a line. So we surround it with nbsp -->
+ <xsl:text> </xsl:text>
+ <input type="button" value=">" onclick="opt{generate-id()}.forms_transferRight()">
+ <xsl:if test="@state='disabled'">
+ <xsl:attribute name="disabled">disabled</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:text> </xsl:text>
+ <br/>
+ <xsl:text> </xsl:text>
+ <input type="button" value=">>" onclick="opt{generate-id()}.forms_transferAllRight()">
+ <xsl:if test="@state='disabled'">
+ <xsl:attribute name="disabled">disabled</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:text> </xsl:text>
+ <br/>
+ <xsl:text> </xsl:text>
+ <input type="button" value="<" onclick="opt{generate-id()}.forms_transferLeft()">
+ <xsl:if test="@state='disabled'">
+ <xsl:attribute name="disabled">disabled</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:text> </xsl:text>
+ <br/>
+ <xsl:text> </xsl:text>
+ <input type="button" value="<<" onclick="opt{generate-id()}.forms_transferAllLeft()">
+ <xsl:if test="@state='disabled'">
+ <xsl:attribute name="disabled">disabled</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:text> </xsl:text>
+ <br/>
+ <xsl:apply-templates select="." mode="common"/>
+ </td>
+ <td>
+ <!-- select for the selected values -->
+ <select id="{@id}" name="{@id}" multiple="multiple"
+ ondblclick="opt{generate-id()}.forms_transferLeft()" >
+ <xsl:apply-templates select="." mode="styling"/>
+ <xsl:for-each select="fi:selection-list/fi:item">
+ <xsl:variable name="value" select="@value"/>
+ <xsl:if test="$values[. = $value]">
+ <option value="{$value}">
+ <xsl:copy-of select="fi:label/node()"/>
+ </option>
+ </xsl:if>
+ </xsl:for-each>
+ </select>
+ </td>
+ </tr>
+ </table>
+ <script type="text/javascript">
+ var opt<xsl:value-of select="generate-id()"/> = forms_createOptionTransfer('<xsl:value-of select="@id"/>', <xsl:value-of select="fi:styling/@submit-on-change = 'true'"/>);
+ </script>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="fi:multivaluefield/fi:styling[@list-type='double-listbox']/@submit-on-change" mode="styling"/>
+
+</xsl:stylesheet>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-advanced-field-styling.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar-styling.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar-styling.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar-styling.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar-styling.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ exclude-result-prefixes="fi">
+ <!--+
+ | This stylesheet is designed to be included by 'forms-advanced-styling.xsl'.
+ +-->
+
+ <!-- Location of the resources directory, where JS libs and icons are stored -->
+ <xsl:param name="resources-uri">resources</xsl:param>
+
+ <xsl:template match="head" mode="forms-calendar">
+ <script src="{$resources-uri}/mattkruse-lib/CalendarPopup.js" type="text/javascript"/>
+ <script src="{$resources-uri}/mattkruse-lib/date.js" type="text/javascript"/>
+ <script type="text/javascript">
+ // Setup calendar
+ var forms_calendar = CalendarPopup('forms_calendarDiv');
+ forms_calendar.setWeekStartDay(1);
+ forms_calendar.showYearNavigation();
+ forms_calendar.showYearNavigationInput();
+ forms_calendar.setCssPrefix("forms_");
+ </script>
+ <link rel="stylesheet" type="text/css" href="{$resources-uri}/forms-calendar.css"/>
+ </xsl:template>
+
+ <xsl:template match="body" mode="forms-calendar">
+ <div id="forms_calendarDiv"/>
+ </xsl:template>
+
+ <!--+
+ | fi:field with either
+ | - explicit styling @type = 'date' or
+ | - implicit if no styling @type is specified,
+ | but datatype/@type = 'date' and datatype/convertor/@variant = 'date',
+ | selection lists must be excluded here
+ +-->
+ <xsl:template match="fi:field[fi:styling/@type='date'] |
+ fi:field[not(fi:styling/@type)][fi:datatype[@type='date'][fi:convertor/@variant='date']][not(fi:selection-list)]">
+ <xsl:variable name="id" select="generate-id()"/>
+
+ <xsl:variable name="format">
+ <xsl:choose>
+ <xsl:when test="fi:datatype[@type='date']/fi:convertor/@pattern">
+ <xsl:value-of select="fi:datatype[@type='date']/fi:convertor/@pattern"/>
+ </xsl:when>
+ <xsl:otherwise>yyyy-MM-dd</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- regular input -->
+ <input id="{@id}" name="{@id}" value="{fi:value}" title="{normalize-space(fi:hint)}" type="text">
+ <xsl:apply-templates select="." mode="styling"/>
+ </input>
+
+ <!-- calendar popup -->
+ <xsl:choose>
+ <xsl:when test="@state = 'disabled'">
+ <!-- TODO: i18n key for @alt -->
+ <img src="{$resources-uri}/cal.gif" alt="Calendar"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="#" name="{$id}" id="{$id}"
+ onclick="forms_calendar.select(forms_getForm(this)['{@id}'],'{$id}','{$format}'); return false;">
+ <!-- TODO: i18n key for @alt -->
+ <img src="{$resources-uri}/cal.gif" alt="Calendar"/>
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- common stuff -->
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar-styling.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar.css
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar.css?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar.css (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar.css Sun Jun 11 16:24:48 2006
@@ -0,0 +1,92 @@
+/*
+* Copyright 1999-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#forms_calendarDiv {
+ position: absolute;
+ visibility: hidden;
+ background-color: white;
+ layer-background-color: white;
+}
+
+.forms_cpYearNavigation, .forms_cpMonthNavigation {
+ background-color:#C0C0C0;
+ text-align:center;
+ vertical-align:center;
+ text-decoration:none;
+ color:#000000;
+ font-weight:bold;
+}
+
+.forms_cpDayColumnHeader, .forms_cpYearNavigation, .forms_cpMonthNavigation, .forms_cpCurrentMonthDate, .forms_cpCurrentMonthDateDisabled, .forms_cpOtherMonthDate, .forms_cpOtherMonthDateDisabled, .forms_cpCurrentDate, .forms_cpCurrentDateDisabled, .forms_cpTodayText, .forms_cpTodayTextDisabled, .forms_cpText {
+ font-family:arial;
+ font-size:8pt;
+}
+
+TD.forms_cpDayColumnHeader {
+ text-align:right;
+ border:solid thin #C0C0C0;
+ border-width:0 0 19 0;
+}
+
+.forms_cpCurrentMonthDate, .forms_cpOtherMonthDate, .forms_cpCurrentDate {
+ text-align:right;
+ text-decoration:none;
+}
+
+.forms_cpCurrentMonthDateDisabled, .forms_cpOtherMonthDateDisabled, .forms_cpCurrentDateDisabled {
+ color:#D0D0D0;
+ text-align:right;
+ text-decoration:line-through;
+}
+
+.forms_cpCurrentMonthDate, .forms_cpCurrentDate {
+ color:#000000;
+}
+
+.forms_cpOtherMonthDate {
+ color:#808080;
+}
+
+TD.forms_cpCurrentDate {
+ color:white; background-color: #C0C0C0;
+ border-width:1;
+ border:solid thin #800000;
+}
+
+TD.forms_cpCurrentDateDisabled {
+ border-width:1;
+ border:solid thin #FFAAAA;
+}
+
+TD.forms_cpTodayText, TD.forms_cpTodayTextDisabled {
+ border:solid thin #C0C0C0;
+ border-width:1 0 0 0;
+}
+
+A.forms_cpTodayText, SPAN.forms_cpTodayTextDisabled {
+ height:20px;
+}
+
+A.forms_cpTodayText {
+ color:black;
+}
+
+.forms_cpTodayTextDisabled {
+ color:#D0D0D0;
+}
+
+.forms_cpBorder {
+ border:solid thin #808080;
+}
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-calendar.css
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-field-styling.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-field-styling.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-field-styling.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-field-styling.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,619 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ exclude-result-prefixes="fi"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+
+>
+ <!--+
+ | This stylesheet is designed to be included by 'forms-samples-styling.xsl'.
+ | Version CVS $Id: forms-field-styling.xsl 57374 2004-11-10 21:19:51Z tim $
+ +-->
+
+ <!-- Location of the resources directory, where JS libs and icons are stored -->
+ <xsl:param name="resources-uri">resources</xsl:param>
+
+ <xsl:template match="head" mode="forms-field">
+ <script src="{$resources-uri}/forms-lib.js" type="text/javascript"/>
+ <link rel="stylesheet" type="text/css" href="{$resources-uri}/forms.css"/>
+ </xsl:template>
+
+ <xsl:template match="body" mode="forms-field">
+ <xsl:copy-of select="@*"/>
+ <xsl:attribute name="onload">forms_onload(); <xsl:value-of select="@onload"/></xsl:attribute>
+ </xsl:template>
+
+ <!--+
+ | Generic fi:field : produce an <input>
+ +-->
+ <xsl:template match="fi:field">
+ <input name="{@id}" id="{@id}" value="{fi:value}" title="{fi:hint}" type="text">
+ <xsl:apply-templates select="." mode="styling"/>
+ </input>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+ <!--+
+ | Common stuff like fi:validation-message, @required.
+ +-->
+ <xsl:template match="fi:*" mode="common">
+ <!-- validation message -->
+ <xsl:apply-templates select="fi:validation-message"/>
+ <!-- required mark -->
+ <xsl:if test="@required='true'"> *</xsl:if>
+ </xsl:template>
+
+ <!--+
+ | Handling the common styling. You may only add attributes to the output
+ | in this template as later processing might add attributes too, for
+ | example @checked or @selected
+ +-->
+ <xsl:template match="fi:*" mode="styling">
+ <xsl:apply-templates select="fi:styling/@*" mode="styling"/>
+
+ <xsl:if test="@state = 'disabled'">
+ <xsl:attribute name="disabled">disabled</xsl:attribute>
+ </xsl:if>
+
+ <!--+
+ | @listbox-size needs to be handled separately as even if it is not
+ | specified some output (@size) must be generated.
+ +-->
+ <xsl:if test="self::fi:field[fi:selection-list][fi:styling/@list-type = 'listbox'] or
+ self::fi:multivaluefield[not(fi:styling/@list-type = 'checkbox')]">
+ <xsl:variable name="size">
+ <xsl:value-of select="fi:styling/@listbox-size"/>
+ <xsl:if test="not(fi:styling/@listbox-size)">5</xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="size">
+ <xsl:value-of select="$size"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="fi:styling/@*" mode="styling">
+ <xsl:copy-of select="."/>
+ </xsl:template>
+
+ <xsl:template match="fi:styling/@submit-on-change" mode="styling">
+ <xsl:if test=". = 'true'">
+ <xsl:attribute name="onchange">forms_submitForm(this)</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="fi:styling/@list-type | fi:styling/@list-orientation |
+ fi:styling/@listbox-size | fi:styling/@format | fi:styling/@layout"
+ mode="styling">
+ <!--+
+ | Ignore marker attributes so they don't go into the resuling HTML.
+ +-->
+ </xsl:template>
+
+ <xsl:template match="fi:styling/@type" mode="styling">
+ <!--+
+ | Do we have a duplicate semantic usage of @type?
+ | @type is only a marker for the stylesheet in general, but some of the
+ | types must/should be in the HTML output too.
+ +-->
+ <xsl:variable name="validHTMLTypes"
+ select="'text hidden checkbox radio password image reset submit'"/>
+ <xsl:if test="normalize-space(.) and
+ contains(concat(' ', $validHTMLTypes, ' '), concat(' ', ., ' '))">
+ <xsl:copy-of select="."/>
+ </xsl:if>
+ </xsl:template>
+
+ <!--+
+ |
+ +-->
+<!--
+ <xsl:template match="fi:validation-message">
+ <a href="#" class="forms-validation-message" onclick="alert('{normalize-space(.)}');return false;"> ! </a>
+ </xsl:template>
+-->
+ <xsl:template match="fi:validation-message">
+<script language="JAVASCRIPT" charset="utf-8">valmsg<xsl:number level="any"/> = "<i18n:text><xsl:value-of select="normalize-space(.)"/></i18n:text>"; </script>
+<xsl:element name="a">
+<xsl:attribute name="href">javascript:alert(valmsg<xsl:number level="any"/>);</xsl:attribute>
+<xsl:attribute name="class">forms-validation-message</xsl:attribute> ! </xsl:element>
+ </xsl:template>
+
+
+
+ <!--+
+ | Hidden fi:field : produce input with type='hidden'
+ +-->
+ <xsl:template match="fi:field[fi:styling/@type='hidden']" priority="2">
+ <input type="hidden" name="{@id}" id="{@id}" value="{fi:value}">
+ <xsl:apply-templates select="." mode="styling"/>
+ </input>
+ </xsl:template>
+
+ <!--+
+ | fi:field with a selection list and @list-type 'radio' : produce
+ | radio-buttons oriented according to @list-orientation
+ | ("horizontal" or "vertical" - default)
+ +-->
+ <xsl:template match="fi:field[fi:selection-list][fi:styling/@list-type='radio']" priority="2">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="value" select="fi:value"/>
+ <xsl:variable name="vertical" select="string(fi:styling/@list-orientation) != 'horizontal'"/>
+ <xsl:choose>
+ <xsl:when test="$vertical">
+ <table cellpadding="0" cellspacing="0" border="0" title="{fi:hint}">
+ <xsl:for-each select="fi:selection-list/fi:item">
+ <tr>
+ <td>
+ <input type="radio" id="{generate-id()}" name="{$id}" value="{@value}">
+ <xsl:if test="@value = $value">
+ <xsl:attribute name="checked">checked</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="../.." mode="styling"/>
+ </input>
+ </td>
+ <td>
+ <xsl:apply-templates select="." mode="label">
+ <xsl:with-param name="id" select="generate-id()"/>
+ </xsl:apply-templates>
+ </td>
+ <xsl:if test="position() = 1">
+ <td rowspan="{count(../fi:item)}">
+ <xsl:apply-templates select="../.." mode="common"/>
+ </td>
+ </xsl:if>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <span title="{fi:hint}">
+ <xsl:for-each select="fi:selection-list/fi:item">
+ <input type="radio" id="{generate-id()}" name="{$id}" value="{@value}">
+ <xsl:if test="@value = $value">
+ <xsl:attribute name="checked">checked</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="../.." mode="styling"/>
+ </input>
+ <xsl:apply-templates select="." mode="label">
+ <xsl:with-param name="id" select="generate-id()"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </span>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--+
+ | fi:field with a selection list (not 'radio' style)
+ | Rendering depends on the attributes of fi:styling :
+ | - if @list-type is "listbox" : produce a list box with @listbox-size visible
+ | items (default 5)
+ | - otherwise, produce a dropdown menu
+ +-->
+ <xsl:template match="fi:field[fi:selection-list]" priority="1">
+ <xsl:variable name="value" select="fi:value"/>
+
+ <!-- dropdown or listbox -->
+ <select title="{fi:hint}" id="{@id}" name="{@id}">
+ <xsl:apply-templates select="." mode="styling"/>
+ <xsl:for-each select="fi:selection-list/fi:item">
+ <option value="{@value}">
+ <xsl:if test="@value = $value">
+ <xsl:attribute name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="fi:label/node()"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+ <!--+
+ | fi:field with a selection list and @type 'output'
+ +-->
+ <xsl:template match="fi:field[fi:selection-list][fi:styling/@type='output']" priority="3">
+ <xsl:variable name="value" select="fi:value"/>
+ <xsl:variable name="selected" select="fi:selection-list/fi:item[@value = $value]"/>
+ <xsl:choose>
+ <xsl:when test="$selected/fi:label">
+ <xsl:copy-of select="$selected/fi:label/node()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--+
+ | fi:field with @type 'textarea'
+ +-->
+ <xsl:template match="fi:field[fi:styling/@type='textarea']">
+ <textarea id="{@id}" name="{@id}" title="{fi:hint}">
+ <xsl:apply-templates select="." mode="styling"/>
+ <!-- remove carriage-returns (occurs on certain versions of IE and doubles linebreaks at each submit) -->
+ <xsl:copy-of select="translate(fi:value/node(), ' ', '')"/>
+ </textarea>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+ <!--+
+ | fi:field with @type 'output' and fi:output are both rendered as text
+ +-->
+<!--
+ <xsl:template match="fi:output | fi:field[fi:styling/@type='output']" priority="2">
+ <xsl:copy-of select="fi:value/node()"/>
+ </xsl:template>
+-->
+ <xsl:template match="fi:field[fi:styling/@type='output']" priority="2">
+ <xsl:copy-of select="fi:value/node()"/>
+ </xsl:template>
+
+ <xsl:template match="fi:output" priority="2">
+ <xsl:variable name="value" select="fi:value/node()"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, '~')">
+ <xsl:call-template name="outputparse">
+ <xsl:with-param name="txt"><xsl:value-of select="$value"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="fi:value/node()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="outputparse">
+ <xsl:param name="txt"/>
+ <xsl:choose>
+ <xsl:when test="contains($txt, '~~')">
+ <xsl:variable name="sbefore">
+ <xsl:value-of select="substring-before($txt, '~~')"/>
+ </xsl:variable>
+ <xsl:if test="string-length($sbefore) > 0">
+ <xsl:call-template name="outputline">
+ <xsl:with-param name="txt"><xsl:value-of select="substring-before($txt, '~~')"/></xsl:with-param>
+ </xsl:call-template><BR/>
+ </xsl:if>
+ <xsl:call-template name="outputparse">
+ <xsl:with-param name="txt"><xsl:value-of select="substring-after($txt, '~~')"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="outputline">
+ <xsl:with-param name="txt"><xsl:value-of select="$txt"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="outputline">
+ <xsl:param name="txt"/>
+ <xsl:choose>
+ <xsl:when test="$txt = ''"></xsl:when>
+ <xsl:when test="contains($txt, '~')">
+ <xsl:element name="i18n:text">
+ <xsl:attribute name="key">
+ <xsl:value-of select="substring-before($txt, '~')"/>
+ </xsl:attribute>
+ <xsl:value-of select="substring-after($txt, '~')"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <i18n:text><xsl:value-of select="$txt"/></i18n:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!--+
+ | Labels for form elements.
+ +-->
+ <xsl:template match="fi:*" mode="label">
+ <xsl:param name="id" select="@id"/>
+ <label for="{$id}" title="{fi:hint}">
+ <xsl:choose>
+ <xsl:when test="contains(fi:label/node(), '~~')">
+<A HREF="{substring-before(fi:label/node(), '~~')}"><xsl:value-of select="substring-after(fi:label/node(), '~~')" /></A>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="fi:label/node()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </label>
+ </xsl:template>
+
+ <!--+
+ | Labels for pure outputs must not contain <label/> as there is no element to point to.
+ +-->
+ <xsl:template match="fi:output | fi:field[fi:styling/@type='output'] | fi:messages | fi:field[fi:selection-list][fi:styling/@list-type='radio']" mode="label">
+ <xsl:copy-of select="fi:label/node()"/>
+ </xsl:template>
+
+ <!--+
+ | fi:booleanfield : produce a checkbox
+ | A hidden booleanfield is not a checkbox, so 'value' contains
+ | the value and not the checked attribute
+ +-->
+ <xsl:template match="fi:booleanfield">
+ <input id="{@id}" type="checkbox" value="true" name="{@id}" title="{fi:hint}">
+ <xsl:apply-templates select="." mode="styling"/>
+ <xsl:choose>
+ <xsl:when test="./fi:styling[@type='hidden']">
+ <xsl:if test="fi:value = 'false'">
+ <xsl:attribute name="value">false</xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="fi:value = 'true'">
+ <xsl:attribute name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </input>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+ <!--+
+ | fi:booleanfield with @type 'output' : rendered as text
+ +-->
+ <xsl:template match="fi:booleanfield[fi:styling/@type='output']">
+ <xsl:choose>
+ <xsl:when test="fi:value = 'true'">
+ yes
+ </xsl:when>
+ <xsl:otherwise>
+ no
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--+
+ | fi:action
+ +-->
+ <xsl:template match="fi:action">
+ <input id="{@id}" type="submit" name="{@id}" title="{fi:hint}">
+ <xsl:attribute name="value"><xsl:value-of select="fi:label/node()"/></xsl:attribute>
+ <xsl:apply-templates select="." mode="styling"/>
+ </input>
+ </xsl:template>
+
+ <!--+
+ | fi:continuation-id : produce a hidden "continuation-id" input
+ +-->
+ <xsl:template match="fi:continuation-id">
+ <xsl:variable name="name">
+ <xsl:value-of select="@name"/>
+ <xsl:if test="not(@name)">continuation-id</xsl:if>
+ </xsl:variable>
+<!-- <div style="display: none;"> -->
+ <input name="{$name}" type="hidden" value="{.}"/>
+<!-- </div> -->
+ </xsl:template>
+
+ <!--+
+ | fi:multivaluefield : produce a list of checkboxes
+ +-->
+ <xsl:template match="fi:multivaluefield[fi:styling/@list-type='checkbox']">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+
+ <span title="{fi:hint}">
+ <xsl:for-each select="fi:selection-list/fi:item">
+ <xsl:variable name="value" select="@value"/>
+ <input id="{generate-id()}" type="checkbox" value="{@value}" name="{$id}">
+ <xsl:if test="$values[. = $value]">
+ <xsl:attribute name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:apply-templates select="." mode="label">
+ <xsl:with-param name="id" select="generate-id()"/>
+ </xsl:apply-templates>
+ <br/>
+ </xsl:for-each>
+ </span>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+ <!--+
+ | fi:multivaluefield : produce a multiple-selection list
+ +-->
+ <xsl:template match="fi:multivaluefield">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+
+ <span title="{fi:hint}">
+ <select id="{@id}" name="{$id}" multiple="multiple">
+ <xsl:apply-templates select="." mode="styling"/>
+ <xsl:for-each select="fi:selection-list/fi:item">
+ <xsl:variable name="value" select="@value"/>
+ <option value="{$value}">
+ <xsl:if test="$values[. = $value]">
+ <xsl:attribute name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="fi:label/node()"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </span>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+ <!--+
+ | fi:upload
+ +-->
+ <xsl:template match="fi:upload">
+ <xsl:choose>
+ <xsl:when test="fi:value">
+ <!-- Has a value (filename): display it with a change button -->
+ <span title="{fi:hint}">
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select="fi:value"/>
+ <xsl:text>] </xsl:text>
+ <input type="button" id="{@id}" name="{@id}" value="..." onclick="forms_submitForm(this)"/>
+ </span>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="file" id="{@id}" name="{@id}" title="{fi:hint}" accept="{@mime-types}">
+ <xsl:apply-templates select="." mode="styling"/>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+ <!--+
+ | fi:repeater
+ +-->
+ <xsl:template match="fi:repeater">
+ <input type="hidden" name="{@id}.size" value="{@size}"/>
+ <table border="1">
+ <tr>
+ <xsl:for-each select="fi:headings/fi:heading">
+ <th><xsl:value-of select="."/></th>
+ </xsl:for-each>
+ </tr>
+ <xsl:apply-templates select="fi:repeater-row"/>
+ </table>
+ </xsl:template>
+
+ <!--+
+ | fi:repeater-row
+ +-->
+ <xsl:template match="fi:repeater-row">
+ <tr>
+ <xsl:for-each select="*">
+ <td>
+ <xsl:apply-templates select="."/>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:template>
+
+ <!--+
+ | fi:repeater-size
+ +-->
+ <xsl:template match="fi:repeater-size">
+ <input type="hidden" name="{@id}.size" value="{@size}"/>
+ </xsl:template>
+
+ <!--+
+ | fi:form-template|fi:form-generated
+ +-->
+ <xsl:template match="fi:form-template|fi:form-generated">
+ <form>
+ <xsl:copy-of select="@*"/>
+ <xsl:attribute name="onsubmit">forms_onsubmit(); <xsl:value-of select="@onsubmit"/></xsl:attribute>
+ <!-- hidden field to store the submit id -->
+ <div><input type="hidden" name="forms_submit_id"/></div>
+ <xsl:apply-templates/>
+
+ <!-- TODO: consider putting this in the xml stream from the generator? -->
+ <xsl:if test="self::fi:form-generated">
+ <input type="submit"/>
+ </xsl:if>
+ </form>
+ </xsl:template>
+
+ <!--+
+ | fi:form
+ +-->
+ <xsl:template match="fi:form">
+ <table border="1">
+ <xsl:for-each select="fi:widgets/*">
+ <tr>
+ <xsl:choose>
+ <xsl:when test="self::fi:repeater">
+ <td colspan="2">
+ <xsl:apply-templates select="."/>
+ </td>
+ </xsl:when>
+ <xsl:when test="self::fi:booleanfield">
+ <td> </td>
+ <td>
+ <xsl:apply-templates select="."/>
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="." mode="label"/>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>
+ <xsl:apply-templates select="." mode="label"/>
+ </td>
+ <td>
+ <xsl:apply-templates select="."/>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="fi:aggregatefield">
+ <input id="{@id}" name="{@id}" value="{fi:value}" title="{fi:hint}">
+ <xsl:apply-templates select="." mode="styling"/>
+ </input>
+ <xsl:apply-templates select="." mode="common"/>
+ </xsl:template>
+
+ <xsl:template match="fi:messages">
+ <xsl:if test="fi:message">
+ <xsl:apply-templates select="." mode="label"/>:
+ <ul>
+ <xsl:for-each select="fi:message">
+ <li><xsl:apply-templates/></li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="fi:validation-errors">
+ <xsl:variable name="header">
+ <xsl:choose>
+ <xsl:when test="header">
+ <xsl:copy-of select="header"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <p class="forms-validation-errors">The following errors have been detected (marked with !):</p>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="footer">
+ <xsl:choose>
+ <xsl:when test="footer">
+ <xsl:copy-of select="footer"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <p class="forms-validation-errors">Please, correct them and re-submit the form.</p>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="messages" select="ancestor::fi:form-template//fi:validation-message"/>
+ <xsl:if test="$messages">
+ <xsl:copy-of select="$header"/>
+ <ul>
+ <xsl:for-each select="$messages">
+ <li class="forms-validation-error">
+ <xsl:variable name="label">
+ <xsl:apply-templates select=".." mode="label"/>
+ </xsl:variable>
+ <xsl:if test="$label">
+ <xsl:copy-of select="$label"/><xsl:text>: </xsl:text>
+ </xsl:if>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ <xsl:copy-of select="$footer"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="@*|node()" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-field-styling.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-htmlarea-styling.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-htmlarea-styling.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-htmlarea-styling.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-htmlarea-styling.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ exclude-result-prefixes="fi">
+ <!--+
+ | This stylesheet is designed to be included by 'forms-advanced-styling.xsl'.
+ +-->
+
+ <!-- Location of the resources directory, where JS libs and icons are stored -->
+ <xsl:param name="resources-uri">resources</xsl:param>
+ <xsl:param name="htmlarea-lang">en</xsl:param>
+
+ <xsl:template match="head" mode="forms-htmlarea">
+ <script type="text/javascript">
+ _editor_url = "<xsl:value-of select="concat($resources-uri, '/htmlarea/')"/>";
+ _editor_lang = "<xsl:value-of select="$htmlarea-lang"/>";
+ </script>
+ <script type="text/javascript" src="{$resources-uri}/htmlarea/htmlarea.js"></script>
+ </xsl:template>
+
+ <xsl:template match="body" mode="forms-htmlarea"/>
+
+ <!--+
+ | fi:field with @type 'htmlarea'
+ +-->
+ <xsl:template match="fi:field[fi:styling[@type='htmlarea']]">
+ <textarea id="{@id}" name="{@id}" title="{fi:hint}">
+ <xsl:apply-templates select="." mode="styling"/>
+ <!-- remove carriage-returns (occurs on certain versions of IE and doubles linebreaks at each submit) -->
+ <xsl:apply-templates select="fi:value/node()" mode="htmlarea-copy"/>
+ </textarea>
+ <xsl:apply-templates select="." mode="common"/>
+ <xsl:choose>
+ <xsl:when test="fi:styling/initFunction">
+ <script language="JavaScript"><xsl:value-of select="fi:styling/initFunction"/>('<xsl:value-of select="@id"/>');</script>
+ </xsl:when>
+ <xsl:otherwise>
+ <script type="text/javascript">HTMLArea.replace('<xsl:value-of select="@id"/>');</script>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@*|*" mode="htmlarea-copy">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="htmlarea-copy"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="text()" mode="htmlarea-copy">
+ <xsl:copy-of select="translate(., ' ', '')"/>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-htmlarea-styling.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-lib.js
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-lib.js?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-lib.js (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-lib.js Sun Jun 11 16:24:48 2006
@@ -0,0 +1,195 @@
+/*
+* Copyright 1999-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+/**
+ * Runtime JavaScript library for Cocoon forms.
+ *
+ * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
+ * @version CVS $Id: forms-lib.js 57536 2004-11-12 18:33:30Z sylvain $
+ */
+
+// Handlers that are to be called in the document's "onload" event
+var forms_onloadHandlers = new Array();
+
+function forms_onload() {
+ for (var i = 0; i < forms_onloadHandlers.length; i++) {
+ forms_onloadHandlers[i].forms_onload();
+ }
+ // Clear it (we no more need them)
+ forms_onloadHandlers = null;
+}
+
+// Handlers that are to be called in form's "onsubmit" event
+//FIXME: this single var implies only one form per page, and needs to be
+// visited if we decide to support several forms per page.
+var forms_onsubmitHandlers = new Array();
+
+function forms_onsubmit() {
+ if (forms_onsubmitHandlers == null) {
+ alert("onsubmit called twice!");
+ }
+
+ for (var i = 0; i < forms_onsubmitHandlers.length; i++) {
+ forms_onsubmitHandlers[i].forms_onsubmit();
+ }
+ // clear it
+ forms_onsubmitHandlers = null;
+}
+
+/**
+ * Submit the form containing an element, also storing in the hidden
+ * 'forms_submit_id' field the name of the element which triggered the submit.
+ */
+function forms_submitForm(element, name) {
+ if (name == undefined) {
+ name = element.name;
+ }
+
+ var form = forms_getForm(element);
+ if (form == null) {
+ alert("Cannot find form for " + element);
+ } else {
+ form["forms_submit_id"].value = name;
+ // FIXME: programmatically submitting the form doesn't trigger onsubmit ? (both in IE and Moz)
+ forms_onsubmit();
+ form.submit();
+ }
+}
+
+/**
+ * Crawl the parents of an element up to finding a form.
+ */
+function forms_getForm(element) {
+ while(element != null && element.tagName != "FORM") {
+ element = element.parentNode;
+ }
+ return element;
+}
+
+/**
+ * Move a named element as an immediate child of the <body> element.
+ * This is required for help popups inside <wi:group> tabs. The reason is that CSS positioning
+ * properties ("left" and "top") on a block with a "position: absolute" are actually relative to
+ * the nearest ancestor that has a position of "absolute", "relative" or "fixed".
+ * See http://www.w3.org/TR/CSS21/visudet.html#containing-block-details $4
+ */
+
+function forms_moveInBody(element) {
+ element.parentNode.removeChild(element);
+ document.body.appendChild(element);
+}
+
+/**
+ * Create a popup window for a named element.
+ *
+ * @param id the ID of the element to make a popup with.
+ */
+function forms_createPopupWindow(id) {
+ var result = new PopupWindow(id);
+ result.autoHide();
+ // add to onload handlers
+ result.forms_id = id;
+ result.forms_onload = function() {
+ forms_moveInBody(document.getElementById(this.forms_id));
+ }
+ forms_onloadHandlers.push(result);
+ return result;
+}
+
+
+function forms_createOptionTransfer(id, submitOnChange) {
+ var result = new OptionTransfer(id + ".unselected", id);
+ result.setAutoSort(true);
+ // add to onload handlers
+ result.forms_id = id;
+ result.forms_onload = function() {
+ var form = forms_getForm(document.getElementById(this.forms_id));
+ this.init(form);
+ sortSelect(this.left);
+ sortSelect(this.right);
+ }
+ result.submitOnChange = submitOnChange;
+ result.forms_transferLeft = function() {
+ this.transferLeft();
+ if (this.submitOnChange) {
+ forms_submitForm(document.getElementById(this.forms_id));
+ }
+ }
+ result.forms_transferRight = function() {
+ this.transferRight();
+ if (this.submitOnChange) {
+ forms_submitForm(document.getElementById(this.forms_id));
+ }
+ }
+ result.forms_transferAllLeft = function() {
+ this.transferAllLeft();
+ if (this.submitOnChange) {
+ forms_submitForm(document.getElementById(this.forms_id));
+ }
+ };
+ result.forms_transferAllRight = function() {
+ this.transferAllRight();
+ if (this.submitOnChange) {
+ forms_submitForm(document.getElementById(this.forms_id));
+ }
+ };
+ forms_onloadHandlers.push(result);
+
+ // add to onsubmit handlers
+ result.forms_onsubmit = function() {
+ // Select all options in the "selected" list to that
+ // its values are sent.
+ selectAllOptions(this.right);
+ }
+ forms_onsubmitHandlers.push(result);
+ return result;
+}
+
+
+/**
+ * Show a tab in a <wi:group>
+ *
+ * @param tabgroup (string) name of the <wi:group>
+ * @param idx (integer) index of the selected tab
+ * @param length (integer) total number of tabs
+ * @param state (string, optional) name of the input storing the tabgroup state
+ */
+function forms_showTab(tabgroup, idx, length, state) {
+ // Change state value
+ if (state.length > 0) {
+ document.forms[0][state].value = idx;
+ }
+ for (var i = 0; i < length; i++) {
+ // Change tab status (selected/unselected)
+ var tab = document.getElementById(tabgroup + "_tab_" + i);
+ if (tab != null) {
+ tab.className = (i == idx) ? 'forms-tab forms-activeTab': 'forms-tab';
+ }
+ // Change tab content visibilty
+ var tabitems = document.getElementById(tabgroup + "_items_" + i);
+ if (tabitems != null) {
+ tabitems.style.display = (i == idx) ? '' : 'none';
+ // execute event handler if any
+ if (i == idx &&
+ window.onTabShownHandlers != null &&
+ window.onTabShownHandlers[tabgroup] != null) {
+ var onShowHandler = window.onTabShownHandlers[tabgroup][tabgroup + "_items_" + i];
+ if (onShowHandler != null) {
+ eval(onShowHandler);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-lib.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-page-styling.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-page-styling.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-page-styling.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-page-styling.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,339 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ exclude-result-prefixes="fi">
+ <!--+
+ | This stylesheet is designed to be included by 'forms-samples-styling.xsl'.
+ +-->
+ <xsl:template match="head" mode="forms-page">
+ <!--+ 'forms-page-styling.xsl' relies on 'forms-field-styling.xsl' for the
+ | inclusion of the correct JS and CSS files. To fix it, we have to
+ | separate the page specific parts into their own files.
+ +-->
+ </xsl:template>
+
+ <xsl:template match="body" mode="forms-page"/>
+
+ <!--
+ fi:group : default is to enclose items in a div
+ -->
+ <xsl:template match="fi:group">
+ <div title="{fi:hint}" class="forms-group">
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="group-layout" select="."/>
+ </div>
+ </xsl:template>
+
+ <!--
+ fi:group of type tabs
+ -->
+ <xsl:template match="fi:group[fi:styling/@type='tabs']">
+ <!-- find the currently selected tab.
+ Thoughts still needed here, such as autogenerating a field in the
+ forms transformer to hold this state.
+ -->
+ <xsl:variable name="active">
+ <xsl:variable name="value" select="normalize-space(fi:state/fi:*/fi:value)"/>
+ <xsl:choose>
+ <xsl:when test="$value">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- copy the "state-widget" attribute for use in for-each -->
+ <xsl:variable name="state-widget" select="fi:state/fi:*/@id"/>
+ <xsl:variable name="id" select="generate-id()"/>
+
+ <div id="{$id}" title="{fi:hint}" class="forms-group-tabs">
+ <!-- add an hidden input for the state -->
+ <xsl:if test="$state-widget">
+ <input type="hidden" name="{$state-widget}" value="{$active}"/>
+ </xsl:if>
+ <!-- div containing the tabs -->
+ <div class="forms-tabArea">
+ <xsl:for-each select="fi:items/fi:*">
+ <xsl:variable name="pos" select="position() - 1"/>
+ <span id="{$id}_tab_{$pos}" onclick="forms_showTab('{$id}', {$pos}, {last()}, '{$state-widget}')">
+ <xsl:attribute name="class">
+ <xsl:text>forms-tab</xsl:text>
+ <xsl:if test="$active = $pos"> forms-activeTab</xsl:if>
+ </xsl:attribute>
+ <xsl:copy-of select="fi:label/node()"/>
+ <xsl:if test="fi:items/*//fi:validation-message">
+ <span class="forms-validation-message"> ! </span>
+ </xsl:if>
+ </span>
+ </xsl:for-each>
+ </div>
+ <!-- a div for each of the items -->
+ <xsl:for-each select="fi:items/fi:*">
+ <xsl:variable name="pos" select="position() - 1"/>
+ <div class="forms-tabContent" id="{$id}_items_{$pos}">
+ <xsl:if test="$active != $pos">
+ <xsl:attribute name="style">display:none</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="."/>
+ </div>
+ </xsl:for-each>
+ </div>
+ <!-- The tabbed elements can have an attribute formsOnShow containing some javascript to be executed
+ when a tab gets shown. -->
+ <script type="text/javascript">
+ if (window.onTabShownHandlers == undefined)
+ window.onTabShownHandlers = new Object();
+ var currentHandlers = new Object();
+ var initialHandler = null;
+ window.onTabShownHandlers["<xsl:value-of select="$id"/>"] = currentHandlers;
+ <xsl:for-each select="fi:items/fi:*">
+ <xsl:variable name="pos" select="position() - 1"/>
+ <xsl:if test="@formsOnShow">
+ currentHandlers["<xsl:value-of select="concat($id, '_items_', $pos)"/>"] = "<xsl:value-of select="@formsOnShow"/>";
+ <xsl:if test="$active = $pos">
+ initialHandler = "<xsl:value-of select="@formsOnShow"/>";
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ if (initialHandler != null) {
+ eval(initialHandler);
+ initialHandler = null;
+ }
+ </script>
+ </xsl:template>
+
+ <!--
+ fi:group of type choice : a popup is used instead of tabs
+ -->
+ <xsl:template match="fi:group[fi:styling/@type='choice']">
+ <!-- find the currently selected tab.
+ Thoughts still needed here, such as autogenerating a field in the formstransformer
+ to hold this state.
+ -->
+ <xsl:variable name="active">
+ <xsl:variable name="value" select="normalize-space(fi:state/fi:*/fi:value)"/>
+ <xsl:choose>
+ <xsl:when test="$value">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- copy the "state-widget" attribute for use in for-each -->
+ <xsl:variable name="state-widget" select="fi:state/fi:*/@id"/>
+ <xsl:variable name="id" select="generate-id()"/>
+
+ <fieldset id="{$id}">
+ <legend title="{fi:hint}">
+ <xsl:apply-templates select="fi:label/node()"/>
+ <select name="{$state-widget}" onchange="forms_showTab('{$id}', this.selectedIndex, {count(fi:items/*)}, '{$state-widget}')">
+ <xsl:for-each select="fi:items/fi:*">
+ <xsl:variable name="pos" select="position() - 1"/>
+ <option>
+ <xsl:attribute name="value">
+ <xsl:choose>
+ <xsl:when test="fi:value">
+ <xsl:value-of select="fi:value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:if test="$active = $pos">
+ <xsl:attribute name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="fi:label/node()"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ <xsl:if test="fi:items/*//fi:validation-message">
+ <span class="forms-validation-message"> ! </span>
+ </xsl:if>
+ </legend>
+ <!-- a div for each of the items -->
+ <xsl:for-each select="fi:items/fi:*">
+ <xsl:variable name="pos" select="position() - 1"/>
+ <div id="{$id}_items_{$pos}" class="forms-item">
+ <xsl:if test="$active != $pos">
+ <xsl:attribute name="style">display:none</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="."/>
+ </div>
+ </xsl:for-each>
+ </fieldset>
+ </xsl:template>
+
+ <!--
+ fi:group of type fieldset : enclose items in a fieldset frame
+ -->
+ <xsl:template match="fi:group[fi:styling/@type='fieldset']">
+ <fieldset>
+ <xsl:apply-templates select="." mode="styling"/>
+ <legend title="{fi:hint}"><xsl:copy-of select="fi:label/node()"/></legend>
+ <xsl:apply-templates mode="group-layout" select="."/>
+ </fieldset>
+ </xsl:template>
+
+ <!--
+ Group items layout : default is no layout
+ -->
+ <xsl:template match="fi:group" mode="group-layout">
+ <xsl:apply-templates select="fi:items/*"/>
+ </xsl:template>
+
+ <!--
+ Column group items layout
+ -->
+ <xsl:template match="fi:group[fi:styling/@layout='column']" mode="group-layout">
+ <table border="0" summary="{fi:hint}">
+ <tbody>
+ <xsl:apply-templates select="fi:items/*" mode="group-column-content"/>
+ </tbody>
+ </table>
+ </xsl:template>
+
+ <!--
+ Default column layout : label above and input below
+ -->
+ <xsl:template match="fi:*" mode="group-column-content">
+ <tr>
+ <td><xsl:apply-templates select="." mode="label"/></td>
+ </tr>
+ <tr>
+ <td><xsl:apply-templates select="."/></td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="fi:action" mode="group-column-content">
+ <tr>
+ <td><xsl:apply-templates select="."/></td>
+ </tr>
+ </xsl:template>
+
+ <!--
+ Columns group items layout
+ -->
+ <xsl:template match="fi:group[fi:styling/@layout='columns']" mode="group-layout">
+ <table border="0" summary="{fi:hint}">
+ <tbody>
+ <xsl:apply-templates select="fi:items/*" mode="group-columns-content"/>
+ </tbody>
+ </table>
+ </xsl:template>
+
+ <!--
+ Default columns layout : label left and input right
+ -->
+ <xsl:template match="fi:*" mode="group-columns-content">
+ <tr valign="top">
+ <td><xsl:apply-templates select="." mode="label"/></td>
+ <td><xsl:apply-templates select="."/></td>
+ </tr>
+ </xsl:template>
+
+ <!--
+ Row group items layout
+ -->
+ <xsl:template match="fi:group[fi:styling/@layout='row']" mode="group-layout">
+ <table border="0" summary="{fi:hint}">
+ <tbody>
+ <tr>
+ <xsl:apply-templates select="fi:items/*" mode="group-row-content"/>
+ </tr>
+ </tbody>
+ </table>
+ </xsl:template>
+
+ <!--
+ Default row layout : label left and input right
+ -->
+ <xsl:template match="fi:*" mode="group-row-content">
+ <td><xsl:apply-templates select="." mode="label"/></td>
+ <td><xsl:apply-templates select="."/></td>
+ </xsl:template>
+
+ <xsl:template match="fi:action" mode="group-row-content">
+ <td><xsl:apply-templates select="."/></td>
+ </xsl:template>
+ <!--
+ Rows group items layout
+ -->
+ <xsl:template match="fi:group[fi:styling/@layout='rows']" mode="group-layout">
+ <table border="0" summary="{fi:hint}">
+ <tbody>
+ <tr>
+ <xsl:apply-templates select="fi:items/*" mode="group-rows-labels"/>
+ </tr>
+ <tr>
+ <xsl:apply-templates select="fi:items/*" mode="group-rows-content"/>
+ </tr>
+ </tbody>
+ </table>
+ </xsl:template>
+
+ <!--
+ Default rows layout : label above and input below
+ -->
+ <xsl:template match="fi:*" mode="group-rows-labels">
+ <td><xsl:apply-templates select="." mode="label"/></td>
+ </xsl:template>
+
+ <xsl:template match="fi:action" mode="group-rows-labels">
+ <td> </td>
+ </xsl:template>
+
+ <xsl:template match="fi:*" mode="group-rows-content">
+ <td><xsl:apply-templates select="."/></td>
+ </xsl:template>
+
+ <!-- boolean field : checkbox and label on a single line -->
+ <xsl:template match="fi:booleanfield" mode="group-columns-content">
+ <tr>
+ <td colspan="2">
+ <xsl:apply-templates select="."/>
+ <xsl:apply-templates select="." mode="label"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <!-- action : on a single line -->
+ <xsl:template match="fi:action" mode="group-columns-content">
+ <tr>
+ <td colspan="2"><xsl:apply-templates select="."/></td>
+ </tr>
+ </xsl:template>
+
+ <!-- any other element : on a single line -->
+ <xsl:template match="*" mode="group-columns-content">
+ <tr>
+ <td> </td><td><xsl:apply-templates select="."/></td>
+ </tr>
+ </xsl:template>
+
+ <!-- double-list multivaluefield : lists under the label -->
+ <xsl:template match="fi:multivaluefield[fi:styling/@list-type='double-listbox']"
+ mode="group-columns-content">
+ <tr>
+ <td colspan="2"><xsl:apply-templates select="." mode="label"/></td>
+ </tr>
+ <tr>
+ <td colspan="2"><xsl:apply-templates select="."/></td>
+ </tr>
+ </xsl:template>
+
+ <!-- nested group -->
+ <xsl:template match="fi:group" mode="group-columns-content">
+ <tr>
+ <td colspan="2"><xsl:apply-templates select="."/></td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="@*|node()" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-page-styling.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-samples-styling.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-samples-styling.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-samples-styling.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-samples-styling.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <!--+ Include styling stylesheets, one for the widgets, the other one for the
+ | page. As 'forms-advanced-field-styling.xsl' is a specialization of
+ | 'forms-field-styling.xsl' the latter one is imported there. If you don't
+ | want advanced styling of widgets, change it here!
+ | See xsl:include as composition and xsl:import as extension/inheritance.
+ +-->
+ <xsl:include href="forms-page-styling.xsl"/>
+ <xsl:include href="forms-advanced-field-styling.xsl"/>
+
+ <xsl:template match="head">
+ <head>
+ <xsl:apply-templates/>
+ <xsl:apply-templates select="." mode="forms-page"/>
+ <xsl:apply-templates select="." mode="forms-field"/>
+ </head>
+ </xsl:template>
+
+ <xsl:template match="body">
+ <body>
+ <!--+ !!! If template with mode 'forms-page' adds text or elements
+ | template with mode 'forms-field' can no longer add attributes!!!
+ +-->
+ <xsl:apply-templates select="." mode="forms-page"/>
+ <xsl:apply-templates select="." mode="forms-field"/>
+ <xsl:apply-templates/>
+ </body>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms-samples-styling.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms.css
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms.css?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms.css (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms.css Sun Jun 11 16:24:48 2006
@@ -0,0 +1,75 @@
+/*
+* Copyright 1999-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+.forms-tab {
+ background-color: white;
+ border: 1px solid black;
+ border-bottom-width: 0px;
+ padding: 2px 1em 2px 1em;
+ margin-right: 5px;
+ position: relative;
+ text-decoration: none;
+ top: -1px;
+ z-index: 1;
+ cursor: pointer;
+}
+
+.forms-tab.forms-activeTab {
+ font-weight: bold;
+ padding-top: 5px;
+ cursor: default;
+ z-index: 3;
+}
+
+.forms-tabContent {
+ background-color: white;
+ border: 1px solid black;
+ padding: 1em;
+ position: relative;
+ z-index: 2;
+}
+
+.forms-validation-message, a.forms-validation-message:link {
+ color: red;
+ font-weight: bold;
+}
+
+.forms-validation-errors {
+}
+
+.forms-validation-error {
+}
+
+.forms-field-required {
+ color:blue;
+ font-weight: bold;
+}
+
+.forms-help {
+ border-style: dotted;
+ border-width: 1px;
+ padding: 5px;
+ background-color:#FFFFC0; /* light yellow */
+ width: 200px; /* otherwise IE does a weird layout */
+ z-index:1000; /* must be higher than forms-tabContent */
+}
+
+.forms-doubleList select {
+ width: 150px;
+}
+
+.forms-doubleList input {
+ width: 40px;
+}
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/forms.css
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/help.gif
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/help.gif?rev=413547&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/help.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/htmlarea/.project
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/htmlarea/.project?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/htmlarea/.project (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/htmlarea/.project Sun Jun 11 16:24:48 2006
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>htmlarea</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/htmlarea/.project
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org