Author: sichen
Date: Mon Sep 25 13:59:02 2006
New Revision: 449813
URL:
http://svn.apache.org/viewvc?view=rev&rev=449813Log:
OFBIZ-240 - Render a selectAll checkbox for forms of type multi. To activate it, define a field named _rowSubmit of type <check/> and give it a title.
Modified:
incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
Modified: incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?view=diff&rev=449813&r1=449812&r2=449813==============================================================================
--- incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Mon Sep 25 13:59:02 2006
@@ -1063,6 +1063,16 @@
}
/**
+ * Checks if field is a row submit field.
+ */
+ public boolean isRowSubmit() {
+ if (!"multi".equals(getModelForm().getType())) return false;
+ if (getFieldInfo().getFieldType() != ModelFormField.FieldInfo.CHECK) return false;
+ if (!CheckField.ROW_SUBMIT_FIELD_NAME.equals(getName())) return false;
+ return true;
+ }
+
+ /**
* @return
*/
public String getWidgetAreaStyle() {
@@ -2557,6 +2567,8 @@
}
public static class CheckField extends FieldInfo {
+ public final static String ROW_SUBMIT_FIELD_NAME = "_rowSubmit";
+
protected CheckField() {
super();
}
Modified: incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?view=diff&rev=449813&r1=449812&r2=449813==============================================================================
--- incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Mon Sep 25 13:59:02 2006
@@ -2190,7 +2190,7 @@
/**
* Renders a link for the column header fields when there is a header-link="" specified in the <field > tag, using
- * style from header-link-style=""
+ * style from header-link-style="". Also renders a selectAll checkbox in multi forms.
* @param buffer
* @param context
* @param modelFormField
@@ -2207,6 +2207,11 @@
targetType="plain";
}
makeHyperlinkString(buffer, modelFormField.getHeaderLinkStyle(), targetType, targetBuffer.toString(), titleText, null);
+ } else if (modelFormField.isRowSubmit()) {
+ if (UtilValidate.isNotEmpty(titleText)) buffer.append(titleText).append("<br>");
+ buffer.append("<input type=\"checkbox\" name=\"selectAll\" value=\"Y\" onclick=\"javascript:toggleAll(this, '");
+ buffer.append(modelFormField.getModelForm().getName());
+ buffer.append("');\"/>");
} else {
buffer.append(titleText);
}