[Xsltforms-support] [PATCH] @ev:phase attribute on xf:actions
Brought to you by:
alain-couthures
From: Kostis A. <ank...@gm...> - 2010-04-13 14:18:09
|
Hi, I've added the capability to define @ev:phase attributes on xf:actions. This patch also include a check of miss-typed phase tokens. Against rev385 (maintained tabs and indentation on sources) (unfortunately i could not build it, since make my apache's rewritting rules might to work) Regards, Kostis PS: 1) Is this mailling-list the right place to submit patches? 2) Should my patches also include the changes on the final xsltforms.{js,xsl} files? file: evPhaseAttr.diff ------------------------------- Index: src/js/xmlevtmngt/Listener.js.xml =================================================================== --- src/js/xmlevtmngt/Listener.js.xml (revision 383) +++ src/js/xmlevtmngt/Listener.js.xml (working copy) @@ -31,6 +31,12 @@ <![CDATA[ function Listener(observer, name, phase, handler) { phase = phase || "default"; + if (phase != "default" && phase != "capture") { + xforms.error(xforms.defaultModel, "xforms-compute-exception", + "Unknown event-phase(" + phase +") for event(" + + name + ")"+(observer? " on element(" + observer.id + ")":"") + "!"); + return; + } this.observer = observer; this.name = name; this.evtName = document.addEventListener? name : "errorupdate"; Index: src/xslt/script/named-templates/listeners.xsl.xml =================================================================== --- src/xslt/script/named-templates/listeners.xsl.xml (revision 383) +++ src/xslt/script/named-templates/listeners.xsl.xml (working copy) @@ -47,7 +47,12 @@ </xsl:choose> <xsl:text>"),</xsl:text> <xsl:call-template name="toScriptParam"><xsl:with-param name="p" select="@ev:event"/></xsl:call-template> - <xsl:text>,null,function(evt) {run(xf_</xsl:text> + <xsl:text>,</xsl:text> + <xsl:choose> + <xsl:when test="@ev:phase">'<xsl:value-of select="@ev:phase"/>'</xsl:when> + <xsl:otherwise>null</xsl:otherwise> + </xsl:choose> + <xsl:text>,function(evt) {run(xf_</xsl:text> <xsl:variable name="lname2" select="local-name()"/> <xsl:variable name="nsuri" select="namespace-uri()"/> <xsl:value-of select="$lname2"/> |