You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ho...@apache.org on 2006/02/02 06:03:33 UTC
svn commit: r374252 - in
/geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard:
confirmURL.jsp edit.jsp
Author: hogstrom
Date: Wed Feb 1 21:03:31 2006
New Revision: 374252
URL: http://svn.apache.org/viewcvs?rev=374252&view=rev
Log:
Geronimo-1336 Corrected issue when specifying database pool sizes
Modified:
geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp
geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp
Modified: geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp?rev=374252&r1=374251&r2=374252&view=diff
==============================================================================
--- geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp (original)
+++ geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/confirmURL.jsp Wed Feb 1 21:03:31 2006
@@ -4,6 +4,53 @@
<p><b>Create Database Pool</b> -- Step 3: Final Pool Configuration</p>
+<script language="JavaScript">
+function <portlet:namespace/>validate() {
+
+ if (document.<portlet:namespace/>DatabaseForm.minSize.value == "") {
+ document.<portlet:namespace/>DatabaseForm.minSize.value = 0;
+ }
+ if (document.<portlet:namespace/>DatabaseForm.maxSize.value == "") {
+ document.<portlet:namespace/>DatabaseForm.maxSize.value = 10;
+ }
+
+ var min = parseInt(document.<portlet:namespace/>DatabaseForm.minSize.value);
+ var max = parseInt(document.<portlet:namespace/>DatabaseForm.maxSize.value);
+ result = true;
+
+ if (isNaN(min)) {
+ alert("Min pool size must be a number. Defaulted to 0");
+ min = document.<portlet:namespace/>DatabaseForm.minSize.value = 0;
+ result = false;
+ }
+ if (min < 0)
+ {
+ alert("Min pool size must be non-negative. Defaulted to 0");
+ min = document.<portlet:namespace/>DatabaseForm.minSize.value = 0;
+ result = false;
+ }
+
+ if (isNaN(max)) {
+ alert("Max pool size must be a number. Defaulted to 10");
+ max = document.<portlet:namespace/>DatabaseForm.maxSize.value = 10;
+ result = false;
+ }
+ if (max <= 0)
+ {
+ alert("Max pool size must be greater than zero. Defaulted to 10" );
+ max = document.<portlet:namespace/>DatabaseForm.maxSize.value = 10;
+ result = false;
+ }
+
+ if (min > max) {
+ alert("Max pool size must be greater than Min pool size." );
+ return false;
+ }
+
+ return result;
+}
+</script>
+
<!-- FORM TO COLLECT DATA FOR THIS PAGE -->
<form name="<portlet:namespace/>DatabaseForm" action="<portlet:actionURL/>" method="POST">
<input type="hidden" name="mode" value="process-url" />
@@ -84,9 +131,10 @@
<!-- SUBMIT BUTTON -->
<tr>
<td></td>
- <td><input type="submit" value="Test Connection" />
- <input type="button" value="Skip Test and Deploy" onclick="document.<portlet:namespace/>DatabaseForm.test.value='false';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
- <input type="button" value="Skip Test and Show Plan" onclick="document.<portlet:namespace/>DatabaseForm.mode.value='plan';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
+ <td>
+ <input type="button" value="Test Connection" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.test.value='true';document.<portlet:namespace/>DatabaseForm.submit();}" />
+ <input type="button" value="Skip Test and Deploy" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.test.value='false';document.<portlet:namespace/>DatabaseForm.submit();return false;}" />
+ <input type="button" value="Skip Test and Show Plan" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.mode.value='plan';document.<portlet:namespace/>DatabaseForm.submit();return false;}" />
</td>
</tr>
</table>
Modified: geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp?rev=374252&r1=374251&r2=374252&view=diff
==============================================================================
--- geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp (original)
+++ geronimo/branches/1.0/applications/console-standard/src/webapp/WEB-INF/view/dbwizard/edit.jsp Wed Feb 1 21:03:31 2006
@@ -5,6 +5,53 @@
<p>This page edits a new or existing database pool.</p>
+<script language="JavaScript">
+function <portlet:namespace/>validate() {
+
+ if (document.<portlet:namespace/>DatabaseForm.minSize.value == "") {
+ document.<portlet:namespace/>DatabaseForm.minSize.value = 0;
+ }
+ if (document.<portlet:namespace/>DatabaseForm.maxSize.value == "") {
+ document.<portlet:namespace/>DatabaseForm.maxSize.value = 10;
+ }
+
+ var min = parseInt(document.<portlet:namespace/>DatabaseForm.minSize.value);
+ var max = parseInt(document.<portlet:namespace/>DatabaseForm.maxSize.value);
+ result = true;
+
+ if (isNaN(min)) {
+ alert("Min pool size must be a number. Defaulted to 0");
+ min = document.<portlet:namespace/>DatabaseForm.minSize.value = 0;
+ result = false;
+ }
+ if (min < 0)
+ {
+ alert("Min pool size must be non-negative. Defaulted to 0");
+ min = document.<portlet:namespace/>DatabaseForm.minSize.value = 0;
+ result = false;
+ }
+
+ if (isNaN(max)) {
+ alert("Max pool size must be a number. Defaulted to 10");
+ max = document.<portlet:namespace/>DatabaseForm.maxSize.value = 10;
+ result = false;
+ }
+ if (max <= 0)
+ {
+ alert("Max pool size must be greater than zero. Defaulted to 10" );
+ max = document.<portlet:namespace/>DatabaseForm.maxSize.value = 10;
+ result = false;
+ }
+
+ if (min > max) {
+ alert("Max pool size must be greater than Min pool size." );
+ return false;
+ }
+
+ return result;
+}
+</script>
+
<!-- FORM TO COLLECT DATA FOR THIS PAGE -->
<form name="<portlet:namespace/>DatabaseForm" action="<portlet:actionURL/>" method="POST">
<input type="hidden" name="mode" value="process-url" />
@@ -208,23 +255,23 @@
<c:when test="${pool.generic}">
<c:choose> <%-- Can't test after deployment because we don't know what JAR to put on the ClassPath, can't show plan becasue we can't update a plan --%>
<c:when test="${empty pool.objectName}">
- <input type="submit" value="Test Connection" />
- <input type="button" value="Skip Test and Deploy" onclick="document.<portlet:namespace/>DatabaseForm.test.value='false';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
- <input type="button" value="Skip Test and Show Plan" onclick="document.<portlet:namespace/>DatabaseForm.mode.value='plan';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
+ <input type="button" value="Test Connection" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.test.value='true';document.<portlet:namespace/>DatabaseForm.submit();}" />
+ <input type="button" value="Skip Test and Deploy" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.test.value='false';document.<portlet:namespace/>DatabaseForm.submit();return false;}" />
+ <input type="button" value="Skip Test and Show Plan" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.mode.value='plan';document.<portlet:namespace/>DatabaseForm.submit();return false;}" />
</c:when>
<c:otherwise>
- <input type="button" value="Save" onclick="document.<portlet:namespace/>DatabaseForm.mode.value='save';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
+ <input type="button" value="Save" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.mode.value='save';document.<portlet:namespace/>DatabaseForm.submit();return false;}" />
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise> <%-- Not a generic JDBC pool --%>
<c:choose>
<c:when test="${empty pool.objectName}"> <%-- If it's new we can preview the plan or save/deploy --%>
- <input type="button" value="Deploy" onclick="document.<portlet:namespace/>DatabaseForm.mode.value='save';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
- <input type="button" value="Show Plan" onclick="document.<portlet:namespace/>DatabaseForm.mode.value='plan';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
+ <input type="button" value="Deploy" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.mode.value='save';document.<portlet:namespace/>DatabaseForm.submit();return false;}" />
+ <input type="button" value="Show Plan" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.mode.value='plan';document.<portlet:namespace/>DatabaseForm.submit();return false;}" />
</c:when>
<c:otherwise> <%-- If it's existing we can only save --%>
- <input type="button" value="Save" onclick="document.<portlet:namespace/>DatabaseForm.mode.value='save';document.<portlet:namespace/>DatabaseForm.submit();return false;" />
+ <input type="button" value="Save" onclick="if (<portlet:namespace/>validate()){document.<portlet:namespace/>DatabaseForm.mode.value='save';document.<portlet:namespace/>DatabaseForm.submit();return false;}" />
</c:otherwise>
</c:choose>
</c:otherwise>