Author: hansbak
Date: Mon Jun 22 04:23:50 2009 New Revision: 787138 URL: http://svn.apache.org/viewvc?rev=787138&view=rev Log: allow date-time attribute on a display field Modified: ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml ofbiz/trunk/framework/widget/dtd/widget-form.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Modified: ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml?rev=787138&r1=787137&r2=787138&view=diff ============================================================================== --- ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml (original) +++ ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml Mon Jun 22 04:23:50 2009 @@ -21,15 +21,15 @@ <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd"> - <form name="SystemInfoNotes" type="list" list-name="systemInfoNotes" + <form name="SystemInfoNotes" type="list" list-name="systemInfoNotes" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> - <field name="noteDateTime" title="Date info created"><display/></field> + <field name="noteDateTime" title="Date info created"><display type="date-time"/></field> <field name="noteInfo" title="System Info Note"><hyperlink target="/myportal/control/showPortletDecorator?portalPortletId=${moreInfoPortletId}" target-type="inter-app" description="${noteInfo}"></hyperlink></field> </form> <form name="SystemInfoStatus" type="list" list-name="systemInfoStatus" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> - <field name="noteDateTime" title="Date Last Changed"><display/></field> + <field name="noteDateTime" title="Date Last Changed"><display type="date-time"/></field> <field name="noteInfo" title="System Info Status"><hyperlink target="/myportal/control/showPortletDecorator?portalPortletId=${moreInfoPortletId}" target-type="inter-app" description="${noteInfo}"></hyperlink></field> </form> </forms> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=787138&r1=787137&r2=787138&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Mon Jun 22 04:23:50 2009 @@ -662,6 +662,9 @@ <xs:enumeration value="date"> <xs:annotation><xs:documentation>Display only the date part of a timestamp field</xs:documentation></xs:annotation> </xs:enumeration> + <xs:enumeration value="date-time"> + <xs:annotation><xs:documentation>Display only the date and hours:minutes part of a timestamp field</xs:documentation></xs:annotation> + </xs:enumeration> </xs:restriction> </xs:simpleType> </xs:attribute> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=787138&r1=787137&r2=787138&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Mon Jun 22 04:23:50 2009 @@ -757,6 +757,7 @@ } else { returnValue = retVal.toString(); } + return returnValue; // do not encode date and number type fields } else { returnValue = defaultValue; } @@ -2057,7 +2058,7 @@ if (this.description != null && !this.description.isEmpty()) { retVal = this.description.expandString(context); } else { - retVal = modelFormField.getEntry(context); + retVal = this.modelFormField.getEntry(context); } if (retVal == null || retVal.length() == 0) { retVal = ""; @@ -2068,7 +2069,8 @@ String isoCode = null; if (this.currency != null && !this.currency.isEmpty()) { isoCode = this.currency.expandString(context); - } + } + try { BigDecimal parsedRetVal = (BigDecimal) ObjectType.simpleTypeConvert(retVal, "BigDecimal", null, null, locale, true); retVal = UtilFormatOut.formatCurrency(parsedRetVal, isoCode, locale, 10); // we set the max to 10 digits as an hack to not round numbers in the ui @@ -2077,8 +2079,10 @@ Debug.logError(e, errMsg, module); throw new IllegalArgumentException(errMsg); } - } else if ("date".equals(type) && retVal.length() > 10) { + } else if ("date".equals(this.type) && retVal.length() > 10) { retVal = retVal.substring(0,10); + } else if ("date-time".equals(this.type) && retVal.length() > 16) { + retVal = retVal.substring(0,16); } return retVal; } |
Free forum by Nabble | Edit this page |