[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new e405d35 Improved: Move page-specific script links to html template (OFBIZ-11799) e405d35 is described below commit e405d35c080a94c07205a24ea4d2dedeab8aa4a9 Author: James Yong AuthorDate: Sat Dec 5 23:23:04 2020 +0800 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. --- .../template/macro/HtmlFormMacroLibrary.ftl| 13 .../webapp/common/js/util/OfbizUtil.js | 23 -- themes/common-theme/widget/CommonScreens.xml | 2 -- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl index 5a4fb0a..3d3feac 100644 --- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl @@ -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=""> -<#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" > tabindex="${tabindex}" name="${name}_i18n" <@renderClass className alert /><#rt/> <#if title?has_content> title="${title}" @@ -112,6 +113,7 @@ under the License. <#if maxlength?has_content> maxlength="${maxlength}" <#if mask?has_content> data-mask="${mask}"<#rt/> <#if cultureInfo?has_content> data-cultureinfo="${cultureInfo}"<#rt/> + <#if datePickerLang?has_content> data-datepickerlang="${datePickerLang}"<#rt/> <#if timePicker?has_content> data-timepicker="${timePicker}"<#rt/> <#if timePickerLang?has_content> data-timepickerlang="${timePickerLang}"<#rt/> data-shortdate="${shortDateInput?string}" @@ -413,9 +415,10 @@ under the License. <#local className = className + " date-time-picker"/> <#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)/> <#if name?has_content> name="${name?html}_fld0_value" @@ -425,6 +428,7 @@ under the License. <#if maxlength?has_content> maxlength="${maxlength}" <#if tabindex?has_content> tabindex="${tabindex}"<#rt/> <#if cultureInfo?has_content> data-cultureinfo="${cultureInfo}"<#rt/> +<#if datePickerLang?has_content> data-datepickerlang="${datePickerLang}"<#rt/> <#if timePicker?has_content> data-timepicker="${timePicker}"<#rt/> <#if timePickerLang?has_content> data-timepickerlang="${timePickerLang}"<#rt/> data-shortdate="${shortDateInput?string}" @@ -449,6 +453,7 @@ under the License. <#if size?has_content> size="${size}" <#if maxlength?has_content>
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new a3fbb66 Improved: Move page-specific script links to html template (OFBIZ-11799) a3fbb66 is described below commit a3fbb66479ec5b985998d2b929456258e2256280 Author: James Yong AuthorDate: Mon Nov 30 10:29:08 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load time-related js and css for date time picker. Tested page at /ordermgr/control/findreturn and /ordermgr/control/orderentry --- .../template/macro/HtmlFormMacroLibrary.ftl| 10 +++ .../webapp/common/js/util/OfbizUtil.js | 35 ++ themes/common-theme/widget/CommonScreens.xml | 4 --- themes/common-theme/widget/Theme.xml | 2 -- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl index bec17c0..5a4fb0a 100644 --- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl @@ -93,6 +93,8 @@ 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=""> <#local cultureInfo = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("datejs", 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)/> <#if dateType!="time" > tabindex="${tabindex}" name="${name}_i18n" <@renderClass className alert /><#rt/> <#if title?has_content> title="${title}" @@ -110,6 +112,8 @@ under the License. <#if maxlength?has_content> maxlength="${maxlength}" <#if mask?has_content> data-mask="${mask}"<#rt/> <#if cultureInfo?has_content> data-cultureinfo="${cultureInfo}"<#rt/> + <#if timePicker?has_content> data-timepicker="${timePicker}"<#rt/> + <#if timePickerLang?has_content> data-timepickerlang="${timePickerLang}"<#rt/> data-shortdate="${shortDateInput?string}" <#if id?has_content> id="${id}"/><#rt/> <#if timeDropdown?has_content && timeDropdown=="time-dropdown"> @@ -410,6 +414,8 @@ under the License. <#local shortDateInput = "date" == dateType/> <#local cultureInfo = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("datejs", 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)/> <#if name?has_content> name="${name?html}_fld0_value" @@ -419,6 +425,8 @@ under the License. <#if maxlength?has_content> maxlength="${maxlength}" <#if tabindex?has_content> tabindex="${tabindex}"<#rt/> <#if cultureInfo?has_content> data-cultureinfo="${cultureInfo}"<#rt/> +<#if timePicker?has_content> data-timepicker="${timePicker}"<#rt/> +<#if timePickerLang?has_content> data-timepickerlang="${timePickerLang}"<#rt/> data-shortdate="${shortDateInput?string}" /> <#if titleStyle?has_content> @@ -441,6 +449,8 @@ under the License. <#if size?has_content> size="${size}" <#if maxlength?has_content> maxlength="${maxlength}" <#if cultureInfo?has_content> data-cultureinfo="${cultureInfo}"<#rt/> +<#if timePicker?has_content> data-timePicker="${timePicker}"<#rt/> +<#if timePickerLang?has_content> data-timepickerlang="${timePickerLang}"<#rt/> data-shortdate="${shortDateInput?string}" /><#rt/> <#if titleStyle?has_content> diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 73c31f3..bf3f469 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -399,19 +399,28 @@ function bindObservers(bind_element) { dateFormat: 'yy-mm-dd' }) } else { -
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 8403157 Improved: Move page-specific script links to html template (OFBIZ-11799) 8403157 is described below commit 840315781a8698179293a5124c0a96b36b1b332f Author: James Yong AuthorDate: Tue Sep 1 22:10:37 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load jeditable js Tested page at example/control/authview/findExampleAjax --- .../webapp/common/js/util/OfbizUtil.js | 38 -- themes/common-theme/widget/CommonScreens.xml | 1 - themes/common-theme/widget/Theme.xml | 1 - themes/docs/themes.adoc| 1 - 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index c662c01..65f1940 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -1038,24 +1038,26 @@ function ajaxInPlaceEditDisplayField(element, url, options) { jQuery(this).css('background-color', 'transparent'); }); -jElement.editable(function(value, settings){ -// removes all line breaks from the value param, because the parseJSON Function can't work with line breaks -value = value.replace(/\n/g, " "); -value = value.replace(/\"/g,""); - -var resultField = jQuery.parseJSON('{"' + settings.name + '":"' + value + '"}'); -// merge both parameter objects together -jQuery.extend(settings.submitdata, resultField); -jQuery.ajax({ -type : settings.method, -url : url, -data : settings.submitdata, -success : function(data) { -// adding the new value to the field and make the modified field 'blink' a little bit to show the user that somethink have changed - jElement.text(value).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).css('background-color', 'transparent'); -} -}); -}, options); + importLibrary(["/common/js/jquery/plugins/jeditable/jquery.jeditable-1.7.3.js"], function() { +jElement.editable(function (value, settings) { +// removes all line breaks from the value param, because the parseJSON Function can't work with line breaks +value = value.replace(/\n/g, " "); +value = value.replace(/\"/g, ""); + +var resultField = jQuery.parseJSON('{"' + settings.name + '":"' + value + '"}'); +// merge both parameter objects together +jQuery.extend(settings.submitdata, resultField); +jQuery.ajax({ +type: settings.method, +url: url, +data: settings.submitdata, +success: function (data) { +// adding the new value to the field and make the modified field 'blink' a little bit to show the user that somethink have changed + jElement.text(value).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).css('background-color', 'transparent'); +} +}); +}, options); +}); } // = End of Ajax Functions = // diff --git a/themes/common-theme/widget/CommonScreens.xml b/themes/common-theme/widget/CommonScreens.xml index 41b236e..5a51420 100644 --- a/themes/common-theme/widget/CommonScreens.xml +++ b/themes/common-theme/widget/CommonScreens.xml @@ -437,7 +437,6 @@ under the License. - diff --git a/themes/common-theme/widget/Theme.xml b/themes/common-theme/widget/Theme.xml index f4b842c..6730d5f 100644 --- a/themes/common-theme/widget/Theme.xml +++ b/themes/common-theme/widget/Theme.xml @@ -62,7 +62,6 @@ under the License. - diff --git a/themes/docs/themes.adoc b/themes/docs/themes.adoc index e30f3e1..6f08147 100644 --- a/themes/docs/themes.adoc +++ b/themes/docs/themes.adoc @@ -287,7 +287,6 @@ The blue light theme has been these properties in VisualThemeRessource : -
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new fc44f9c Improved: Move page-specific script links to html template (OFBIZ-11799) fc44f9c is described below commit fc44f9ce3bbf5d2c95d5c887003b6b11c3cd7c7d Author: James Yong AuthorDate: Sun Aug 30 21:25:10 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load fjTimer/jquerytimer-min.js Tested on /partymgr/control/viewprofile?partyId=DemoEmployee --- .../webapp/partymgr/static/PartyProfileContent.js | 70 +++--- .../webapp/common/js/util/OfbizUtil.js | 36 ++- themes/common-theme/widget/CommonScreens.xml | 1 - themes/common-theme/widget/Theme.xml | 1 - themes/docs/themes.adoc| 1 - 5 files changed, 56 insertions(+), 53 deletions(-) diff --git a/applications/party/webapp/partymgr/static/PartyProfileContent.js b/applications/party/webapp/partymgr/static/PartyProfileContent.js index 8765b8a..59e2e04 100644 --- a/applications/party/webapp/partymgr/static/PartyProfileContent.js +++ b/applications/party/webapp/partymgr/static/PartyProfileContent.js @@ -84,40 +84,42 @@ function checkIframeStatus() { } function getUploadProgressStatus(event){ -jQuery('#uploadPartyContent').append("" + uiLabelJsonObjects.CommonUiLabels[0] + "..."); -var i=0; -jQuery.fjTimer({ -interval: 1000, -repeat: true, -tick: function(counter, timerId) { -var timerId = timerId; -jQuery.ajax({ -url: 'getFileUploadProgressStatus', -dataType: 'json', -success: function(data) { -if (data._ERROR_MESSAGE_LIST_ != undefined) { - jQuery('#content-messages').html(data._ERROR_MESSAGE_LIST_); -timerId.stop(); - } else if (data._ERROR_MESSAGE_ != undefined) { - jQuery('#content-messages').html(data._ERROR_MESSAGE_); -timerId.stop(); - } else { -var readPercent = data.readPercent; -jQuery("#progress_bar").progressbar("option", "value", readPercent); - jQuery('#progressBarSavingMsg').html(uiLabelJsonObjects.CommonUiLabels[0] + "... (" + readPercent + "%)"); -if(readPercent > 99){ - jQuery('#progressBarSavingMsg').html(uiLabelJsonObjects.CommonUiLabels[1] + "..."); -// stop the fjTimer +importLibrary(["/common/js/jquery/plugins/fjTimer/jquerytimer-min.js"], function(){ +jQuery('#uploadPartyContent').append("" + uiLabelJsonObjects.CommonUiLabels[0] + "..."); +var i=0; +jQuery.fjTimer({ +interval: 1000, +repeat: true, +tick: function(counter, timerId) { +var timerId = timerId; +jQuery.ajax({ +url: 'getFileUploadProgressStatus', +dataType: 'json', +success: function(data) { +if (data._ERROR_MESSAGE_LIST_ != undefined) { + jQuery('#content-messages').html(data._ERROR_MESSAGE_LIST_); timerId.stop(); -// call the upload complete method to do final stuff -checkIframeStatus(); -} - } -}, -error: function() { - timerId.stop(); -} -}); -} + } else if (data._ERROR_MESSAGE_ != undefined) { + jQuery('#content-messages').html(data._ERROR_MESSAGE_); +timerId.stop(); + } else { +var readPercent = data.readPercent; +jQuery("#progress_bar").progressbar("option", "value", readPercent); + jQuery('#progressBarSavingMsg').html(uiLabelJsonObjects.CommonUiLabels[0] + "... (" + readPercent + "%)"); +if(readPercent > 99){ + jQuery('#progressBarSavingMsg').html(uiLabelJsonObjects.CommonUiLabels[1] + "..."); +// stop the fjTimer +timerId.stop(); +// call the upload complete method to do final stuff +checkIframeStatus(); +} + } +}, +error: function() {
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 5088abe Improved: Move page-specific script links to html template (OFBIZ-11799) 5088abe is described below commit 5088abe59d2c60550fc1ae2298f264716f9bc4a3 Author: James Yong AuthorDate: Sun Aug 23 14:24:51 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load jstree js at ProductStoreGroupTree.ftl Tested at https://localhost:8443/catalog/control/ListParentProductStoreGroup --- .../template/store/ProductStoreGroupTree.ftl | 47 -- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/applications/product/template/store/ProductStoreGroupTree.ftl b/applications/product/template/store/ProductStoreGroupTree.ftl index 91c0027..3c1 100644 --- a/applications/product/template/store/ProductStoreGroupTree.ftl +++ b/applications/product/template/store/ProductStoreGroupTree.ftl @@ -17,8 +17,6 @@ specific language governing permissions and limitations under the License. --> - -
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 135c7f5 Improved: Move page-specific script links to html template (OFBIZ-11799) 135c7f5 is described below commit 135c7f5158d4c0b0eb548821d78bfbbd1aef625d Author: James Yong AuthorDate: Sun Aug 23 13:57:03 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load jstree js at CategoryTree.ftl Tested at https://localhost:8443/catalog/control/main --- .../product/template/category/CategoryTree.ftl | 81 -- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/applications/product/template/category/CategoryTree.ftl b/applications/product/template/category/CategoryTree.ftl index dcb6a47..3a995c6 100644 --- a/applications/product/template/category/CategoryTree.ftl +++ b/applications/product/template/category/CategoryTree.ftl @@ -17,8 +17,6 @@ specific language governing permissions and limitations under the License. --> - -
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 9960b1c Improved: Move page-specific script links to html template (OFBIZ-11799) 9960b1c is described below commit 9960b1cdb8db423435ddf4be411d32507948caac Author: James Yong AuthorDate: Sun Aug 23 12:23:15 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load jstree in DisplayContentNav.ftl. Tested page at /exampleext/control/showHelp?helpTopic=EXAMPLEEXT_main==help=undefined=undefined --- .../content/template/content/DisplayContentNav.ftl | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/applications/content/template/content/DisplayContentNav.ftl b/applications/content/template/content/DisplayContentNav.ftl index e7ed363..8a8b01b 100644 --- a/applications/content/template/content/DisplayContentNav.ftl +++ b/applications/content/template/content/DisplayContentNav.ftl @@ -16,9 +16,7 @@ specific language governing permissions and limitations under the License. --> - - - +
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 1f9c300 Improved: Move page-specific script links to html template (OFBIZ-11799) 1f9c300 is described below commit 1f9c3000271e7a12e9c79105f0a8d6c9117fdf0e Author: James Yong AuthorDate: Sat Aug 22 21:11:20 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load jstree and cookie js in ContentNav.ftl and CategoryTree.ftl. Tested on /content/control/navigateContent /humanres/control/main --- .../content/template/content/ContentNav.ftl| 81 -- .../content/widget/content/ContentScreens.xml | 2 +- .../humanres/template/category/CategoryTree.ftl| 78 +++-- 3 files changed, 87 insertions(+), 74 deletions(-) diff --git a/applications/content/template/content/ContentNav.ftl b/applications/content/template/content/ContentNav.ftl index 42e31df..d527e38 100644 --- a/applications/content/template/content/ContentNav.ftl +++ b/applications/content/template/content/ContentNav.ftl @@ -16,7 +16,6 @@ specific language governing permissions and limitations under the License. --> - <#-- some labels are not unescaped in the JSON object so we have to do this manuely --> @@ -65,44 +64,50 @@ jQuery(document).ready(createTree()); <#-create Tree--> function createTree() { jQuery(function () { -jQuery("#tree").jstree({ -"plugins" : [ "themes", "json_data", "ui", "contextmenu", "crrm"], -"json_data" : { -"data" : rawdata, -"progressive_render" : false -}, -'contextmenu': { -'items': { -'ccp' : false, -'create' : false, -'rename' : false, -'remove' : false, -'create1' : { -'label' : "New Folder", -'action' : function(obj) { -callCreateDocumentTree(obj.attr('id')); -} -}, -'create2' : { -'label' : "New Content in Folder", -'action' : function(obj) { -callCreateDocument(obj.attr('id')); -} -}, -'rename1' : { -'label' : "Rename Folder", -'action' : function(obj) { -callRenameDocumentTree(obj.attr('id')); -} -}, -'delete1' : { -'label' : "Delete Folder", -'action' : function(obj) { -callDeleteDocument(obj.attr('id'), obj.attr('contentId'), obj.attr('AssocType'), obj.attr('fromDate')); -} -}, +importLibrary(["/common/js/jquery/plugins/jsTree/jquery.jstree.js"], function(){ +jQuery("#tree").jstree({ +"plugins" : [ "themes", "json_data", "ui", "contextmenu", "crrm"], +"json_data" : { +"data" : rawdata, +"progressive_render" : false +}, +'contextmenu': { +'items': { +'ccp' : false, +'create' : false, +'rename' : false, +'remove' : false, +'create1' : { +'label' : "New Folder", +'action' : function(obj) { +callCreateDocumentTree(obj.attr('id')); +} +}, +'create2' : { +'label' : "New Content in Folder", +'action' : function(obj) { +callCreateDocument(obj.attr('id')); +} +}, +'rename1' : { +'label' : "Rename Folder", +'action' : function(obj) { +callRenameDocumentTree(obj.attr('id')); +} +}, +'delete1' : { +'label' : "Delete Folder", +'action' : function(obj) { +callDeleteDocument(obj.attr('id'), obj.attr('contentId'), obj.attr('AssocType'), obj.attr('fromDate')); +
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new b480426 Improved: Move page-specific script links to html template (OFBIZ-11799) b480426 is described below commit b480426e1087492c93d048a8f09f7e6808333e0f Author: James Yong AuthorDate: Fri Aug 21 15:13:35 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) use importLibrary js function to load impersonate.css --- themes/common-theme/template/ImpersonateBanner.ftl | 26 +++--- themes/common-theme/template/Impersonated.ftl | 23 --- themes/common-theme/widget/CommonScreens.xml | 3 +-- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/themes/common-theme/template/ImpersonateBanner.ftl b/themes/common-theme/template/ImpersonateBanner.ftl index de1b550..900e49b 100644 --- a/themes/common-theme/template/ImpersonateBanner.ftl +++ b/themes/common-theme/template/ImpersonateBanner.ftl @@ -18,13 +18,23 @@ under the License. --> <#if parameters.originUserLogin??> - - - -× -${uiLabelMap.CommonImpersonateTitle} -${uiLabelMap.CommonImpersonateUserLogin} : ${context.userLogin.userLoginId!} -${uiLabelMap.CommonImpersonateStop} - + + ++
++ + +importLibrary(["/common/css/impersonate.css"], function(){ +var content = jQuery.parseHTML($('#impersonateContent-template').html()); +$("#impersonateContentBody").append(content); +}); + diff --git a/themes/common-theme/template/Impersonated.ftl b/themes/common-theme/template/Impersonated.ftl index b6117ce..abf78cb 100644 --- a/themes/common-theme/template/Impersonated.ftl +++ b/themes/common-theme/template/Impersonated.ftl @@ -16,18 +16,25 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - <#assign messageMap = Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("originUserLoginId", impersonator)/> <#assign impersonationMessage= Static["org.apache.ofbiz.base.util.UtilProperties"].getMessage("SecurityextUiLabels", "loginevents.impersonation_in_process", messageMap, locale)/> <#assign fromDate = Static["org.apache.ofbiz.base.util.UtilFormatOut"].formatDateTime(impersonationFromDate, "", locale, timeZone)/> - - - ${impersonationMessage!} - ${uiLabelMap.CommonSince} ${fromDate!} - ${uiLabelMap.CommonLogout} - + + + -setInterval('window.location.reload()', 3); +importLibrary(["/common/css/impersonate.css"], function(){ +var parsedContent = jQuery.parseHTML($('#impersonateMode-template').html()); +$("#impersonateMode").append(parsedContent); +}); +setInterval(function (){ +window.location.reload(); +}, 3); diff --git a/themes/common-theme/widget/CommonScreens.xml b/themes/common-theme/widget/CommonScreens.xml index 292a50b..2a65c1a 100644 --- a/themes/common-theme/widget/CommonScreens.xml +++ b/themes/common-theme/widget/CommonScreens.xml @@ -150,7 +150,6 @@ under the License. - @@ -576,7 +575,7 @@ under the License. - ++× ++${uiLabelMap.CommonImpersonateTitle}
+${uiLabelMap.CommonImpersonateUserLogin} : ${context.userLogin.userLoginId!}
+${uiLabelMap.CommonImpersonateStop} +
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 149e90e Improved: Move page-specific script links to html template (OFBIZ-11799) 149e90e is described below commit 149e90e60827115754c6bb2465634f1fac461d0e Author: James Yong AuthorDate: Wed Aug 19 10:17:51 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) use importLibrary js function to load moment js. --- .../webapp/common/js/util/setUserTimeZone.js | 27 +- themes/common-theme/widget/CommonScreens.xml | 2 -- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/setUserTimeZone.js b/themes/common-theme/webapp/common/js/util/setUserTimeZone.js index b74504b..0c29340 100644 --- a/themes/common-theme/webapp/common/js/util/setUserTimeZone.js +++ b/themes/common-theme/webapp/common/js/util/setUserTimeZone.js @@ -19,16 +19,21 @@ under the License. // Only once by session (ref https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) if (sessionStorage.getItem("SetTimeZoneFromBrowser") === null || sessionStorage.getItem("SetTimeZoneFromBrowser") !== "done") { -var timezone = moment.tz.guess(); -$.ajax({ -url: "SetTimeZoneFromBrowser", -type: "POST", -async: false, -data: "localeName=" + timezone, -success: function(success) { -if (success._ERROR_MESSAGE_ === undefined && success._ERROR_MESSAGE_LIST_ === undefined) { -sessionStorage.setItem("SetTimeZoneFromBrowser", "done"); -} -} +var libraryFiles = ["/common/js/plugins/moment-timezone/moment-with-locales.min.js"]; +importLibrary(libraryFiles, function(){ + importLibrary(["/common/js/plugins/moment-timezone/moment-timezone-with-data.min.js"], function(){ +var timezone = moment.tz.guess(); +$.ajax({ +url: "SetTimeZoneFromBrowser", +type: "POST", +async: false, +data: "localeName=" + timezone, +success: function(success) { +if (success._ERROR_MESSAGE_ === undefined && success._ERROR_MESSAGE_LIST_ === undefined) { +sessionStorage.setItem("SetTimeZoneFromBrowser", "done"); +} +} +}); +}); }); } diff --git a/themes/common-theme/widget/CommonScreens.xml b/themes/common-theme/widget/CommonScreens.xml index a49716a..292a50b 100644 --- a/themes/common-theme/widget/CommonScreens.xml +++ b/themes/common-theme/widget/CommonScreens.xml @@ -130,8 +130,6 @@ under the License. - -
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new ede5aa1 Improved: Move page-specific script links to html template (OFBIZ-11799) ede5aa1 is described below commit ede5aa15501b13035417f4ad343522d19d430fe9 Author: James Yong AuthorDate: Mon Aug 17 21:52:19 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) ensure select2 lang js is loaded after the main js. --- .../template/includes/SetMultipleSelectJs.ftl | 49 +++-- .../template/includes/SetMultipleSelectJsList.ftl | 50 -- 2 files changed, 53 insertions(+), 46 deletions(-) diff --git a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl index acf835d..4d72567 100644 --- a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl +++ b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl @@ -20,36 +20,39 @@ under the License. jQuery(document).ready(function () { var libraryFiles = ["/common/js/jquery/plugins/select2/js/select2-4.0.6.js", -"/common/js/jquery/plugins/select2/css/select2-4.0.6.css", -"<@jsLangFilesMap>select2@jsLangFilesMap>"]; +"/common/js/jquery/plugins/select2/css/select2-4.0.6.css"]; importLibrary(libraryFiles, function(){ -multiple = jQuery("#${asm_multipleSelect!}"); +var langFile = ["<@jsLangFilesMap>select2@jsLangFilesMap>"]; +importLibrary(langFile, function(){ -<#if asm_title??> -// set the dropdown "title" if?? -multiple.attr('title', '${asm_title}'); -#if> +multiple = jQuery("#${asm_multipleSelect!}"); -multiple.select2({ -tags: true, -multiple: true, -lang: <#if userLogin??>'${userLogin.lastLocale!"en"}'<#else>"en"#if>, -width: "50%" -}); +<#if asm_title??> +// set the dropdown "title" if?? +multiple.attr('title', '${asm_title}'); +#if> -<#if asm_relatedField??> <#-- can be used without related field --> -// track possible relatedField changes -// on initial focus (focus-field-name must be asm_relatedField) or if the field value changes, select related multi values. -typeValue = jQuery('#${asm_typeField}').val(); -jQuery("#${asm_relatedField}").one('focus', function () { -selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}'); -}); -jQuery("#${asm_relatedField}").change(function () { +multiple.select2({ +tags: true, +multiple: true, +lang: <#if userLogin??>'${userLogin.lastLocale!"en"}'<#else>"en"#if>, +width: "50%" +}); + +<#if asm_relatedField??> <#-- can be used without related field --> +// track possible relatedField changes +// on initial focus (focus-field-name must be asm_relatedField) or if the field value changes, select related multi values. +typeValue = jQuery('#${asm_typeField}').val(); +jQuery("#${asm_relatedField}").one('focus', function () { +selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}'); +}); +jQuery("#${asm_relatedField}").change(function () { +selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}'); +}); selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}'); +#if> }); -selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}'); -#if> }); }); diff --git a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl index e59cec4..a201476 100644 --- a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl +++ b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl @@ -22,35 +22,39 @@ under the License. jQuery(document).ready(function () { var libraryFiles = ["/common/js/jquery/plugins/select2/js/select2-4.0.6.js", -
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 7322abb Improved: Move page-specific script links to html template (OFBIZ-11799) 7322abb is described below commit 7322abbcbe88bed5fe9babfc883c9dfc6de685f7 Author: James Yong AuthorDate: Mon Aug 17 20:45:47 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) refactoring --- themes/common-theme/template/includes/GeoLocation.ftl | 4 ++-- themes/common-theme/template/includes/SetMultipleSelectJs.ftl | 4 ++-- .../common-theme/template/includes/SetMultipleSelectJsList.ftl | 4 ++-- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 10 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/themes/common-theme/template/includes/GeoLocation.ftl b/themes/common-theme/template/includes/GeoLocation.ftl index f87383e..d27b494 100644 --- a/themes/common-theme/template/includes/GeoLocation.ftl +++ b/themes/common-theme/template/includes/GeoLocation.ftl @@ -115,8 +115,8 @@ under the License. <#elseif "GEOPT_OSM" == geoChart.dataSourceId>
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 0c2c3d4 Improved: Move page-specific script links to html template (OFBIZ-11799) 0c2c3d4 is described below commit 0c2c3d4cb92e8e0b9ca7245ed45aea9c63ecc730 Author: James Yong AuthorDate: Mon Aug 17 13:02:41 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) importLibrary function to check for local environment before setting crossDomain. --- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index bb9da1b..c08d60d 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -1434,7 +1434,7 @@ var importLibrary = function() { function cachedScript(url, options) { // Allow user to set any option except for following options = $.extend(options || {}, { -crossDomain: true, // set to true to allow the file to be shown under browser's sources folder +crossDomain: isLocalEnviron(), // when true, file is shown under browser's sources folder dataType: "script", cache: true, url: url @@ -1467,4 +1467,8 @@ var importLibrary = function() { alert('Error loading one of the files: \n' + urls.join('\n')) }); } -}(); \ No newline at end of file +}(); + +function isLocalEnviron(){ +return ["localhost","127.0.0.1"].includes(window.location.hostname); +} \ No newline at end of file
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 06b4333 Improved: Move page-specific script links to html template (OFBIZ-11799) 06b4333 is described below commit 06b4333c546dc59966f352decc75731700bf78b0 Author: James Yong AuthorDate: Sun Aug 16 19:22:18 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) refactoring + use importLibrary js function to load readmore and jgrowl js. --- .../webapp/common/js/util/OfbizUtil.js | 91 +++--- themes/common-theme/widget/CommonScreens.xml | 2 - 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index ff7dbc1..bb9da1b 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -1090,47 +1090,51 @@ function submitFormDisableSubmits(form) { } function showjGrowl(showAllLabel, collapseLabel, hideAllLabel, jGrowlPosition, jGrowlWidth, jGrowlHeight, jGrowlSpeed) { +var libraryFiles = ["/common/js/jquery/plugins/Readmore.js-master/readmore.js", +"/common/js/jquery/plugins/jquery-jgrowl/jquery.jgrowl-1.4.6.min.js"]; +importLibrary(libraryFiles, function() { +var contentMessages = jQuery("#content-messages"); +if (contentMessages.length) { +jQuery("#content-messages").hide(); +var errMessage = jQuery("#content-messages").html(); +var classEvent = ""; +var classList = jQuery("#content-messages").attr('class').split(/\s+/); +var stickyValue = false; +jQuery(classList).each(function (index) { +var localClass = classList[index]; +if (localClass == "eventMessage" || localClass == "errorMessage") { +classEvent = localClass + "JGrowl"; +} +}); +if (classEvent == "errorMessageJGrowl") { +stickyValue = true; +} -var contentMessages = jQuery("#content-messages"); -if (contentMessages.length) { -jQuery("#content-messages").hide(); -var errMessage = jQuery("#content-messages").html(); -var classEvent = ""; -var classList = jQuery("#content-messages").attr('class').split(/\s+/); -var stickyValue = false; -jQuery(classList).each(function(index) { -var localClass = classList[index]; -if(localClass == "eventMessage" || localClass == "errorMessage" ){ -classEvent = localClass + "JGrowl"; +if (errMessage == null || errMessage == "" || errMessage == undefined) { +// No Error Message Information is set, Error Msg Box can't be created +return; } -}); -if (classEvent == "errorMessageJGrowl") { -stickyValue = true; -} +$.jGrowl.defaults.closerTemplate = '' + hideAllLabel + ''; +if (jGrowlPosition !== null && jGrowlPosition !== undefined) $.jGrowl.defaults.position = jGrowlPosition; +$.jGrowl(errMessage, { +theme: classEvent, sticky: stickyValue, +beforeOpen: function (e, m, o) { +if (jGrowlWidth !== null && jGrowlWidth !== undefined) $(e).width(jGrowlWidth + 'px'); +if (jGrowlHeight !== null && jGrowlHeight !== undefined) $(e).height(jGrowlHeight + 'px'); +}, +afterOpen: function (e, m) { +jQuery(".jGrowl-message").readmore({ +moreLink: '' + showAllLabel + '', +lessLink: '' + collapseLabel + '', -if (errMessage == null || errMessage == "" || errMessage == undefined ) { -// No Error Message Information is set, Error Msg Box can't be created -return; +maxHeight: 75 +}); +}, +speed: jGrowlSpeed +}); +contentMessages.remove(); } -$.jGrowl.defaults.closerTemplate = ''+hideAllLabel+''; -if (jGrowlPosition !== null && jGrowlPosition !== undefined) $.jGrowl.defaults.position = jGrowlPosition; -$.jGrowl(errMessage, { theme: classEvent, sticky: stickyValue, -beforeOpen: function(e,m,o){ -if (jGrowlWidth !== null && jGrowlWidth !== undefined) $(e).width( jGrowlWidth+'px' ); -if (jGrowlHeight !== null && jGrowlHeight !== undefined) $(e).height( jGrowlHeight+'px' ); -}, -afterOpen: function(e,m) { -jQuery(".jGrowl-message").readmore({ -
[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)
This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 39c1e28 Improved: Move page-specific script links to html template (OFBIZ-11799) 39c1e28 is described below commit 39c1e280f9b4ee8d7b6b4d939b278ab4f653aa4f Author: James Yong AuthorDate: Sun Aug 16 18:05:32 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) refactoring + importLibrary function to use crossDomain = true to allow js file to be shown under browser's sources folder --- .../content/template/website/WebSiteCMSNav.ftl | 3 +- .../common-theme/template/includes/GeoLocation.ftl | 4 +- .../template/includes/SetMultipleSelectJs.ftl | 44 +- .../template/includes/SetMultipleSelectJsList.ftl | 52 +++--- .../webapp/common/js/util/OfbizUtil.js | 9 ++-- 5 files changed, 56 insertions(+), 56 deletions(-) diff --git a/applications/content/template/website/WebSiteCMSNav.ftl b/applications/content/template/website/WebSiteCMSNav.ftl index f155685..1a93989 100644 --- a/applications/content/template/website/WebSiteCMSNav.ftl +++ b/applications/content/template/website/WebSiteCMSNav.ftl @@ -445,8 +445,7 @@ function createEditor() { <#if language?has_content && language != "en"> libraryFiles.push("/common/js/jquery/plugins/elrte-1.3/js/i18n/elrte.${language!"en"}.js") -importLibrary(libraryFiles, -function() { +importLibrary(libraryFiles, function() { var opts = { cssClass : 'el-rte', lang : '${language!"en"}', diff --git a/themes/common-theme/template/includes/GeoLocation.ftl b/themes/common-theme/template/includes/GeoLocation.ftl index c85f722..f87383e 100644 --- a/themes/common-theme/template/includes/GeoLocation.ftl +++ b/themes/common-theme/template/includes/GeoLocation.ftl @@ -115,8 +115,8 @@ under the License. <#elseif "GEOPT_OSM" == geoChart.dataSourceId> -importLibrary(["/common/js/plugins/OpenLayers-5.3.0.js", "/common/js/plugins/OpenLayers-5.3.0.css"], -function() { +var importLibraryFiles = ["/common/js/plugins/OpenLayers-5.3.0.js", "/common/js/plugins/OpenLayers-5.3.0.css"]; +importLibrary(importLibraryFiles, function() { var iconFeatures=[]; <#if geoChart.points?has_content> diff --git a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl index ebded16..b02022a 100644 --- a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl +++ b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl @@ -19,36 +19,36 @@ under the License. <#if asm_multipleSelect??> <#-- we check only this var and suppose the others are also present -->