From 3b7e63744c9148b0c9c8130a5a818d33dcebda3c Mon Sep 17 00:00:00 2001 From: Pawan Verma Date: Tue, 19 May 2020 17:37:24 +0530 Subject: [PATCH] Improved: Expansion of form widget field disabled atrribute with xsd improvement (#141) (OFBIZ-10432) 1. Added disabled attribute support in ModelFormField with xs:boolean type 2. Removed specific field level disabled attribute support for CheckField and TextField 3. Modified existing usage of disabled attribute as per new implementation. Thanks: Rishi for the report and Taher, Gil and Jacques for the feedback --- .../accounting/widget/InvoiceForms.xml | 2 +- .../product/widget/catalog/ReviewForms.xml | 2 +- framework/widget/dtd/widget-form.xsd | 10 +------- .../ofbiz/widget/model/ModelFormField.java | 25 +++++-------------- .../widget/model/ModelFormFieldBuilder.java | 9 +++++++ .../widget/model/XmlWidgetFieldVisitor.java | 2 -- .../renderer/macro/MacroFormRenderer.java | 24 +++++++++++++----- .../template/macro/CsvFormMacroLibrary.ftl | 8 +++--- .../template/macro/FoFormMacroLibrary.ftl | 8 +++--- .../template/macro/HtmlFormMacroLibrary.ftl | 14 ++++++----- .../template/macro/TextFormMacroLibrary.ftl | 8 +++--- .../template/macro/XlsFormMacroLibrary.ftl | 8 +++--- .../template/macro/XmlFormMacroLibrary.ftl | 8 +++--- 13 files changed, 64 insertions(+), 64 deletions(-) diff --git a/applications/accounting/widget/InvoiceForms.xml b/applications/accounting/widget/InvoiceForms.xml index 40e255057ca..b141f80f166 100644 --- a/applications/accounting/widget/InvoiceForms.xml +++ b/applications/accounting/widget/InvoiceForms.xml @@ -513,7 +513,7 @@ under the License. - + diff --git a/applications/product/widget/catalog/ReviewForms.xml b/applications/product/widget/catalog/ReviewForms.xml index 663a98c292e..c7f6a21ee30 100644 --- a/applications/product/widget/catalog/ReviewForms.xml +++ b/applications/product/widget/catalog/ReviewForms.xml @@ -64,7 +64,7 @@ under the License. - + <#lt/> -<#macro renderDateTimeField name className alert dateType timeDropdownParamName defaultDateTimeString localizedIconTitle timeHourName timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType timeDropdown="" classString="" hour1="" hour2="" shortDateInput="" title="" value="" size="" maxlength="" id="" formName="" mask="" event="" action="" step="" timeValues="" tabindex="" > +<#macro renderDateTimeField name className alert dateType timeDropdownParamName defaultDateTimeString localizedIconTitle timeHourName timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType timeDropdown="" classString="" hour1="" hour2="" shortDateInput="" title="" value="" size="" maxlength="" id="" formName="" mask="" event="" action="" step="" timeValues="" tabindex="" disabled=""> <#if dateType!="time" > tabindex="${tabindex}" name="${name}_i18n" <@renderClass className alert /><#rt/> @@ -97,6 +98,7 @@ under the License. <#if value?has_content> value="${value}" <#if size?has_content> size="${size}"<#rt/> <#if maxlength?has_content> maxlength="${maxlength}" + <#if disabled?has_content> disabled="${disabled}"<#rt/> <#if id?has_content> id="${id}_i18n"/><#rt/> <#local className = className + " date-time-picker"/> @@ -140,12 +142,12 @@ under the License. -<#macro renderDropDownField name className alert id formName action explicitDescription options fieldName otherFieldName otherValue otherFieldSize ajaxEnabled ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup="" tabindex="" multiple="" event="" size="" firstInList="" currentValue="" allowEmpty="" dDFCurrent="" noCurrentSelectedKey=""> +<#macro renderDropDownField name className alert id formName action explicitDescription options fieldName otherFieldName otherValue otherFieldSize ajaxEnabled ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup="" tabindex="" multiple="" event="" size="" firstInList="" currentValue="" allowEmpty="" dDFCurrent="" noCurrentSelectedKey="" disabled=""> <#if conditionGroup?has_content> - " <@renderClass className alert /><#if id?has_content> id="${id}"<#if multiple?has_content> multiple="multiple"<#if ajaxEnabled> class="autoCompleteDropDown"<#if event?has_content> ${event}="${action}"<#if size?has_content> size="${size}"<#if tabindex?has_content> tabindex="${tabindex}"<#if disabled?has_content && disabled> disabled="${disabled}"<#rt/> <#if otherFieldName?has_content> data-other-field-name="${otherFieldName}" data-other-field-value='${otherValue?js_string}' @@ -189,14 +191,14 @@ under the License. -<#macro renderRadioField items className alert name action conditionGroup="" currentValue="" noCurrentSelectedKey="" event="" tabindex=""> +<#macro renderRadioField items className alert name action conditionGroup="" currentValue="" noCurrentSelectedKey="" event="" tabindex="" disabled=""> <#if conditionGroup?has_content> <#list items as item> ><#rt/> <#if currentValue==item.key> checked="checked"<#if tabindex?has_content> tabindex="${tabindex}"<#rt/> - <#elseif noCurrentSelectedKey?has_content && noCurrentSelectedKey == item.key> checked="checked" + <#elseif noCurrentSelectedKey?has_content && noCurrentSelectedKey == item.key> checked="checked"<#if disabled?has_content> disabled="${disabled}" name="${name?default("")?html}" value="${item.key?default("")?html}"<#if event?has_content> ${event}="${action}"/><#rt/> ${item.description} diff --git a/themes/common-theme/template/macro/TextFormMacroLibrary.ftl b/themes/common-theme/template/macro/TextFormMacroLibrary.ftl index 0e97938ad4b..c7303e8e384 100644 --- a/themes/common-theme/template/macro/TextFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/TextFormMacroLibrary.ftl @@ -26,11 +26,11 @@ under the License. <#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask tabindex readonly placeholder="" delegatorName="default"><@renderField value /> -<#macro renderTextareaField name className alert cols rows maxlength id readonly value visualEditorEnable buttons tabindex language=""><@renderField value /> +<#macro renderTextareaField name className alert cols rows maxlength id readonly value visualEditorEnable buttons tabindex language="" disabled=""><@renderField value /> -<#macro renderDateTimeField name className alert title value size maxlength id dateType shortDateInput timeDropdownParamName defaultDateTimeString localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName mask="" event="" action="" step="" timeValues="" tabindex="" ><@renderField value /> +<#macro renderDateTimeField name className alert title value size maxlength id dateType shortDateInput timeDropdownParamName defaultDateTimeString localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName mask="" event="" action="" step="" timeValues="" tabindex="" disabled=""><@renderField value /> -<#macro renderDropDownField name className alert id multiple formName otherFieldName event action size firstInList currentValue explicitDescription allowEmpty options fieldName otherFieldName otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup tabindex> +<#macro renderDropDownField name className alert id multiple formName otherFieldName event action size firstInList currentValue explicitDescription allowEmpty options fieldName otherFieldName otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup tabindex disabled> <#if currentValue?has_content && firstInList?has_content> <@renderField explicitDescription /> <#else> @@ -42,7 +42,7 @@ under the License. <#macro renderTooltip tooltip tooltipStyle> <#macro renderCheckField items className alert id allChecked currentValue name event action conditionGroup tabindex disabled> -<#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex> +<#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex disabled> <#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl tabindex> <#macro renderResetField className alert name title> diff --git a/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl b/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl index 0472f2da759..6d50f946295 100644 --- a/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl @@ -32,19 +32,19 @@ under the License. <#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask tabindex readonly placeholder="" delegatorName="default"><@renderItemField value "txf" className/> -<#macro renderTextareaField name className alert cols rows maxlength id readonly value visualEditorEnable buttons tabindex language=""> +<#macro renderTextareaField name className alert cols rows maxlength id readonly value visualEditorEnable buttons tabindex language="" disabled=""> -<#macro renderDateTimeField name className alert title value size maxlength id dateType shortDateInput timeDropdownParamName defaultDateTimeString localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName mask="" event="" action="" step="" timeValues="" tabindex="" > +<#macro renderDateTimeField name className alert title value size maxlength id dateType shortDateInput timeDropdownParamName defaultDateTimeString localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName mask="" event="" action="" step="" timeValues="" tabindex="" disabled=""> <#if dateType=="time" ><@renderItemField value "tf" className/> <#elseif dateType=="date"><@renderItemField value "dt" className/> <#else><@renderItemField value "dtf" className/> -<#macro renderDropDownField name className alert id multiple formName otherFieldName event action size firstInList currentValue explicitDescription allowEmpty options fieldName otherFieldName otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup tabindex><@renderItemField explicitDescription "txf" className/> +<#macro renderDropDownField name className alert id multiple formName otherFieldName event action size firstInList currentValue explicitDescription allowEmpty options fieldName otherFieldName otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup tabindex disabled><@renderItemField explicitDescription "txf" className/> <#macro renderCheckField items className alert id allChecked currentValue name event action conditionGroup tabindex disabled><@renderItemField currentValue "txf" className/> -<#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex><@renderItemField currentValue "txf" className/> +<#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex disabled><@renderItemField currentValue "txf" className/> <#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl tabindex> diff --git a/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl index acc2f28752d..6780b8cd503 100644 --- a/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl @@ -42,15 +42,15 @@ under the License. <#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask tabindex readonly placeholder="" delegatorName="default"><@renderField value/> -<#macro renderTextareaField name className alert cols rows maxlength id readonly value visualEditorEnable buttons tabindex language=""><@renderField value/> +<#macro renderTextareaField name className alert cols rows maxlength id readonly value visualEditorEnable buttons tabindex language="" disabled=""><@renderField value/> -<#macro renderDateTimeField name className alert title value size maxlength id dateType shortDateInput timeDropdownParamName defaultDateTimeString localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName mask="" event="" action="" step="" timeValues="" tabindex="" ><@renderField value/> +<#macro renderDateTimeField name className alert title value size maxlength id dateType shortDateInput timeDropdownParamName defaultDateTimeString localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName mask="" event="" action="" step="" timeValues="" tabindex="" disabled=""><@renderField value/> -<#macro renderDropDownField name className alert id multiple formName otherFieldName event action size firstInList currentValue explicitDescription allowEmpty options fieldName otherFieldName otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup tabindex> +<#macro renderDropDownField name className alert id multiple formName otherFieldName event action size firstInList currentValue explicitDescription allowEmpty options fieldName otherFieldName otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup tabindex disabled> <#macro renderCheckField items className alert id allChecked currentValue name event action conditionGroup tabindex disabled> -<#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex> +<#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex disabled> <#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl tabindex> <#macro renderResetField className alert name title>