You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2003/10/15 15:08:47 UTC
cvs commit: cocoon-2.1/src/blocks/woody/samples/resources woody-field-styling.xsl
joerg 2003/10/15 06:08:47
Modified: src/blocks/woody/samples/forms form1_template_flow.xml
form1_template_action.xml
src/blocks/woody/samples/resources woody-field-styling.xsl
Log:
my first woody commit: added listbox style type to multivaluefield
Revision Changes Path
1.7 +3 -1 cocoon-2.1/src/blocks/woody/samples/forms/form1_template_flow.xml
Index: form1_template_flow.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form1_template_flow.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- form1_template_flow.xml 25 Sep 2003 17:37:30 -0000 1.6
+++ form1_template_flow.xml 15 Oct 2003 13:08:47 -0000 1.7
@@ -50,7 +50,9 @@
<wi:label>Boolean fields</wi:label>
<wi:items>
<wt:widget id="somebool"/>
- <wt:widget id="drinks"/>
+ <wt:widget id="drinks">
+ <wi:styling list-type="listbox" listbox-size="4"/>
+ </wt:widget>
</wi:items>
</wi:group>
</wi:items>
1.7 +3 -1 cocoon-2.1/src/blocks/woody/samples/forms/form1_template_action.xml
Index: form1_template_action.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form1_template_action.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- form1_template_action.xml 24 Sep 2003 20:47:07 -0000 1.6
+++ form1_template_action.xml 15 Oct 2003 13:08:47 -0000 1.7
@@ -51,7 +51,9 @@
<wi:label>Boolean fields</wi:label>
<wi:items>
<wt:widget id="somebool"/>
- <wt:widget id="drinks"/>
+ <wt:widget id="drinks">
+ <wi:styling list-type="checkbox"/>
+ </wt:widget>
</wi:items>
</wi:group>
</wi:items>
1.3 +42 -15 cocoon-2.1/src/blocks/woody/samples/resources/woody-field-styling.xsl
Index: woody-field-styling.xsl
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-field-styling.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- woody-field-styling.xsl 25 Sep 2003 17:37:30 -0000 1.2
+++ woody-field-styling.xsl 15 Oct 2003 13:08:47 -0000 1.3
@@ -231,26 +231,53 @@
</xsl:template>
<!--
- wi:mutivaluefield : produce a list of checkboxes
- TODO : add other representations existing for selection-lists.
+ wi:multivaluefield : produce a list of checkboxes or a multiple selection-lists
-->
<xsl:template match="wi:multivaluefield">
<xsl:variable name="id" select="@id"/>
<xsl:variable name="values" select="wi:values/wi:value/text()"/>
+ <xsl:variable name="liststyle" select="wi:styling/@list-type"/>
+
<span title="{wi:help}">
- <xsl:for-each select="wi:selection-list/wi:item">
- <xsl:variable name="value" select="@value"/>
- <input type="checkbox" value="{@value}" name="{$id}">
- <xsl:if test="wi:styling/@submit-on-change='true'">
- <xsl:attribute name="onchange">woody_submitForm(this)</xsl:attribute>
- </xsl:if>
- <xsl:if test="$values[.=$value]">
- <xsl:attribute name="checked">true</xsl:attribute>
- </xsl:if>
- </input>
- <xsl:copy-of select="wi:label/node()"/>
- <br/>
- </xsl:for-each>
+ <xsl:choose>
+ <!-- checkbox -->
+ <xsl:when test="$liststyle = 'checkbox'">
+ <xsl:for-each select="wi:selection-list/wi:item">
+ <xsl:variable name="value" select="@value"/>
+ <input type="checkbox" value="{@value}" name="{$id}">
+ <xsl:if test="$values[. = $value]">
+ <xsl:attribute name="checked">true</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:copy-of select="wi:label/node()"/>
+ <br/>
+ </xsl:for-each>
+ </xsl:when>
+ <!-- listbox -->
+ <xsl:otherwise>
+ <select name="{$id}" multiple="multiple">
+ <xsl:attribute name="size">
+ <xsl:choose>
+ <xsl:when test="wi:styling/@listbox-size">
+ <xsl:value-of select="wi:styling/@listbox-size"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>5</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:for-each select="wi:selection-list/wi: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="wi:label/node()"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </xsl:otherwise>
+ </xsl:choose>
</span>
<xsl:call-template name="woody-field-common"/>
</xsl:template>