You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/10/10 00:14:19 UTC
svn commit: r312504 [1/2] - in /beehive/trunk/netui:
src/tags-html/org/apache/beehive/netui/tags/
src/tags-html/org/apache/beehive/netui/tags/html/
src/tags-html/org/apache/beehive/netui/tags/javascript/
test/webapps/drt/coreWeb/tags/popupFormBean/ tes...
Author: rich
Date: Sun Oct 9 15:13:50 2005
New Revision: 312504
URL: http://svn.apache.org/viewcvs?rev=312504&view=rev
Log:
This is a contribution from Carlin Rogers (our newest committer, who's waiting for commit rights :) ) to address http://issues.apache.org/jira/browse/BEEHIVE-863 : Passing a FormBean to a popup
tests: bvt in netui (WinXP)
BB: same (linux)
Added:
beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/
beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/Controller.jpf (with props)
beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/
beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/GetModel.jpf (with props)
beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/index.jsp (with props)
beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/index.jsp (with props)
beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/results.jsp (with props)
beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PopupPassForm.xml (with props)
Modified:
beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java
beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ConfigurePopup.java
beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/PopupSupport.java
beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/CoreScriptFeature.java
beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java
beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties
beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DisableSecondClick.xml
beehive/trunk/netui/test/webapps/drt/testRecorder/tests/MockPortalPopupWindows.xml
beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PopupAttribute.xml
beehive/trunk/netui/test/webapps/drt/testRecorder/tests/UpdateFormFromNestedPopup.xml
Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java Sun Oct 9 15:13:50 2005
@@ -27,6 +27,7 @@
import org.apache.beehive.netui.tags.naming.FormDataNameInterceptor;
import org.apache.beehive.netui.tags.naming.INameInterceptor;
import org.apache.beehive.netui.tags.naming.IndexedNameInterceptor;
+import org.apache.beehive.netui.tags.html.Form;
import org.apache.beehive.netui.util.Bundle;
import org.apache.beehive.netui.util.logging.Logger;
import org.apache.beehive.netui.pageflow.internal.InternalUtils;
@@ -465,5 +466,19 @@
int ret = i.intValue();
req.setAttribute(NETUI_UNIQUE_CNT, new Integer(ret + 1));
return ret;
+ }
+
+ /**
+ * Returns the closest parent form tag, or null if there is none.
+ */
+ protected Form getNearestForm()
+ {
+ Tag parentTag = getParent();
+ while (parentTag != null) {
+ if (parentTag instanceof Form)
+ return (Form) parentTag;
+ parentTag = parentTag.getParent();
+ }
+ return null;
}
}
Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ConfigurePopup.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ConfigurePopup.java?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ConfigurePopup.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ConfigurePopup.java Sun Oct 9 15:13:50 2005
@@ -23,6 +23,7 @@
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.JspTag;
import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.tagext.Tag;
/**
@@ -56,6 +57,7 @@
private boolean _replace = false;
private String _popupFunc;
private String _onPopupDone;
+ private boolean _updateFormFields = false;
/**
* Return the name of the Tag.
@@ -96,6 +98,21 @@
}
/**
+ * Sets whether the JavaScript function that opens the popup window should add data
+ * from the form fields to the request.
+ * @param updateFormFields whether the data from the form fields is included in the popup window request.
+ * @jsptagref.attributedescription Whether the data from the form fields is included in the popup window request.
+ * @jsptagref.databindable true
+ * @jsptagref.attributesyntaxvalue <i>string_updateFormFields</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="Whether the data from the form fields is included in the popup window request."
+ */
+ public void setUpdateFormFields(boolean updateFormFields)
+ {
+ _updateFormFields = updateFormFields;
+ }
+
+ /**
* Sets the name of the popup window.
* @param name the name of the popup window.
* @jsptagref.attributedescription The name of the popup window.
@@ -319,6 +336,13 @@
popupSupport.setReplace(_replace);
popupSupport.setPopupFunc(_popupFunc);
popupSupport.setOnPopupDone(_onPopupDone);
+
+ if (_updateFormFields) {
+ Form form = getNearestForm();
+ String realFormName = form.getRealFormId();
+ form.insureRealId();
+ popupSupport.setFormName(realFormName);
+ }
}
}
Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java Sun Oct 9 15:13:50 2005
@@ -430,20 +430,6 @@
}
/**
- * Returns the closest parent form tag, or null if there is none.
- */
- protected Form getNearestForm()
- {
- Tag parentTag = getParent();
- while (parentTag != null) {
- if (parentTag instanceof Form)
- return (Form) parentTag;
- parentTag = parentTag.getParent();
- }
- return null;
- }
-
- /**
* Assumptions:
* <ul>
* <li>The state.name must be fully formed or the "real name" of the form.</li>
Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/PopupSupport.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/PopupSupport.java?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/PopupSupport.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/PopupSupport.java Sun Oct 9 15:13:50 2005
@@ -46,6 +46,7 @@
private boolean _replace = false;
private String _onPopupDone;
private String _popupFunc;
+ private String _formName;
public void setName(String name)
{
@@ -122,6 +123,22 @@
_popupFunc = popupFunc;
}
+ /**
+ * Sets whether the JavaScript function that opens the popup window should add data
+ * from the form fields to the request. The form name is used in the JavaScript
+ * function of onClick to identify the form object correctly. The JavaScript
+ * will only be set up to pass the names and values for the form fields on the
+ * request if the form name is set.
+ *
+ * @param formName the name attribute of the form to pass field data from.
+ * This must be the real/generated form name and not the
+ * netui:form tagId attribute.
+ */
+ public void setFormName(String formName)
+ {
+ _formName = formName;
+ }
+
public String getOnClick(ServletRequest req, String url)
{
// Build up the string that's passed to javascript open() to specify window features.
@@ -141,11 +158,21 @@
firstOne = false;
}
}
-
- String popupFunc = (_popupFunc != null ? _popupFunc : POPUP_FUNC);
+
+ String onClick = null;
String popupWindow = getScopedFunctionName(req, POPUP_WINDOW);
- Object[] args = new Object[]{popupFunc, url, _name, features.toString(), Boolean.valueOf(_replace), popupWindow};
- return ScriptRequestState.getString("popupSupportOnClick", args);
+
+ String popupFunc = (_popupFunc != null ? _popupFunc : POPUP_FUNC);
+ if (_formName != null && _formName.length() > 0) {
+ Object[] args = new Object[]{popupFunc, url, _name, features.toString(), Boolean.valueOf(_replace), popupWindow, _formName};
+ onClick = ScriptRequestState.getString("popupSupportUpdateFormOnClick", args);
+ }
+ else {
+ Object[] args = new Object[]{popupFunc, url, _name, features.toString(), Boolean.valueOf(_replace), popupWindow};
+ onClick = ScriptRequestState.getString("popupSupportOnClick", args);
+ }
+
+ return onClick;
}
public void addParams(IUrlParams urlParams, ServletRequest request)
Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/CoreScriptFeature.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/CoreScriptFeature.java?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/CoreScriptFeature.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/CoreScriptFeature.java Sun Oct 9 15:13:50 2005
@@ -30,15 +30,16 @@
public static final int INT_ANCHOR_SUBMIT = 0x00020;
public static final int INT_POPUP_OPEN = 0x00040;
public static final int INT_POPUP_DONE = 0x00080;
- public static final int INT_ALLOCATE_LEGACY = 0x00100;
- public static final int INT_ALLOCATE_ID = 0x00200;
- public static final int INT_ALLOCATE_NAME = 0x00400;
- public static final int INT_LEGACY_SCOPE_LOOKUP = 0x00800;
- public static final int INT_TREE_INIT = 0x01000;
- public static final int INT_DIVPANEL_INIT = 0x02000;
- public static final int INT_DYNAMIC_INIT = 0x04000;
- public static final int INT_BUTTON_DISABLE_AND_SUBMIT = 0x08000;
- public static final int INT_BUTTON_DISABLE = 0x10000;
+ public static final int INT_POPUP_UPDATE_FORM = 0x00100;
+ public static final int INT_ALLOCATE_LEGACY = 0x00200;
+ public static final int INT_ALLOCATE_ID = 0x00400;
+ public static final int INT_ALLOCATE_NAME = 0x00800;
+ public static final int INT_LEGACY_SCOPE_LOOKUP = 0x01000;
+ public static final int INT_TREE_INIT = 0x02000;
+ public static final int INT_DIVPANEL_INIT = 0x04000;
+ public static final int INT_DYNAMIC_INIT = 0x08000;
+ public static final int INT_BUTTON_DISABLE_AND_SUBMIT = 0x10000;
+ public static final int INT_BUTTON_DISABLE = 0x20000;
// These features are not written out once. They are identified by setting the top bit
protected static final int INT_SET_FOCUS = 0x10000001;
@@ -58,6 +59,7 @@
public static final CoreScriptFeature ANCHOR_SUBMIT = new CoreScriptFeature(INT_ANCHOR_SUBMIT);
public static final CoreScriptFeature POPUP_OPEN = new CoreScriptFeature(INT_POPUP_OPEN);
public static final CoreScriptFeature POPUP_DONE = new CoreScriptFeature(INT_POPUP_DONE);
+ public static final CoreScriptFeature POPUP_UPDATE_FORM = new CoreScriptFeature(INT_POPUP_UPDATE_FORM);
public static final CoreScriptFeature ALLOCATE_LEGACY = new CoreScriptFeature(INT_ALLOCATE_LEGACY);
public static final CoreScriptFeature ALLOCATE_ID = new CoreScriptFeature(INT_ALLOCATE_ID);
public static final CoreScriptFeature ALLOCATE_NAME = new CoreScriptFeature(INT_ALLOCATE_NAME);
@@ -81,6 +83,7 @@
case INT_ANCHOR_SUBMIT: return "ANCHOR_SUBMIT";
case INT_POPUP_OPEN: return "POPUP_OPEN";
case INT_POPUP_DONE: return "POPUP_DONE";
+ case INT_POPUP_UPDATE_FORM: return "POPUP_UPDATE_FORM";
case INT_ALLOCATE_LEGACY: return "ALLOCATE_LEGACY";
case INT_ALLOCATE_ID: return "ALLOCATE_ID";
case INT_ALLOCATE_NAME: return "ALLOCATE_NAME";
Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java Sun Oct 9 15:13:50 2005
@@ -286,6 +286,8 @@
return "popupSupportPopupWindow";
case CoreScriptFeature.INT_POPUP_DONE:
return "popupDone";
+ case CoreScriptFeature.INT_POPUP_UPDATE_FORM:
+ return "popupSupportUpdateForm";
case CoreScriptFeature.INT_ROLLOVER:
return "rollover";
case CoreScriptFeature.INT_TREE_INIT:
Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties Sun Oct 9 15:13:50 2005
@@ -41,7 +41,7 @@
# The following method will be written out once an may be called by
# multiple buttons. The event JavaScript is defined following it.
buttonDisableAndSubmitForm=\
-// submit the form from an Button after disabling the Button\n\
+// submit the form from a Button after disabling the Button\n\
// Search for the form by actionName,\n\
// Replace the action with the passed in action\n\
// Submit the form\n\
@@ -82,19 +82,82 @@
\ var window_netui_popup = new Array();\n\
'}'\n\
\n\
-function {0}(url, name, features, replace, popup)\n\
+// Parse the field names and values from a Form and return\n\
+// them as a string of parameters to add to a url query\n\
+function get_form_query(formNode)\n\
+'{'\n\
+\ var params = "";\n\
+\n\
+\ if (formNode != null)\n\
+\ '{'\n\
+\ var sep = "";\n\
+\ for (var i = 0; i < formNode.elements.length; i++) '{'\n\
+\ switch (formNode[i].type) '{'\n\
+\ case "radio":\n\
+\ case "checkbox": // input type='checkbox'\n\
+\ if (!formNode[i].checked)\n\
+\ break;\n\
+\ params += sep + formNode[i].name + "=" + formNode[i].value;\n\
+\ sep="&";\n\
+\ break;\n\
+\ case "file": // input type='file'\n\
+\ case "hidden": // input type='hidden'\n\
+\ case "text": // input type='text'\n\
+\ case "textArea": // textarea\n\
+\ case "select-one": // select\n\
+\ case "select-multiple": // select multiple\n\
+\ if (formNode[i].value == "")\n\
+\ break;\n\
+\ params += sep + formNode[i].name + "=" + formNode[i].value;\n\
+\ sep="&";\n\
+\ break;\n\
+\ // ignore these...\n\
+\ case "submit": // input type='submit'\n\
+\ case "reset": // input type='reset'\n\
+\ case "button": // input type='button'\n\
+\ case "password": // input type='password'\n\
+\ break;\n\
+\ '}'\n\
+\ '}'\n\
+\ '}'\n\
+\n\
+\ return params;\n\
+'}'\n\
+\n\
+function {0}(url, name, features, replace, popup, formName)\n\
'{'\n\
\ if (window_netui_popup[popup] != null && ! window_netui_popup[popup].closed)\n\
\ '{'\n\
\ window_netui_popup[popup].focus();\n\
\ return;\n\
\ '}'\n\
+\n\
+\ if (formName != null && formName.length > 0) '{'\n\
+\ var formNode = null;\n\
+\ for (var i = 0; i < document.forms.length; i++) '{'\n\
+\ if (document.forms[i].name == formName) '{'\n\
+\ formNode = document.forms[i];\n\
+\ break;\n\
+\ '}'\n\
+\ '}'\n\
+\n\
+\ if (formNode != null) '{'\n\
+\ var sep = "?";\n\
+\ if (url != null && url.length != 0 && url.indexOf("?") > 0) '{'\n\
+\ sep = "&";\n\
+\ '}'\n\
+\ url += sep + get_form_query(formNode);\n\
+\ '}'\n\
+\ '}'\n\
+\n\
\ window_netui_popup[popup]=open(url, name, features, replace);\n\
\ if (window_netui_popup[popup].opener == null) window_netui_popup[popup].opener=self;\n\
'}'\n
# Open a popup window using a custom function
-popupSupportOnClick={0}(''{1}'',''{2}'',''{3}'',{4},''{5}'');return false;
+popupSupportOnClick={0}(''{1}'',''{2}'',''{3}'',{4},''{5}'',null);return false;
+
+popupSupportUpdateFormOnClick={0}(''{1}'',''{2}'',''{3}'',{4},''{5}'',''{6}'');return false;
popupDone=\
function {0}(map)\n\
Added: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/Controller.jpf
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/Controller.jpf?rev=312504&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/Controller.jpf (added)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/Controller.jpf Sun Oct 9 15:13:50 2005
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package tags.popupFormBean;
+
+import org.apache.beehive.netui.pageflow.FormData;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import tags.popupFormBean.getModel.GetModel;
+
+@Jpf.Controller(
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+)
+public class Controller extends PageFlowController
+{
+ String[] styles = new String[] {GetModel.SHORT, GetModel.LONGBOARD,
+ GetModel.HYBRID, GetModel.FISH, GetModel.SOFT_TOP};
+ public String[] getStyles() {
+ return styles;
+ }
+
+ String defaultStyle = "Short";
+ public String getDefaultStyle() {
+ return defaultStyle;
+ }
+
+ String[] colors =
+ new String[] {"Red", "Blue", "Green", "Yellow", "White", "Black"};
+ public String[] getColors() {
+ return colors;
+ }
+
+ String defaultColor = "White";
+ public String getDefaultColor() {
+ return defaultColor;
+ }
+
+ @Jpf.Action()
+ protected Forward modelSuccess( GetModel.ModelForm model ) {
+ return new Forward( "_auto" );
+ }
+
+ @Jpf.Action()
+ protected Forward modelCancel() {
+ return new Forward( "_auto" ); // THIS IS THE MAGIC GLOBAL FORWARD
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(
+ name="continue",
+ path = "getModel/displayModel.do"
+ )
+ }
+ )
+ protected Forward getModel(SubmitForm form) {
+ GetModel.ModelForm modelForm = new GetModel.ModelForm();
+ modelForm.setStyle(form.getStyle());
+
+ return new Forward("continue", modelForm);
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(
+ name = "success",
+ path = "results.jsp"
+ )
+ }
+ )
+ protected Forward submit(SubmitForm form) {
+ return new Forward("success", "form", form );
+ }
+
+
+ public static class SubmitForm extends FormData
+ {
+ private String _dealer;
+ private String _style;
+ private String _model;
+ private String _color;
+
+ public String getDealer() {
+ return _dealer;
+ }
+
+ public void setDealer(String value) {
+ _dealer = value;
+ }
+
+ public String getStyle() {
+ return _style;
+ }
+
+ public void setStyle(String value) {
+ _style = value;
+ }
+
+ public String getModel() {
+ return _model;
+ }
+
+ public void setModel(String value) {
+ _model = value;
+ }
+
+ public String getColor() {
+ return _color;
+ }
+
+ public void setColor(String value) {
+ _color = value;
+ }
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/Controller.jpf
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/GetModel.jpf
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/GetModel.jpf?rev=312504&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/GetModel.jpf (added)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/GetModel.jpf Sun Oct 9 15:13:50 2005
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package tags.popupFormBean.getModel;
+
+import org.apache.beehive.netui.pageflow.FormData;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+@Jpf.Controller(
+ nested=true,
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+)
+public class GetModel extends PageFlowController
+{
+ // Silly data for this test case
+ public static final String SHORT = "Short";
+ public static final String LONGBOARD = "Longboard";
+ public static final String HYBRID = "Hybrid";
+ public static final String FISH = "Fish";
+ public static final String SOFT_TOP = "Soft Top";
+
+ private static String[] shortboards = {
+ "6'0", "6'2", "6'4", "6'6", "6'8", "7'0", "7'6"
+ };
+
+ private static String[] longboards = {
+ "9'0 tri", "9'0 classic", "9'2 tri", "9'6 tri",
+ "9'6 classic", "10'0 tri", "10'6 classic"
+ };
+
+ private static String[] hybrids = {
+ "6'6", "6'8", "7'0", "7'6"
+ };
+
+ private static String[] fish = {
+ "6'0", "6'2", "6'4", "6'6", "6'8"
+ };
+
+ private static String[] soft = {
+ "9'0 tri", "9'6 tri", "10'0 tri"
+ };
+
+ String _style = SHORT;
+ public String getStyle() {
+ return _style;
+ }
+
+ String[] _models = shortboards;
+ public String[] getModels() {
+ return _models;
+ }
+
+ String _defaultModel = shortboards[0];
+ public String getDefaultModel() {
+ return _defaultModel;
+ }
+
+ /**
+ * This is the model code and state that will be returned in {@link #done}.
+ */
+ private ModelForm _modelForm;
+
+ @Jpf.Action(
+ useFormBean="_modelForm",
+ forwards={
+ @Jpf.Forward(name="success", path="index.jsp")
+ }
+ )
+ protected Forward displayModel(ModelForm form) {
+ String style = form.getStyle();
+ if (style != null && style.length() > 0) {
+ _style = style;
+ }
+
+ if (_style.equals(LONGBOARD)) {
+ _models = longboards;
+ } else if (_style.equals(HYBRID)) {
+ _models = hybrids;
+ } else if (_style.equals(FISH)) {
+ _models = fish;
+ } else if (_style.equals(SOFT_TOP)) {
+ _models = soft;
+ } else {
+ _models = shortboards;
+ }
+
+ _defaultModel = _models[0];
+
+ Forward fwd = new Forward("success");
+ return fwd;
+ }
+
+ @Jpf.Action(
+ useFormBean="_modelForm",
+ forwards={
+ @Jpf.Forward(
+ name="done",
+ returnAction="modelSuccess",
+ outputFormBean="_modelForm"
+ )
+ }
+ )
+ protected Forward done(ModelForm form) {
+ return new Forward("done");
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="done", returnAction="modelCancel")
+ }
+ )
+ protected Forward cancel(ModelForm form) {
+ return new Forward("done");
+ }
+
+ public static class ModelForm extends FormData
+ {
+ private String _style;
+ private String _model;
+
+ public ModelForm() {
+ _style = SHORT;
+ }
+
+ public String getStyle() {
+ return _style;
+ }
+
+ public void setStyle(String style) {
+ _style = style;
+ }
+
+ public String getModel() {
+ return _model;
+ }
+
+ public void setModel(String model) {
+ _model = model;
+ }
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/GetModel.jpf
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/index.jsp?rev=312504&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/index.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/index.jsp Sun Oct 9 15:13:50 2005
@@ -0,0 +1,29 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+
+ <h3>Select a Model</h3>
+ <p>Board Style: ${pageFlow.style}</p>
+ <netui:form action="done">
+ <table>
+ <tr valign="top">
+ <td>Model:</td>
+ <td>
+ <netui:radioButtonGroup dataSource="actionForm.model" optionsDataSource="${pageFlow.models}" defaultValue="${pageFlow.defaultModel}"/>
+ </td>
+ </tr>
+ </table>
+ <br/>
+ <netui:button type="submit" value="submit"/>
+ <netui:button type="submit" action="cancel" value="cancel"/>
+ </netui:form>
+
+ </netui:body>
+</netui:html>
+
+
Propchange: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/getModel/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/index.jsp?rev=312504&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/index.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/index.jsp Sun Oct 9 15:13:50 2005
@@ -0,0 +1,60 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <h2>Test - Passing a FormBean to a Popup</h2>
+
+ <netui:form action="submit">
+ <table>
+ <tr valign="top">
+ <td><b>Dealer:<b></td>
+ <td>
+ <netui:textBox dataSource="actionForm.dealer"/>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td><b>Color:</b></td>
+ <td>
+ <netui:checkBoxGroup dataSource="actionForm.color" optionsDataSource="${pageFlow.colors}" defaultValue="${pageFlow.defaultColor}"/>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>Style:</td>
+ <td>
+ (passed to nested popup when looking up a model)
+ <br>
+ <netui:radioButtonGroup dataSource="actionForm.style" optionsDataSource="${pageFlow.styles}" defaultValue="${pageFlow.defaultStyle}"/>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td><b>Model:<b></td>
+ <td>
+ <netui:textBox tagId="modelField" dataSource="actionForm.model"/>
+
+ <netui:anchor action="getModel" popup="true">
+ look up
+ <netui:configurePopup updateFormFields="true" resizable="true" width="500" height="350">
+ <netui:retrievePopupOutput tagIdRef="modelField" dataSource="outputFormBean.model"/>
+ </netui:configurePopup>
+ </netui:anchor>
+
+ </td>
+ </tr>
+ </table>
+ <br/>
+ <netui:button action="getModel" value="Get Model" popup="true">
+ <netui:configurePopup updateFormFields="true" resizable="true" width="500" height="350">
+ <netui:retrievePopupOutput tagIdRef="modelField" dataSource="outputFormBean.model"/>
+ </netui:configurePopup>
+ </netui:button>
+ <br/>
+ <netui:button type="submit" value="submit"/>
+ </netui:form>
+
+ </netui:body>
+</netui:html>
+
Propchange: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/results.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/results.jsp?rev=312504&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/results.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/results.jsp Sun Oct 9 15:13:50 2005
@@ -0,0 +1,22 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ Dealer: <b>${pageInput.form.dealer}</b>
+ <br/>
+ Color: <b>${pageInput.form.color}</b>
+ <br/>
+ Style: <b>${pageInput.form.style}</b>
+ <br/>
+ Model: <b>${pageInput.form.model}</b>
+ <br/>
+ <br/>
+ <netui:anchor action="begin">start over</netui:anchor>
+ </netui:body>
+</netui:html>
+
+
Propchange: beehive/trunk/netui/test/webapps/drt/coreWeb/tags/popupFormBean/results.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (original)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Sun Oct 9 15:13:50 2005
@@ -6035,6 +6035,21 @@
</features>
</test>
<test>
+ <name>PopupPassForm</name>
+ <description>Test popup support for passing a form's fields (name/value pairs) to a popup window form.</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>bvt.struts11</category>
+ <category>tags</category>
+ </categories>
+ <features>
+ <feature>Popup</feature>
+ <feature>Form</feature>
+ <feature>Nesting</feature>
+ </features>
+ </test>
+ <test>
<name>PostToXmlBean</name>
<description>Test to ensure that we can post data directly into an XmlBean.</description>
<webapp>coreWeb</webapp>
Modified: beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DisableSecondClick.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DisableSecondClick.xml?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DisableSecondClick.xml (original)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DisableSecondClick.xml Sun Oct 9 15:13:50 2005
@@ -105,7 +105,7 @@
// **** Start the NetUI Framework Generated JavaScript ****
-// submit the form from an Button after disabling the Button
+// submit the form from a Button after disabling the Button
// Search for the form by actionName,
// Replace the action with the passed in action
// Submit the form
Modified: beehive/trunk/netui/test/webapps/drt/testRecorder/tests/MockPortalPopupWindows.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/MockPortalPopupWindows.xml?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/tests/MockPortalPopupWindows.xml (original)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/tests/MockPortalPopupWindows.xml Sun Oct 9 15:13:50 2005
@@ -135,7 +135,7 @@
<input type="text" name="portletA{actionForm.zip}" id="portletA.zipField">
<span style="color:red"></span>
- <a href="/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletA.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletA.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletA" onclick="Netui_Popup('/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletA.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletA.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletA','','width=550,height=150,location=0',false,'Netui_Window_portletA');return false;">look up</a>
+ <a href="/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletA.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletA.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletA" onclick="Netui_Popup('/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletA.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletA.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletA','','width=550,height=150,location=0',false,'Netui_Window_portletA',null);return false;">look up</a>
</td>
</tr>
@@ -153,13 +153,74 @@
var window_netui_popup = new Array();
}
-function Netui_Popup(url, name, features, replace, popup)
+// Parse the field names and values from a Form and return
+// them as a string of parameters to add to a url query
+function get_form_query(formNode)
+{
+ var params = "";
+
+ if (formNode != null)
+ {
+ var sep = "";
+ for (var i = 0; i < formNode.elements.length; i++) {
+ switch (formNode[i].type) {
+ case "radio":
+ case "checkbox": // input type=checkbox
+ if (!formNode[i].checked)
+ break;
+ params += sep + formNode[i].name + "=" + formNode[i].value;
+ sep="&";
+ break;
+ case "file": // input type=file
+ case "hidden": // input type=hidden
+ case "text": // input type=text
+ case "textArea": // textarea
+ case "select-one": // select
+ case "select-multiple": // select multiple
+ if (formNode[i].value == "")
+ break;
+ params += sep + formNode[i].name + "=" + formNode[i].value;
+ sep="&";
+ break;
+ // ignore these...
+ case "submit": // input type=submit
+ case "reset": // input type=reset
+ case "button": // input type=button
+ case "password": // input type=password
+ break;
+ }
+ }
+ }
+
+ return params;
+}
+
+function Netui_Popup(url, name, features, replace, popup, formName)
{
if (window_netui_popup[popup] != null && ! window_netui_popup[popup].closed)
{
window_netui_popup[popup].focus();
return;
}
+
+ if (formName != null && formName.length > 0) {
+ var formNode = null;
+ for (var i = 0; i < document.forms.length; i++) {
+ if (document.forms[i].name == formName) {
+ formNode = document.forms[i];
+ break;
+ }
+ }
+
+ if (formNode != null) {
+ var sep = "?";
+ if (url != null && url.length != 0 && url.indexOf("?") > 0) {
+ sep = "&";
+ }
+ url += sep + get_form_query(formNode);
+ }
+ }
+
window_netui_popup[popup]=open(url, name, features, replace);
if (window_netui_popup[popup].opener == null) window_netui_popup[popup].opener=self;
}
@@ -315,7 +376,7 @@
<input type="text" name="portletB{actionForm.zip}" id="portletB.zipField">
<span style="color:red"></span>
- <a href="/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletB.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletB.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletB" onclick="Netui_Popup('/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletB.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletB.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletB','','width=550,height=150,location=0',false,'Netui_Window_portletB');return false;">look up</a>
+ <a href="/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletB.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletB.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletB" onclick="Netui_Popup('/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletB.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletB.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletB','','width=550,height=150,location=0',false,'Netui_Window_portletB',null);return false;">look up</a>
</td>
</tr>
@@ -1175,7 +1236,7 @@
<input type="text" name="portletB{actionForm.zip}" id="portletB.zipField">
<span style="color:red"></span>
- <a href="/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletB.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletB.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletB" onclick="Netui_Popup('/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletB.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletB.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletB','','width=550,height=150,location=0',false,'Netui_Window_portletB');return false;">look up</a>
+ <a href="/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletB.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletB.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletB" onclick="Netui_Popup('/coreWeb/miniTests/updateFormFromNestedPopup/getZip.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AretrieveItem=outputFormBean.state%3AportletB.stateField&_netui%3AretrieveItem=outputFormBean.zip%3AportletB.zipField&_netui%3AreturnActionCallback=Netui_OnPopupDone&jpfScopeID=portletB','','width=550,height=150,location=0',false,'Netui_Window_portletB',null);return false;">look up</a>
</td>
</tr>
@@ -1193,13 +1254,74 @@
var window_netui_popup = new Array();
}
-function Netui_Popup(url, name, features, replace, popup)
+// Parse the field names and values from a Form and return
+// them as a string of parameters to add to a url query
+function get_form_query(formNode)
+{
+ var params = "";
+
+ if (formNode != null)
+ {
+ var sep = "";
+ for (var i = 0; i < formNode.elements.length; i++) {
+ switch (formNode[i].type) {
+ case "radio":
+ case "checkbox": // input type=checkbox
+ if (!formNode[i].checked)
+ break;
+ params += sep + formNode[i].name + "=" + formNode[i].value;
+ sep="&";
+ break;
+ case "file": // input type=file
+ case "hidden": // input type=hidden
+ case "text": // input type=text
+ case "textArea": // textarea
+ case "select-one": // select
+ case "select-multiple": // select multiple
+ if (formNode[i].value == "")
+ break;
+ params += sep + formNode[i].name + "=" + formNode[i].value;
+ sep="&";
+ break;
+ // ignore these...
+ case "submit": // input type=submit
+ case "reset": // input type=reset
+ case "button": // input type=button
+ case "password": // input type=password
+ break;
+ }
+ }
+ }
+
+ return params;
+}
+
+function Netui_Popup(url, name, features, replace, popup, formName)
{
if (window_netui_popup[popup] != null && ! window_netui_popup[popup].closed)
{
window_netui_popup[popup].focus();
return;
}
+
+ if (formName != null && formName.length > 0) {
+ var formNode = null;
+ for (var i = 0; i < document.forms.length; i++) {
+ if (document.forms[i].name == formName) {
+ formNode = document.forms[i];
+ break;
+ }
+ }
+
+ if (formNode != null) {
+ var sep = "?";
+ if (url != null && url.length != 0 && url.indexOf("?") > 0) {
+ sep = "&";
+ }
+ url += sep + get_form_query(formNode);
+ }
+ }
+
window_netui_popup[popup]=open(url, name, features, replace);
if (window_netui_popup[popup].opener == null) window_netui_popup[popup].opener=self;
}
Modified: beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PopupAttribute.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PopupAttribute.xml?rev=312504&r1=312503&r2=312504&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PopupAttribute.xml (original)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/tests/PopupAttribute.xml Sun Oct 9 15:13:50 2005
@@ -78,26 +78,26 @@
<h3>/tags/popup/Controller.jpf</h3>
anchor:
- <a href="/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone" onclick="Netui_Popup('/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window');return false;">goNested</a>
+ <a href="/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone" onclick="Netui_Popup('/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window',null);return false;">goNested</a>
<br/>
imageAnchor:
- <a href="/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone" onclick="Netui_Popup('/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window');return false;"><img src="/coreWeb/tags/popup/cool.gif"></a>
+ <a href="/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone" onclick="Netui_Popup('/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window',null);return false;"><img src="/coreWeb/tags/popup/cool.gif"></a>
<br/>
area:
<img src="cool.gif" usemap="#map1"/>
<map name="map1">
- <area href="/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone" shape="rect" coords="0,0,25,25" onclick="Netui_Popup('/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window');return false;">
+ <area href="/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone" shape="rect" coords="0,0,25,25" onclick="Netui_Popup('/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window',null);return false;">
</map>
<form action="/coreWeb/tags/popup/goNested.do" method="post">
button (uses form's action):
- <input type="submit" value="goNested" onclick="Netui_Popup('/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window');return false;">
+ <input type="submit" value="goNested" onclick="Netui_Popup('/coreWeb/tags/popup/goNested.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window',null);return false;">
<br/>
button (overrides action):
- <input type="submit" name="actionOverride:goNested2?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AreturnActionCallback=Netui_OnPopupDone" value="goNested2" onclick="Netui_Popup('/coreWeb/tags/popup/goNested2.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window');return false;">
+ <input type="submit" name="actionOverride:goNested2?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&_netui%3AreturnActionCallback=Netui_OnPopupDone" value="goNested2" onclick="Netui_Popup('/coreWeb/tags/popup/goNested2.do?_netui%3AreturnActionViewRenderer=org.apache.beehive.netui.tags.internal.ReturnActionViewRenderer&amp;_netui%3AreturnActionCallback=Netui_OnPopupDone','','width=200,height=100',false,'Netui_Window',null);return false;">
</form>
<script language="JavaScript" type="text/JavaScript">
<!--
@@ -108,13 +108,74 @@
var window_netui_popup = new Array();
}
-function Netui_Popup(url, name, features, replace, popup)
+// Parse the field names and values from a Form and return
+// them as a string of parameters to add to a url query
+function get_form_query(formNode)
+{
+ var params = "";
+
+ if (formNode != null)
+ {
+ var sep = "";
+ for (var i = 0; i < formNode.elements.length; i++) {
+ switch (formNode[i].type) {
+ case "radio":
+ case "checkbox": // input type=checkbox
+ if (!formNode[i].checked)
+ break;
+ params += sep + formNode[i].name + "=" + formNode[i].value;
+ sep="&";
+ break;
+ case "file": // input type=file
+ case "hidden": // input type=hidden
+ case "text": // input type=text
+ case "textArea": // textarea
+ case "select-one": // select
+ case "select-multiple": // select multiple
+ if (formNode[i].value == "")
+ break;
+ params += sep + formNode[i].name + "=" + formNode[i].value;
+ sep="&";
+ break;
+ // ignore these...
+ case "submit": // input type=submit
+ case "reset": // input type=reset
+ case "button": // input type=button
+ case "password": // input type=password
+ break;
+ }
+ }
+ }
+
+ return params;
+}
+
+function Netui_Popup(url, name, features, replace, popup, formName)
{
if (window_netui_popup[popup] != null && ! window_netui_popup[popup].closed)
{
window_netui_popup[popup].focus();
return;
}
+
+ if (formName != null && formName.length > 0) {
+ var formNode = null;
+ for (var i = 0; i < document.forms.length; i++) {
+ if (document.forms[i].name == formName) {
+ formNode = document.forms[i];
+ break;
+ }
+ }
+
+ if (formNode != null) {
+ var sep = "?";
+ if (url != null && url.length != 0 && url.indexOf("?") > 0) {
+ sep = "&";
+ }
+ url += sep + get_form_query(formNode);
+ }
+ }
+
window_netui_popup[popup]=open(url, name, features, replace);
if (window_netui_popup[popup].opener == null) window_netui_popup[popup].opener=self;
}