Author: jleroux
Date: Thu Apr 29 06:39:25 2010 New Revision: 939216 URL: http://svn.apache.org/viewvc?rev=939216&view=rev Log: An improving patch from Chris Snow "Provide better user help" (https://issues.apache.org/jira/browse/OFBIZ-3702) - OFBIZ-3702 Answers 3 of 4 points Scott outlined on dev ML Modified: ofbiz/trunk/framework/example/widget/example/ExampleForms.xml ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/UtilHelpText.java Modified: ofbiz/trunk/framework/example/widget/example/ExampleForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleForms.xml?rev=939216&r1=939215&r2=939216&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleForms.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleForms.xml Thu Apr 29 06:39:25 2010 @@ -93,7 +93,7 @@ under the License. <on-event-update-area event-type="paginate" area-id="ListExamplesAjax" area-target="ListExampleFormOnly"/> </form> - <form name="EditExample" type="single" target="updateExample" title="" default-map-name="example"> + <form name="EditExample" type="single" target="updateExample" title="" default-map-name="example" default-entity-name="Example"> <actions> <entity-one entity-name="StatusItem" value-field="currentStatus" auto-field-map="false"> <field-map field-name="statusId" from-field="example.statusId"/> @@ -101,7 +101,7 @@ under the License. </actions> <alt-target use-when="example==null" target="createExample"/> <auto-fields-service service-name="updateExample"/> - <field use-when="example!=null" name="exampleId" title="${uiLabelMap.ExampleExampleId}" tooltip="${uiLabelMap.CommonNotModifRecreat}" entity-name="Example"><display/></field> + <field use-when="example!=null" name="exampleId" title="${uiLabelMap.ExampleExampleId}" tooltip="${uiLabelMap.CommonNotModifRecreat}"><display/></field> <field use-when="example==null @and exampleId==null" name="exampleId" title="${uiLabelMap.ExampleExampleId}"><ignored/></field> <field use-when="example==null @and exampleId!=null" name="exampleId" title="${uiLabelMap.ExampleExampleId}"><display description="${uiLabelMap.CommonCannotBeFound}: [${exampleId}]" also-hidden="false"/></field> <field name="exampleTypeId" title="${uiLabelMap.CommonType}" id-name="exampleTypeId"> @@ -112,12 +112,12 @@ under the License. </entity-options> </drop-down> </field> - <field name="statusId" use-when="example==null" title="${uiLabelMap.CommonStatus}" entity-name="Example"> + <field name="statusId" use-when="example==null" title="${uiLabelMap.CommonStatus}"> <drop-down allow-empty="false"> <entity-options entity-name="ExampleStatusItem" description="${description}"/> </drop-down> </field> - <field name="statusId" use-when="example!=null" title="${uiLabelMap.CommonStatus}" entity-name="Example"> + <field name="statusId" use-when="example!=null" title="${uiLabelMap.CommonStatus}"> <drop-down allow-empty="false" current-description="${currentStatus.description}"> <entity-options entity-name="StatusValidChangeToDetail" key-field-name="statusIdTo" description="${transitionName} (${description})"> <entity-constraint name="statusId" env-name="example.statusId"/> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=939216&r1=939215&r2=939216&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Thu Apr 29 06:39:25 2010 @@ -1203,19 +1203,20 @@ public class MacroFormRenderer implement style = requiredStyle; } } - Delegator delegator = (Delegator)request.getAttribute("delegator"); - Locale locale = (Locale)context.get("locale"); - String entityName = modelFormField.getEntityName(); - String fieldName = modelFormField.getFieldName(); - String helpText = UtilHelpText.getHelp(entityName, fieldName, delegator, locale); - - String displayHelpText = UtilProperties.getPropertyValue("widget.properties", "widget.form.displayhelpText"); StringWriter sr = new StringWriter(); sr.append("<@renderFieldTitle "); sr.append(" style=\""); sr.append(style); + + String displayHelpText = UtilProperties.getPropertyValue("widget.properties", "widget.form.displayhelpText"); if ("Y".equals(displayHelpText)) { + Delegator delegator = modelFormField.getModelForm().getDelegator(context); + Locale locale = (Locale)context.get("locale"); + String entityName = modelFormField.getEntityName(); + String fieldName = modelFormField.getFieldName(); + String helpText = UtilHelpText.getEntityFieldDescription(entityName, fieldName, delegator, locale); + sr.append("\" fieldHelpText=\""); sr.append(FreeMarkerWorker.encodeDoubleQuotes(helpText)); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/UtilHelpText.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/UtilHelpText.java?rev=939216&r1=939215&r2=939216&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/UtilHelpText.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/UtilHelpText.java Thu Apr 29 06:39:25 2010 @@ -26,7 +26,7 @@ public class UtilHelpText { * @param locale the locale * @return the help text, or the resource propertyName if no help text exists */ - public static String getHelp(final String entityName, final String fieldName, final Delegator delegator, final Locale locale) { + public static String getEntityFieldDescription(final String entityName, final String fieldName, final Delegator delegator, final Locale locale) { if (UtilValidate.isEmpty(entityName)) { Debug.logWarning("entityName [" + entityName + "] is empty", module); |
Free forum by Nabble | Edit this page |