svn commit: r754637 - in /ofbiz/trunk: applications/product/webapp/catalog/WEB-INF/ applications/product/webapp/catalog/feature/ applications/product/webapp/catalog/product/ framework/widget/src/org/ofbiz/widget/form/ framework/widget/src/org/ofbiz/wid...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r754637 - in /ofbiz/trunk: applications/product/webapp/catalog/WEB-INF/ applications/product/webapp/catalog/feature/ applications/product/webapp/catalog/product/ framework/widget/src/org/ofbiz/widget/form/ framework/widget/src/org/ofbiz/wid...

jonesde
Author: jonesde
Date: Sun Mar 15 09:15:30 2009
New Revision: 754637

URL: http://svn.apache.org/viewvc?rev=754637&view=rev
Log:
Finished link-type=hidden-form support for type=multi forms, using the EditFeatureGroupAppls page/form as a test case, with improvements now in place there

Modified:
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
    ofbiz/trunk/applications/product/webapp/catalog/feature/FeatureForms.xml
    ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=754637&r1=754636&r2=754637&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Sun Mar 15 09:15:30 2009
@@ -1128,25 +1128,25 @@
     <request-map uri="CreateProductFeatureGroupAppl">
         <security https="true" auth="true"/>
         <event type="service" invoke="createProductFeatureGroupAppl"/>
-        <response name="success" type="view" value="EditFeatureGroupAppls"/>
+        <response name="success" type="request-redirect" value="EditFeatureGroupAppls"><redirect-parameter name="productFeatureGroupId"/></response>
         <response name="error" type="view" value="EditFeatureGroupAppls"/>
     </request-map>
     <request-map uri="UpdateProductFeatureGroupAppl">
         <security https="true" auth="true"/>
         <event type="service-multi" invoke="updateProductFeatureGroupAppl"/>
-        <response name="success" type="view" value="EditFeatureGroupAppls"/>
+        <response name="success" type="request-redirect" value="EditFeatureGroupAppls"><redirect-parameter name="productFeatureGroupId"/></response>
         <response name="error" type="view" value="EditFeatureGroupAppls"/>
     </request-map>
     <request-map uri="ApplyFeaturesFromCategoryToGroup">
         <security https="true" auth="true"/>
         <event type="service-multi" invoke="createProductFeatureGroupAppl"/>
-        <response name="success" type="view" value="EditFeatureGroupAppls"/>
+        <response name="success" type="request-redirect" value="EditFeatureGroupAppls"><redirect-parameter name="productFeatureGroupId"/></response>
         <response name="error" type="view" value="EditFeatureGroupAppls"/>
     </request-map>
     <request-map uri="RemoveProductFeatureGroupAppl">
         <security https="true" auth="true"/>
         <event type="service" invoke="removeProductFeatureGroupAppl"/>
-        <response name="success" type="view" value="EditFeatureGroupAppls"/>
+        <response name="success" type="request-redirect" value="EditFeatureGroupAppls"><redirect-parameter name="productFeatureGroupId"/></response>
         <response name="error" type="view" value="EditFeatureGroupAppls"/>
     </request-map>
     <request-map uri="EditFeatureTypes">

Modified: ofbiz/trunk/applications/product/webapp/catalog/feature/FeatureForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/feature/FeatureForms.xml?rev=754637&r1=754636&r2=754637&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/feature/FeatureForms.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/feature/FeatureForms.xml Sun Mar 15 09:15:30 2009
@@ -224,7 +224,11 @@
         </field>
         <field name="sequenceNum"><text size="3"/></field>
         <field name="removeFeatureGroupAppl" title="${uiLabelMap.CommonRemove}" widget-style="buttontext">
-            <hyperlink target="RemoveProductFeatureGroupAppl?productFeatureGroupId=${productFeatureGroupId}&amp;productFeatureId=${productFeatureId}&amp;fromDate=${fromDate}" description="${uiLabelMap.CommonRemove}"/>
+            <hyperlink target="RemoveProductFeatureGroupAppl" description="${uiLabelMap.CommonRemove}" link-type="hidden-form">
+                <parameter param-name="productFeatureGroupId"/>
+                <parameter param-name="productFeatureId"/>
+                <parameter param-name="fromDate"/>
+            </hyperlink>
         </field>
         <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit">
             <submit/>

Modified: ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml?rev=754637&r1=754636&r2=754637&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml Sun Mar 15 09:15:30 2009
@@ -420,12 +420,12 @@
         <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
         <field name="deleteLink" title=" " widget-style="buttontext">
             <hyperlink target="deleteProductPrice" description="${uiLabelMap.CommonDelete}" link-type="hidden-form" also-hidden="false">
-                <parameter param-name="productId" from-field="productId"/>
-                <parameter param-name="productPriceTypeId" from-field="productPriceTypeId"/>
-                <parameter param-name="productPricePurposeId" from-field="productPricePurposeId"/>
-                <parameter param-name="currencyUomId" from-field="currencyUomId"/>
-                <parameter param-name="productStoreGroupId" from-field="productStoreGroupId"/>
-                <parameter param-name="fromDate" from-field="fromDate"/>
+                <parameter param-name="productId"/>
+                <parameter param-name="productPriceTypeId"/>
+                <parameter param-name="productPricePurposeId"/>
+                <parameter param-name="currencyUomId"/>
+                <parameter param-name="productStoreGroupId"/>
+                <parameter param-name="fromDate"/>
             </hyperlink>
         </field>
     </form>

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=754637&r1=754636&r2=754637&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Sun Mar 15 09:15:30 2009
@@ -1422,6 +1422,7 @@
             // render item rows
             int itemIndex = -1;
             Object item = null;
+            context.put("wholeFormContext", context);
             Map<String, Object> previousItem = FastMap.newInstance();
             while ((item = this.safeNext(iter)) != null) {
                 itemIndex++;

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=754637&r1=754636&r2=754637&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Sun Mar 15 09:15:30 2009
@@ -19,6 +19,7 @@
 package org.ofbiz.widget.html;
 
 import java.io.IOException;
+import java.io.StringWriter;
 import java.sql.Timestamp;
 import java.util.Calendar;
 import java.util.HashSet;
@@ -337,11 +338,16 @@
         ModelFormField modelFormField = hyperlinkField.getModelFormField();
         if ("hidden-form".equals(hyperlinkField.getLinkType())) {
             if ("multi".equals(modelFormField.getModelForm().getType())) {
-                WidgetWorker.makeHyperlinkString(writer, modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), hyperlinkField.getParameterList(), hyperlinkField.getDescription(context), this.request, this.response, context, hyperlinkField.getTargetWindow(context), modelFormField.getEvent(), modelFormField.getAction(context));
-                
-                //WidgetWorker.makeHiddenFormLinkAnchor(writer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context), modelFormField.getEvent(), modelFormField.getAction(context), modelFormField, this.request, this.response, context);
-                // TODO: this is a bit trickier, since we can't do a nested form we'll have to put the link to submit the form in place, but put the actual form def elsewhere, ie after the big form is closed
-                //WidgetWorker.makeHiddenFormLinkForm(writer, hyperlinkField.getTarget(context), hyperlinkField.getTargetType(), hyperlinkField.getTargetWindow(context), hyperlinkField.getParameterList(), modelFormField, this.request, this.response, context);
+                WidgetWorker.makeHiddenFormLinkAnchor(writer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context), modelFormField.getEvent(), modelFormField.getAction(context), modelFormField, this.request, this.response, context);
+
+                // this is a bit trickier, since we can't do a nested form we'll have to put the link to submit the form in place, but put the actual form def elsewhere, ie after the big form is closed
+                Map<String, Object> wholeFormContext = UtilGenerics.checkMap(context.get("wholeFormContext"));
+                Appendable postMultiFormWriter = wholeFormContext != null ? (Appendable) wholeFormContext.get("postMultiFormWriter") : null;
+                if (postMultiFormWriter == null) {
+                    postMultiFormWriter = new StringWriter();
+                    wholeFormContext.put("postMultiFormWriter", postMultiFormWriter);
+                }
+                WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, hyperlinkField.getTarget(context), hyperlinkField.getTargetType(), hyperlinkField.getTargetWindow(context), hyperlinkField.getParameterList(), modelFormField, this.request, this.response, context);
             } else {
                 WidgetWorker.makeHiddenFormLinkForm(writer, hyperlinkField.getTarget(context), hyperlinkField.getTargetType(), hyperlinkField.getTargetWindow(context), hyperlinkField.getParameterList(), modelFormField, this.request, this.response, context);
                 WidgetWorker.makeHiddenFormLinkAnchor(writer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context), modelFormField.getEvent(), modelFormField.getAction(context), modelFormField, this.request, this.response, context);
@@ -1397,7 +1403,16 @@
         }
         writer.append("</form>");
         appendWhitespace(writer);
-        renderEndingBoundaryComment(writer, "Form Widget", modelForm);
+        
+        // see if there is anything that needs to be added outside of the multi-form
+        Map<String, Object> wholeFormContext = UtilGenerics.checkMap(context.get("wholeFormContext"));
+        Appendable postMultiFormWriter = wholeFormContext != null ? (Appendable) wholeFormContext.get("postMultiFormWriter") : null;
+        if (postMultiFormWriter != null) {
+            writer.append(postMultiFormWriter.toString());
+            appendWhitespace(writer);
+        }
+        
+        renderEndingBoundaryComment(writer, "Form Widget - Form Element (Multi)", modelForm);
     }
 
     public void renderFormatListWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
@@ -1435,7 +1450,7 @@
         if (this.renderPagination) {
             this.renderNextPrev(writer, context, modelForm);
         }
-        renderEndingBoundaryComment(writer, "Form Widget", modelForm);
+        renderEndingBoundaryComment(writer, "Form Widget - Formal List Wrapper", modelForm);
     }
 
     /* (non-Javadoc)