diff --git a/framework/widget/dtd/widget-common.xsd b/framework/widget/dtd/widget-common.xsd index 0fd32d33347..4a076f2ed32 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 f82a0b2f443..ec3096dc58f 100644 --- a/framework/widget/dtd/widget-form.xsd +++ b/framework/widget/dtd/widget-form.xsd @@ -587,6 +587,7 @@ under the License. + @@ -1553,6 +1554,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 573290cc254..3861e04501f 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 @@ -364,14 +364,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 3dd94b21ced..01e813f7682 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 @@ -1750,13 +1750,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");