sylvain 2003/08/16 13:41:04
Modified: src/blocks/woody/java/org/apache/cocoon/woody/transformation
WidgetReplacingPipe.java
src/blocks/woody/samples/xsl/html woody-default.xsl
Log:
New "continuation-id" template element, rendered as a hidden field.
Allows call-function on GET / continue on POST for a single URL
Revision Changes Path
1.8 +17 -2
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/transformation/WidgetReplacingPipe.java
Index: WidgetReplacingPipe.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/transformation/WidgetReplacingPipe.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WidgetReplacingPipe.java 28 Jul 2003 15:57:16 -0000 1.7
+++ WidgetReplacingPipe.java 16 Aug 2003 20:41:04 -0000 1.8
@@ -215,6 +215,21 @@
String[] namesToTranslate = {"action"};
Attributes transAtts = translateAttributes(attributes,
namesToTranslate);
contentHandler.startElement(Constants.WI_NS , FORM_TEMPLATE_EL,
Constants.WI_PREFIX_COLON + FORM_TEMPLATE_EL, transAtts);
+
+ } else if (localName.equals("continuation-id")){
+ // Insert the continuation id
+ // FIXME(SW) we could avoid costly JXPath evaluation if we had the
objectmodel here.
+ Object idObj =
pipeContext.getJXPathContext().getValue("$continuation/id");
+ if (idObj == null) {
+ throw new SAXException("No continuation found");
+ }
+
+ String id = idObj.toString();
+ contentHandler.startPrefixMapping(Constants.WI_PREFIX,
Constants.WI_NS);
+ contentHandler.startElement(Constants.WI_NS, "continuation-id",
Constants.WI_PREFIX_COLON + "continuation-id", attributes);
+ contentHandler.characters(id.toCharArray(), 0, id.length());
+ contentHandler.endElement(Constants.WI_NS, "continuation-id",
Constants.WI_PREFIX_COLON + "continuation-id");
+ contentHandler.endPrefixMapping(Constants.WI_PREFIX);
} else {
throw new SAXException("Unsupported WoodyTemplateTransformer
element: " + localName);
}
@@ -346,8 +361,8 @@
contextWidget = null;
contentHandler.endElement(Constants.WI_NS, FORM_TEMPLATE_EL,
Constants.WI_PREFIX_COLON + FORM_TEMPLATE_EL);
contentHandler.endPrefixMapping(Constants.WI_PREFIX);
- } else {
- super.endElement(namespaceURI, localName, qName);
+ } else if (namespaceURI.equals(Constants.WT_NS) &&
localName.equals("continuation-id")) {
+ // nothing
}
elementNestingCounter--;
}
1.8 +11 -0 cocoon-2.1/src/blocks/woody/samples/xsl/html/woody-default.xsl
Index: woody-default.xsl
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/xsl/html/woody-default.xsl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- woody-default.xsl 12 Aug 2003 12:57:18 -0000 1.7
+++ woody-default.xsl 16 Aug 2003 20:41:04 -0000 1.8
@@ -102,6 +102,17 @@
</input>
</xsl:template>
+ <xsl:template match="wi:continuation-id">
+ <xsl:choose>
+ <xsl:when test="@name">
+ <input name="[EMAIL PROTECTED]" type="hidden" value="{.}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input name="continuation-id" type="hidden" value="{.}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<xsl:template match="wi:multivaluefield">
<xsl:if test="wi:validation-message">
<xsl:call-template name="validation-message">