Improved: Move page-specific script links to html template (OFBIZ-11799)
Use importLibrary js function to load locale-specific datepicker js. Corrected locale naming in macro to use '.locale'. Tested page at /ordermgr/control/findreturn and /ordermgr/control/orderentry.
This commit is contained in:
@@ -92,9 +92,10 @@ under the License.
|
||||
|
||||
<#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="">
|
||||
<span class="view-calendar">
|
||||
<#local cultureInfo = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("datejs", locale)/>
|
||||
<#local cultureInfo = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("datejs", .locale)/>
|
||||
<#local datePickerLang = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("jquery", .locale)/>
|
||||
<#local timePicker = "/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.js,/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.css">
|
||||
<#local timePickerLang = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("dateTime", locale)/>
|
||||
<#local timePickerLang = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("dateTime", .locale)/>
|
||||
<#if dateType!="time" >
|
||||
<input type="text" <#if tabindex?has_content> tabindex="${tabindex}"</#if> name="${name}_i18n" <@renderClass className alert /><#rt/>
|
||||
<#if title?has_content> title="${title}"</#if>
|
||||
@@ -112,6 +113,7 @@ under the License.
|
||||
<#if maxlength?has_content> maxlength="${maxlength}"</#if>
|
||||
<#if mask?has_content> data-mask="${mask}"</#if><#rt/>
|
||||
<#if cultureInfo?has_content> data-cultureinfo="${cultureInfo}"</#if><#rt/>
|
||||
<#if datePickerLang?has_content> data-datepickerlang="${datePickerLang}"</#if><#rt/>
|
||||
<#if timePicker?has_content> data-timepicker="${timePicker}"</#if><#rt/>
|
||||
<#if timePickerLang?has_content> data-timepickerlang="${timePickerLang}"</#if><#rt/>
|
||||
data-shortdate="${shortDateInput?string}"
|
||||
@@ -413,9 +415,10 @@ under the License.
|
||||
<#local className = className + " date-time-picker"/>
|
||||
</#if>
|
||||
<#local shortDateInput = "date" == dateType/>
|
||||
<#local cultureInfo = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("datejs", locale)/>
|
||||
<#local cultureInfo = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("datejs", .locale)/>
|
||||
<#local datePickerLang = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("jquery", .locale)/>
|
||||
<#local timePicker = "/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.js,/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.css"/>
|
||||
<#local timePickerLang = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("dateTime", locale)/>
|
||||
<#local timePickerLang = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("dateTime", .locale)/>
|
||||
<span class="view-calendar">
|
||||
<input id="${id}_fld0_value" type="text" <@renderClass className alert />
|
||||
<#if name?has_content> name="${name?html}_fld0_value"</#if>
|
||||
@@ -425,6 +428,7 @@ under the License.
|
||||
<#if maxlength?has_content> maxlength="${maxlength}"</#if>
|
||||
<#if tabindex?has_content> tabindex="${tabindex}"</#if><#rt/>
|
||||
<#if cultureInfo?has_content> data-cultureinfo="${cultureInfo}"</#if><#rt/>
|
||||
<#if datePickerLang?has_content> data-datepickerlang="${datePickerLang}"</#if><#rt/>
|
||||
<#if timePicker?has_content> data-timepicker="${timePicker}"</#if><#rt/>
|
||||
<#if timePickerLang?has_content> data-timepickerlang="${timePickerLang}"</#if><#rt/>
|
||||
data-shortdate="${shortDateInput?string}"
|
||||
@@ -449,6 +453,7 @@ under the License.
|
||||
<#if size?has_content> size="${size}"</#if>
|
||||
<#if maxlength?has_content> maxlength="${maxlength}"</#if>
|
||||
<#if cultureInfo?has_content> data-cultureinfo="${cultureInfo}"</#if><#rt/>
|
||||
<#if datePickerLang?has_content> data-datepickerlang="${datePickerLang}"</#if><#rt/>
|
||||
<#if timePicker?has_content> data-timePicker="${timePicker}"</#if><#rt/>
|
||||
<#if timePickerLang?has_content> data-timepickerlang="${timePickerLang}"</#if><#rt/>
|
||||
data-shortdate="${shortDateInput?string}"
|
||||
|
||||
@@ -389,22 +389,25 @@ function bindObservers(bind_element) {
|
||||
});
|
||||
}
|
||||
});
|
||||
var libDatePickerLang = [element.data("datepickerlang")];
|
||||
if (shortDate) {
|
||||
element.datepicker({
|
||||
showWeek: true,
|
||||
showOn: 'button',
|
||||
buttonImage: '',
|
||||
buttonText: '',
|
||||
buttonImageOnly: false,
|
||||
dateFormat: 'yy-mm-dd'
|
||||
})
|
||||
importLibrary(libDatePickerLang, function () {
|
||||
element.datepicker({
|
||||
showWeek: true,
|
||||
showOn: 'button',
|
||||
buttonImage: '',
|
||||
buttonText: '',
|
||||
buttonImageOnly: false,
|
||||
dateFormat: 'yy-mm-dd'
|
||||
})
|
||||
});
|
||||
} else {
|
||||
var libTimePicker = element.data("timepicker");
|
||||
if (libTimePicker) {
|
||||
libTimePicker = libTimePicker.split(",");
|
||||
importLibrary(libTimePicker, function () {
|
||||
var libTimePickerLang = [element.data("timepickerlang")];
|
||||
importLibrary(libTimePickerLang, function () {
|
||||
var libDateTimePickerLang = libDatePickerLang.concat([element.data("timepickerlang")]);
|
||||
importLibrary(libDateTimePickerLang, function () {
|
||||
element.datetimepicker({
|
||||
showSecond: true,
|
||||
// showMillisec: true,
|
||||
|
||||
@@ -122,7 +122,6 @@ under the License.
|
||||
<screen name="GlobalActions">
|
||||
<section>
|
||||
<actions>
|
||||
<set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.JQuery.getFilePath(initialLocaleComplete)}" global="true" />
|
||||
<set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.Validation.getFilePath(initialLocaleComplete)}" global="true" />
|
||||
<!-- Jgrowl -->
|
||||
<set field="layoutSettings.styleSheets[+0]" value="/common/js/jquery/plugins/jquery-jgrowl/jquery.jgrowl-1.4.6.min.css" global="true" />
|
||||
@@ -428,7 +427,6 @@ under the License.
|
||||
<!-- The default (global) java scripts -->
|
||||
<!-- jQuery part -->
|
||||
<!-- Load available JS Language Files -->
|
||||
<set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.JQuery.getFilePath(initialLocaleComplete)}" global="true"/>
|
||||
<set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.Validation.getFilePath(initialLocaleComplete)}" global="true"/>
|
||||
|
||||
<set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/ui/jquery-ui-1.12.1.min.js" global="true"/>
|
||||
|
||||
Reference in New Issue
Block a user