Author: adrianc
Date: Sat Jun 20 19:41:05 2015 New Revision: 1686666 URL: http://svn.apache.org/r1686666 Log: Restored the 'request-confirmation' and 'confirmation-message' menu item attributes that were removed in the recent widget refactoring - https://issues.apache.org/jira/browse/OFBIZ-6334. Modified: ofbiz/trunk/framework/widget/dtd/widget-common.xsd ofbiz/trunk/framework/widget/dtd/widget-form.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/CommonWidgetModels.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/ModelFormField.java Modified: ofbiz/trunk/framework/widget/dtd/widget-common.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-common.xsd?rev=1686666&r1=1686665&r2=1686666&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-common.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-common.xsd Sat Jun 20 19:41:05 2015 @@ -583,11 +583,11 @@ under the License. <xs:element minOccurs="0" name="image" type="image" /> </xs:sequence> <xs:attribute type="xs:string" name="text" /> - <xs:attribute type="xs:string" name="id" > + <xs:attribute type="xs:string" name="id"> <xs:annotation> - <xs:documentation> - If you use id for link present in list form or multi form, you can use ${itemIndex} to generate an unique id by line. - </xs:documentation> + <xs:documentation> + If you use id for link present in list form or multi form, you can use ${itemIndex} to generate an unique id by line. + </xs:documentation> </xs:annotation> </xs:attribute> <xs:attribute type="xs:string" name="style" /> @@ -652,6 +652,22 @@ under the License. </xs:restriction> </xs:simpleType> </xs:attribute> + <xs:attribute name="request-confirmation" default="false"> + <xs:annotation> + <xs:documentation>If true then the user is presented with a dialog box, if confirmation-message is empty, use default</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="true" /> + <xs:enumeration value="false" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="confirmation-message" type="xs:string"> + <xs:annotation> + <xs:documentation>The message displayed in confirmation box</xs:documentation> + </xs:annotation> + </xs:attribute> </xs:complexType> <xs:complexType name="image" mixed="true"> <xs:attribute type="xs:string" name="src" /> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=1686666&r1=1686665&r2=1686666&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Sat Jun 20 19:41:05 2015 @@ -1263,22 +1263,6 @@ under the License. <xs:documentation>Specifies the string to display, can use the ${} syntax to insert context values; if empty the value of the field will be printed for a default.</xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute name="request-confirmation" default="false"> - <xs:annotation> - <xs:documentation>If true then the user is presented with a dialog box, if confirmation-message is empty, use default</xs:documentation> - </xs:annotation> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="confirmation-message" type="xs:string"> - <xs:annotation> - <xs:documentation>The message displayed in confirmation box</xs:documentation> - </xs:annotation> - </xs:attribute> <xs:attribute name="also-hidden" default="true"> <xs:annotation> <xs:documentation>If set to true, an hidden form field is also rendered, with the name of the field and its content.</xs:documentation> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/CommonWidgetModels.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/CommonWidgetModels.java?rev=1686666&r1=1686665&r2=1686666&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/CommonWidgetModels.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/CommonWidgetModels.java Sat Jun 20 19:41:05 2015 @@ -329,6 +329,8 @@ public final class CommonWidgetModels { private final FlexibleStringExpander targetWindowExdr; private final FlexibleStringExpander textExdr; private final String urlMode; + private final boolean requestConfirmation; + private final FlexibleStringExpander confirmationMsgExdr; // FIXME: These don't belong in this class (might have been used for image) private final String height; private final String width; @@ -386,6 +388,8 @@ public final class CommonWidgetModels { size = Integer.valueOf(sizeAttr); } this.size = size; + this.requestConfirmation = "true".equals(linkElement.getAttribute("request-confirmation")); + this.confirmationMsgExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("confirmation-message")); this.width = linkElement.getAttribute("width"); this.height = linkElement.getAttribute("height"); } @@ -409,6 +413,8 @@ public final class CommonWidgetModels { this.textExdr = FlexibleStringExpander.getInstance((String) portalPage.get("portalPageName", locale)); this.urlMode = "intra-app"; this.size = null; + this.requestConfirmation = false; + this.confirmationMsgExdr = FlexibleStringExpander.getInstance(""); this.width = ""; this.height = ""; } @@ -421,6 +427,14 @@ public final class CommonWidgetModels { return autoServiceParameters; } + public String getConfirmationMsg(Map<String, Object> context) { + return this.confirmationMsgExdr.expandString(context); + } + + public FlexibleStringExpander getConfirmationMsgExdr() { + return confirmationMsgExdr; + } + public boolean getEncode() { return this.encode; } @@ -487,6 +501,10 @@ public final class CommonWidgetModels { return prefixExdr; } + public boolean getRequestConfirmation() { + return this.requestConfirmation; + } + public boolean getSecure() { return this.secure; } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/ModelFormField.java?rev=1686666&r1=1686665&r2=1686666&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/ModelFormField.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/ModelFormField.java Sat Jun 20 19:41:05 2015 @@ -74,7 +74,6 @@ import org.ofbiz.widget.renderer.FormRen import org.ofbiz.widget.renderer.FormStringRenderer; import org.ofbiz.widget.renderer.MenuStringRenderer; import org.ofbiz.widget.renderer.ScreenRenderer; -import org.ofbiz.widget.renderer.ScreenStringRenderer; import org.w3c.dom.Element; import bsh.EvalError; @@ -2333,17 +2332,13 @@ public class ModelFormField { public static class HyperlinkField extends FieldInfo { private final boolean alsoHidden; - private final FlexibleStringExpander confirmationMsgExdr; private final FlexibleStringExpander description; - private final boolean requestConfirmation; private final Link link; public HyperlinkField(Element element, ModelFormField modelFormField) { super(element, modelFormField); this.alsoHidden = !"false".equals(element.getAttribute("also-hidden")); - this.confirmationMsgExdr = FlexibleStringExpander.getInstance(element.getAttribute("confirmation-message")); this.description = FlexibleStringExpander.getInstance(element.getAttribute("description")); - this.requestConfirmation = "true".equals(element.getAttribute("request-confirmation")); // Backwards-compatible fix element.setAttribute("url-mode", element.getAttribute("target-type")); this.link = new Link(element); @@ -2352,9 +2347,7 @@ public class ModelFormField { private HyperlinkField(HyperlinkField original, ModelFormField modelFormField) { super(original.getFieldSource(), original.getFieldType(), modelFormField); this.alsoHidden = original.alsoHidden; - this.confirmationMsgExdr = original.confirmationMsgExdr; this.description = original.description; - this.requestConfirmation = original.requestConfirmation; this.link = original.link; } @@ -2406,11 +2399,11 @@ public class ModelFormField { } public String getConfirmationMsg(Map<String, Object> context) { - return this.confirmationMsgExdr.expandString(context); + return link.getConfirmationMsg(context); } public FlexibleStringExpander getConfirmationMsgExdr() { - return confirmationMsgExdr; + return link.getConfirmationMsgExdr(); } public FlexibleStringExpander getDescription() { @@ -2422,7 +2415,7 @@ public class ModelFormField { } public boolean getRequestConfirmation() { - return this.requestConfirmation; + return link.getRequestConfirmation(); } public Link getLink() { |
Free forum by Nabble | Edit this page |