You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/06/17 15:28:01 UTC
cvs commit: jakarta-tapestry/src/documentation skinconf.xml
hlship 2005/06/17 06:28:01
Modified: framework/src/java/org/apache/tapestry/form Form.js
FormSupportImpl.java
framework/src/scripts TestWMLStaleSession.xml
TestSelectOption.xml TestListEdit.xml
TestWMLFormComponents.xml TestWMLComponents.xml
framework/src/test/org/apache/tapestry/form
TestFormSupport.java
src/documentation/resources/stylesheets votes2document.xsl
src/documentation skinconf.xml
Log:
Have the Form component render out a hidden field named "submitmode".
Update Form.js to set the submitmode when the form is submitted.
Revision Changes Path
1.5 +3 -3 jakarta-tapestry/framework/src/java/org/apache/tapestry/form/Form.js
Index: Form.js
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/form/Form.js,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Form.js 16 Jun 2005 20:57:10 -0000 1.4
+++ Form.js 17 Jun 2005 13:28:01 -0000 1.5
@@ -155,7 +155,7 @@
if (event.abort == false)
{
- // this.form.mode.value = "cancel";
+ this.form.submitmode.value = "cancel";
this.form.onsubmit = null;
this.form.submit();
}
@@ -190,7 +190,7 @@
if (event.abort)
return false;
- // this.form.mode.value = "submit";
+ this.form.submitmode.value = "submit";
return true;
}
@@ -226,7 +226,7 @@
if (event.abort)
return;
- // this.form.mode.value = "refresh";
+ this.form.submitmode.value = "refresh";
this.form.onsubmit = null;
this.form.submit();
}
1.8 +14 -1 jakarta-tapestry/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
Index: FormSupportImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FormSupportImpl.java 16 Jun 2005 18:27:11 -0000 1.7
+++ FormSupportImpl.java 17 Jun 2005 13:28:01 -0000 1.8
@@ -69,6 +69,13 @@
public static final String RESERVED_FORM_IDS = "reservedids";
+ /**
+ * Indicates why the form was submitted: whether for normal ("submit"), refresh, or because the
+ * form was canceled.
+ */
+
+ public static final String SUBMIT_MODE = "submitmode";
+
public static final String SCRIPT = "/org/apache/tapestry/form/Form.js";
private final static Set _standardReservedIds;
@@ -80,6 +87,7 @@
set.addAll(Arrays.asList(ServiceConstants.RESERVED_IDS));
set.add(FORM_IDS);
set.add(RESERVED_FORM_IDS);
+ set.add(SUBMIT_MODE);
_standardReservedIds = Collections.unmodifiableSet(set);
}
@@ -416,6 +424,11 @@
addHiddenFieldsForLinkParameters(link);
+ // Create a hidden field to store the submission mode, in case
+ // client-side JavaScript forces an update.
+
+ addHiddenValue(SUBMIT_MODE, null);
+
IMarkupWriter nested = _writer.getNestedWriter();
_form.renderBody(nested, _cycle);
@@ -531,7 +544,7 @@
if (HiveMind.isNonBlank(id))
writer.attribute("id", id);
- writer.attribute("value", value);
+ writer.attribute("value", value == null ? "" : value);
writer.println();
}
1.8 +2 -0 jakarta-tapestry/framework/src/scripts/TestWMLStaleSession.xml
Index: TestWMLStaleSession.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestWMLStaleSession.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestWMLStaleSession.xml 9 May 2005 20:43:03 -0000 1.7
+++ TestWMLStaleSession.xml 17 Jun 2005 13:28:01 -0000 1.8
@@ -63,6 +63,7 @@
<match>component</match>
<match>page</match>
<match>service</match>
+ <match>submitmode</match>
</assert-output-matches>
<assert-output-matches name="Go Parameter Values" subgroup="1">
@@ -73,6 +74,7 @@
<match>go</match>
<match>Stale</match>
<match>direct</match>
+ <match></match>
</assert-output-matches>
</request>
1.8 +3 -0 jakarta-tapestry/framework/src/scripts/TestSelectOption.xml
Index: TestSelectOption.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestSelectOption.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestSelectOption.xml 3 May 2005 17:41:27 -0000 1.7
+++ TestSelectOption.xml 17 Jun 2005 13:28:01 -0000 1.8
@@ -42,6 +42,7 @@
<match>name="component" value="$Form"</match>
<match>name="page" value="Home"</match>
<match>name="service" value="direct"</match>
+ <match>name="submitmode" value=""</match>
</assert-output-matches>
<assert-regexp name="Select Tag">
@@ -129,6 +130,7 @@
<match>name="component" value="$Form"</match>
<match>name="page" value="Two"</match>
<match>name="service" value="direct"</match>
+ <match>name="submitmode" value=""</match>
</assert-output-matches>
<assert-output name="Select Tag">
@@ -227,6 +229,7 @@
<match>name="page" value="Three"</match>
<match>name="service" value="direct"</match>
<match>name="session" value="T"</match>
+ <match>name="submitmode" value=""</match>
</assert-output-matches>
<assert-output name="Select Tag">
1.7 +3 -0 jakarta-tapestry/framework/src/scripts/TestListEdit.xml
Index: TestListEdit.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestListEdit.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestListEdit.xml 9 Jun 2005 18:33:44 -0000 1.6
+++ TestListEdit.xml 17 Jun 2005 13:28:01 -0000 1.7
@@ -38,6 +38,7 @@
<match>name="component" value="form"</match>
<match>name="page" value="ListEdit"</match>
<match>name="service" value="direct"</match>
+ <match>name="submitmode" value=""</match>
<match>name="e" value="SClothing"</match>
<match>name="e" value="SEye Color"</match>
<match>name="e" value="SFood"</match>
@@ -145,6 +146,7 @@
<match>name="component" value="$ListEditForm.$Form"</match>
<match>name="page" value="ListEditArray"</match>
<match>name="service" value="direct"</match>
+ <match>name="submitmode" value=""</match>
<match>name="e" value="SFred"</match>
<match>name="e" value="SDino"</match>
<match>name="e" value="SWilma"</match>
@@ -171,6 +173,7 @@
<match>name="component" value="$ListEditForm.$Form"</match>
<match>name="page" value="ListEditNull"</match>
<match>name="service" value="direct"</match>
+ <match>name="submitmode" value=""</match>
</assert-output-matches>
</request>
</mock-test>
\ No newline at end of file
1.9 +4 -0 jakarta-tapestry/framework/src/scripts/TestWMLFormComponents.xml
Index: TestWMLFormComponents.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestWMLFormComponents.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TestWMLFormComponents.xml 16 Jun 2005 09:00:43 -0000 1.8
+++ TestWMLFormComponents.xml 17 Jun 2005 13:28:01 -0000 1.9
@@ -82,6 +82,7 @@
<match>component</match>
<match>page</match>
<match>service</match>
+ <match>submitmode</match>
<match>u</match>
<match>formids</match>
@@ -90,6 +91,7 @@
<match>page</match>
<match>service</match>
<match>reservedids</match>
+ <match>submitmode</match>
<match>v</match>
</assert-output-matches>
@@ -101,6 +103,7 @@
<match>g</match>
<match>Rewind</match>
<match>direct</match>
+ <match></match>
<match>$(u)</match>
<match>v</match>
@@ -109,6 +112,7 @@
<match>Rewind</match>
<match>action</match>
<match>action</match>
+ <match></match>
<match>$(v)</match>
</assert-output-matches>
1.8 +3 -1 jakarta-tapestry/framework/src/scripts/TestWMLComponents.xml
Index: TestWMLComponents.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestWMLComponents.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestWMLComponents.xml 9 May 2005 20:43:03 -0000 1.7
+++ TestWMLComponents.xml 17 Jun 2005 13:28:01 -0000 1.8
@@ -114,7 +114,8 @@
<match>component</match>
<match>page</match>
<match>service</match>
- <match>reservedids</match>
+ <match>reservedids</match>
+ <match>submitmode</match>
<match>u</match>
<match>l</match>
</assert-output-matches>
@@ -129,6 +130,7 @@
<match>Home</match>
<match>action</match>
<match>action</match>
+ <match></match>
<match>$(username)</match>
<match>$(l)</match>
</assert-output-matches>
1.8 +16 -7 jakarta-tapestry/framework/src/test/org/apache/tapestry/form/TestFormSupport.java
Index: TestFormSupport.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/form/TestFormSupport.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestFormSupport.java 16 Jun 2005 18:27:11 -0000 1.7
+++ TestFormSupport.java 17 Jun 2005 13:28:01 -0000 1.8
@@ -189,6 +189,7 @@
trainHidden(writer, "formids", "barney,wilma,barney$0");
trainHidden(writer, "service", "fred");
+ trainHidden(writer, "submitmode", "");
nested.close();
@@ -333,7 +334,8 @@
trainHidden(writer, "formids", "");
trainHidden(writer, "service", "fred");
-
+ trainHidden(writer, "submitmode", "");
+
nested.close();
writer.end();
@@ -431,7 +433,8 @@
trainHidden(writer, "formids", "");
trainHidden(writer, "service", "fred");
-
+ trainHidden(writer, "submitmode", "");
+
nested.close();
writer.end();
@@ -525,6 +528,7 @@
trainHidden(writer, "formids", "");
trainHidden(writer, "service", "fred");
+ trainHidden(writer, "submitmode", "");
trainHidden(writer, "hidden1", "value1");
trainHidden(writer, "hidden2", "id2", "value2");
@@ -704,7 +708,8 @@
trainHidden(writer, "formids", "action$0");
trainHidden(writer, "action", "fred");
trainHidden(writer, "reservedids", "action");
-
+ trainHidden(writer, "submitmode", "");
+
nested.close();
writer.end();
@@ -798,7 +803,8 @@
trainHidden(writer, "formids", "");
trainHidden(writer, "service", "fred");
-
+ trainHidden(writer, "submitmode", "");
+
nested.close();
writer.end();
@@ -1139,7 +1145,8 @@
trainHidden(writer, "formids", "barney");
trainHidden(writer, "service", "fred");
-
+ trainHidden(writer, "submitmode", "");
+
nested.close();
writer.end();
@@ -1244,7 +1251,8 @@
trainHidden(writer, "formids", "");
trainHidden(writer, "service", "fred");
-
+ trainHidden(writer, "submitmode", "");
+
// EasyMock can't fully verify that this gets called at the right moment, nor can we truly
// prove (well, except by looking at the code), that the deferred runnables execute at the
// right time.
@@ -1448,7 +1456,8 @@
trainHidden(writer, "formids", "");
trainHidden(writer, "service", "fred");
-
+ trainHidden(writer, "submitmode", "");
+
nested.close();
writer.end();
1.2 +7 -7 jakarta-tapestry/src/documentation/resources/stylesheets/votes2document.xsl
Index: votes2document.xsl
===================================================================
RCS file: /home/cvs/jakarta-tapestry/src/documentation/resources/stylesheets/votes2document.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- votes2document.xsl 7 Jun 2005 21:26:54 -0000 1.1
+++ votes2document.xsl 17 Jun 2005 13:28:01 -0000 1.2
@@ -34,16 +34,16 @@
</document>
</xsl:template>
<xsl:template match="vote">
- <tr>
- <td>
+ <tr class="section">
+ <th>
<xsl:value-of select="@date"/>
- </td>
- <td>
+ </th>
+ <th>
<xsl:value-of select="@title"/>
- </td>
- <td>
+ </th>
+ <th>
<xsl:value-of select="@dev"/>
- </td>
+ </th>
</tr>
<tr>
<td/>
1.6 +9 -0 jakarta-tapestry/src/documentation/skinconf.xml
Index: skinconf.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/src/documentation/skinconf.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- skinconf.xml 14 Mar 2005 18:37:13 -0000 1.5
+++ skinconf.xml 17 Jun 2005 13:28:01 -0000 1.6
@@ -151,6 +151,15 @@
padding: 2px;
background-color: #ffffcc;
}
+
+ TR.section TH
+ {
+ color: black;
+ background-color: white;
+ text-align: left;
+ font-weight: bold;
+ white-space: nowrap;
+ }
</extra-css>
<colors>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org