diff --git a/framework/widget/dtd/widget-common.xsd b/framework/widget/dtd/widget-common.xsd index 0fd32d3334..4a076f2ed3 100644 --- a/framework/widget/dtd/widget-common.xsd +++ b/framework/widget/dtd/widget-common.xsd @@ -515,6 +515,13 @@ under the License. + + + Generate 4 parameters : portalPageId, portalPortletId, portletSeqId and currentAreaId update from-field parameters.xxx + + + + @@ -525,6 +532,7 @@ under the License. + diff --git a/framework/widget/dtd/widget-form.xsd b/framework/widget/dtd/widget-form.xsd index e28189e889..7a086c7f80 100644 --- a/framework/widget/dtd/widget-form.xsd +++ b/framework/widget/dtd/widget-form.xsd @@ -587,6 +587,7 @@ under the License. + @@ -1559,6 +1560,7 @@ under the License. + diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/CommonWidgetModels.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/CommonWidgetModels.java index 042f50d55f..43b9b7ced6 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/CommonWidgetModels.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/CommonWidgetModels.java @@ -376,14 +376,22 @@ public Link(Element linkElement) { this.linkType = linkElement.getAttribute("link-type"); } List parameterElementList = UtilXml.childElementList(linkElement, "parameter"); - if (parameterElementList.isEmpty()) { + boolean autoPortletParamsElement = UtilXml.firstChildElement(linkElement, "auto-parameters-portlet") == null ? false : true; + if (parameterElementList.isEmpty() && ! autoPortletParamsElement) { this.parameterList = Collections.emptyList(); } else { + int paramListSize = parameterElementList.size() + (autoPortletParamsElement ? 4 : 0); List parameterList = new ArrayList<>( - parameterElementList.size()); + paramListSize); for (Element parameterElement : parameterElementList) { parameterList.add(new Parameter(parameterElement)); } + if (autoPortletParamsElement) { + parameterList.add(new CommonWidgetModels.Parameter("portalPageId", "parameters.portalPageId", true)); + parameterList.add(new CommonWidgetModels.Parameter("portalPortletId", "parameters.portalPortletId", true)); + parameterList.add(new CommonWidgetModels.Parameter("portletSeqId", "parameters.portletSeqId", true)); + parameterList.add(new CommonWidgetModels.Parameter("currentAreaId", "parameters.currentAreaId", true)); + } this.parameterList = Collections.unmodifiableList(parameterList); } Element autoServiceParamsElement = UtilXml.firstChildElement(linkElement, "auto-parameters-service"); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java index 6e83f15ea8..431cd71dd4 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java @@ -2336,13 +2336,21 @@ public UpdateArea(Element updateAreaElement, String defaultServiceName, String d this.defaultServiceName = defaultServiceName; this.defaultEntityName = defaultEntityName; List parameterElementList = UtilXml.childElementList(updateAreaElement, "parameter"); - if (parameterElementList.isEmpty()) { + boolean autoPortletParamsElement = UtilXml.firstChildElement(updateAreaElement, "auto-parameters-portlet") == null ? false : true; + if (parameterElementList.isEmpty() && ! autoPortletParamsElement) { this.parameterList = Collections.emptyList(); } else { - List parameterList = new ArrayList<>(parameterElementList.size()); + int paramListSize = parameterElementList.size() + (autoPortletParamsElement ? 4 : 0); + List parameterList = new ArrayList<>(paramListSize); for (Element parameterElement : parameterElementList) { parameterList.add(new CommonWidgetModels.Parameter(parameterElement)); } + if (autoPortletParamsElement) { + parameterList.add(new CommonWidgetModels.Parameter("portalPageId", "parameters.portalPageId", true)); + parameterList.add(new CommonWidgetModels.Parameter("portalPortletId", "parameters.portalPortletId", true)); + parameterList.add(new CommonWidgetModels.Parameter("portletSeqId", "parameters.portletSeqId", true)); + parameterList.add(new CommonWidgetModels.Parameter("currentAreaId", "parameters.currentAreaId", true)); + } this.parameterList = Collections.unmodifiableList(parameterList); } Element autoServiceParamsElement = UtilXml.firstChildElement(updateAreaElement, "auto-parameters-service");