svn commit: r1353710 - in /ofbiz/branches/20120329_portletWidget: framework/common/config/ framework/common/entitydef/ framework/webapp/src/org/ofbiz/webapp/event/ framework/widget/src/org/ofbiz/widget/form/ specialpurpose/example/webapp/example/WEB-IN...

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

svn commit: r1353710 - in /ofbiz/branches/20120329_portletWidget: framework/common/config/ framework/common/entitydef/ framework/webapp/src/org/ofbiz/webapp/event/ framework/widget/src/org/ofbiz/widget/form/ specialpurpose/example/webapp/example/WEB-IN...

erwan
Author: erwan
Date: Mon Jun 25 19:37:00 2012
New Revision: 1353710

URL: http://svn.apache.org/viewvc?rev=1353710&view=rev
Log:
- add parameters-map attribute management for show-portlet (eg: hyperlink)
- in serviceEventHandler, return response_message when it's not successful in request, to be able to manage failed message in ajax-json
- modification/correction in example component to show usage of failed message and parameters-map in show-portlet

Modified:
    ofbiz/branches/20120329_portletWidget/framework/common/config/PortalAdminUiLabels.xml
    ofbiz/branches/20120329_portletWidget/framework/common/entitydef/entitymodel.xml
    ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
    ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
    ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller-portlet.xml
    ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller.xml
    ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/ExampleForms.xml
    ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/example/ExampleForms.xml

Modified: ofbiz/branches/20120329_portletWidget/framework/common/config/PortalAdminUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/common/config/PortalAdminUiLabels.xml?rev=1353710&r1=1353709&r2=1353710&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/common/config/PortalAdminUiLabels.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/common/config/PortalAdminUiLabels.xml Mon Jun 25 19:37:00 2012
@@ -19,6 +19,11 @@
     under the License.
 -->
 <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    
+    <property key="FormFieldTitle_titleLabel">
+        <value xml:lang="en">Screenlet Title Label</value>
+        <value xml:lang="fr">Label de titre de la screenlet</value>
+    </property>
     <property key="tooltip_mgmtPageId">
         <value xml:lang="en">Used for recap link</value>
         <value xml:lang="fr">Utilisé dans le lien vers la page de management</value>

Modified: ofbiz/branches/20120329_portletWidget/framework/common/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/common/entitydef/entitymodel.xml?rev=1353710&r1=1353709&r2=1353710&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/common/entitydef/entitymodel.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/common/entitydef/entitymodel.xml Mon Jun 25 19:37:00 2012
@@ -845,7 +845,8 @@ under the License.
             <key-map field-name="portalPortletId"/>
         </view-link>
     </view-entity>
-    <entity entity-name="PortletAttribute" package-name="org.ofbiz.common.portal" title="Allows to set different attribute values for each instance of the same portlet">
+    <entity entity-name="PortletAttribute" package-name="org.ofbiz.common.portal" title="Allows to set different attribute values for each instance of the same portlet"
+                                           default-resource-name="CommonPortalEntityLabels">
         <field name="portalPageId" type="id-ne"></field>
         <field name="portalPortletId" type="id-ne"></field>
         <field name="portletSeqId" type="id-ne"></field>

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java?rev=1353710&r1=1353709&r2=1353710&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java Mon Jun 25 19:37:00 2012
@@ -365,6 +365,7 @@ public class ServiceEventHandler impleme
                 responseString = ModelService.RESPOND_SUCCESS;
             } else {
                 responseString = (String) result.get(ModelService.RESPONSE_MESSAGE);
+                request.setAttribute(ModelService.RESPONSE_MESSAGE,result.get(ModelService.RESPONSE_MESSAGE)); // necessary for Ajax-Json and ModelService.RESPOND_FAIL
             }
 
             // set the messages in the request; this will be picked up by messages.ftl and displayed

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1353710&r1=1353709&r2=1353710&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Mon Jun 25 19:37:00 2012
@@ -2563,6 +2563,7 @@ public class ModelFormField {
         protected FlexibleStringExpander portletSeqId;
         protected List<String> formsToSerialize = FastList.newInstance();
         protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance();
+        protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr;
 
         public ShowPortletItem(Element element, ShowPortletLink showPortletLink) {
             this.showPortletLink = showPortletLink;
@@ -2577,6 +2578,7 @@ public class ModelFormField {
             this.setImageTitle(element.getAttribute("image-title"));
             this.setTarget(element.getAttribute("target"));
             this.setImage (element.getAttribute("image-location"));
+            this.parametersMapAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("parameters-map"));
             this.setSize(element.getAttribute("size"));
             this.setCollapseScreenlet(element.getAttribute("collapse-screenlet"));
             this.setMarkSelected(element.getAttribute("mark-selected"));
@@ -2678,6 +2680,10 @@ public class ModelFormField {
 
         public Map<String, String> getParameterMap(Map<String, Object> context) {
             Map<String, String> fullParameterMap = FastMap.newInstance();
+            Map<String, String> addlParamMap = this.parametersMapAcsr.get(context);
+            if (addlParamMap != null) {
+                fullParameterMap.putAll(addlParamMap);
+            }
             for (WidgetWorker.Parameter parameter: this.parameterList) {
                 String paramValue = parameter.getValue(context);
                 if (UtilValidate.isNotEmpty(paramValue) || parameter.sendIfEmpty(context)){

Modified: ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller-portlet.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller-portlet.xml?rev=1353710&r1=1353709&r2=1353710&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller-portlet.xml (original)
+++ ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller-portlet.xml Mon Jun 25 19:37:00 2012
@@ -20,6 +20,7 @@
         <security https="true" auth="true"/>
         <event type="service" invoke="createExample"/>
         <response name="success" type="request" value="json"/>
+        <response name="fail" type="request" value="json"/>
         <response name="error" type="request" value="json"/>
     </request-map>
     <request-map uri="updateExampleJson">

Modified: ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller.xml?rev=1353710&r1=1353709&r2=1353710&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller.xml (original)
+++ ofbiz/branches/20120329_portletWidget/specialpurpose/example/webapp/example/WEB-INF/controller.xml Mon Jun 25 19:37:00 2012
@@ -74,12 +74,6 @@ under the License.
         </response>
         <response name="error" type="view" value="EditExample"/>
     </request-map>
-    <request-map uri="createExampleAjax">
-        <security https="true" auth="true"/>
-        <event type="service" invoke="createExample"/>
-        <response name="success" type="request" value="json"/>
-        <response name="error" type="request" value="json"/>
-    </request-map>
     <request-map uri="updateExampleAjax">
         <security https="true" auth="true"/>
         <event type="service" invoke="updateExample"/>

Modified: ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/ExampleForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/ExampleForms.xml?rev=1353710&r1=1353709&r2=1353710&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/ExampleForms.xml (original)
+++ ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/ExampleForms.xml Mon Jun 25 19:37:00 2012
@@ -90,8 +90,9 @@ under the License.
         <field name="description" title="${uiLabelMap.CommonDescription}" sort-field="true"><display/></field>
         <field name="exampleDate" ><display type="date"/></field>
         <field name="deleteLink" title=" ">
-            <show-portlet portlet-id="ListExample" target="deleteExampleAjax" parameters-map="queryStringMap"
-                          request-confirmation="true" image-location="${iconsPurpose.Delete}" image-title="${uiLabelMap.IconsTooltips_Delete}">
+            <show-portlet portlet-id="ListExample" target="deleteExamplePortlet" parameters-map="result.queryStringMap"
+                          request-confirmation="true" confirmation-message="${uiLabelMap.CommonConfirmDelete} : [${exampleId}] ${exampleName}"
+                          image-location="${iconsPurpose.Delete}" image-title="${uiLabelMap.IconsTooltips_Delete}">
               <parameter param-name="exampleId"/>
               <parameter param-name="comingFromDelete" value="Y"/>
             </show-portlet>
@@ -134,7 +135,7 @@ under the License.
         <field name="exampleDate" ><display type="date"/></field>
     </form>
     <!-- Form used directly by a portlet (no screen including it) -->
-    <form name="CreateExample" type="single" default-entity-name="Example" target="createExampleAjax">
+    <form name="CreateExample" type="single" default-entity-name="Example" target="createExampleJson">
         <actions>
             <entity-one entity-name="StatusItem" value-field="currentStatus" auto-field-map="false">
                 <field-map field-name="statusId" from-field="example.statusId"/>
@@ -142,7 +143,7 @@ under the License.
         </actions>
         <auto-fields-service service-name="createExample"/>
         <field name="exampleTypeId" title="${uiLabelMap.CommonType}" id-name="exampleTypeId">
-            <drop-down allow-empty="false">
+            <drop-down allow-empty="true">
                 <!-- this is a neat feature, but not good for the type because the user would have to know the possible types in order to enter at least the first letter, so leaving it out by default; just uncomment to enable: <auto-complete/> -->
                 <entity-options entity-name="ExampleType" description="${description}">
                     <entity-order-by field-name="description"/>

Modified: ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/example/ExampleForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/example/ExampleForms.xml?rev=1353710&r1=1353709&r2=1353710&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/example/ExampleForms.xml (original)
+++ ofbiz/branches/20120329_portletWidget/specialpurpose/example/widget/example/ExampleForms.xml Mon Jun 25 19:37:00 2012
@@ -146,7 +146,7 @@ under the License.
     <!-- Typically, this extended form wouldn't be necessary. The parent form (EditExample) would
         have these settings. -->
     <form name="EditExampleBackgroundSubmit" type="single" extends="EditExample" target="updateExampleAjax">
-        <alt-target use-when="example==null" target="createExampleAjax"/>
+        <alt-target use-when="example==null" target="createExampleJson"/>
         <field name="statusId" use-when="example==null" title="${uiLabelMap.CommonStatus}" id-name="statusId">
             <drop-down allow-empty="false">
                 <entity-options entity-name="ExampleStatusItem" description="${description}"/>