joerg 2004/02/18 13:11:44
Modified: src/blocks/woody/samples/resources woody-page-styling.xsl
woody-field-styling.xsl
woody-advanced-field-styling.xsl
Added: src/blocks/woody/samples/resources
woody-htmlarea-styling.xsl
Log:
further separation of advanced and 'normal' styles: when using only normal
field styling, no additional JS or CSS is loaded anymore (only Woody stuff)
Revision Changes Path
1.20 +4 -4
cocoon-2.1/src/blocks/woody/samples/resources/woody-page-styling.xsl
Index: woody-page-styling.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-page-styling.xsl,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- woody-page-styling.xsl 26 Jan 2004 17:33:57 -0000 1.19
+++ woody-page-styling.xsl 18 Feb 2004 21:11:44 -0000 1.20
@@ -19,7 +19,7 @@
wi:group : default is to enclose items in a div
-->
<xsl:template match="wi:group">
- <div title="{wi:help}">
+ <div title="{wi:hint}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="group-layout" select="."/>
</div>
@@ -46,7 +46,7 @@
<xsl:variable name="state-widget" select="wi:state/wi:*/@id"/>
<xsl:variable name="id" select="generate-id()"/>
- <div id="{$id}">
+ <div id="{$id}" title="{wi:hint}">
<!-- add an hidden input for the state -->
<xsl:if test="$state-widget">
<input type="hidden" name="{$state-widget}" value="{$active}"/>
@@ -102,7 +102,7 @@
<xsl:variable name="id" select="generate-id()"/>
<fieldset id="{$id}">
- <legend>
+ <legend title="{wi:hint}">
<xsl:apply-templates select="wi:label/node()"/>
<select name="{$state-widget}" onchange="woody_showTab('{$id}',
this.selectedIndex, {count(wi:items/*)}, '{$state-widget}')">
<xsl:for-each select="wi:items/wi:*">
@@ -147,7 +147,7 @@
-->
<xsl:template match="wi:group[wi:styling/@type='fieldset']">
<fieldset>
- <xsl:copy-of select="wi:styling/@*[name() != 'type' and name() !=
'layout']"/>
+ <xsl:apply-templates select="." mode="styling"/>
<legend title="{wi:hint}"><xsl:copy-of
select="wi:label/node()"/></legend>
<xsl:apply-templates mode="group-layout" select="."/>
</fieldset>
1.42 +7 -39
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.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- woody-field-styling.xsl 7 Feb 2004 10:15:23 -0000 1.41
+++ woody-field-styling.xsl 18 Feb 2004 21:11:44 -0000 1.42
@@ -12,14 +12,7 @@
<xsl:param name="resources-uri">resources</xsl:param>
<xsl:template match="head" mode="woody-field">
- <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}/woody-lib.js" type="text/javascript"/>
- <script type="text/javascript">
- _editor_url = "<xsl:value-of select="concat($resources-uri,
'/htmlarea/')"/>";
- _editor_lang = "en";
- </script>
- <script type="text/javascript"
src="{$resources-uri}/htmlarea/htmlarea.js"></script>
<link rel="stylesheet" type="text/css"
href="{$resources-uri}/woody.css"/>
</xsl:template>
@@ -52,7 +45,8 @@
<!--+
| Handling the common styling. You may only add attributes to the
output
- | as following handling (e.g. checked/unchecked) might add attributes
too.
+ | in this template as later processing might add attributes too, for
+ | example @checked or @selected
+-->
<xsl:template match="wi:*" mode="styling">
<xsl:apply-templates select="wi:styling/@*" mode="styling"/>
@@ -60,8 +54,6 @@
<!--+
| @listbox-size needs to be handled separately as even if it is not
| specified some output (@size) must be generated.
- | Separating this out into this common styling looks a bit like
- | over-separation, doesn't it?
+-->
<xsl:if test="self::wi:field[wi:selection-list][wi:styling/@list-type =
'listbox'] or
self::wi:multivaluefield[not(wi:styling/@list-type =
'checkbox')]">
@@ -86,7 +78,7 @@
</xsl:template>
<xsl:template match="wi:styling/@list-type | wi:styling/@list-orientation |
- wi:styling/@listbox-size | wi:styling/@format"
+ wi:styling/@listbox-size | wi:styling/@format |
wi:styling/@layout"
mode="styling">
<!--+
| Ignore marker attributes so they don't go into the resuling HTML.
@@ -103,25 +95,14 @@
select="'text hidden textarea checkbox radio password
image reset submit'"/>
<xsl:if test="normalize-space(.) and
contains(concat(' ', $validHTMLTypes, ' '), concat(' ', .,
' '))">
- <xsl:copy-of select="."/>
+ <xsl:copy-of select="."/>
</xsl:if>
</xsl:template>
- <!--+
- |
- +-->
- <xsl:template match="wi:help">
- <div class="woody-help" id="help{generate-id()}"
style="visibility:hidden; position:absolute;">
- <xsl:apply-templates select="node()"/>
- </div>
- <script type="text/javascript">
- var helpWin<xsl:value-of select="generate-id()"/> =
woody_createPopupWindow('help<xsl:value-of select="generate-id()"/>');
- </script>
- <a id="{generate-id()}" href="#"
onclick="helpWin{generate-id()}.showPopup('{generate-id()}');return
false;"><img border="0" src="resources/help.gif"/></a>
- </xsl:template>
+ <xsl:template match="wi:help"/>
<!--+
- |
+ |
+-->
<xsl:template match="wi:validation-message">
<a href="#" class="woody-validation-message"
onclick="alert('{normalize-space(.)}');return false;"> ! </a>
@@ -238,19 +219,6 @@
<xsl:copy-of select="translate(wi:value/node(), ' ', '')"/>
</textarea>
<xsl:apply-templates select="." mode="common"/>
- </xsl:template>
-
- <!--
- wi:field with @type 'htmlarea'
- -->
- <xsl:template match="wi:field[wi:[EMAIL PROTECTED]'htmlarea']]">
- <textarea id="[EMAIL PROTECTED]" name="[EMAIL PROTECTED]"
title="{wi: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(wi:value/node(), ' ', '')"/>
- </textarea>
- <xsl:apply-templates select="." mode="common"/>
- <script language="JavaScript">HTMLArea.replace('<xsl:value-of
select="@id"/>');</script>
</xsl:template>
<!--+
1.7 +21 -2
cocoon-2.1/src/blocks/woody/samples/resources/woody-advanced-field-styling.xsl
Index: woody-advanced-field-styling.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-advanced-field-styling.xsl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- woody-advanced-field-styling.xsl 26 Jan 2004 17:33:57 -0000 1.6
+++ woody-advanced-field-styling.xsl 18 Feb 2004 21:11:44 -0000 1.7
@@ -6,25 +6,30 @@
<!--+
| This stylesheet is designed to be included by
'woody-samples-styling.xsl'.
| It extends the 'woody-field-styling.xsl' with additional stylings.
- | The calendar can also be seen as advanced field styling, it's only
- | separated out of this file because of its much specific stuff.
+ | 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="woody-field-styling.xsl"/>
<xsl:include href="woody-calendar-styling.xsl"/>
+ <xsl:include href="woody-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="woody-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="woody-calendar"/>
+ <xsl:apply-templates select="." mode="woody-htmlarea"/>
</xsl:template>
<xsl:template match="body" mode="woody-field">
<xsl:apply-imports/>
<xsl:apply-templates select="." mode="woody-calendar"/>
+ <xsl:apply-templates select="." mode="woody-htmlarea"/>
</xsl:template>
<!--+ This template should not be necessary as this stylesheet "inherits"
@@ -35,6 +40,20 @@
+-->
<xsl:template match="*">
<xsl:apply-imports/>
+ </xsl:template>
+
+ <!--+
+ |
+ +-->
+ <xsl:template match="wi:help">
+ <xsl:variable name="id" select="generate-id()"/>
+ <div class="woody-help" id="help{$id}" style="visibility:hidden;
position:absolute;">
+ <xsl:apply-templates select="node()"/>
+ </div>
+ <script type="text/javascript">
+ var helpWin<xsl:value-of select="$id"/> =
woody_createPopupWindow('help<xsl:value-of select="$id"/>');
+ </script>
+ <a id="{$id}" href="#" onclick="helpWin{$id}.showPopup('{$id}');return
false;"><img border="0" src="resources/help.gif"/></a>
</xsl:template>
<!--+
1.1
cocoon-2.1/src/blocks/woody/samples/resources/woody-htmlarea-styling.xsl
Index: woody-htmlarea-styling.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"
exclude-result-prefixes="wi">
<!--+
| This stylesheet is designed to be included by
'woody-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="woody-htmlarea">
<script type="text/javascript">
_editor_url = "<xsl:value-of select="concat($resources-uri,
'/htmlarea/')"/>";
_editor_lang = "en";
</script>
<script type="text/javascript"
src="{$resources-uri}/htmlarea/htmlarea.js"></script>
</xsl:template>
<xsl:template match="body" mode="woody-htmlarea"/>
<!--+
| wi:field with @type 'htmlarea'
+-->
<xsl:template match="wi:field[wi:[EMAIL PROTECTED]'htmlarea']]">
<textarea id="[EMAIL PROTECTED]" name="[EMAIL PROTECTED]"
title="{wi: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="wi:value/node()" mode="htmlarea-copy"/>
</textarea>
<xsl:apply-templates select="." mode="common"/>
<script language="JavaScript">HTMLArea.replace('<xsl:value-of
select="@id"/>');</script>
</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>