[ofbiz-framework] branch trunk updated: Fixed: Unable to build in M1 Mac (OFBIZ-12460) (#417)
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 35f7ff3 Fixed: Unable to build in M1 Mac (OFBIZ-12460) (#417) 35f7ff3 is described below commit 35f7ff34a9951a78561c97509444a3ec69103440 Author: James Yong AuthorDate: Sun Dec 19 22:08:59 2021 +0800 Fixed: Unable to build in M1 Mac (OFBIZ-12460) (#417) Upgrade Node.js from 12.18.1 to 16.13.1. 16.13.1 is the latest version with long-term support and has build for M1 Mac. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2e2ce49..160464a 100644 --- a/build.gradle +++ b/build.gradle @@ -109,7 +109,7 @@ javadoc { node { download = true -version = "12.18.1" +version = "16.13.1" // npmVersion will be the one that comes default with node // https://github.com/node-gradle/gradle-node-plugin/blob/2.2.4/README.md
[ofbiz-framework] branch trunk updated: Fixed: Display last-visited-time popup after login (OFBIZ-12148)
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 162506d Fixed: Display last-visited-time popup after login (OFBIZ-12148) 162506d is described below commit 162506d372a7cb2a69c2bcf1752bb91a681ee58c Author: James Yong AuthorDate: Wed Feb 24 16:54:39 2021 +0700 Fixed: Display last-visited-time popup after login (OFBIZ-12148) Empty popup occurs when showjGrowl is run later than the javascript from unsafe message. Delay running of showjGrowl function from 10 to 100 milliseconds. Thanks Jacques for reporting. --- themes/common-theme/template/includes/Messages.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/common-theme/template/includes/Messages.ftl b/themes/common-theme/template/includes/Messages.ftl index 67cbb33..ca85f80 100644 --- a/themes/common-theme/template/includes/Messages.ftl +++ b/themes/common-theme/template/includes/Messages.ftl @@ -107,7 +107,7 @@ setTimeout(function(){ showjGrowl( "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}", "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}"); - }, 10); + }, 100); <#else> showjGrowl( "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}",
[ofbiz-framework] branch trunk updated: Improved: Display last-visited-time popup after login (OFBIZ-12148) (#266)
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 ad0211a Improved: Display last-visited-time popup after login (OFBIZ-12148) (#266) ad0211a is described below commit ad0211ab2d965563f54c1b9c7f9c2a093984a11c Author: James Yong AuthorDate: Mon Feb 8 00:04:29 2021 +0800 Improved: Display last-visited-time popup after login (OFBIZ-12148) (#266) Improved: Display last-visited-time popup after login (OFBIZ-12148) To allow users to know of any unauthorised access to their accounts. Thanks: Michael for review --- framework/common/config/SecurityUiLabels.xml | 5 ++ .../common/webcommon/WEB-INF/common-controller.xml | 4 + framework/security/config/security.properties | 5 ++ .../org/apache/ofbiz/webapp/AfterLoginEvents.java | 100 + 4 files changed, 114 insertions(+) diff --git a/framework/common/config/SecurityUiLabels.xml b/framework/common/config/SecurityUiLabels.xml index 3c88bc8..6426938 100644 --- a/framework/common/config/SecurityUiLabels.xml +++ b/framework/common/config/SecurityUiLabels.xml @@ -505,6 +505,11 @@ 浏览名称 檢視名稱 + +Your last visit was on ${jsLastVisit} +您上次访问的时间是 ${jsLastVisit} +您上次訪問的時間是 ${jsLastVisit} + Benutzer Anmeldung suchen Lookup User Login diff --git a/framework/common/webcommon/WEB-INF/common-controller.xml b/framework/common/webcommon/WEB-INF/common-controller.xml index 36b10c9..e35662c 100644 --- a/framework/common/webcommon/WEB-INF/common-controller.xml +++ b/framework/common/webcommon/WEB-INF/common-controller.xml @@ -39,6 +39,10 @@ under the License. + + + + Verify a user is logged in. diff --git a/framework/security/config/security.properties b/framework/security/config/security.properties index 2947ce4..702971a 100644 --- a/framework/security/config/security.properties +++ b/framework/security/config/security.properties @@ -228,3 +228,8 @@ templateClassResolver= #-- people may like to allow more than what is allowed OOTB #-- As it name says, allowAllUploads opens all possibilities allowAllUploads= + +#-- Popup last-visited time from database after user has logged in. +#-- So users can know of any unauthorised access to their accounts. +#-- Default is true. +afterlogin.lastvisit.show= \ No newline at end of file diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/AfterLoginEvents.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/AfterLoginEvents.java new file mode 100644 index 000..7744126 --- /dev/null +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/AfterLoginEvents.java @@ -0,0 +1,100 @@ +/*** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ***/ +package org.apache.ofbiz.webapp; + +import org.apache.ofbiz.base.util.Debug; +import org.apache.ofbiz.base.util.UtilHttp; +import org.apache.ofbiz.base.util.UtilProperties; +import org.apache.ofbiz.common.JsLanguageFilesMappingUtil; +import org.apache.ofbiz.entity.Delegator; +import org.apache.ofbiz.entity.GenericEntityException; +import org.apache.ofbiz.entity.GenericValue; +import org.apache.ofbiz.entity.util.EntityListIterator; +import org.apache.ofbiz.entity.util.EntityQuery; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Locale; + +public class AfterLoginEvents { + +private static final String MODULE = AfterLoginEvents.class.getName(); +private static final String SCRIPT_SHOW_LAST_VISIT_DATE; + +static { +SCRIPT_SHOW_LAST_VISIT_DATE = "" ++ "importLibrary(%s, function () {\n" ++ "var dateForma
[ofbiz-framework] branch trunk updated: Improved: Apply CSS Grid to Find Orders (OFBIZ-12116)
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 0863084 Improved: Apply CSS Grid to Find Orders (OFBIZ-12116) 0863084 is described below commit 0863084062605044521c00e30203f5c79e8e8146 Author: James Yong AuthorDate: Tue Jan 26 20:56:23 2021 +0800 Improved: Apply CSS Grid to Find Orders (OFBIZ-12116) Improve CSS for centering grid item --- themes/common-theme/webapp/common/css/info.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/common-theme/webapp/common/css/info.css b/themes/common-theme/webapp/common/css/info.css index acde038..390d05b 100644 --- a/themes/common-theme/webapp/common/css/info.css +++ b/themes/common-theme/webapp/common/css/info.css @@ -73,6 +73,6 @@ limitations under the License. grid-column: 2 / span 3; } .ofbiz-form .full-width-center { -display: flex; -justify-items: center; +grid-column: 1 / span 4; +justify-self: center; }
[ofbiz-framework] branch trunk updated: Fixed: Issue in rendering Comparitive balance sheet pdf (OFBIZ-12151), and Exporting the PDF for Cash Flow Statement displays the macro code for the date fields
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 d7d424f Fixed: Issue in rendering Comparitive balance sheet pdf (OFBIZ-12151), and Exporting the PDF for Cash Flow Statement displays the macro code for the date fields (OFBIZ-12155) d7d424f is described below commit d7d424fafd5900a9e20debbe2580a8b042e45da8 Author: James Yong AuthorDate: Sun Jan 24 10:27:42 2021 +0800 Fixed: Issue in rendering Comparitive balance sheet pdf (OFBIZ-12151), and Exporting the PDF for Cash Flow Statement displays the macro code for the date fields (OFBIZ-12155) Bug introduced when fixing OFBIZ-12097 Thanks: Lalit for reporting OFBIZ-12151; Ankit, OFBIZ-12155. Jacques for linking the issues. --- themes/common-theme/template/macro/FoFormMacroLibrary.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/common-theme/template/macro/FoFormMacroLibrary.ftl b/themes/common-theme/template/macro/FoFormMacroLibrary.ftl index 22f1584..0759433 100644 --- a/themes/common-theme/template/macro/FoFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/FoFormMacroLibrary.ftl @@ -55,7 +55,7 @@ under the License. <#macro renderTextareaField name className alert cols rows maxlength id readonly value visualEditorEnable language buttons tabindex language="" disabled=""><@makeBlock className value /> -<#macro renderDateTimeField name className alert title value size maxlength step timeValues id event action 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=""><@makeBlock className value /> +<#macro renderDateTimeField name className alert title value size maxlength step timeValues id event action 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="" isXMLHttpRequest=""><@makeBlock className value /> <#macro renderDropDownField name className alert id multiple formName otherFieldName event action size explicitDescription allowEmpty options fieldName otherFieldName otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey ajaxOptions frequency minChars choices autoSelect partialSearch partialChars ignoreCase fullSearch conditionGroup tabindex firstInList="" currentValue="" disabled=""> <#if currentValue?has_content && firstInList?has_content>
[ofbiz-framework] branch trunk updated: Improved: Allow Unsafe Event Message (OFBIZ-12147)
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 6a08920 Improved: Allow Unsafe Event Message (OFBIZ-12147) 6a08920 is described below commit 6a0892060630b8bc7b0bee3e7614ae133f49e020 Author: James Yong AuthorDate: Thu Jan 21 22:53:57 2021 +0800 Improved: Allow Unsafe Event Message (OFBIZ-12147) Only delay jgrowl message when there is _UNSAFE_EVENT_MESSAGE_ Thanks Michael for feedback. --- themes/common-theme/template/includes/Messages.ftl | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themes/common-theme/template/includes/Messages.ftl b/themes/common-theme/template/includes/Messages.ftl index e9b9322..67cbb33 100644 --- a/themes/common-theme/template/includes/Messages.ftl +++ b/themes/common-theme/template/includes/Messages.ftl @@ -102,11 +102,17 @@ under the License. <#assign jGrowlHeight = modelTheme.getProperty("jgrowlHeight")> <#assign jGrowlSpeed = modelTheme.getProperty("jgrowlSpeed")> +<#if unsafeEventMessage?has_content> setTimeout(function(){ showjGrowl( "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}", "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}"); -}, 10); + }, 10); +<#else> +showjGrowl( +"${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}", +"${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}"); +</#if>
[ofbiz-framework] branch trunk updated: Improved: Updated tasks.checkstyleMain.maxErrors to 278
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 b679d36 Improved: Updated tasks.checkstyleMain.maxErrors to 278 b679d36 is described below commit b679d36b492b23fc0a5797e9a637f5924aa0cba8 Author: James Yong AuthorDate: Thu Jan 21 21:21:54 2021 +0800 Improved: Updated tasks.checkstyleMain.maxErrors to 278 --- build.gradle| 2 +- framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java | 2 +- .../base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java | 2 +- .../src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 139f526..56a1dc2 100644 --- a/build.gradle +++ b/build.gradle @@ -296,7 +296,7 @@ checkstyle { // the sum of errors found last time it was changed after using the // ‘checkstyle’ tool present in the framework and in the official // plugins. -tasks.checkstyleMain.maxErrors = 279 +tasks.checkstyleMain.maxErrors = 278 // Currently there are a lot of errors so we need to temporarily // hide them to avoid polluting the terminal output. showViolations = false diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java index 4af9c74..15a6bc7 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java @@ -40,7 +40,7 @@ import org.apache.commons.codec.binary.Hex; * Misc String Utility Functions * */ -public class StringUtil { +public final class StringUtil { public static final StringUtil INSTANCE = new StringUtil(); private static final String MODULE = StringUtil.class.getName(); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java index d91187e..85db461 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java @@ -1299,4 +1299,4 @@ public final class UtilValidate { } return isValid; } -} \ No newline at end of file +} diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java index 6784926..3bf5632 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java @@ -79,7 +79,7 @@ import org.apache.ofbiz.widget.model.ThemeFactory; /** * RequestHandler - Request Processor Object */ -public class RequestHandler { +public final class RequestHandler { private static final String MODULE = RequestHandler.class.getName(); private final ViewFactory viewFactory;
[ofbiz-framework] branch trunk updated: Improved: Allow Unsafe Event Message (OFBIZ-12147)
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 1bfd3c5 Improved: Allow Unsafe Event Message (OFBIZ-12147) 1bfd3c5 is described below commit 1bfd3c5fb0c33959c19dd0a14549728808da2e4a Author: James Yong AuthorDate: Thu Jan 21 20:46:06 2021 +0800 Improved: Allow Unsafe Event Message (OFBIZ-12147) Allow application to define event messages that contain javascripts, via request attribute "_UNSAFE_EVENT_MESSAGE_" Thanks Jacques for review --- .../apache/ofbiz/webapp/control/RequestHandler.java| 2 +- themes/common-theme/template/includes/Messages.ftl | 18 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java index 87d94c7..6784926 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java @@ -749,7 +749,7 @@ public class RequestHandler { String key = entry.getKey(); if ("_ERROR_MESSAGE_LIST_".equals(key) || "_ERROR_MESSAGE_MAP_".equals(key) || "_ERROR_MESSAGE_".equals(key) || "_WARNING_MESSAGE_LIST_".equals(key) || "_WARNING_MESSAGE_".equals(key) -|| "_EVENT_MESSAGE_LIST_".equals(key) || "_EVENT_MESSAGE_".equals(key)) { +|| "_EVENT_MESSAGE_LIST_".equals(key) || "_EVENT_MESSAGE_".equals(key) || "_UNSAFE_EVENT_MESSAGE_".equals(key)) { request.setAttribute(key, entry.getValue()); } } diff --git a/themes/common-theme/template/includes/Messages.ftl b/themes/common-theme/template/includes/Messages.ftl index 78996db..e9b9322 100644 --- a/themes/common-theme/template/includes/Messages.ftl +++ b/themes/common-theme/template/includes/Messages.ftl @@ -41,6 +41,7 @@ under the License. <#if !warningMessageList?has_content> <#assign warningMessageList = requestAttributes._WARNING_MESSAGE_LIST_?if_exists> + <#assign unsafeEventMessage = requestAttributes._UNSAFE_EVENT_MESSAGE_!> <#-- display the error messages --> <#if (errorMessage?has_content || errorMessageList?has_content)> @@ -59,8 +60,8 @@ under the License. <#-- display the event messages --> - <#if (eventMessage?has_content || eventMessageList?has_content)> - + <#noescape>${uiLabelMap.CommonFollowingOccurred}: <#if eventMessage?has_content> @@ -71,6 +72,9 @@ under the License. ${StringUtil.wrapString(eventMsg)} +<#if unsafeEventMessage?has_content> + <#noescape>${StringUtil.wrapString(unsafeEventMessage)} + @@ -91,14 +95,18 @@ under the License. <#if (errorMessage?has_content || errorMessageList?has_content - || eventMessage?has_content || eventMessageList?has_content + || eventMessage?has_content || eventMessageList?has_content || unsafeEventMessage?has_content || warningMessage?has_content || warningMessageList?has_content)> <#assign jGrowlPosition = modelTheme.getProperty("jgrowlPosition")> <#assign jGrowlWidth = modelTheme.getProperty("jgrowlWidth")> <#assign jGrowlHeight = modelTheme.getProperty("jgrowlHeight")> <#assign jGrowlSpeed = modelTheme.getProperty("jgrowlSpeed")> -showjGrowl( +<script> +setTimeout(function(){ + showjGrowl( "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}", - "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}"); + "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}"); +}, 10); +
[ofbiz-framework] branch trunk updated: Improved: Rename MultiBlockHtmlTemplateUtil to ScriptLinkHelper (OFBIZ-12134)
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 9c7dc7b Improved: Rename MultiBlockHtmlTemplateUtil to ScriptLinkHelper (OFBIZ-12134) 9c7dc7b is described below commit 9c7dc7b8778022bb91733b74f7e0fc57e3867f65 Author: James Yong AuthorDate: Wed Jan 13 09:26:42 2021 +0800 Improved: Rename MultiBlockHtmlTemplateUtil to ScriptLinkHelper (OFBIZ-12134) Rename + Refactor --- .../java/org/apache/ofbiz/common/CommonEvents.java | 4 +- .../ofbiz/webapp/control/ControlEventListener.java | 4 +- .../webapp/ftl/ScriptTagsFooterTransform.java | 4 +- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 26 ++-- ...HtmlTemplateUtil.java => ScriptLinkHelper.java} | 46 +- .../ofbiz/widget/renderer/ScreenRenderer.java | 6 +-- 6 files changed, 50 insertions(+), 40 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java index 89aad37..debfbcf 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java @@ -62,7 +62,7 @@ import org.apache.ofbiz.entity.util.EntityUtilProperties; import org.apache.ofbiz.webapp.control.JWTManager; import org.apache.ofbiz.webapp.control.LoginWorker; import org.apache.ofbiz.widget.model.ModelWidget; -import org.apache.ofbiz.widget.model.MultiBlockHtmlTemplateUtil; +import org.apache.ofbiz.widget.model.ScriptLinkHelper; import org.apache.ofbiz.widget.model.ThemeFactory; import org.apache.ofbiz.widget.renderer.VisualTheme; @@ -189,7 +189,7 @@ public class CommonEvents { public static String jsResponseFromRequest(HttpServletRequest request, HttpServletResponse response) { String fileName = request.getParameter("name"); -String script = MultiBlockHtmlTemplateUtil.getScriptFromCache(request.getSession(), fileName); +String script = ScriptLinkHelper.getScriptFromCache(request.getSession(), fileName); // return the JS String Writer out; diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlEventListener.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlEventListener.java index d8198ef..3435e3b 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlEventListener.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlEventListener.java @@ -38,7 +38,7 @@ import org.apache.ofbiz.entity.serialize.XmlSerializer; import org.apache.ofbiz.entity.transaction.TransactionUtil; import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.security.CsrfUtil; -import org.apache.ofbiz.widget.model.MultiBlockHtmlTemplateUtil; +import org.apache.ofbiz.widget.model.ScriptLinkHelper; /** * HttpSessionListener that gathers and tracks various information and statistics @@ -74,7 +74,7 @@ public class ControlEventListener implements HttpSessionListener { HttpSession session = event.getSession(); CsrfUtil.cleanupTokenMap(session); -MultiBlockHtmlTemplateUtil.cleanupScriptCache(session); +ScriptLinkHelper.cleanupScriptCache(session); // Finalize the Visit boolean beganTransaction = false; diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/ScriptTagsFooterTransform.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/ScriptTagsFooterTransform.java index 8288ab5..fa7598e 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/ScriptTagsFooterTransform.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/ScriptTagsFooterTransform.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; -import org.apache.ofbiz.widget.model.MultiBlockHtmlTemplateUtil; +import org.apache.ofbiz.widget.model.ScriptLinkHelper; import freemarker.core.Environment; import freemarker.ext.beans.BeanModel; @@ -51,7 +51,7 @@ public class ScriptTagsFooterTransform implements TemplateTransformModel { BeanModel req = (BeanModel) env.getVariable("request"); if (req != null) { HttpServletRequest request = (HttpServletRequest) req.getWrappedObject(); -Set scriptSrcSet = MultiBlockHtmlTemplateUtil.getScriptLinksForFoot(request); +Set scriptSrcSet = ScriptLinkHelper.getScriptLinksForBodyEnd(request); if (scriptSrcSet != null) { String srcList = ""; for (String
[ofbiz-framework] branch trunk updated: Refactoring
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 3c83ab5 Refactoring 3c83ab5 is described below commit 3c83ab53b2552ff7d07dc76fc4feea86d2545a3e Author: James Yong AuthorDate: Tue Jan 12 23:25:25 2021 +0800 Refactoring --- .../org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java index ee722d2..2352945 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java @@ -37,7 +37,7 @@ public final class MultiBlockHtmlTemplateUtil { private static final String MODULE = MultiBlockHtmlTemplateUtil.class.getName(); public static final String FTL_WRITER = "WriterForFTL"; -private static final String SCRIPT_LINKS_FOR_FOOT = "ScriptLinksForFoot"; +private static final String SCRIPT_LINKS_FOR_BODY_END = "ScriptLinksForBodyEnd"; private static int maxScriptCacheSizePerUserSession = 15; private static int estimatedConcurrentUserSessions = 250; /** @@ -61,11 +61,11 @@ public final class MultiBlockHtmlTemplateUtil { * @param filePath */ public static void addScriptLinkForFoot(final HttpServletRequest request, final String filePath) { -Set scriptLinks = UtilGenerics.cast(request.getAttribute(SCRIPT_LINKS_FOR_FOOT)); +Set scriptLinks = UtilGenerics.cast(request.getAttribute(SCRIPT_LINKS_FOR_BODY_END)); if (scriptLinks == null) { // use of LinkedHashSet to maintain insertion order scriptLinks = new LinkedHashSet<>(); -request.setAttribute(SCRIPT_LINKS_FOR_FOOT, scriptLinks); +request.setAttribute(SCRIPT_LINKS_FOR_BODY_END, scriptLinks); } scriptLinks.add(filePath); } @@ -76,7 +76,7 @@ public final class MultiBlockHtmlTemplateUtil { * @return */ public static Set getScriptLinksForFoot(HttpServletRequest request) { -Set scriptLinks = UtilGenerics.cast(request.getAttribute(SCRIPT_LINKS_FOR_FOOT)); +Set scriptLinks = UtilGenerics.cast(request.getAttribute(SCRIPT_LINKS_FOR_BODY_END)); return scriptLinks; }
[ofbiz-framework] branch trunk updated: Fixed: Incorrect date format in tooltip (OFBIZ-12123)
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 d32814e Fixed: Incorrect date format in tooltip (OFBIZ-12123) d32814e is described below commit d32814e5c8759c3f7aba42fe2d0d7cd390441982 Author: James Yong AuthorDate: Tue Jan 12 12:32:53 2021 +0800 Fixed: Incorrect date format in tooltip (OFBIZ-12123) Tooltip should show the date format used by the picker. --- .../webapp/common/js/util/OfbizUtil.js | 37 ++ 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 016a488..e90fe39 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -330,17 +330,18 @@ function initDateTimePicker(self) { importLibrary(libCultureInfo, function () { //If language specific lib is found, use date / time converter else just copy the value fields if (Date.CultureInfo != undefined) { +var dateFormat; +var ofbizTime; +if (shortDate) { +dateFormat = Date.CultureInfo.formatPatterns.shortDate; +ofbizTime = "-MM-dd"; +} else { +dateFormat = Date.CultureInfo.formatPatterns.shortDate + " " + Date.CultureInfo.formatPatterns.longTime; +ofbizTime = "-MM-dd HH:mm:ss" +} +element_i18n.attr('title', dateFormat); var initDate = element.val(); if (initDate != "") { -var dateFormat; -var ofbizTime; -if (shortDate) { -dateFormat = Date.CultureInfo.formatPatterns.shortDate; -ofbizTime = "-MM-dd"; -} else { -dateFormat = Date.CultureInfo.formatPatterns.shortDate + " " + Date.CultureInfo.formatPatterns.longTime; -ofbizTime = "-MM-dd HH:mm:ss" -} // The JS date parser doesn't understand the dot before ms in the date/time string. The ms here should be always 000 if (initDate.indexOf('.') != -1) { initDate = initDate.substring(0, initDate.indexOf('.')); @@ -353,15 +354,6 @@ function initDateTimePicker(self) { element.change(function () { var value = element.val(); -var dateFormat; -var ofbizTime; -if (shortDate) { -dateFormat = Date.CultureInfo.formatPatterns.shortDate; -ofbizTime = "-MM-dd"; -} else { -dateFormat = Date.CultureInfo.formatPatterns.shortDate + " " + Date.CultureInfo.formatPatterns.longTime; -ofbizTime = "-MM-dd HH:mm:ss" -} var newValue = "" if (value != "") { var dateObj = Date.parseExact(value, ofbizTime); @@ -372,15 +364,6 @@ function initDateTimePicker(self) { element_i18n.change(function () { var value = element_i18n.val(); -var dateFormat; -var ofbizTime; -if (shortDate) { -dateFormat = Date.CultureInfo.formatPatterns.shortDate; -ofbizTime = "-MM-dd"; -} else { -dateFormat = Date.CultureInfo.formatPatterns.shortDate + " " + Date.CultureInfo.formatPatterns.longTime; -ofbizTime = "-MM-dd HH:mm:ss" -} var newValue = ""; var dateObj = Date.parseExact(value, dateFormat); if (value != "" && dateObj !== null) {
[ofbiz-framework] branch trunk updated: Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097)
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 25adbd2 Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097) 25adbd2 is described below commit 25adbd2088bd2b9172dc94264d03cd9e9eed58f4 Author: James Yong AuthorDate: Tue Jan 12 11:11:01 2021 +0800 Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097) Fixed regression. Manual entry is cleared after moving to next field. Thanks: Olivier for reporting --- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index dcffe7d..016a488 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -382,7 +382,7 @@ function initDateTimePicker(self) { ofbizTime = "-MM-dd HH:mm:ss" } var newValue = ""; -var dateObj = Date.parseExact(self.value, dateFormat); +var dateObj = Date.parseExact(value, dateFormat); if (value != "" && dateObj !== null) { newValue = dateObj.toString(ofbizTime); } else { // invalid input
[ofbiz-framework] branch trunk updated: Improved: Open Menu file from browser (OFBIZ-12119)
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 067db8f Improved: Open Menu file from browser (OFBIZ-12119) 067db8f is described below commit 067db8fe9e4ce09b1279f33aa01a3e40d03681c0 Author: James Yong AuthorDate: Sat Jan 9 13:05:23 2021 +0800 Improved: Open Menu file from browser (OFBIZ-12119) User can open menu definition file from the browser by clicking on the named border. --- .../org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java | 8 1 file changed, 8 insertions(+) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java index 99d3f9b..f3b55ee 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java @@ -52,6 +52,7 @@ import org.apache.ofbiz.widget.renderer.VisualTheme; import freemarker.core.Environment; import freemarker.template.Template; import freemarker.template.TemplateException; +import org.apache.ofbiz.widget.renderer.html.HtmlWidgetRenderer; public class MacroMenuRenderer implements MenuStringRenderer { @@ -299,6 +300,9 @@ public class MacroMenuRenderer implements MenuStringRenderer { } catch (TemplateException e) { throw new IOException(e); } +if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { +writer.append(HtmlWidgetRenderer.endNamedBorder("Menu", menu.getBoundaryCommentName())); +} } @Override @@ -367,6 +371,10 @@ public class MacroMenuRenderer implements MenuStringRenderer { @Override public void renderMenuOpen(Appendable writer, Map context, ModelMenu menu) throws IOException { +if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { +writer.append(HtmlWidgetRenderer.beginNamedBorder("Menu", +menu.getBoundaryCommentName(), ((HttpServletRequest) context.get("request")).getContextPath())); +} Map parameters = new HashMap<>(); if (ModelWidget.widgetBoundaryCommentsEnabled(context)) { StringBuilder sb = new StringBuilder("Begin Menu Widget ");
[ofbiz-framework] branch trunk updated: Fixed: Open Screen file from browser (OFBIZ-12038)
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 f484b0d Fixed: Open Screen file from browser (OFBIZ-12038) f484b0d is described below commit f484b0d3184c3312bd4e70a69c26e154d86ce1a4 Author: James Yong AuthorDate: Wed Jan 6 23:23:35 2021 +0800 Fixed: Open Screen file from browser (OFBIZ-12038) Fix named borders not rendered for sub-screens. --- .../ofbiz/widget/renderer/macro/MacroScreenRenderer.java | 10 ++ .../ofbiz/widget/renderer/macro/MacroScreenViewHandler.java| 10 -- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java index 810bf44..7cc9ed1 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java @@ -64,6 +64,7 @@ import org.apache.ofbiz.widget.renderer.MenuStringRenderer; import org.apache.ofbiz.widget.renderer.Paginator; import org.apache.ofbiz.widget.renderer.ScreenStringRenderer; import org.apache.ofbiz.widget.renderer.VisualTheme; +import org.apache.ofbiz.widget.renderer.html.HtmlWidgetRenderer; import org.xml.sax.SAXException; import freemarker.core.Environment; @@ -172,9 +173,18 @@ public class MacroScreenRenderer implements ScreenStringRenderer { parameters.put("boundaryComment", sb.toString()); executeMacro(writer, "renderSectionBegin", parameters); } +if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE && section.isMainSection()) { +// render start of named border for screen +writer.append(HtmlWidgetRenderer.beginNamedBorder("Screen", +section.getBoundaryCommentName(), ((HttpServletRequest) context.get("request")).getContextPath())); +} } @Override public void renderSectionEnd(Appendable writer, Map context, ModelScreenWidget.Section section) throws IOException { +if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE && section.isMainSection()) { +// render end of named border for screen +writer.append(HtmlWidgetRenderer.endNamedBorder("Screen", section.getBoundaryCommentName())); +} if (this.widgetCommentsEnabled) { Map parameters = new HashMap<>(); StringBuilder sb = new StringBuilder(); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java index fd09b24..6972238 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java @@ -36,14 +36,12 @@ import org.apache.ofbiz.base.util.collections.MapStack; import org.apache.ofbiz.webapp.view.AbstractViewHandler; import org.apache.ofbiz.webapp.view.ViewHandlerException; import org.apache.ofbiz.widget.model.ModelTheme; -import org.apache.ofbiz.widget.model.ModelWidget; import org.apache.ofbiz.widget.renderer.FormStringRenderer; import org.apache.ofbiz.widget.renderer.MenuStringRenderer; import org.apache.ofbiz.widget.renderer.ScreenRenderer; import org.apache.ofbiz.widget.renderer.ScreenStringRenderer; import org.apache.ofbiz.widget.renderer.TreeStringRenderer; import org.apache.ofbiz.widget.renderer.VisualTheme; -import org.apache.ofbiz.widget.renderer.html.HtmlWidgetRenderer; import org.xml.sax.SAXException; import freemarker.template.TemplateException; @@ -115,15 +113,7 @@ public class MacroScreenViewHandler extends AbstractViewHandler { context.put("screens", screens); context.put("simpleEncoder", UtilCodec.getEncoder(visualTheme.getModelTheme().getEncoder(getName(; screenStringRenderer.renderScreenBegin(writer, context); -if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { -// render start of named border for screen -writer.append(HtmlWidgetRenderer.beginNamedBorder("Screen", page, request.getContextPath())); -} screens.render(page); -if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { -// render end of named border for screen -writer.append(HtmlWidgetRende
[ofbiz-framework] branch trunk updated: Improved: Apply CSS Grid to Find Orders (OFBIZ-12116)
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 ba5536f Improved: Apply CSS Grid to Find Orders (OFBIZ-12116) ba5536f is described below commit ba5536fe5735fcddc7eb8b515372cab932c0a913 Author: James Yong AuthorDate: Sun Jan 3 11:13:13 2021 +0800 Improved: Apply CSS Grid to Find Orders (OFBIZ-12116) Improve naming --- applications/order/template/order/FindOrders.ftl | 4 ++-- themes/common-theme/webapp/common/css/info.css | 10 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/applications/order/template/order/FindOrders.ftl b/applications/order/template/order/FindOrders.ftl index 21d9e10..24231f7 100644 --- a/applications/order/template/order/FindOrders.ftl +++ b/applications/order/template/order/FindOrders.ftl @@ -155,7 +155,7 @@ function paginateOrderList(viewSize, viewIndex, hideFields) { <#if parameters.hideFields?default("N") != "Y"> - + ${uiLabelMap.OrderOrderId} @@ -246,7 +246,7 @@ function paginateOrderList(viewSize, viewIndex, hideFields) { ${uiLabelMap.CommonStatus} - + <#list orderStatuses as orderStatus> checked/> diff --git a/themes/common-theme/webapp/common/css/info.css b/themes/common-theme/webapp/common/css/info.css index f791b3e..acde038 100644 --- a/themes/common-theme/webapp/common/css/info.css +++ b/themes/common-theme/webapp/common/css/info.css @@ -40,11 +40,13 @@ limitations under the License. /* used by ofbiz-form on CSS Grid Layout */ .ofbiz-form { display: grid; -grid-template-columns: [col1-label] minmax(150px, auto) 1fr [col2-label] minmax(150px, auto) 1fr; grid-auto-flow: row; grid-gap: .4em; padding: 1em; } +.with-left-right-columns { +grid-template-columns: [left-col-label] minmax(150px, auto) 1fr [right-col-label] minmax(150px, auto) 1fr; +} .ofbiz-form label { text-align: right; padding: 0.4em; @@ -55,10 +57,10 @@ limitations under the License. } .ofbiz-form > label.left-column, .ofbiz-form > fieldset.left-column { -grid-column: col1-label; +grid-column: left-col-label; } .ofbiz-form > label.right-column { -grid-column: col2-label; +grid-column: right-col-label; } .ofbiz-form > input, .ofbiz-form > select, @@ -67,7 +69,7 @@ limitations under the License. padding: .1em; border: 1px solid lightgray; } -.ofbiz-form .full-width-control { +.ofbiz-form .full-span-field { grid-column: 2 / span 3; } .ofbiz-form .full-width-center {
[ofbiz-framework] branch trunk updated: Improved: Apply CSS Grid to Find Orders (OFBIZ-12116)
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 6f3c7cb Improved: Apply CSS Grid to Find Orders (OFBIZ-12116) 6f3c7cb is described below commit 6f3c7cb4c2bfd913bb8748776e7b02c15af41df5 Author: James Yong AuthorDate: Sat Jan 2 12:46:44 2021 +0800 Improved: Apply CSS Grid to Find Orders (OFBIZ-12116) Apply CSS Grid Layout on the form. Keep related fields together --- applications/order/template/order/FindOrders.ftl | 554 + .../order/widget/ordermgr/OrderViewScreens.xml | 1 - themes/common-theme/webapp/common/css/info.css | 38 ++ 3 files changed, 281 insertions(+), 312 deletions(-) diff --git a/applications/order/template/order/FindOrders.ftl b/applications/order/template/order/FindOrders.ftl index d50e07c..21d9e10 100644 --- a/applications/order/template/order/FindOrders.ftl +++ b/applications/order/template/order/FindOrders.ftl @@ -155,320 +155,252 @@ function paginateOrderList(viewSize, viewIndex, hideFields) { <#if parameters.hideFields?default("N") != "Y"> - - - - - - -${uiLabelMap.OrderOrderId} - - - -${uiLabelMap.OrderOrderName} - - - -${uiLabelMap.OrderExternalId} - - - -${uiLabelMap.OrderCustomerPo} - - - -${uiLabelMap.OrderInternalCode} - - - -${uiLabelMap.ProductProductId} - - <@htmlTemplate.lookupField value='${requestParameters.productId!}' formName="lookuporder" name="productId" id="productId" fieldFormName="LookupProduct"/> - - - <#if goodIdentificationTypes?has_content> - - ${uiLabelMap.ProductGoodIdentificationType} - - - <#if currentGoodIdentificationType?has_content> - ${currentGoodIdentificationType.get("description", locale)} - --- - - ${uiLabelMap.ProductAnyGoodIdentification} - <#list goodIdentificationTypes as goodIdentificationType> - ${goodIdentificationType.get("description", locale)} - - - - - - ${uiLabelMap.ProductGoodIdentification} - - + + + ${uiLabelMap.OrderOrderId} + + + ${uiLabelMap.OrderOrderName} + + + ${uiLabelMap.OrderOrderType} + + <#if currentType?has_content> + ${currentType.get("description", locale)} + --- + + ${uiLabelMap.OrderAnyOrderType} + <#list orderTypes as orderType> + ${orderType.get("description", locale)} + + + + ${uiLabelMap.OrderCustomerPo} + + + ${uiLabelMap.CommonDateFilter} + + <@htmlTemplate.renderDateTimeField name="minDate" event="" action="" value="${requestParameters.minDate!}" className="" alert="" title="Format: -MM-dd HH:mm:ss.SSS" size="25" maxlength="30" id="minDate1" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeT [...] + ${uiLabelMap.CommonFrom} + + + ${uiLabelMap.OrderExternalId} + + + + + <@htmlTemplate.renderDateTimeField name="maxDate" event="" action="" value="${requestParameters.maxDate!}" className="" alert="" title="Format: -MM-dd HH:mm:ss.SSS" size="25" maxlength="30" id="maxDate1" dateType="date" shortDateInput=false timeDropdownParamName=""
[ofbiz-framework] branch trunk updated: Improved: Change inline style to js for multiple select field (OFBIZ-12115)
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 a66f0a9 Improved: Change inline style to js for multiple select field (OFBIZ-12115) a66f0a9 is described below commit a66f0a9be8d61b17ed0aeb4f635bc79d513a136d Author: James Yong AuthorDate: Fri Jan 1 13:13:46 2021 +0800 Improved: Change inline style to js for multiple select field (OFBIZ-12115) Test pages at /ordermgr/control/FindRequest and /ordermgr/control/findorders --- .../template/includes/SetMultipleSelectJs.ftl| 15 +++ .../template/includes/SetMultipleSelectJsList.ftl| 20 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl index 8f089ce..d05c848 100644 --- a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl +++ b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl @@ -55,18 +55,9 @@ jQuery(document).ready(function () { }); }); }); - - - <#if asm_multipleSelectForm?? && asm_formSize??> -#${asm_multipleSelectForm} -{ -width: ${asm_formSize!700}px; -position: relative; -} +jQuery("#${asm_multipleSelectForm}").css({"width": "${asm_formSize!700}px", "position": "relative"}); </#if> -.asmListItem { -width: ${asm_asmListItemPercentOfForm!95}%; -} - +jQuery(".asmListItem").css("width", "${asm_asmListItemPercentOfForm!95}%") + diff --git a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl index 4731f89..606e2f4 100644 --- a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl +++ b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl @@ -17,6 +17,7 @@ specific language governing permissions and limitations under the License. --> <#if asm_listField??> <#-- we check only this var and suppose the others are also present --> + <#assign ranOnce=false> <#list asm_listField as row> <#if row.asm_multipleSelect??> @@ -57,19 +58,14 @@ under the License. }); }); }); + <#if !ranOnce> +<#assign ranOnce=true> +<#if asm_multipleSelectForm?? && asm_formSize??> + jQuery("#${asm_multipleSelectForm}").css({"width": "${asm_formSize!700}px", "position": "relative"}); +</#if> + jQuery(".asmListItem").css("width", "${asm_asmListItemPercentOfForm!95}%") + </#if> - - <#if asm_multipleSelectForm?? && asm_formSize??> - #${asm_multipleSelectForm} - { - width: ${asm_formSize!700}px; - position: relative; - } - </#if> - .asmListItem { - width: ${asm_asmListItemPercentOfForm!95}%; - } -
[ofbiz-framework] branch trunk updated: Reverted: apply buttontext class for links inside screenlet title bar (OFBIZ-12112)
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 816a2a6 Reverted: apply buttontext class for links inside screenlet title bar (OFBIZ-12112) 816a2a6 is described below commit 816a2a6ac1ae410cb85087bb986a4e3c1dc4b9bc Author: James Yong AuthorDate: Sun Dec 27 15:29:03 2020 +0800 Reverted: apply buttontext class for links inside screenlet title bar (OFBIZ-12112) Links not showing correctly for themes like Bluelight, Tomahawk. This reverts commit 9d0e5313 --- applications/order/template/entry/CheckInits.ftl | 8 applications/order/template/order/FindOrders.ftl | 6 +++--- applications/order/template/order/ViewAllocationPlan.ftl | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/applications/order/template/entry/CheckInits.ftl b/applications/order/template/entry/CheckInits.ftl index 0f96fe0..5317c70 100644 --- a/applications/order/template/entry/CheckInits.ftl +++ b/applications/order/template/entry/CheckInits.ftl @@ -39,8 +39,8 @@ under the License. ${uiLabelMap.OrderSalesOrder}<#if shoppingCart??>${uiLabelMap.OrderInProgress} -${uiLabelMap.CommonContinue} -findparty">${uiLabelMap.PartyFindParty} +${uiLabelMap.CommonContinue} +findparty">${uiLabelMap.PartyFindParty} @@ -125,8 +125,8 @@ under the License. ${uiLabelMap.OrderPurchaseOrder}<#if shoppingCart??>${uiLabelMap.OrderInProgress} -${uiLabelMap.CommonContinue} -findparty">${uiLabelMap.PartyFindParty} +${uiLabelMap.CommonContinue} +findparty">${uiLabelMap.PartyFindParty} diff --git a/applications/order/template/order/FindOrders.ftl b/applications/order/template/order/FindOrders.ftl index 2f7efbf..d50e07c 100644 --- a/applications/order/template/order/FindOrders.ftl +++ b/applications/order/template/order/FindOrders.ftl @@ -143,11 +143,11 @@ function paginateOrderList(viewSize, viewIndex, hideFields) { <#if "Y" == requestParameters.hideFields?default("N")> -${uiLabelMap.CommonShowLookupFields} +${uiLabelMap.CommonShowLookupFields} <#else> <#if orderList??>${uiLabelMap.CommonHideFields} -findparty?externalLoginKey=${requestAttributes.externalLoginKey!}">${uiLabelMap.PartyLookupParty} -${uiLabelMap.OrderLookupOrder} +findparty?externalLoginKey=${requestAttributes.externalLoginKey!}">${uiLabelMap.PartyLookupParty} +${uiLabelMap.OrderLookupOrder} diff --git a/applications/order/template/order/ViewAllocationPlan.ftl b/applications/order/template/order/ViewAllocationPlan.ftl index 1b9fc91..3bb374a 100644 --- a/applications/order/template/order/ViewAllocationPlan.ftl +++ b/applications/order/template/order/ViewAllocationPlan.ftl @@ -97,7 +97,7 @@ under the License. ${uiLabelMap.OrderOverview} [${uiLabelMap.CommonId}:${allocationPlanInfo.planId!}] <#if (allocationPlanInfo.statusId! == "ALLOC_PLAN_CREATED" || allocationPlanInfo.statusId! == "ALLOC_PLAN_APPROVED") && security.hasPermission("ALLOCPLAN_CANCEL", session)> - ${uiLabelMap.OrderCancelPlan} + ${uiLabelMap.OrderCancelPlan} @@ -106,7 +106,7 @@ under the License. <#if (allocationPlanInfo.statusId! == "ALLOC_PLAN_CREATED") && security.hasPermission("ALLOCPLAN_APPROVE", session)> - ${uiLabelMap.OrderApprovePlan} + ${uiLabelMap.OrderApprovePlan}
[ofbiz-framework] branch trunk updated: Improved: apply buttontext class for links inside screenlet title bar (OFBIZ-12112)
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 9d0e531 Improved: apply buttontext class for links inside screenlet title bar (OFBIZ-12112) 9d0e531 is described below commit 9d0e5313bcd236a7867e20d25b3737fea64d7df0 Author: James Yong AuthorDate: Sat Dec 26 20:25:47 2020 +0800 Improved: apply buttontext class for links inside screenlet title bar (OFBIZ-12112) For Order application --- applications/order/template/entry/CheckInits.ftl | 8 applications/order/template/order/FindOrders.ftl | 6 +++--- applications/order/template/order/ViewAllocationPlan.ftl | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/applications/order/template/entry/CheckInits.ftl b/applications/order/template/entry/CheckInits.ftl index 5317c70..0f96fe0 100644 --- a/applications/order/template/entry/CheckInits.ftl +++ b/applications/order/template/entry/CheckInits.ftl @@ -39,8 +39,8 @@ under the License. ${uiLabelMap.OrderSalesOrder}<#if shoppingCart??>${uiLabelMap.OrderInProgress} -${uiLabelMap.CommonContinue} -findparty">${uiLabelMap.PartyFindParty} +${uiLabelMap.CommonContinue} +findparty">${uiLabelMap.PartyFindParty} @@ -125,8 +125,8 @@ under the License. ${uiLabelMap.OrderPurchaseOrder}<#if shoppingCart??>${uiLabelMap.OrderInProgress} -${uiLabelMap.CommonContinue} -findparty">${uiLabelMap.PartyFindParty} +${uiLabelMap.CommonContinue} +findparty">${uiLabelMap.PartyFindParty} diff --git a/applications/order/template/order/FindOrders.ftl b/applications/order/template/order/FindOrders.ftl index d50e07c..2f7efbf 100644 --- a/applications/order/template/order/FindOrders.ftl +++ b/applications/order/template/order/FindOrders.ftl @@ -143,11 +143,11 @@ function paginateOrderList(viewSize, viewIndex, hideFields) { <#if "Y" == requestParameters.hideFields?default("N")> -${uiLabelMap.CommonShowLookupFields} +${uiLabelMap.CommonShowLookupFields} <#else> <#if orderList??>${uiLabelMap.CommonHideFields} -findparty?externalLoginKey=${requestAttributes.externalLoginKey!}">${uiLabelMap.PartyLookupParty} -${uiLabelMap.OrderLookupOrder} +findparty?externalLoginKey=${requestAttributes.externalLoginKey!}">${uiLabelMap.PartyLookupParty} +${uiLabelMap.OrderLookupOrder} diff --git a/applications/order/template/order/ViewAllocationPlan.ftl b/applications/order/template/order/ViewAllocationPlan.ftl index 3bb374a..1b9fc91 100644 --- a/applications/order/template/order/ViewAllocationPlan.ftl +++ b/applications/order/template/order/ViewAllocationPlan.ftl @@ -97,7 +97,7 @@ under the License. ${uiLabelMap.OrderOverview} [${uiLabelMap.CommonId}:${allocationPlanInfo.planId!}] <#if (allocationPlanInfo.statusId! == "ALLOC_PLAN_CREATED" || allocationPlanInfo.statusId! == "ALLOC_PLAN_APPROVED") && security.hasPermission("ALLOCPLAN_CANCEL", session)> - ${uiLabelMap.OrderCancelPlan} + ${uiLabelMap.OrderCancelPlan} @@ -106,7 +106,7 @@ under the License. <#if (allocationPlanInfo.statusId! == "ALLOC_PLAN_CREATED") && security.hasPermission("ALLOCPLAN_APPROVE", session)> - ${uiLabelMap.OrderApprovePlan} + ${uiLabelMap.OrderApprovePlan}
[ofbiz-framework] branch trunk updated: Improved: Do not limit form width if asm_formSize is not defined (OFBIZ-12102)
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 451f42a Improved: Do not limit form width if asm_formSize is not defined (OFBIZ-12102) 451f42a is described below commit 451f42a21c498330dd48aa807eb875bad1877a3c Author: James Yong AuthorDate: Sat Dec 26 17:08:22 2020 +0800 Improved: Do not limit form width if asm_formSize is not defined (OFBIZ-12102) Extend the same behavior to SetMultipleSelectJs.ftl. --- themes/common-theme/template/includes/SetMultipleSelectJs.ftl | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl index 4d72567..8f089ce 100644 --- a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl +++ b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl @@ -58,14 +58,13 @@ jQuery(document).ready(function () {
[ofbiz-framework] branch trunk updated: Improved: Do not limit form width if asm_formSize is not defined (OFBIZ-12102)
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 f561c41 Improved: Do not limit form width if asm_formSize is not defined (OFBIZ-12102) f561c41 is described below commit f561c41ea0fe3e3363128f89a9a2eaf0448fd538 Author: James Yong AuthorDate: Sat Dec 26 13:14:07 2020 +0800 Improved: Do not limit form width if asm_formSize is not defined (OFBIZ-12102) Changed at SetMultipleSelectJsList.ftl. Tested page at /ordermgr/control/FindRequest --- .../common-theme/template/includes/SetMultipleSelectJsList.ftl | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl index a201476..4731f89 100644 --- a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl +++ b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl @@ -61,14 +61,13 @@ under the License.
[ofbiz-framework] branch trunk updated: Implemented: Support Freemarker square interpolation syntax (OFBIZ-12099)
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 203fa5f Implemented: Support Freemarker square interpolation syntax (OFBIZ-12099) 203fa5f is described below commit 203fa5f1c1bc2ae34d964936e75a74fc7d79a457 Author: James Yong AuthorDate: Mon Dec 21 19:46:11 2020 +0800 Implemented: Support Freemarker square interpolation syntax (OFBIZ-12099) Use square interpolation syntax when file extension is .spi.ftl --- .../main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 942b3c1..cde3114 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -70,7 +70,11 @@ public class HtmlWidget extends ModelScreenWidget { private static final UtilCache SPECIAL_TEMPLATE_CACHE = UtilCache.createUtilCache("widget.screen.template.ftl.general", 0, 0, false); protected static final Configuration SPECIAL_CONFIG = FreeMarkerWorker.makeConfiguration(new ExtendedWrapper(FreeMarkerWorker.VERSION)); - +private static final Configuration SPECIAL_CONFIG_SQUARE_INTERPOLATION = +FreeMarkerWorker.makeConfiguration(new ExtendedWrapper(FreeMarkerWorker.VERSION)); +static { + SPECIAL_CONFIG_SQUARE_INTERPOLATION.setInterpolationSyntax(Configuration.SQUARE_BRACKET_INTERPOLATION_SYNTAX); +} // not sure if this is the best way to get FTL to use my fancy MapModel derivative, but should work at least... public static class ExtendedWrapper extends BeansWrapper { public ExtendedWrapper(Version version) { @@ -176,7 +180,11 @@ public class HtmlWidget extends ModelScreenWidget { if (location.endsWith(".fo.ftl")) { // FOP can't render correctly escaped characters template = FreeMarkerWorker.getTemplate(location); } else { -template = FreeMarkerWorker.getTemplate(location, SPECIAL_TEMPLATE_CACHE, SPECIAL_CONFIG); +if (location.endsWith(".sqi.ftl")) { +template = FreeMarkerWorker.getTemplate(location, SPECIAL_TEMPLATE_CACHE, SPECIAL_CONFIG_SQUARE_INTERPOLATION); +} else { +template = FreeMarkerWorker.getTemplate(location, SPECIAL_TEMPLATE_CACHE, SPECIAL_CONFIG); +} } FreeMarkerWorker.renderTemplate(template, context, writer);
[ofbiz-framework] branch trunk updated: Add notes to js funcs
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 cc90994 Add notes to js funcs cc90994 is described below commit cc90994a4f7378557d10f33b72e242c4dc958939 Author: James Yong AuthorDate: Sun Dec 20 15:01:09 2020 +0800 Add notes to js funcs --- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 11 +++ 1 file changed, 11 insertions(+) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 8585ff8..dcffe7d 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -1489,6 +1489,13 @@ function sendJWT(targetUrl) { } } +/** + * Load an array of external javascript and/or css files asynchronously. + * Run success function after the external files are loaded. + * @param urls array of js / css links + * @param onSuccessFn function to run when the files are loaded successfully + * @param onErrorFn optional function to run when any of the files are not loaded correctly + */ var importLibrary = function() { var importLibraryFiles = new Map(); return function (urls, onSuccessFn, onErrorFn) { @@ -1530,6 +1537,10 @@ var importLibrary = function() { } }(); +/** + * Is browser accessing local server? + * @returns {boolean} + */ function isLocalEnviron(){ return ["localhost","127.0.0.1"].includes(window.location.hostname); } \ No newline at end of file
[ofbiz-framework] branch trunk updated: Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097)
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 483e77e Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097) 483e77e is described below commit 483e77ea838d544772d5fe1592910bc3dbc9e177 Author: James Yong AuthorDate: Sun Dec 20 08:46:52 2020 +0800 Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097) Use inline script when request is ajax --- .../widget/renderer/macro/MacroFormRenderer.java | 6 + .../template/macro/HtmlFormMacroLibrary.ftl| 7 +- .../webapp/common/js/util/OfbizUtil.js | 233 +++-- 3 files changed, 130 insertions(+), 116 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java index 69cdae9..64728d7 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java @@ -729,6 +729,10 @@ public final class MacroFormRenderer implements FormStringRenderer { formattedMask = "-99-99 99:99:99"; } } +String isXMLHttpRequest = "false"; +if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With"))) { +isXMLHttpRequest = "true"; +} String tabindex = modelFormField.getTabindex(); StringWriter sr = new StringWriter(); sr.append("<@renderDateTimeField "); @@ -796,6 +800,8 @@ public final class MacroFormRenderer implements FormStringRenderer { sr.append(formattedMask); sr.append("\" tabindex=\""); sr.append(tabindex); +sr.append("\" isXMLHttpRequest=\""); +sr.append(isXMLHttpRequest); sr.append("\" disabled="); sr.append(Boolean.toString(disabled)); sr.append(" />"); diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl index 3d3feac..741871e 100644 --- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl @@ -90,7 +90,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="" disabled=""> +<#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="" isXMLHttpRequest=""> <#local cultureInfo = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("datejs", .locale)/> <#local datePickerLang = Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("jquery", .locale)/> @@ -147,6 +147,11 @@ under the License. +<#if isXMLHttpRequest=="true"> + + initDateTimePicker(document.getElementById("${id}")); + + diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 09c3573..8585ff8 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -309,122 +309,8 @@ function bindObservers(bind_element) { var element = jQuery(this); element.validate(); }); - jQuery(bind_element).find(".date-time-picker").each(function(){ -var element = jQuery(this); -
[ofbiz-plugins] branch trunk updated: Improved: Change inline style to class for wait-spinner (OFBIZ-12095)
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-plugins.git The following commit(s) were added to refs/heads/trunk by this push: new d45c377 Improved: Change inline style to class for wait-spinner (OFBIZ-12095) d45c377 is described below commit d45c3773397d09b0625662c5a8c32f9b503318cf Author: James Yong AuthorDate: Sat Dec 19 17:49:08 2020 +0800 Improved: Change inline style to class for wait-spinner (OFBIZ-12095) Inline style not encouraged by Content Security Policy --- multiflex/template/Header.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multiflex/template/Header.ftl b/multiflex/template/Header.ftl index a07de35..a411622 100644 --- a/multiflex/template/Header.ftl +++ b/multiflex/template/Header.ftl @@ -20,7 +20,7 @@ under the License. - +
[ofbiz-framework] branch trunk updated: Improved: Change inline style to class for wait-spinner (OFBIZ-12095)
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 71a0d6b Improved: Change inline style to class for wait-spinner (OFBIZ-12095) 71a0d6b is described below commit 71a0d6b4dbd9a41b951c95bbe38bd5b193431cbc Author: James Yong AuthorDate: Sat Dec 19 13:10:47 2020 +0800 Improved: Change inline style to class for wait-spinner (OFBIZ-12095) Add code missed in earlier commit --- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 559bd96..09c3573 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -1264,6 +1264,7 @@ function waitSpinnerShow() { winHeight = jQuery(window).height(); lookupTop = (scrollOffY + winHeight / 2) - (jSpinner.height() / 2); +jSpinner.removeClass("hidden"); jSpinner.css("display", "block"); jSpinner.css("left", lookupLeft + "px"); jSpinner.css("top", lookupTop + "px");
[ofbiz-framework] branch trunk updated: Improved: Change inline style to class for wait-spinner (OFBIZ-12095)
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 d380125 Improved: Change inline style to class for wait-spinner (OFBIZ-12095) d380125 is described below commit d3801256dfef10e9d5576a4e3c0f262591dda68e Author: James Yong AuthorDate: Sat Dec 19 12:42:28 2020 +0800 Improved: Change inline style to class for wait-spinner (OFBIZ-12095) Inline style not encouraged by Content Security Policy --- themes/bluelight/template/Header.ftl| 2 +- themes/common-theme/webapp/common/css/info.css | 5 + themes/flatgrey/template/Header.ftl | 2 +- themes/rainbowstone/template/includes/HomeMenu.ftl | 2 +- themes/rainbowstone/template/includes/TopAppBar.ftl | 2 +- themes/tomahawk/template/Header.ftl | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/themes/bluelight/template/Header.ftl b/themes/bluelight/template/Header.ftl index 6ff5e16..5c8d65e 100644 --- a/themes/bluelight/template/Header.ftl +++ b/themes/bluelight/template/Header.ftl @@ -122,7 +122,7 @@ under the License. <#include "component://common-theme/template/ImpersonateBanner.ftl"/> - + diff --git a/themes/common-theme/webapp/common/css/info.css b/themes/common-theme/webapp/common/css/info.css index 537e944..c7aa241 100644 --- a/themes/common-theme/webapp/common/css/info.css +++ b/themes/common-theme/webapp/common/css/info.css @@ -31,3 +31,8 @@ limitations under the License. .info-cursor-none { cursor: text; } + +/* used by wait-spinner */ +.hidden { +display: none; +} diff --git a/themes/flatgrey/template/Header.ftl b/themes/flatgrey/template/Header.ftl index a24bbe3..4a8dcec 100644 --- a/themes/flatgrey/template/Header.ftl +++ b/themes/flatgrey/template/Header.ftl @@ -102,7 +102,7 @@ under the License. <#assign organizationLogoLinkURL = "${layoutSettings.organizationLogoLinkUrl!}"> <#include "component://common-theme/template/ImpersonateBanner.ftl"/> - + diff --git a/themes/rainbowstone/template/includes/HomeMenu.ftl b/themes/rainbowstone/template/includes/HomeMenu.ftl index 7ed398b..7eab625 100644 --- a/themes/rainbowstone/template/includes/HomeMenu.ftl +++ b/themes/rainbowstone/template/includes/HomeMenu.ftl @@ -70,7 +70,7 @@ under the License. setUserLayoutPreferences('HOME_MENU_FAVORITES', 'displayFavorites', displayFavorite); } - + diff --git a/themes/rainbowstone/template/includes/TopAppBar.ftl b/themes/rainbowstone/template/includes/TopAppBar.ftl index 318c0fa..2906df2 100644 --- a/themes/rainbowstone/template/includes/TopAppBar.ftl +++ b/themes/rainbowstone/template/includes/TopAppBar.ftl @@ -31,7 +31,7 @@ under the License. <#include "component://common-theme/template/ImpersonateBanner.ftl"/> - + diff --git a/themes/tomahawk/template/Header.ftl b/themes/tomahawk/template/Header.ftl index ab07096..e735907 100644 --- a/themes/tomahawk/template/Header.ftl +++ b/themes/tomahawk/template/Header.ftl @@ -107,7 +107,7 @@ under the License. <#include "component://common-theme/template/ImpersonateBanner.ftl"/> - +
[ofbiz-framework] branch trunk updated: Fixed: wait spinner doesn't show when running ajaxUpdateArea (OFBIZ-12094)
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 798822c Fixed: wait spinner doesn't show when running ajaxUpdateArea (OFBIZ-12094) 798822c is described below commit 798822c94fc2910e09944321868563b167772291 Author: James Yong AuthorDate: Sat Dec 19 09:19:34 2020 +0800 Fixed: wait spinner doesn't show when running ajaxUpdateArea (OFBIZ-12094) Use setTimeout() after running waitSpinnerShow() to ensure wait spinner icon is displayed properly. --- .../webapp/common/js/util/OfbizUtil.js | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 4bda2cc..559bd96 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -620,16 +620,18 @@ function ajaxUpdateArea(areaId, target, targetParams) { return; } waitSpinnerShow(); -jQuery.ajax({ -url: target, -type: "POST", -data: targetParams, -success: function(data) { -jQuery("#" + areaId).html(data); -waitSpinnerHide(); -}, -error: function(data) {waitSpinnerHide()} -}); +setTimeout(function() { +jQuery.ajax({ +url: target, +type: "POST", +data: targetParams, +success: function(data) { +jQuery("#" + areaId).html(data); +waitSpinnerHide(); +}, +error: function(data) {waitSpinnerHide()} +}); +}, 0); } /** Update multiple areas (HTML container elements).
[ofbiz-framework] branch trunk updated: Correct spelling for μManager.
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 89f36f1 Correct spelling for μManager. 89f36f1 is described below commit 89f36f1a06b943b74d42daf37bdcd998ffa6422a Author: James Yong AuthorDate: Tue Dec 8 19:49:15 2020 +0800 Correct spelling for μManager. Reference: https://imagejdocu.tudor.lu/faq/general/which_file_formats_are_supported_by_imagej --- framework/security/config/security.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/security/config/security.properties b/framework/security/config/security.properties index c0fba4e..2947ce4 100644 --- a/framework/security/config/security.properties +++ b/framework/security/config/security.properties @@ -217,7 +217,7 @@ templateClassResolver= #-- #-- If you want to get more image formats then use imageJ: #-- For imagejSupportedFormats see https://imagejdocu.tudor.lu/faq/general/which_file_formats_are_supported_by_imagej. NOTE: plugins support is important here -#-- imagejSupportedFormats=TIFF(.tiff,.tif),JPEG(.jpeg,.jpg),BMP(.bmp),FITS(.fits),PGM(.pgm),PPM(.ppm),PBM(.pbm),GIF(.gif),AnimatedGIF(.gif),PNG(.png),DICOM(.dic,.dcm,.dicom),PICT(.pict,.pic,.pct),PSD(.psd),TGA(.tga),ICO(.ico),CUR(.cur),Sunraster(.sun),XBM(.xbm),XPM(.xpm),PCX(.pcx),ANALYZE,NIfTi,AHF(.ahf),SPE(.spe),PIC(.pic),LeicaTIFF(.tiff,.lei),Quicktime(.pic,.mov),AVI(.avi),PDS(.pds),LSM(.lsm),RAW,ISAC,FluoViewTIFF(.tiff),FluoviewFV1000OIB(.oib),FluoviewFV1000OIF(.oif,.tif,-ro.pty,.lu [...] +#-- imagejSupportedFormats=TIFF(.tiff,.tif),JPEG(.jpeg,.jpg),BMP(.bmp),FITS(.fits),PGM(.pgm),PPM(.ppm),PBM(.pbm),GIF(.gif),AnimatedGIF(.gif),PNG(.png),DICOM(.dic,.dcm,.dicom),PICT(.pict,.pic,.pct),PSD(.psd),TGA(.tga),ICO(.ico),CUR(.cur),Sunraster(.sun),XBM(.xbm),XPM(.xpm),PCX(.pcx),ANALYZE,NIfTi,AHF(.ahf),SPE(.spe),PIC(.pic),LeicaTIFF(.tiff,.lei),Quicktime(.pic,.mov),AVI(.avi),PDS(.pds),LSM(.lsm),RAW,ISAC,FluoViewTIFF(.tiff),FluoviewFV1000OIB(.oib),FluoviewFV1000OIF(.oif,.tif,-ro.pty,.lu [...] #-- #-- PDFBox and PDFReader are used for PDF files #--
[ofbiz-framework] branch trunk updated: Improve notes for Tomcat SSO
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 931716a Improve notes for Tomcat SSO 931716a is described below commit 931716a6281a941d4b2460e413c4f43eb5fa2b27 Author: James Yong AuthorDate: Tue Dec 8 19:37:21 2020 +0800 Improve notes for Tomcat SSO --- framework/security/config/security.properties | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/framework/security/config/security.properties b/framework/security/config/security.properties index 43ede04..c0fba4e 100644 --- a/framework/security/config/security.properties +++ b/framework/security/config/security.properties @@ -121,8 +121,9 @@ security.login.cert.allow=true # -- pattern for the userlogin id in CN section of certificate security.login.cert.pattern=^(\\w*\\s?\\w*)\\W*.*$ -# -- use Tomcat SingleSignOn valve -# -- Tomcat SSO should not be used in a cluster: OFBIZ-10123 +# -- Use Tomcat SingleSignOn valve to allow single sign on (SSO) and single log out (SLO). +# -- Remember to set security.login.externalLoginKey.enabled to false when using Tomcat SSO. +# -- Note Tomcat SSO is not implemented for cluster as Tomcat ClusterSingleSignOn is not used: OFBIZ-10123 security.login.tomcat.sso=false # -- Hours after which EmailAdressVerification should expire @@ -216,7 +217,7 @@ templateClassResolver= #-- #-- If you want to get more image formats then use imageJ: #-- For imagejSupportedFormats see https://imagejdocu.tudor.lu/faq/general/which_file_formats_are_supported_by_imagej. NOTE: plugins support is important here -#-- imagejSupportedFormats=TIFF(.tiff,.tif),JPEG(.jpeg,.jpg),BMP(.bmp),FITS(.fits),PGM(.pgm),PPM(.ppm),PBM(.pbm),GIF(.gif),AnimatedGIF(.gif),PNG(.png),DICOM(.dic,.dcm,.dicom),PICT(.pict,.pic,.pct),PSD(.psd),TGA(.tga),ICO(.ico),CUR(.cur),Sunraster(.sun),XBM(.xbm),XPM(.xpm),PCX(.pcx),ANALYZE,NIfTi,AHF(.ahf),SPE(.spe),PIC(.pic),LeicaTIFF(.tiff,.lei),Quicktime(.pic,.mov),AVI(.avi),PDS(.pds),LSM(.lsm),RAW,ISAC,FluoViewTIFF(.tiff),FluoviewFV1000OIB(.oib),FluoviewFV1000OIF(.oif,.tif,-ro.pty,.lu [...] +#-- imagejSupportedFormats=TIFF(.tiff,.tif),JPEG(.jpeg,.jpg),BMP(.bmp),FITS(.fits),PGM(.pgm),PPM(.ppm),PBM(.pbm),GIF(.gif),AnimatedGIF(.gif),PNG(.png),DICOM(.dic,.dcm,.dicom),PICT(.pict,.pic,.pct),PSD(.psd),TGA(.tga),ICO(.ico),CUR(.cur),Sunraster(.sun),XBM(.xbm),XPM(.xpm),PCX(.pcx),ANALYZE,NIfTi,AHF(.ahf),SPE(.spe),PIC(.pic),LeicaTIFF(.tiff,.lei),Quicktime(.pic,.mov),AVI(.avi),PDS(.pds),LSM(.lsm),RAW,ISAC,FluoViewTIFF(.tiff),FluoviewFV1000OIB(.oib),FluoviewFV1000OIF(.oif,.tif,-ro.pty,.lu [...] #-- #-- PDFBox and PDFReader are used for PDF files #--
[ofbiz-framework] branch trunk updated: Fixed: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086)
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 c164494 Fixed: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086) c164494 is described below commit c1644940e94771dcaddb1b0d5f98b7042cdc1f8c Author: James Yong AuthorDate: Mon Dec 7 23:46:02 2020 +0800 Fixed: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086) Fixed compile error in MacroFormRendererTest.java. Thanks: Daniel and Tomek for the finding --- .../org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java b/framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java index 8999bcb..d7f197e 100644 --- a/framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java +++ b/framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java @@ -124,7 +124,7 @@ public class MacroFormRendererTest { label.getText(withNotNull()); result = ""; -ftlWriter.executeMacro(withNotNull(), withNotNull()); +ftlWriter.executeMacro(withNotNull(), withNull(), withNotNull()); times = 0; } }; @@ -1039,7 +1039,7 @@ public class MacroFormRendererTest { new Verifications() { { List macros = new ArrayList<>(); -ftlWriter.executeMacro(withNotNull(), withCapture(macros)); +ftlWriter.executeMacro(withNotNull(), withNull(), withCapture(macros)); assertThat(macros, not(empty())); final String macro = macros.get(0);
[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_c
[ofbiz-framework] branch trunk updated: Improved: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086)
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 76a940a Improved: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086) 76a940a is described below commit 76a940ab43b25a1d77c433e0a8071cbd818fdef0 Author: James Yong AuthorDate: Sat Dec 5 23:13:55 2020 +0800 Improved: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086) DateFindField and DateTimeField macros need to find locale-specific javascript library files. --- .../apache/ofbiz/widget/renderer/macro/FtlWriter.java| 12 +--- .../ofbiz/widget/renderer/macro/MacroFormRenderer.java | 16 +--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/FtlWriter.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/FtlWriter.java index cb48600..0be368f 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/FtlWriter.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/FtlWriter.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.rmi.server.UID; +import java.util.Locale; import java.util.Map; import java.util.WeakHashMap; @@ -45,9 +46,9 @@ public final class FtlWriter { this.visualTheme = visualTheme; } -public void executeMacro(Appendable writer, String macro) { +public void executeMacro(Appendable writer, Locale locale, String macro) { try { -Environment environment = getEnvironment(writer); +Environment environment = getEnvironment(writer, locale); environment.setVariable("visualTheme", FreeMarkerWorker.autoWrap(visualTheme, environment)); environment.setVariable("modelTheme", FreeMarkerWorker.autoWrap(visualTheme.getModelTheme(), environment)); Reader templateReader = new StringReader(macro); @@ -59,13 +60,18 @@ public final class FtlWriter { } } -private Environment getEnvironment(Appendable writer) throws TemplateException, IOException { +private Environment getEnvironment(Appendable writer, Locale locale) throws TemplateException, IOException { Environment environment = environments.get(writer); if (environment == null) { Map input = UtilMisc.toMap("key", null); environment = FreeMarkerWorker.renderTemplate(macroLibrary, input, writer); environments.put(writer, environment); } +if (locale != null) { +environment.setLocale(locale); +} else { +environment.setLocale(Locale.getDefault()); +} return environment; } } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java index 1ff4731..9fa988e 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java @@ -168,7 +168,17 @@ public final class MacroFormRenderer implements FormStringRenderer { } private void executeMacro(Appendable writer, String macro) { -ftlWriter.executeMacro(writer, macro); +ftlWriter.executeMacro(writer, null, macro); +} + +/** + * Make locale available before executing macro + * @param writer + * @param locale + * @param macro + */ +private void executeMacro(Appendable writer, Locale locale, String macro) { +ftlWriter.executeMacro(writer, locale, macro); } private String encode(String value, ModelFormField modelFormField, Map context) { @@ -789,7 +799,7 @@ public final class MacroFormRenderer implements FormStringRenderer { sr.append("\" disabled="); sr.append(Boolean.toString(disabled)); sr.append(" />"); -executeMacro(writer, sr.toString()); +executeMacro(writer, (Locale) context.get("locale"), sr.toString()); this.addAsterisks(writer, context, modelFormField); this.appendTooltip(writer, context, modelFormField); } @@ -2228,7 +2238,7 @@ public final class MacroFormRenderer implements FormStringRenderer { sr.append("\" tabindex=\""); sr.append(tabindex); sr.append("\" />"); -executeMacro(writer, sr.toString()); +executeMacro(writer, locale, sr.toString()); this.appendTooltip(writer, context, modelFormField); }
[ofbiz-framework] branch trunk updated: Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071)
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 cfabbc9 Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071) cfabbc9 is described below commit cfabbc9b7426a781bf1cb8b135364bb0b4ab25be Author: James Yong AuthorDate: Sat Dec 5 19:24:09 2020 +0800 Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071) Fixed for Jquery DatePicker --- .../src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java | 2 +- themes/common-theme/template/JsLanguageFilesMapping.ftl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java index 96c858f..a21c173 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java @@ -207,7 +207,7 @@ public final class JsLanguageFilesMapping { public static class JQuery { private static Map localeFiles = new HashMap<>(); -private static String defaultDateJs = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js"; +private static String defaultDateJs = "/common/js/jquery/ui/i18n/datepicker-en.js"; static { localeFiles.put("sq", "/common/js/jquery/ui/i18n/datepicker-sq.js"); diff --git a/themes/common-theme/template/JsLanguageFilesMapping.ftl b/themes/common-theme/template/JsLanguageFilesMapping.ftl index ab1f3f9..a463b2e 100644 --- a/themes/common-theme/template/JsLanguageFilesMapping.ftl +++ b/themes/common-theme/template/JsLanguageFilesMapping.ftl @@ -54,7 +54,7 @@ public final class JsLanguageFilesMapping { public static class JQuery { private static Map localeFiles = new HashMap<>(); -private static String defaultDateJs = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js"; +private static String defaultDateJs = "/common/js/jquery/ui/i18n/datepicker-en.js"; static { <#list jquery.keySet() as jqueryFiles>
[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 cul
[ofbiz-framework] branch trunk updated: Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071)
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 283752f Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071) 283752f is described below commit 283752fd265b59a3a007e06780a2c1d580cb0cee Author: James Yong AuthorDate: Sat Nov 28 21:26:47 2020 +0800 Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071) Default language file specified for DateTime doesn't exist in the project i.e. /common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js Changed to /common/js/jquery/plugins/datetimepicker/i18n/jquery-ui-timepicker-en.js --- .../java/org/apache/ofbiz/common/JsLanguageFilesMapping.java | 12 ++-- themes/common-theme/template/JsLanguageFilesMapping.ftl | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java index 2d6b06b..96c858f 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java @@ -31,7 +31,7 @@ public final class JsLanguageFilesMapping { public static class DateJs { -private static Map localeFiles = new HashMap(); +private static Map localeFiles = new HashMap<>(); private static String defaultDateJs = "/common/js/jquery/plugins/datejs/date-en-US.js"; static { @@ -206,7 +206,7 @@ public final class JsLanguageFilesMapping { } public static class JQuery { -private static Map localeFiles = new HashMap(); +private static Map localeFiles = new HashMap<>(); private static String defaultDateJs = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js"; static { @@ -381,7 +381,7 @@ public final class JsLanguageFilesMapping { } public static class Validation { -private static Map localeFiles = new HashMap(); +private static Map localeFiles = new HashMap<>(); private static String defaultValidation = "/common/js/jquery/plugins/validate/localization/messages_en.js"; static { @@ -555,8 +555,8 @@ public final class JsLanguageFilesMapping { } public static class DateTime { -private static Map localeFiles = new HashMap(); -private static String defaultDateTime = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js"; +private static Map localeFiles = new HashMap<>(); +private static String defaultDateTime = "/common/js/jquery/plugins/datetimepicker/i18n/jquery-ui-timepicker-en.js"; static { localeFiles.put("sq", "/common/js/jquery/plugins/datetimepicker/i18n/jquery-ui-timepicker-sq.js"); @@ -729,7 +729,7 @@ public final class JsLanguageFilesMapping { } public static class Select2 { -private static Map localeFiles = new HashMap(); +private static Map localeFiles = new HashMap<>(); private static String defaultSelect2 = "/common/js/jquery/plugins/select2/js/i18n/en.js"; static { diff --git a/themes/common-theme/template/JsLanguageFilesMapping.ftl b/themes/common-theme/template/JsLanguageFilesMapping.ftl index 8009f32..ab1f3f9 100644 --- a/themes/common-theme/template/JsLanguageFilesMapping.ftl +++ b/themes/common-theme/template/JsLanguageFilesMapping.ftl @@ -93,7 +93,7 @@ public final class JsLanguageFilesMapping { public static class DateTime { private static Map localeFiles = new HashMap<>(); -private static String defaultDateTime = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js"; +private static String defaultDateTime = "/common/js/jquery/plugins/datetimepicker/i18n/jquery-ui-timepicker-en.js"; static { <#list dateTime.keySet() as dateTimeFiles>
[ofbiz-framework] branch trunk updated: Improved: Load language js for date.js only when required (OFBIZ-12064)
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 bc5b0d5 Improved: Load language js for date.js only when required (OFBIZ-12064) bc5b0d5 is described below commit bc5b0d595cab9103e9ec0c03234cec81c80f47c3 Author: James Yong AuthorDate: Fri Nov 27 21:51:35 2020 +0800 Improved: Load language js for date.js only when required (OFBIZ-12064) Tested on 1) date time field at /ordermgr/control/orderentry and 2) date find field at /ordermgr/control/findreturn --- .../ofbiz/common/JsLanguageFilesMappingUtil.java | 44 +++ .../ftl/JsLanguageFilesMappingTransform.java | 20 +-- .../template/macro/HtmlFormMacroLibrary.ftl| 5 + .../webapp/common/js/util/OfbizUtil.js | 139 +++-- themes/common-theme/widget/CommonScreens.xml | 2 - 5 files changed, 122 insertions(+), 88 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMappingUtil.java b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMappingUtil.java new file mode 100644 index 000..aa0699a --- /dev/null +++ b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMappingUtil.java @@ -0,0 +1,44 @@ +/*** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ***/ +package org.apache.ofbiz.common; + +/** + * Allow access to language files mapping from freemarker template + */ +public final class JsLanguageFilesMappingUtil { + +private JsLanguageFilesMappingUtil() { } + +public static String getFile(String libraryName, String localeString) { +switch (libraryName) { +case "datejs": +return JsLanguageFilesMapping.DateJs.getFilePath(localeString); +case "dateTime": +return JsLanguageFilesMapping.DateTime.getFilePath(localeString); +case "jquery": +return JsLanguageFilesMapping.JQuery.getFilePath(localeString); +case "select2": +return JsLanguageFilesMapping.Select2.getFilePath(localeString); +case "validation": +return JsLanguageFilesMapping.Validation.getFilePath(localeString); +default: +return ""; +} +} +} diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java index 05198b6..53243e4 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java @@ -31,6 +31,7 @@ import org.apache.ofbiz.common.JsLanguageFilesMapping; import freemarker.core.Environment; import freemarker.ext.beans.BeanModel; import freemarker.template.TemplateTransformModel; +import org.apache.ofbiz.common.JsLanguageFilesMappingUtil; /** * access JsLanguageFilesMapping from ftl using macro @@ -52,24 +53,7 @@ public class JsLanguageFilesMappingTransform implements TemplateTransformModel { if (!libraryName.isEmpty()) { HttpServletRequest request = (HttpServletRequest) req.getWrappedObject(); String localeString = UtilHttp.getLocale(request).toString(); -switch (libraryName) { -case "datejs": - out.write(JsLanguageFilesMapping.DateJs.getFilePath(localeString)); -break; -case "dateTime": - out.write(JsLanguageFilesMapping.DateTime.getFilePath(localeString)); -break; -
[ofbiz-framework] branch trunk updated: Improved: Open Screen file from browser (OFBIZ-12038)
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 127cd86 Improved: Open Screen file from browser (OFBIZ-12038) 127cd86 is described below commit 127cd86da70b8c31942d23760533d015cfc438df Author: James Yong AuthorDate: Sun Oct 11 09:18:58 2020 +0800 Improved: Open Screen file from browser (OFBIZ-12038) Refactoring --- .../src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 516b69b..942b3c1 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -168,7 +168,7 @@ public class HtmlWidget extends ModelScreenWidget { if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); } -if (!location.endsWith(".fo.ftl") && HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { +if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE && !location.endsWith(".fo.ftl")) { HttpServletRequest request = ((HttpServletRequest) context.get("request")); writer.append(HtmlWidgetRenderer.beginNamedBorder("Template", location, request.getContextPath())); } @@ -180,7 +180,7 @@ public class HtmlWidget extends ModelScreenWidget { } FreeMarkerWorker.renderTemplate(template, context, writer); -if (!location.endsWith(".fo.ftl") && HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { +if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE && !location.endsWith(".fo.ftl")) { writer.append(HtmlWidgetRenderer.endNamedBorder("Template", location)); } if (insertWidgetBoundaryComments) {
[ofbiz-framework] branch trunk updated: Improved: Open Form Widget (Single Type) source file from browser (OFBIZ-12041)
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 a983c77 Improved: Open Form Widget (Single Type) source file from browser (OFBIZ-12041) a983c77 is described below commit a983c7741cb791301c7aee4f3f4ae73c4418a2a7 Author: James Yong AuthorDate: Sun Oct 11 08:37:39 2020 +0800 Improved: Open Form Widget (Single Type) source file from browser (OFBIZ-12041) Add function to open the corresponding Form Widget file with IDE when the named border is clicked from browser. Dependent on widget.dev.namedBorder and widget.dev.cmd.openSourceFile properties. Thanks Jacques for review --- .../org/apache/ofbiz/widget/renderer/FormRenderer.java | 14 ++ .../ofbiz/widget/renderer/html/HtmlWidgetRenderer.java | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java index e6b3522..6c61a39 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java @@ -55,6 +55,10 @@ import org.apache.ofbiz.widget.model.ModelForm.FieldGroup; import org.apache.ofbiz.widget.model.ModelForm.FieldGroupBase; import org.apache.ofbiz.widget.model.ModelFormField; import org.apache.ofbiz.widget.model.ModelGrid; +import org.apache.ofbiz.widget.model.ModelWidget; +import org.apache.ofbiz.widget.renderer.html.HtmlWidgetRenderer; + +import javax.servlet.http.HttpServletRequest; /** * A form rendering engine. @@ -969,6 +973,12 @@ public class FormRenderer { // render form open if (!modelForm.getSkipStart()) { formStringRenderer.renderFormOpen(writer, context, modelForm); +if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { +HttpServletRequest request = (HttpServletRequest) context.get("request"); +writer.append(HtmlWidgetRenderer.beginNamedBorder("Form", +modelForm.getFormLocation() + "#" + modelForm.getName(), +request.getContextPath())); +} } // render all hidden & ignored fields @@ -1185,6 +1195,10 @@ public class FormRenderer { // render form close if (!modelForm.getSkipEnd()) { +if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { +writer.append(HtmlWidgetRenderer.endNamedBorder("Form", +modelForm.getFormLocation() + "#" + modelForm.getName())); +} formStringRenderer.renderFormClose(writer, context, modelForm); } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index fd78801..a112ed0 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -94,7 +94,8 @@ public class HtmlWidgetRenderer { String fileName = location.substring(location.lastIndexOf("/") + 1); switch (NAMED_BORDER_TYPE) { case SOURCE: -return ""
[ofbiz-framework] branch trunk updated: Improved: Remove date.format-1.2.3-min.js (OFBIZ-12040)
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 0987c11 Improved: Remove date.format-1.2.3-min.js (OFBIZ-12040) 0987c11 is described below commit 0987c11ca7955314d870820e9b79f6bd1a7d1450 Author: James Yong AuthorDate: Sat Oct 10 19:36:24 2020 +0800 Improved: Remove date.format-1.2.3-min.js (OFBIZ-12040) This Javascript library is not use in the project. --- .../template/includes/ServerHour24HourFormatJs.ftl | 2 - .../common/js/plugins/date/date.format-1.2.3 | 126 - .../js/plugins/date/date.format-1.2.3-min.js | 1 - themes/common-theme/widget/Theme.xml | 1 - themes/docs/themes.adoc| 1 - 5 files changed, 131 deletions(-) diff --git a/themes/common-theme/template/includes/ServerHour24HourFormatJs.ftl b/themes/common-theme/template/includes/ServerHour24HourFormatJs.ftl index f187561..51e80bf 100644 --- a/themes/common-theme/template/includes/ServerHour24HourFormatJs.ftl +++ b/themes/common-theme/template/includes/ServerHour24HourFormatJs.ftl @@ -36,8 +36,6 @@ under the License. } else { date.setSeconds(date.getSeconds() + 1); } -// dateFormat does not respect the timezone :/ Fortunately toString is what we want :) -//jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: " + dateFormat(date, "-mm-dd HH:MM:ss")); jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: " + date.toString()); } }) diff --git a/themes/common-theme/webapp/common/js/plugins/date/date.format-1.2.3 b/themes/common-theme/webapp/common/js/plugins/date/date.format-1.2.3 deleted file mode 100644 index a6f6c24..000 --- a/themes/common-theme/webapp/common/js/plugins/date/date.format-1.2.3 +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Date Format 1.2.3 - * (c) 2007-2009 Steven Levithan - * MIT license - * - * Includes enhancements by Scott Trenda - * and Kris Kowal - * - * Accepts a date, a mask, or a date and a mask. - * Returns a formatted version of the given date. - * The date defaults to the current date/time. - * The mask defaults to dateFormat.masks.default. - */ - -var dateFormat = function () { - var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, -timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, -timezoneClip = /[^-+\dA-Z]/g, -pad = function (val, len) { - val = String(val); - len = len || 2; - while (val.length < len) val = "0" + val; - return val; -}; - - // Regexes and supporting functions are cached through closure - return function (date, mask, utc) { -var dF = dateFormat; - -// You can't provide utc if you skip other args (use the "UTC:" mask prefix) -if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) { - mask = date; - date = undefined; -} - -// Passing date through Date applies Date.parse, if necessary -date = date ? new Date(date) : new Date; -if (isNaN(date)) throw SyntaxError("invalid date"); - -mask = String(dF.masks[mask] || mask || dF.masks["default"]); - -// Allow setting the utc argument via the mask -if (mask.slice(0, 4) == "UTC:") { - mask = mask.slice(4); - utc = true; -} - -var _ = utc ? "getUTC" : "get", - d = date[_ + "Date"](), - D = date[_ + "Day"](), - m = date[_ + "Month"](), - y = date[_ + "FullYear"](), - H = date[_ + "Hours"](), - M = date[_ + "Minutes"](), - s = date[_ + "Seconds"](), - L = date[_ + "Milliseconds"](), - o = utc ? 0 : date.getTimezoneOffset(), - flags = { -d:d, -dd: pad(d), -ddd: dF.i18n.dayNames[D], -: dF.i18n.dayNames[D + 7], -m:m + 1, -mm: pad(m + 1), -mmm: dF.i18n.monthNames[m], -: dF.i18n.monthNames[m + 12], -yy: String(y).slice(2), -: y, -h:H % 12 || 12, -hh: pad(H % 12 || 12), -H:H, -HH: pad(H), -M:M, -MM: pad(M), -s:s, -ss: pad(s), -l:pad(L, 3), -L:pad(L > 99 ? Math.round(L / 10) : L), -t:H < 12 ? "a" : "p", -tt: H < 12 ? "am" : "pm", -T:H < 12 ? "A" : "P&
[ofbiz-framework] branch trunk updated: Improved: Open Screen file from browser (OFBIZ-12038)
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 cbbcb14 Improved: Open Screen file from browser (OFBIZ-12038) cbbcb14 is described below commit cbbcb1411906294b9aad2afe6c0900a3b6398aaa Author: James Yong AuthorDate: Sat Oct 10 18:06:14 2020 +0800 Improved: Open Screen file from browser (OFBIZ-12038) Refactoring --- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 10 ++-- .../widget/renderer/html/HtmlWidgetRenderer.java | 66 +- .../renderer/macro/MacroScreenViewHandler.java | 13 +++-- 3 files changed, 53 insertions(+), 36 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 4dd8d43..516b69b 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -168,12 +168,10 @@ public class HtmlWidget extends ModelScreenWidget { if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); } -HttpServletRequest request = ((HttpServletRequest) context.get("request")); -if (!location.endsWith(".fo.ftl") && request != null) { -String contextPath = request.getContextPath(); - writer.append(HtmlWidgetRenderer.beginNamedBorder("Template", location, contextPath)); +if (!location.endsWith(".fo.ftl") && HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { +HttpServletRequest request = ((HttpServletRequest) context.get("request")); + writer.append(HtmlWidgetRenderer.beginNamedBorder("Template", location, request.getContextPath())); } - Template template = null; if (location.endsWith(".fo.ftl")) { // FOP can't render correctly escaped characters template = FreeMarkerWorker.getTemplate(location); @@ -182,7 +180,7 @@ public class HtmlWidget extends ModelScreenWidget { } FreeMarkerWorker.renderTemplate(template, context, writer); -if (!location.endsWith(".fo.ftl") && request != null) { +if (!location.endsWith(".fo.ftl") && HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { writer.append(HtmlWidgetRenderer.endNamedBorder("Template", location)); } if (insertWidgetBoundaryComments) { diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index cc9e226..fd78801 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -40,6 +40,11 @@ public class HtmlWidgetRenderer { public static final String WHITE_SPACE = "\r\n"; /** + * Store property value of widget.dev.namedBorder + */ +public static final ModelWidget.NamedBorderType NAMED_BORDER_TYPE = ModelWidget.widgetNamedBorderType(); + +/** * Sets widget comments enabled. * @param widgetCommentsEnabled the widget comments enabled */ @@ -49,8 +54,6 @@ public class HtmlWidgetRenderer { private boolean widgetCommentsEnabled = false; -private static ModelWidget.NamedBorderType namedBorderType = ModelWidget.widgetNamedBorderType(); - /** * Is widget comments enabled boolean. * @return the boolean @@ -77,37 +80,48 @@ public class HtmlWidgetRenderer { return "" + WHITE_SPACE; } +/** + * Always check the following condition is true before running the method: + * HtmlWidgetRenderer.namedBorderType != ModelWidget.NamedBorderType.NONE + * @param widgetType + * @param location + * @param contextPath + * @return + */ public static String beginNamedBorder(String widgetType, String location, String contextPath) { -if (namedBorderType != ModelWidget.NamedBorderType.NONE) { -List themeBasePathsToExempt = UtilHtml.getVisualThemeFolderNamesToExempt(); -if (!themeBasePathsToExempt.stream().anyMatch(location::contains)) { -String fileName = location.substring(locat
[ofbiz-framework] branch trunk updated: Fixed: Open Screen file from browser (OFBIZ-12038)
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 0088af8 Fixed: Open Screen file from browser (OFBIZ-12038) 0088af8 is described below commit 0088af8b90aa6de658a605fe1c86dad12df1fb37 Author: James Yong AuthorDate: Sat Oct 10 16:29:41 2020 +0800 Fixed: Open Screen file from browser (OFBIZ-12038) Fix regresssions in integration tests --- .../src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java| 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 62d3158..4dd8d43 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -168,8 +168,9 @@ public class HtmlWidget extends ModelScreenWidget { if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); } -if (!location.endsWith(".fo.ftl")) { -String contextPath = ((HttpServletRequest) context.get("request")).getContextPath(); +HttpServletRequest request = ((HttpServletRequest) context.get("request")); +if (!location.endsWith(".fo.ftl") && request != null) { +String contextPath = request.getContextPath(); writer.append(HtmlWidgetRenderer.beginNamedBorder("Template", location, contextPath)); } @@ -181,7 +182,7 @@ public class HtmlWidget extends ModelScreenWidget { } FreeMarkerWorker.renderTemplate(template, context, writer); -if (!location.endsWith(".fo.ftl")) { +if (!location.endsWith(".fo.ftl") && request != null) { writer.append(HtmlWidgetRenderer.endNamedBorder("Template", location)); } if (insertWidgetBoundaryComments) {
[ofbiz-framework] branch trunk updated: Improved: Open Screen file from browser (OFBIZ-12038)
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 5fca2ed Improved: Open Screen file from browser (OFBIZ-12038) 5fca2ed is described below commit 5fca2ed58deb59d7eb2847810208f42cdc5f7a09 Author: James Yong AuthorDate: Sat Oct 10 12:39:43 2020 +0800 Improved: Open Screen file from browser (OFBIZ-12038) Refactoring --- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 17 +++-- .../widget/renderer/html/HtmlWidgetRenderer.java | 29 ++ .../renderer/macro/MacroScreenViewHandler.java | 10 ++-- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 65723ad..62d3158 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -168,18 +168,9 @@ public class HtmlWidget extends ModelScreenWidget { if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); } -boolean insertWidgetNamedBorder = false; -NamedBorderType namedBorderType = null; if (!location.endsWith(".fo.ftl")) { -namedBorderType = ModelWidget.widgetNamedBorderType(); -if (namedBorderType != NamedBorderType.NONE) { -insertWidgetNamedBorder = true; -} -} -String contextPath = ""; -if (insertWidgetNamedBorder) { -contextPath = ((HttpServletRequest) context.get("request")).getContextPath(); -writer.append(HtmlWidgetRenderer.buildNamedBorder("Begin", "Template", location, namedBorderType, contextPath)); +String contextPath = ((HttpServletRequest) context.get("request")).getContextPath(); + writer.append(HtmlWidgetRenderer.beginNamedBorder("Template", location, contextPath)); } Template template = null; @@ -190,8 +181,8 @@ public class HtmlWidget extends ModelScreenWidget { } FreeMarkerWorker.renderTemplate(template, context, writer); -if (insertWidgetNamedBorder) { -writer.append(HtmlWidgetRenderer.buildNamedBorder("End", "Template", location, namedBorderType, contextPath)); +if (!location.endsWith(".fo.ftl")) { + writer.append(HtmlWidgetRenderer.endNamedBorder("Template", location)); } if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("End", "Template", location)); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index 74c2b9b..cc9e226 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -49,6 +49,8 @@ public class HtmlWidgetRenderer { private boolean widgetCommentsEnabled = false; +private static ModelWidget.NamedBorderType namedBorderType = ModelWidget.widgetNamedBorderType(); + /** * Is widget comments enabled boolean. * @return the boolean @@ -75,17 +77,15 @@ public class HtmlWidgetRenderer { return "" + WHITE_SPACE; } -public static String buildNamedBorder(String boundaryType, String widgetType, String widgetName, - ModelWidget.NamedBorderType namedBorderType, String contextPath) { -List themeBasePathsToExempt = UtilHtml.getVisualThemeFolderNamesToExempt(); -if (!themeBasePathsToExempt.stream().anyMatch(widgetName::contains)) { -// add additional visual label for non-theme ftl -if ("Begin".equals(boundaryType)) { -String fileName = widgetName.substring(widgetName.lastIndexOf("/") + 1); +public static String beginNamedBorder(String widgetType, String location, String contextPath) { +if (namedBorderType != ModelWidget.NamedBorderType.NONE) { +List themeBasePathsToExempt = UtilHtml.getVisualThemeFolderName
[ofbiz-framework] branch trunk updated: Improved: Open Screen file from browser (OFBIZ-12038)
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 0e40d9f Improved: Open Screen file from browser (OFBIZ-12038) 0e40d9f is described below commit 0e40d9f091aa2bd2a5fff3761049eb8ea10a68c1 Author: James Yong AuthorDate: Thu Oct 8 15:28:43 2020 +0800 Improved: Open Screen file from browser (OFBIZ-12038) Allow the opening of screen definition that contributed to the web page from the browser. Command to open the file is set at widget.dev.cmd.openSourceFile. Thanks Jacques for review. --- .../java/org/apache/ofbiz/common/CommonEvents.java | 40 ++ framework/widget/config/widget.properties | 9 ++--- .../renderer/macro/MacroScreenViewHandler.java | 11 ++ 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java index 20ddb6d..89aad37 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java @@ -26,8 +26,10 @@ import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; +import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; +import java.io.LineNumberReader; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.net.URL; @@ -464,21 +466,45 @@ public class CommonEvents { if (UtilValidate.isNotEmpty(sourceLocation) && sourceLocation.startsWith("component:")) { try { // find absolute path of file -URL sourceFileUrl = FlexibleLocation.resolveLocation(sourceLocation); -String location = sourceFileUrl.getFile(); +URL sourceFileUrl = null; +String fragment = ""; +if (sourceLocation.contains("#")) { +int indexOfHash = sourceLocation.indexOf("#"); +sourceFileUrl = FlexibleLocation.resolveLocation(sourceLocation.substring(0, indexOfHash)); +fragment = sourceLocation.substring(indexOfHash + 1); +} else { +sourceFileUrl = FlexibleLocation.resolveLocation(sourceLocation); +} +String platformSpecificPath = sourceFileUrl.getFile(); // ensure file separator in location is correct -if (!location.contains(File.separator) && "\\".equals(File.separator)) { -location = location.replaceAll("/", ""); +if (!platformSpecificPath.contains(File.separator) && "\\".equals(File.separator)) { +platformSpecificPath = platformSpecificPath.replaceAll("/", ""); +} +// get line number +int lineNumber = 1; +if (UtilValidate.isNotEmpty(fragment)) { +try (LineNumberReader lnr = new LineNumberReader(new FileReader(platformSpecificPath))) { +String line; +while ((line = lnr.readLine()) != null) { +if (line.matches(".*name=\"" + fragment + "\".*")) { +lineNumber = lnr.getLineNumber(); +break; +} +} +} catch (IOException e) { +Debug.logError(e, MODULE); +} } -location = "\"" + location + "\""; // prepare content map for string expansion Map sourceMap = new HashMap<>(); -sourceMap.put("sourceLocation", location); +sourceMap.put("sourceLocation", platformSpecificPath); +sourceMap.put("lineNumber", lineNumber); // get command to run String cmdTemplate = UtilProperties.getPropertyValue("widget", "widget.dev.cmd.openSourceFile"); String cmd = (String) FlexibleStringExpander.getInstance(cmdTemplate).expand(sourceMap); // run command -Process process = Runtime.getRuntime().exec(String.format(
[ofbiz-framework] branch trunk updated: Fixed: Open FTL File from browser (OFBIZ-12018)
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 6fa1671 Fixed: Open FTL File from browser (OFBIZ-12018) 6fa1671 is described below commit 6fa16710bcda40ee3deba04f51c2c7b728505298 Author: James Yong AuthorDate: Sat Oct 3 17:51:15 2020 +0800 Fixed: Open FTL File from browser (OFBIZ-12018) Fix named border not properly clean up. --- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 3 +-- 1 file changed, 1 insertion(+), 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 a81f9a2..c96ddb7 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -65,9 +65,8 @@ $(document).ready(function() { // fadeout info-overlay labels $this.off(); var container = $this.closest(".info-container"); -container.find(".info-content").contents().unwrap(); container.contents().unwrap(); -$this.closest(".info-overlay").remove(); +$this.remove(); }); }, (200 * ++count) + 5000);
[ofbiz-framework] branch trunk updated: Improved: Open FTL File from browser (OFBIZ-12018)
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 582e6c6 Improved: Open FTL File from browser (OFBIZ-12018) 582e6c6 is described below commit 582e6c6ac9929b77e2eb8b55864a549838863957 Author: James Yong AuthorDate: Sat Oct 3 11:08:14 2020 +0800 Improved: Open FTL File from browser (OFBIZ-12018) Comment + Rename method --- .../src/main/java/org/apache/ofbiz/common/CommonEvents.java | 8 +++- .../src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 2 +- .../src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java index b8b9a2e..20ddb6d 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java @@ -451,8 +451,14 @@ public class CommonEvents { return "success"; } +/** + * Open the source file. Only when widget.dev.namedBorder=SOURCE + * @param request + * @param response + * @return + */ public static String openSourceFile(HttpServletRequest request, HttpServletResponse response) { -ModelWidget.NamedBorderType namedBorderType = ModelWidget.widgetNamedBorderEnabled(); +ModelWidget.NamedBorderType namedBorderType = ModelWidget.widgetNamedBorderType(); if (namedBorderType == ModelWidget.NamedBorderType.SOURCE) { String sourceLocation = request.getParameter("sourceLocation"); if (UtilValidate.isNotEmpty(sourceLocation) && sourceLocation.startsWith("component:")) { diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 8d9015d..65723ad 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -171,7 +171,7 @@ public class HtmlWidget extends ModelScreenWidget { boolean insertWidgetNamedBorder = false; NamedBorderType namedBorderType = null; if (!location.endsWith(".fo.ftl")) { -namedBorderType = ModelWidget.widgetNamedBorderEnabled(); +namedBorderType = ModelWidget.widgetNamedBorderType(); if (namedBorderType != NamedBorderType.NONE) { insertWidgetNamedBorder = true; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java index 9393d7a..cdbe9aa 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java @@ -156,7 +156,7 @@ public abstract class ModelWidget implements Serializable { * determine how to display named border for development * @return NamedBorderType from widget.dev.namedBorder property */ -public static NamedBorderType widgetNamedBorderEnabled() { +public static NamedBorderType widgetNamedBorderType() { return NamedBorderType.valueOf(UtilProperties.getPropertyValue("widget", "widget.dev.namedBorder", NamedBorderType.NONE.toString())); } }
[ofbiz-framework] branch trunk updated: Improved: Move SeoConfigUtil.java from Product to Widget component (OFBIZ-12031)
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 aa8ae4b Improved: Move SeoConfigUtil.java from Product to Widget component (OFBIZ-12031) aa8ae4b is described below commit aa8ae4b01ef4054870a2369b04322392e0ff26ce Author: James Yong AuthorDate: Fri Oct 2 22:57:15 2020 +0800 Improved: Move SeoConfigUtil.java from Product to Widget component (OFBIZ-12031) Help to remove dependency of product component from widget component An afterthought: webapp component seems better for SeoConfigUtil.java than widget component. Thanks Jacques for review --- .../main/java/org/apache/ofbiz/product/category/SeoContextFilter.java | 1 + .../main/java/org/apache/ofbiz/product/category/SeoControlServlet.java | 1 + .../src/main/java/org/apache/ofbiz/product/category/SeoUrlUtil.java | 1 + .../apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java| 2 +- .../org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java | 2 +- .../main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java | 2 +- .../java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java | 2 +- .../webapp/src/main/java/org/apache/ofbiz/webapp}/SeoConfigUtil.java| 2 +- .../widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 2 +- .../java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java | 2 +- 10 files changed, 10 insertions(+), 7 deletions(-) diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java index 0d4d461..bf376cf 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java @@ -52,6 +52,7 @@ import org.apache.ofbiz.webapp.control.ConfigXMLReader; import org.apache.ofbiz.webapp.control.ConfigXMLReader.ControllerConfig; import org.apache.ofbiz.webapp.control.ControlFilter; import org.apache.ofbiz.webapp.control.WebAppConfigurationException; +import org.apache.ofbiz.webapp.SeoConfigUtil; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.Perl5Matcher; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java index 3373d73..99c48d4 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java @@ -32,6 +32,7 @@ import org.apache.catalina.servlets.DefaultServlet; import org.apache.jasper.servlet.JspServlet; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.webapp.control.ControlServlet; +import org.apache.ofbiz.webapp.SeoConfigUtil; /** * SeoControlServlet.java - SEO Master servlet for the web application. diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoUrlUtil.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoUrlUtil.java index 064c723..a660917 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoUrlUtil.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoUrlUtil.java @@ -19,6 +19,7 @@ package org.apache.ofbiz.product.category; import org.apache.ofbiz.base.util.UtilValidate; +import org.apache.ofbiz.webapp.SeoConfigUtil; public final class SeoUrlUtil { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java index 61ad409..c6d36ea 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java @@ -35,12 +35,12 @@ import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.entity.util.EntityUtilProperties; import org.apache.ofbiz.product.category.CatalogUrlFilter; import org.apache.ofbiz.product.category.CategoryContentWrapper; -import org.apache.ofbiz.product.category.SeoConfigUtil; import org.apache.ofbiz.product.product.ProductContentWrapper; import org.apache.ofbiz.security.CsrfUtil; import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.webapp.OfbizUrlBuilder; import org.apache.ofbiz.webapp.control.WebAppConfigurationException; +import org.apache.ofbiz.webapp.SeoConfigUtil; import
[ofbiz-framework] branch trunk updated: Fixed: Open FTL File from browser (OFBIZ-12018)
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 10fbedb Fixed: Open FTL File from browser (OFBIZ-12018) 10fbedb is described below commit 10fbedbce0dff5afab729f07e19fd40756a61b43 Author: James Yong AuthorDate: Fri Oct 2 20:33:44 2020 +0800 Fixed: Open FTL File from browser (OFBIZ-12018) Not able to open source file when clicking on named border in ecomseo landing page Thanks Jacques for reporting --- .../src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 6 -- .../apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java| 9 +++-- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 5 +++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index fb70871..708a84b 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -176,8 +176,10 @@ public class HtmlWidget extends ModelScreenWidget { insertWidgetNamedBorder = true; } } +String contextPath = ""; if (insertWidgetNamedBorder) { -writer.append(HtmlWidgetRenderer.buildNamedBorder("Begin", "Template", location, namedBorderType)); +contextPath = ((HttpServletRequest) context.get("request")).getContextPath(); +writer.append(HtmlWidgetRenderer.buildNamedBorder("Begin", "Template", location, namedBorderType, contextPath)); } Template template = null; @@ -189,7 +191,7 @@ public class HtmlWidget extends ModelScreenWidget { FreeMarkerWorker.renderTemplate(template, context, writer); if (insertWidgetNamedBorder) { -writer.append(HtmlWidgetRenderer.buildNamedBorder("End", "Template", location, namedBorderType)); +writer.append(HtmlWidgetRenderer.buildNamedBorder("End", "Template", location, namedBorderType, contextPath)); } if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("End", "Template", location)); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index 99ee553..950c6f2 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.ofbiz.base.util.UtilHtml; import org.apache.ofbiz.base.util.UtilHttp; +import org.apache.ofbiz.product.category.SeoConfigUtil; import org.apache.ofbiz.widget.model.ModelWidget; /** @@ -74,7 +75,8 @@ public class HtmlWidgetRenderer { return "" + WHITE_SPACE; } -public static String buildNamedBorder(String boundaryType, String widgetType, String widgetName, ModelWidget.NamedBorderType namedBorderType) { +public static String buildNamedBorder(String boundaryType, String widgetType, String widgetName, + ModelWidget.NamedBorderType namedBorderType, String contextPath) { List themeBasePathsToExempt = UtilHtml.getVisualThemeFolderNamesToExempt(); if (!themeBasePathsToExempt.stream().anyMatch(widgetName::contains)) { // add additional visual label for non-theme ftl @@ -82,7 +84,10 @@ public class HtmlWidgetRenderer { String fileName = widgetName.substring(widgetName.lastIndexOf("/") + 1); switch (namedBorderType) { case SOURCE: -return "" +return "" + fileName + ""; case LABEL: diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 90a1a93..a81f9a2 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -48,10 +48,11 @@ $(document).ready(function() { selectList.each(function(){ const $this = $(this); $this.removeClass("
[ofbiz-framework] branch trunk updated: Fixed: Open FTL File from browser (OFBIZ-12018)
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 f15c037 Fixed: Open FTL File from browser (OFBIZ-12018) f15c037 is described below commit f15c037e073b2692f103384bdfe906039b44e1a9 Author: James Yong AuthorDate: Wed Sep 30 19:16:53 2020 +0800 Fixed: Open FTL File from browser (OFBIZ-12018) Some named borders were hidden in ecomseo landing page --- .../ofbiz/widget/renderer/html/HtmlWidgetRenderer.java | 12 ++-- themes/common-theme/webapp/common/css/info.css | 10 -- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index 3ec7257..99ee553 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -79,20 +79,20 @@ public class HtmlWidgetRenderer { if (!themeBasePathsToExempt.stream().anyMatch(widgetName::contains)) { // add additional visual label for non-theme ftl if ("Begin".equals(boundaryType)) { -return ""; -} else if ("End".equals(boundaryType)) { String fileName = widgetName.substring(widgetName.lastIndexOf("/") + 1); switch (namedBorderType) { case SOURCE: -return "" +return "" + fileName -+ ""; ++ ""; case LABEL: -return "" +return "" + fileName -+ ""; ++ ""; default: return ""; } +} else if ("End".equals(boundaryType)) { +return ""; } } return ""; diff --git a/themes/common-theme/webapp/common/css/info.css b/themes/common-theme/webapp/common/css/info.css index 8dd2ba8..bb271af 100644 --- a/themes/common-theme/webapp/common/css/info.css +++ b/themes/common-theme/webapp/common/css/info.css @@ -1,21 +1,11 @@ .info-container { -display: grid; -} -.info-overlay { color: rgb(165, 42, 42); justify-items: center; border: 2px dashed rgba(236, 198, 48, 0.7); transition: .5s ease-out; } -.info-content, -.info-overlay { -grid-area: 1 / 1; -} .info-overlay-item { -height: 50%; background: rgba(255, 213, 70); -border: 2px dashed rgba(236, 198, 48); -z-index: 10; } .info-cursor { cursor: pointer;
[ofbiz-framework] branch trunk updated: Improved: multi-block attribute for html-template tag (OFBIZ-11686)
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 91d8a2f Improved: multi-block attribute for html-template tag (OFBIZ-11686) 91d8a2f is described below commit 91d8a2f02ab9b7366a722e29feaeba7661468614 Author: James Yong AuthorDate: Mon Sep 28 21:54:25 2020 +0800 Improved: multi-block attribute for html-template tag (OFBIZ-11686) Form getJs link according to SEO Config setting --- .../main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index c75c06f..fb70871 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -38,6 +38,7 @@ import org.apache.ofbiz.base.util.cache.UtilCache; import org.apache.ofbiz.base.util.collections.MapStack; import org.apache.ofbiz.base.util.string.FlexibleStringExpander; import org.apache.ofbiz.base.util.template.FreeMarkerWorker; +import org.apache.ofbiz.product.category.SeoConfigUtil; import org.apache.ofbiz.security.CsrfUtil; import org.apache.ofbiz.widget.renderer.ScreenRenderer; import org.apache.ofbiz.widget.renderer.ScreenStringRenderer; @@ -324,12 +325,17 @@ public class HtmlWidget extends ModelScreenWidget { } String key = MultiBlockHtmlTemplateUtil.putScriptInCache(context, fileName, scripts.toString()); +HttpServletRequest request = (HttpServletRequest) context.get("request"); // construct script link -String webappName = (String) context.get("webappName"); -String url = "/" + webappName + "/control/getJs?name=" + key; +String contextPath = request.getContextPath(); +String url = null; +if (SeoConfigUtil.isCategoryUrlEnabled(contextPath)) { +url = contextPath + "/getJs?name=" + key; +} else { +url = contextPath + "/control/getJs?name=" + key; +} // add csrf token to script link -HttpServletRequest request = (HttpServletRequest) context.get("request"); String tokenValue = CsrfUtil.generateTokenForNonAjax(request, "getJs"); url = CsrfUtil.addOrUpdateTokenInUrl(url, tokenValue);
[ofbiz-framework] branch trunk updated: Improved: Open FTL File from browser (OFBIZ-12018)
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 c911019 Improved: Open FTL File from browser (OFBIZ-12018) c911019 is described below commit c9110198568e988e65ba6b9d3881b7edb60254cc Author: James Yong AuthorDate: Mon Sep 28 21:50:01 2020 +0800 Improved: Open FTL File from browser (OFBIZ-12018) Better usability when clicking on named border --- .../widget/renderer/html/HtmlWidgetRenderer.java | 14 ++ themes/common-theme/webapp/common/css/info.css | 6 +++ .../webapp/common/js/util/OfbizUtil.js | 57 +- 3 files changed, 44 insertions(+), 33 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index 8b17243..3ec7257 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -18,7 +18,6 @@ ***/ package org.apache.ofbiz.widget.renderer.html; -import java.io.File; import java.io.IOException; import java.util.List; @@ -79,24 +78,21 @@ public class HtmlWidgetRenderer { List themeBasePathsToExempt = UtilHtml.getVisualThemeFolderNamesToExempt(); if (!themeBasePathsToExempt.stream().anyMatch(widgetName::contains)) { // add additional visual label for non-theme ftl -switch (boundaryType) { -case "End": +if ("Begin".equals(boundaryType)) { +return ""; +} else if ("End".equals(boundaryType)) { String fileName = widgetName.substring(widgetName.lastIndexOf("/") + 1); switch (namedBorderType) { case SOURCE: -return "" +return "" + fileName -+ ""; ++ ""; case LABEL: return "" + fileName + ""; default: return ""; } -default: -return ""; } } return ""; diff --git a/themes/common-theme/webapp/common/css/info.css b/themes/common-theme/webapp/common/css/info.css index 217a5f4..8dd2ba8 100644 --- a/themes/common-theme/webapp/common/css/info.css +++ b/themes/common-theme/webapp/common/css/info.css @@ -17,3 +17,9 @@ border: 2px dashed rgba(236, 198, 48); z-index: 10; } +.info-cursor { +cursor: pointer; +} +.info-cursor-none { +cursor: text; +} diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 11b4ab3..90a1a93 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -35,39 +35,48 @@ $(document).ready(function() { } } }); -jQuery(document).ajaxSuccess(function () { -initNamedBorder(); -}) //initializing UI combobox dropdown by overriding its methods. ajaxAutoCompleteDropDown(); // bindObservers will add observer on passed html section when DOM is ready. bindObservers("body"); -function initNamedBorder() { -jQuery("[data-source]").off(); -// fadeout info-overlay labels -setTimeout(function(){ -$('.info-overlay').fadeOut(1000, function(){ -jQuery("[data-source]").off(); -$('.info-container').contents().unwrap(); -$('.info-content').contents().unwrap(); -$('.info-overlay').delay(1000).remove(); -}); -}, 3000); +let count = 1; +function initNamedBorders() { // clickable link in named border to open source file -jQuery("[data-source]").click(function(){ -var sourceLocaton = jQuery(this).data("source"); -jQuery.ajax({ -url: 'openSourceFile', -type: "POST", -data: {sourceLocation:sourceLocaton}, -success: function(data) { -alert("Command is sent to open source file with your IDE"); -} +var selectList = jQuery(".info-cursor-none[data-source]"); +// console.log("length="+selectList
[ofbiz-framework] branch trunk updated: Fixed: Open FTL File from browser (OFBIZ-12018)
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 4b8dd2a Fixed: Open FTL File from browser (OFBIZ-12018) 4b8dd2a is described below commit 4b8dd2a06bb28bf14e350382432845143783b621 Author: James Yong AuthorDate: Fri Sep 25 22:44:46 2020 +0800 Fixed: Open FTL File from browser (OFBIZ-12018) Unable to open file in Windows Thanks Jacques for reporting. --- .../src/main/java/org/apache/ofbiz/common/CommonEvents.java | 6 ++ framework/widget/config/widget.properties | 8 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java index 6313fbf..b8b9a2e 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java @@ -25,6 +25,7 @@ import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; @@ -459,6 +460,11 @@ public class CommonEvents { // find absolute path of file URL sourceFileUrl = FlexibleLocation.resolveLocation(sourceLocation); String location = sourceFileUrl.getFile(); +// ensure file separator in location is correct +if (!location.contains(File.separator) && "\\".equals(File.separator)) { +location = location.replaceAll("/", ""); +} +location = "\"" + location + "\""; // prepare content map for string expansion Map sourceMap = new HashMap<>(); sourceMap.put("sourceLocation", location); diff --git a/framework/widget/config/widget.properties b/framework/widget/config/widget.properties index 8d7a446..dc1be2c 100644 --- a/framework/widget/config/widget.properties +++ b/framework/widget/config/widget.properties @@ -33,13 +33,9 @@ widget.verbose=true # SOURCE - Show named border with link to open the source code widget.dev.namedBorder=NONE -# Command template to open file with editor -# Linux: +# Command template to open file with editor. Make sure the program is in PATH. # idea ${sourceLocation} -# eclipse --launcher.openFile ${sourceLocation} -# Windows: -# idea.exe ${sourceLocation} -# eclipse.exe --launcher.openFile ${sourceLocation} +# eclipse ${sourceLocation} widget.dev.cmd.openSourceFile=idea ${sourceLocation} # Default number of items to be displayed per page in a list form
[ofbiz-plugins] branch trunk updated: Improved: Open FTL File from browser (OFBIZ-12018)
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-plugins.git The following commit(s) were added to refs/heads/trunk by this push: new 9c40c67 Improved: Open FTL File from browser (OFBIZ-12018) 9c40c67 is described below commit 9c40c67e7a45f1cb8e9d13462567fb0eb1c772b6 Author: James Yong AuthorDate: Fri Sep 25 22:25:15 2020 +0800 Improved: Open FTL File from browser (OFBIZ-12018) Add request map for ecommerce --- ecommerce/webapp/ecommerce/WEB-INF/controller.xml | 8 1 file changed, 8 insertions(+) diff --git a/ecommerce/webapp/ecommerce/WEB-INF/controller.xml b/ecommerce/webapp/ecommerce/WEB-INF/controller.xml index d3401a7..a7c9b86 100644 --- a/ecommerce/webapp/ecommerce/WEB-INF/controller.xml +++ b/ecommerce/webapp/ecommerce/WEB-INF/controller.xml @@ -182,6 +182,14 @@ under the License. + + + + + + + +
[ofbiz-framework] branch trunk updated: Fixed: Open FTL File from browser (OFBIZ-12018)
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 d7a5d60 Fixed: Open FTL File from browser (OFBIZ-12018) d7a5d60 is described below commit d7a5d601bd9c07fa26f4f0d737841f651d749bff Author: James Yong AuthorDate: Fri Sep 25 13:00:34 2020 +0800 Fixed: Open FTL File from browser (OFBIZ-12018) StringIndexOutOfBoundsException error in Windows Thanks Jacques for reporting. --- .../base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java | 8 .../org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java index 4ca2e17..44bfe15 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java @@ -121,8 +121,8 @@ public final class UtilHtml { try { List xmlThemes = ThemeFactory.getThemeXmlFiles(); visualThemeBasePathsName = new ArrayList<>(); -String themePathKey = File.separator + "themes" + File.separator; -String pluginPathKey = File.separator + "plugins" + File.separator; +String themePathKey = "/themes/"; +String pluginPathKey = "/plugins/"; for (File xmlTheme : xmlThemes) { String path = xmlTheme.toURI().toURL().toString(); // get the path after themes or plugins folders @@ -132,9 +132,9 @@ public final class UtilHtml { path = path.substring(path.indexOf(pluginPathKey) + 9); } // get folder name -path = path.substring(0, path.indexOf(File.separator)); +path = path.substring(0, path.indexOf("/")); if (!path.contains("common-theme") && !path.contains("ecommerce")) { -visualThemeBasePathsName.add(File.separator + path + File.separator); +visualThemeBasePathsName.add("/" + path + "/"); } } } catch (IOException e) { diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index e79a718..8b17243 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -81,7 +81,7 @@ public class HtmlWidgetRenderer { // add additional visual label for non-theme ftl switch (boundaryType) { case "End": -String fileName = widgetName.substring(widgetName.lastIndexOf(File.separator) + 1); +String fileName = widgetName.substring(widgetName.lastIndexOf("/") + 1); switch (namedBorderType) { case SOURCE: return "
[ofbiz-framework] branch trunk updated: Improved: Open FTL File from browser (OFBIZ-12018)
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 ad2e8de Improved: Open FTL File from browser (OFBIZ-12018) ad2e8de is described below commit ad2e8de7c2e09d41955e7eafb59dbb6d2984f138 Author: James Yong AuthorDate: Thu Sep 24 21:36:24 2020 +0800 Improved: Open FTL File from browser (OFBIZ-12018) Add function to open the corresponding FTL file with IDE when the named border is clicked from browser. Thanks Rishi and Jacques for review --- .../java/org/apache/ofbiz/base/util/UtilHtml.java | 2 ++ .../java/org/apache/ofbiz/common/CommonEvents.java | 38 ++ .../common/webcommon/WEB-INF/common-controller.xml | 7 framework/widget/config/widget.properties | 14 +++- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 13 ++-- .../org/apache/ofbiz/widget/model/ModelWidget.java | 9 ++--- .../widget/renderer/html/HtmlWidgetRenderer.java | 18 +++--- .../webapp/common/js/util/OfbizUtil.js | 14 8 files changed, 103 insertions(+), 12 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java index 5265304..4ca2e17 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java @@ -125,11 +125,13 @@ public final class UtilHtml { String pluginPathKey = File.separator + "plugins" + File.separator; for (File xmlTheme : xmlThemes) { String path = xmlTheme.toURI().toURL().toString(); +// get the path after themes or plugins folders if (path.indexOf(themePathKey) > 0) { path = path.substring(path.indexOf(themePathKey) + 8); } else if (path.indexOf(pluginPathKey) > 0) { path = path.substring(path.indexOf(pluginPathKey) + 9); } +// get folder name path = path.substring(0, path.indexOf(File.separator)); if (!path.contains("common-theme") && !path.contains("ecommerce")) { visualThemeBasePathsName.add(File.separator + path + File.separator); diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java index 3ecf80b..6313fbf 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java @@ -24,9 +24,12 @@ import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.io.Writer; +import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -42,17 +45,20 @@ import javax.servlet.http.HttpSession; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.apache.ofbiz.base.lang.JSON; +import org.apache.ofbiz.base.location.FlexibleLocation; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilGenerics; import org.apache.ofbiz.base.util.UtilHttp; import org.apache.ofbiz.base.util.UtilProperties; import org.apache.ofbiz.base.util.UtilValidate; +import org.apache.ofbiz.base.util.string.FlexibleStringExpander; import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.util.EntityUtilProperties; import org.apache.ofbiz.webapp.control.JWTManager; import org.apache.ofbiz.webapp.control.LoginWorker; +import org.apache.ofbiz.widget.model.ModelWidget; import org.apache.ofbiz.widget.model.MultiBlockHtmlTemplateUtil; import org.apache.ofbiz.widget.model.ThemeFactory; import org.apache.ofbiz.widget.renderer.VisualTheme; @@ -444,4 +450,36 @@ public class CommonEvents { return "success"; } +public static String openSourceFile(HttpServletRequest request, HttpServletResponse response) { +ModelWidget.NamedBorderType namedBorderType = ModelWidget.widgetNamedBorderEnabled(); +if (namedBorderType == ModelWidget.NamedBorderType.SOURCE) { +String sourceLocation = request.getParameter("sourceLocation"); +if (UtilValidate.isNotEmpty(sourceLocation) && sourceLocation.startsW
[ofbiz-framework] branch trunk updated: Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002)
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 814d95a Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002) 814d95a is described below commit 814d95afc8ec48cf5ead9e82edefe436a670eaf5 Author: James Yong AuthorDate: Mon Sep 21 14:45:00 2020 +0800 Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002) Fixed some other named borders not removed + Only increase z-index for the border labels --- themes/common-theme/webapp/common/css/info.css | 2 +- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/common-theme/webapp/common/css/info.css b/themes/common-theme/webapp/common/css/info.css index a861213..217a5f4 100644 --- a/themes/common-theme/webapp/common/css/info.css +++ b/themes/common-theme/webapp/common/css/info.css @@ -4,7 +4,6 @@ .info-overlay { color: rgb(165, 42, 42); justify-items: center; -z-index: 10; border: 2px dashed rgba(236, 198, 48, 0.7); transition: .5s ease-out; } @@ -16,4 +15,5 @@ height: 50%; background: rgba(255, 213, 70); border: 2px dashed rgba(236, 198, 48); +z-index: 10; } diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 948e8ca..c59fc35 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -53,6 +53,7 @@ $(document).ready(function() { }); }, 3000); } +initNamedBorder(); }); /* bindObservers function contains the code of adding observers and it can be called for specific section as well
[ofbiz-framework] branch trunk updated: Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002)
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 26fcfd1 Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002) 26fcfd1 is described below commit 26fcfd180bb78ecad25cbe5b891c45a8664f93be Author: James Yong AuthorDate: Mon Sep 21 14:23:36 2020 +0800 Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002) Unable to add internal organization in HR tree Thanks Olivier for reporting --- .../webapp/common/js/util/OfbizUtil.js | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 9aa14bb..948e8ca 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -35,18 +35,24 @@ $(document).ready(function() { } } }); +jQuery(document).ajaxSuccess(function () { +initNamedBorder(); +}) //initializing UI combobox dropdown by overriding its methods. ajaxAutoCompleteDropDown(); // bindObservers will add observer on passed html section when DOM is ready. bindObservers("body"); -// fadeout info-overlay labels -setTimeout(function(){ -$('.info-overlay').fadeOut(1000, function(){ -$('.info-container').contents().unwrap(); -$('.info-content').contents().unwrap(); -$('.info-overlay').delay(1000).remove(); -}); -}, 3000); + +function initNamedBorder() { +// fadeout info-overlay labels +setTimeout(function(){ +$('.info-overlay').fadeOut(1000, function(){ +$('.info-container').contents().unwrap(); +$('.info-content').contents().unwrap(); +$('.info-overlay').delay(1000).remove(); +}); +}, 3000); +} }); /* bindObservers function contains the code of adding observers and it can be called for specific section as well
[ofbiz-framework] branch trunk updated: Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002)
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 2cc3ab0 Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002) 2cc3ab0 is described below commit 2cc3ab0f668cd6b91e9ee0766b71a1006d09d639 Author: James Yong AuthorDate: Sat Sep 19 23:34:53 2020 +0800 Fixed: Show border and file name for content rendered from ftl (OFBIZ-12002) Error in testIntegration Thanks Jacques for reporting --- .../widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 800f812..3cd8e5f 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -167,7 +167,7 @@ public class HtmlWidget extends ModelScreenWidget { if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); } -boolean insertWidgetNamedBorder = ModelWidget.widgetNamedBorderEnabled(); +boolean insertWidgetNamedBorder = !location.endsWith(".fo.ftl") && ModelWidget.widgetNamedBorderEnabled(); if (insertWidgetNamedBorder) { writer.append(HtmlWidgetRenderer.buildNamedBorder("Begin", "Template", location)); }
[ofbiz-framework] branch trunk updated: Improved: multi-block attribute for html-template tag (OFBIZ-11686)
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 17e2ded Improved: multi-block attribute for html-template tag (OFBIZ-11686) 17e2ded is described below commit 17e2ded1cc2daf96d88c0b995d2a64023de6d2bf Author: James Yong AuthorDate: Sat Sep 19 10:04:18 2020 +0800 Improved: multi-block attribute for html-template tag (OFBIZ-11686) Move getJs and js request mapping out of "AJAX events" comments block --- .../common/webcommon/WEB-INF/common-controller.xml | 25 +++--- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/framework/common/webcommon/WEB-INF/common-controller.xml b/framework/common/webcommon/WEB-INF/common-controller.xml index 1142a2d..a2dd12a 100644 --- a/framework/common/webcommon/WEB-INF/common-controller.xml +++ b/framework/common/webcommon/WEB-INF/common-controller.xml @@ -233,7 +233,19 @@ under the License. - + + + + + + + + + + + + + @@ -324,17 +336,6 @@ under the License. - - - - - - - - - - -
[ofbiz-framework] branch trunk updated: Improved: Show border and file name for content rendered from ftl (OFBIZ-12002)
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 347c905 Improved: Show border and file name for content rendered from ftl (OFBIZ-12002) 347c905 is described below commit 347c9056743b63c7898f5e5dc52cd31193b55258 Author: James Yong AuthorDate: Fri Sep 18 14:37:36 2020 +0800 Improved: Show border and file name for content rendered from ftl (OFBIZ-12002) New property “widget.dev.namedBorder” to control the display of the named border Thanks Michael for review --- framework/widget/config/widget.properties| 3 +++ .../java/org/apache/ofbiz/widget/model/HtmlWidget.java | 7 +++ .../java/org/apache/ofbiz/widget/model/ModelWidget.java | 8 .../ofbiz/widget/renderer/html/HtmlWidgetRenderer.java | 16 +++- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/framework/widget/config/widget.properties b/framework/widget/config/widget.properties index 9a83b79..306fb31 100644 --- a/framework/widget/config/widget.properties +++ b/framework/widget/config/widget.properties @@ -27,6 +27,9 @@ # boundary comments. widget.verbose=true +# Enable widget named border for development +widget.dev.namedBorder=true + # Default number of items to be displayed per page in a list form widget.form.defaultViewSize=20 diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 4bae38a..800f812 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -167,6 +167,10 @@ public class HtmlWidget extends ModelScreenWidget { if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); } +boolean insertWidgetNamedBorder = ModelWidget.widgetNamedBorderEnabled(); +if (insertWidgetNamedBorder) { +writer.append(HtmlWidgetRenderer.buildNamedBorder("Begin", "Template", location)); +} Template template = null; if (location.endsWith(".fo.ftl")) { // FOP can't render correctly escaped characters @@ -176,6 +180,9 @@ public class HtmlWidget extends ModelScreenWidget { } FreeMarkerWorker.renderTemplate(template, context, writer); +if (insertWidgetNamedBorder) { +writer.append(HtmlWidgetRenderer.buildNamedBorder("End", "Template", location)); +} if (insertWidgetBoundaryComments) { writer.append(HtmlWidgetRenderer.buildBoundaryComment("End", "Template", location)); } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java index 3d1dcec..8630fd1 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java @@ -150,4 +150,12 @@ public abstract class ModelWidget implements Serializable { } return result; } + +/** + * Returns true if showing filename and border on the rendered part of the template. + * @return true if widget.dev.namedBorder is set to true + */ +public static boolean widgetNamedBorderEnabled() { +return "true".equals(UtilProperties.getPropertyValue("widget", "widget.dev.namedBorder")); +} } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index 781e099..0b89029 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.IOException; import java.util.List; -import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilHtml; import org.apache.ofbiz.base.util.UtilHttp; import org.apache.ofbiz.widget.model.ModelWidget; @@ -73,10 +72,10 @@ public class HtmlWidgetRenderer { * @param widgetName The widget name */ public static String buildBoundaryComment(String boundaryType, String widgetType, String widgetName) { -String boundaryCommen
[ofbiz-framework] branch trunk updated: Improved: Remove formatBoundaryComment function in HtmlWidgetRenderer class (OFBIZ-12015)
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 d4713fa Improved: Remove formatBoundaryComment function in HtmlWidgetRenderer class (OFBIZ-12015) d4713fa is described below commit d4713fa6473c36f1eaaf10a3ba1a876b4ed344de Author: James Yong AuthorDate: Thu Sep 17 21:11:07 2020 +0800 Improved: Remove formatBoundaryComment function in HtmlWidgetRenderer class (OFBIZ-12015) Use buildBoundaryComment function instead of formatBoundaryComment function. Both functions do the same thing. Thanks: Jacques for review --- .../main/java/org/apache/ofbiz/widget/model/HtmlWidget.java| 4 ++-- .../apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java | 10 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 8225d4b..4bae38a 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -165,7 +165,7 @@ public class HtmlWidget extends ModelScreenWidget { try { boolean insertWidgetBoundaryComments = ModelWidget.widgetBoundaryCommentsEnabled(context); if (insertWidgetBoundaryComments) { - writer.append(HtmlWidgetRenderer.formatBoundaryComment("Begin", "Template", location)); + writer.append(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); } Template template = null; @@ -177,7 +177,7 @@ public class HtmlWidget extends ModelScreenWidget { FreeMarkerWorker.renderTemplate(template, context, writer); if (insertWidgetBoundaryComments) { - writer.append(HtmlWidgetRenderer.formatBoundaryComment("End", "Template", location)); + writer.append(HtmlWidgetRenderer.buildBoundaryComment("End", "Template", location)); } } catch (IllegalArgumentException | TemplateException | IOException e) { String errMsg = "Error rendering included template at location [" + location + "]: " + e.toString(); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index caa1723..781e099 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -72,11 +72,7 @@ public class HtmlWidgetRenderer { * @param widgetType The widget type: "Screen Widget", "Form Widget", etc. * @param widgetName The widget name */ -public String buildBoundaryComment(String boundaryType, String widgetType, String widgetName) { -return formatBoundaryComment(boundaryType, widgetType, widgetName); -} - -public static String formatBoundaryComment(String boundaryType, String widgetType, String widgetName) { +public static String buildBoundaryComment(String boundaryType, String widgetType, String widgetName) { String boundaryComment = "" + WHITE_SPACE; if (!Debug.verboseOn()) { return boundaryComment; @@ -110,7 +106,7 @@ public class HtmlWidgetRenderer { */ public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException { if (this.widgetCommentsEnabled) { -writer.append(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); +writer.append(buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); } } @@ -122,7 +118,7 @@ public class HtmlWidgetRenderer { */ public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException { if (this.widgetCommentsEnabled) { -writer.append(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); +writer.append(buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); } }
[ofbiz-framework] branch trunk updated: Improved: Show border and file name for content rendered from ftl (OFBIZ-12002)
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 b18dd6a Improved: Show border and file name for content rendered from ftl (OFBIZ-12002) b18dd6a is described below commit b18dd6a9ce39a595f6d1eebdb83f1b583a812d1d Author: James Yong AuthorDate: Sat Sep 12 20:10:08 2020 +0800 Improved: Show border and file name for content rendered from ftl (OFBIZ-12002) To reduce the need to view the page source from the browser. Activated when print.verbose=true and widget.verbose=true. Thanks: Jacques for review --- .../java/org/apache/ofbiz/base/util/UtilHtml.java | 35 -- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 19 +++- .../widget/renderer/html/HtmlWidgetRenderer.java | 24 ++- themes/common-theme/webapp/common/css/info.css | 19 .../webapp/common/js/util/OfbizUtil.js | 8 + themes/common-theme/widget/Theme.xml | 1 + 6 files changed, 95 insertions(+), 11 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java index 94f72c3..bbafaaf 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java @@ -18,6 +18,7 @@ ***/ package org.apache.ofbiz.base.util; +import org.apache.ofbiz.widget.model.ThemeFactory; import org.jsoup.parser.ParseError; import org.jsoup.parser.Parser; @@ -28,9 +29,12 @@ import javax.xml.stream.events.EndElement; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Stack; @@ -39,6 +43,7 @@ public final class UtilHtml { private static final String MODULE = UtilHtml.class.getName(); private static final Parser JSOUP_HTML_PARSER = createJSoupHtmlParser(); private static final String[] TAG_SHOULD_CLOSE_LIST = new String[]{"div"}; +private static List visualThemeBasePathsName; private UtilHtml() { } private static Parser createJSoupHtmlParser() { @@ -110,7 +115,33 @@ public final class UtilHtml { return errorList; } -public static void logFormattedError(String content, String location, String error, String module) { -Debug.logError("[Parsing " + location + "] " + error, module); +public static List getVisualThemeFolderNamesToExempt() { +if (visualThemeBasePathsName == null) { +try { +List xmlThemes = ThemeFactory.getThemeXmlFiles(); +visualThemeBasePathsName = new ArrayList<>(); +String themePathKey = File.separator + "themes" + File.separator; +String pluginPathKey = File.separator + "plugins" + File.separator; +for (File xmlTheme : xmlThemes) { +String path = xmlTheme.toURI().toURL().toString(); +if (path.indexOf(themePathKey) > 0) { +path = path.substring(path.indexOf(themePathKey) + 8); +} else if (path.indexOf(pluginPathKey) > 0) { +path = path.substring(path.indexOf(pluginPathKey) + 9); +} +path = path.substring(0, path.indexOf(File.separator)); +if (!path.contains("common-theme") && !path.contains("ecommerce")) { +visualThemeBasePathsName.add(File.separator + path + File.separator); +} +} +} catch (IOException e) { +Debug.logError(e, MODULE); +} +} +return Collections.unmodifiableList(visualThemeBasePathsName); +} + +public static void logHtmlWarning(String content, String location, String error, String module) { +Debug.logWarning("[Parsing " + location + "] " + error, module); } } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index bd21c03..4b275dc 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -269,14 +269,17 @@ public clas
[ofbiz-framework] branch trunk updated: Refactor ThemeFactory.java
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 8c4a191 Refactor ThemeFactory.java 8c4a191 is described below commit 8c4a19118d59ed0cd2e567997568f656aa7f4f41 Author: James Yong AuthorDate: Fri Sep 11 20:14:58 2020 +0800 Refactor ThemeFactory.java --- .../apache/ofbiz/widget/model/ThemeFactory.java| 31 +++--- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ThemeFactory.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ThemeFactory.java index 20720b7..62d23d6 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ThemeFactory.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ThemeFactory.java @@ -52,7 +52,7 @@ import org.xml.sax.SAXException; /** * Widget Theme Library - Theme factory class */ -public class ThemeFactory { +public final class ThemeFactory { private static final String MODULE = ThemeFactory.class.getName(); @@ -61,6 +61,7 @@ public class ThemeFactory { private static final UtilCache THEME_VISUAL_THEME_ID_CACHE = UtilCache.createUtilCache("widget.theme.idAndVisualTheme", 0, 0, false); +private ThemeFactory() { } /** * From a w3c Document return the modelTheme instantiated * @param themeFileDoc @@ -76,18 +77,11 @@ public class ThemeFactory { } /** - * Scann all Theme.xml definition to reload all VisualTheme oin cache + * Reload all VisualTheme in cache */ private static void pullModelThemesFromXmlToCache() { -String ofbizHome = System.getProperty("ofbiz.home"); -String themeFolderPath = ofbizHome + "/themes"; -String pluginsFolderPath = ofbizHome + "/plugins"; try { -List xmlThemes = FileUtil.findXmlFiles(themeFolderPath, null, "theme", "widget-theme.xsd"); -List xmlPluginThemes = FileUtil.findXmlFiles(pluginsFolderPath, null, "theme", "widget-theme.xsd"); -if (UtilValidate.isNotEmpty(xmlPluginThemes)) { -xmlThemes.addAll(xmlPluginThemes); -} +List xmlThemes = getThemeXmlFiles(); for (File xmlTheme : xmlThemes) { ModelTheme modelTheme = getModelThemeFromLocation(xmlTheme.toURI().toURL().toString()); if (modelTheme != null) { @@ -102,6 +96,23 @@ public class ThemeFactory { } /** + * Scan all Theme.xml definition + * @return + * @throws IOException + */ +public static List getThemeXmlFiles() throws IOException { +String ofbizHome = System.getProperty("ofbiz.home"); +String themeFolderPath = ofbizHome + "/themes"; +String pluginsFolderPath = ofbizHome + "/plugins"; +List xmlThemes = FileUtil.findXmlFiles(themeFolderPath, null, "theme", "widget-theme.xsd"); +List xmlPluginThemes = FileUtil.findXmlFiles(pluginsFolderPath, null, "theme", "widget-theme.xsd"); +if (UtilValidate.isNotEmpty(xmlPluginThemes)) { +xmlThemes.addAll(xmlPluginThemes); +} +return xmlThemes; +} + +/** * From a visualThemeId return the VisualTheme object corresponding in cache * If it's empty, reload the cache from all Theme definition * @param visualThemeId
[ofbiz-framework] branch trunk updated: Improved: Well-formed html in ftl template (OFBIZ-11996)
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 161c0c0 Improved: Well-formed html in ftl template (OFBIZ-11996) 161c0c0 is described below commit 161c0c0c05ad33474779706cf8bf1d548528f817 Author: James Yong AuthorDate: Thu Sep 10 17:12:36 2020 +0800 Improved: Well-formed html in ftl template (OFBIZ-11996) refactoring + add test case --- .../java/org/apache/ofbiz/base/util/UtilHtml.java | 75 -- .../org/apache/ofbiz/base/util/UtilHtmlTest.java | 13 +++- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 10 +-- 3 files changed, 56 insertions(+), 42 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java index 39f185e..94f72c3 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java @@ -29,6 +29,7 @@ import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Stack; @@ -59,51 +60,57 @@ public final class UtilHtml { /** * * @param content - * @param locationInfo for printing location information - * @return true if there is error + * @return list of errors */ -public static boolean hasUnclosedTag(String content, String locationInfo) { +public static List hasUnclosedTag(String content) { XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLEventReader eventReader = null; +List errorList = new ArrayList<>(); try { +// wrap with template tag as some content contains multiple root eventReader = inputFactory.createXMLEventReader( -new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)), "utf-8"); -} catch (XMLStreamException e) { -Debug.logError(e.getMessage(), MODULE); -return true; -} - -Stack stack = new Stack(); -boolean hasError = false; -while (eventReader.hasNext()) { -try { -XMLEvent event = eventReader.nextEvent(); -if (event.isStartElement()) { -StartElement startElement = event.asStartElement(); -stack.push(startElement); -} -if (event.isEndElement()) { -EndElement endElement = event.asEndElement(); -stack.pop(); -} -} catch (XMLStreamException e) { -if (!stack.isEmpty()) { -StartElement startElement = stack.pop(); -String elementName = startElement.getName().getLocalPart(); -if (Arrays.stream(TAG_SHOULD_CLOSE_LIST).anyMatch(elementName::equals)) { -hasError = true; -UtilHtml.logFormattedError(content, locationInfo, e.getMessage(), MODULE); +new ByteArrayInputStream(("" + content + "").getBytes(StandardCharsets.UTF_8)), +"utf-8"); +Stack stack = new Stack(); +while (eventReader.hasNext()) { +try { +XMLEvent event = eventReader.nextEvent(); +if (event.isStartElement()) { +StartElement startElement = event.asStartElement(); +stack.push(startElement); } -} else { -UtilHtml.logFormattedError(content, locationInfo, e.getMessage(), MODULE); +if (event.isEndElement()) { +EndElement endElement = event.asEndElement(); +stack.pop(); +} +} catch (XMLStreamException e) { +if (!stack.isEmpty()) { +StartElement startElement = stack.pop(); +String elementName = startElement.getName().getLocalPart(); +if (Arrays.stream(TAG_SHOULD_CLOSE_LIST).anyMatch(elementName::equals)) { +errorList.add(e.getMessage()); +} +} else { +errorList.add(e.getMessage()); +} +break; +} +} +} catch (XMLStreamException e) { +errorList.add(e.getMessage()); +} finally { +i
[ofbiz-framework] branch trunk updated: Improved: Well-formed html in ftl template (OFBIZ-11996)
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 aab02b5 Improved: Well-formed html in ftl template (OFBIZ-11996) aab02b5 is described below commit aab02b514275a096f5bbb2dbb04ead601e0cfc62 Author: James Yong AuthorDate: Thu Sep 10 13:10:32 2020 +0800 Improved: Well-formed html in ftl template (OFBIZ-11996) Add code to check closing tags and refactoring --- .../java/org/apache/ofbiz/base/util/UtilHtml.java | 109 + .../org/apache/ofbiz/base/util/UtilHtmlTest.java | 34 +++ .../org/apache/ofbiz/widget/model/HtmlWidget.java | 33 ++- 3 files changed, 153 insertions(+), 23 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java new file mode 100644 index 000..39f185e --- /dev/null +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java @@ -0,0 +1,109 @@ +/*** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ***/ +package org.apache.ofbiz.base.util; + +import org.jsoup.parser.ParseError; +import org.jsoup.parser.Parser; + +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.EndElement; +import javax.xml.stream.events.StartElement; +import javax.xml.stream.events.XMLEvent; +import java.io.ByteArrayInputStream; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.List; +import java.util.Stack; + +public final class UtilHtml { + +private static final String MODULE = UtilHtml.class.getName(); +private static final Parser JSOUP_HTML_PARSER = createJSoupHtmlParser(); +private static final String[] TAG_SHOULD_CLOSE_LIST = new String[]{"div"}; +private UtilHtml() { } + +private static Parser createJSoupHtmlParser() { +Parser parser = Parser.htmlParser(); +parser.setTrackErrors(100); +return parser; +} + +public static List validateHtmlFragmentWithJSoup(String content) { +if (content != null) { +JSOUP_HTML_PARSER.parseInput(content, ""); +if (JSOUP_HTML_PARSER.isTrackErrors()) { +return JSOUP_HTML_PARSER.getErrors(); +} +} +return null; +} + +/** + * + * @param content + * @param locationInfo for printing location information + * @return true if there is error + */ +public static boolean hasUnclosedTag(String content, String locationInfo) { +XMLInputFactory inputFactory = XMLInputFactory.newInstance(); +XMLEventReader eventReader = null; +try { +eventReader = inputFactory.createXMLEventReader( +new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)), "utf-8"); +} catch (XMLStreamException e) { +Debug.logError(e.getMessage(), MODULE); +return true; +} + +Stack stack = new Stack(); +boolean hasError = false; +while (eventReader.hasNext()) { +try { +XMLEvent event = eventReader.nextEvent(); +if (event.isStartElement()) { +StartElement startElement = event.asStartElement(); +stack.push(startElement); +} +if (event.isEndElement()) { +EndElement endElement = event.asEndElement(); +stack.pop(); +} +} catch (XMLStreamException e) { +if (!stack.isEmpty()) { +StartElement startElement = stack.pop(); +String elementName = startElement.getName().getLocalPart(); +if (Arrays.stream(T
[ofbiz-framework] branch trunk updated: Improved: Allow to accept CDATA (OFBIZ-7004)
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 cac8c27 Improved: Allow to accept CDATA (OFBIZ-7004) cac8c27 is described below commit cac8c274773eb87d498db6b8647bb9990b5cece9 Author: James Yong AuthorDate: Thu Sep 10 10:13:28 2020 +0800 Improved: Allow to accept CDATA (OFBIZ-7004) Fix cvc-complex-type.2.1 error --- framework/widget/dtd/widget-screen.xsd | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/widget/dtd/widget-screen.xsd b/framework/widget/dtd/widget-screen.xsd index be4e5b2..3774d9a 100644 --- a/framework/widget/dtd/widget-screen.xsd +++ b/framework/widget/dtd/widget-screen.xsd @@ -514,7 +514,11 @@ under the License. - + + + + +
[ofbiz-framework] branch trunk updated: Improved: Allow to accept CDATA (OFBIZ-7004)
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 a8eb8bc Improved: Allow to accept CDATA (OFBIZ-7004) a8eb8bc is described below commit a8eb8bc059f81ae02db9edcd6e13ebc92793f6af Author: James Yong AuthorDate: Thu Sep 10 09:12:05 2020 +0800 Improved: Allow to accept CDATA (OFBIZ-7004) Allow inline content Thanks: Jacques for review in 2016 --- framework/widget/dtd/widget-screen.xsd | 2 +- .../main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 13 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/framework/widget/dtd/widget-screen.xsd b/framework/widget/dtd/widget-screen.xsd index 99f32b1..be4e5b2 100644 --- a/framework/widget/dtd/widget-screen.xsd +++ b/framework/widget/dtd/widget-screen.xsd @@ -518,7 +518,7 @@ under the License. - + diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index dd6593e..163fffd 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -202,11 +202,13 @@ public class HtmlWidget extends ModelScreenWidget { public static class HtmlTemplate extends ModelScreenWidget { private FlexibleStringExpander locationExdr; private boolean multiBlock; +private String inlineFTL; public HtmlTemplate(ModelScreen modelScreen, Element htmlTemplateElement) { super(modelScreen, htmlTemplateElement); this.locationExdr = FlexibleStringExpander.getInstance(htmlTemplateElement.getAttribute("location")); this.multiBlock = !"false".equals(htmlTemplateElement.getAttribute("multi-block")); +this.inlineFTL = htmlTemplateElement.getTextContent(); } /** @@ -229,6 +231,17 @@ public class HtmlWidget extends ModelScreenWidget { @Override public void renderWidgetString(Appendable writer, Map context, ScreenStringRenderer screenStringRenderer) throws IOException { +if (UtilValidate.isNotEmpty(this.inlineFTL)) { +try { +FreeMarkerWorker.renderTemplateFromString("", this.inlineFTL, context, writer, 0, false); +} catch (TemplateException | IOException e) { +String errMsg = "Error rendering [" + this.inlineFTL + "]: " + e.toString(); +Debug.logError(e, errMsg, MODULE); +writeError(writer, errMsg); +} +return; +} + if (!isMultiBlock() && !Debug.verboseOn()) { renderHtmlTemplate(writer, locationExdr, context); return;
[ofbiz-framework] branch trunk updated: Improved: Well-formed html in ftl template (OFBIZ-11996)
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 d322ae5 Improved: Well-formed html in ftl template (OFBIZ-11996) d322ae5 is described below commit d322ae51e31e9f8ba60cb59683fbabb06c4d2b6a Author: James Yong AuthorDate: Sun Sep 6 18:26:54 2020 +0800 Improved: Well-formed html in ftl template (OFBIZ-11996) fix checkstyle issue --- .../src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 5a046bf..dd6593e 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -236,8 +236,8 @@ public class HtmlWidget extends ModelScreenWidget { /** * We use stack to store the string writer because a freemarker template may also render a sub screen - * widget by using ${screens.render(link to the screen)}. So before rendering the sub screen widget, ScreenRenderer class will check for the - * existence of the stack and retrieve the correct string writer. + * widget by using ${screens.render(link to the screen)}. So before rendering the sub screen widget, + * ScreenRenderer class will check for the existence of the stack and retrieve the correct string writer. * Inline script tags are removed from the final rendering, if multi-block = true */ String location = locationExdr.expandString(context);
[ofbiz-framework] branch trunk updated: Improved: Well-formed html in ftl template (OFBIZ-11996)
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 8cbdb6a Improved: Well-formed html in ftl template (OFBIZ-11996) 8cbdb6a is described below commit 8cbdb6a225eed7b4571840bf6ff9cbe139ae088c Author: James Yong AuthorDate: Sun Sep 6 07:44:40 2020 +0800 Improved: Well-formed html in ftl template (OFBIZ-11996) When print.verbose=true, check for well-formed html in ftl templates to catch programming errors. --- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 174 - .../widget/model/MultiBlockHtmlTemplateUtil.java | 2 +- .../ofbiz/widget/renderer/ScreenRenderer.java | 4 +- 3 files changed, 101 insertions(+), 79 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 0ae8dea..5a046bf 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -43,6 +43,9 @@ import org.apache.ofbiz.widget.renderer.ScreenStringRenderer; import org.apache.ofbiz.widget.renderer.html.HtmlWidgetRenderer; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; +import org.jsoup.parser.ParseError; +import org.jsoup.parser.ParseErrorList; +import org.jsoup.parser.Parser; import org.jsoup.select.Elements; import org.w3c.dom.Element; @@ -56,6 +59,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; +import java.util.function.Consumer; /** * Widget Library - Screen model HTML class. @@ -187,80 +191,6 @@ public class HtmlWidget extends ModelScreenWidget { } } -/** - * Render html template when multi-block=true. We use stack to store the string writer because a freemarker template may also render a sub screen - * widget by using ${screens.render(link to the screen)}. So before rendering the sub screen widget, ScreenRenderer class will check for the - * existence of the stack and retrieve the correct string writer. Inline script tags are removed from the final rendering. - * @param writer - * @param locationExdr - * @param context - * @throws IOException - */ -public static void renderHtmlTemplateWithMultiBlock(Appendable writer, FlexibleStringExpander locationExdr, -Map context) throws IOException { -String location = locationExdr.expandString(context); - -StringWriter stringWriter = new StringWriter(); -Stack stringWriterStack = UtilGenerics.cast(context.get(MultiBlockHtmlTemplateUtil.MULTI_BLOCK_WRITER)); -if (stringWriterStack == null) { -stringWriterStack = new Stack<>(); -} -stringWriterStack.push(stringWriter); -context.put(MultiBlockHtmlTemplateUtil.MULTI_BLOCK_WRITER, stringWriterStack); -renderHtmlTemplate(stringWriter, locationExdr, context); -stringWriterStack.pop(); -// check if no more parent freemarker template before removing from context -if (stringWriterStack.empty()) { -context.remove(MultiBlockHtmlTemplateUtil.MULTI_BLOCK_WRITER); -} -String data = stringWriter.toString(); -stringWriter.close(); - -Document doc = Jsoup.parseBodyFragment(data); - -// extract js script tags -Elements scriptElements = doc.select("script"); -if (scriptElements != null && scriptElements.size() > 0) { -StringBuilder scripts = new StringBuilder(); -for (org.jsoup.nodes.Element script : scriptElements) { -String type = script.attr("type"); -String src = script.attr("src"); -if (UtilValidate.isEmpty(src)) { -if (UtilValidate.isEmpty(type) || "application/javascript".equals(type)) { -scripts.append(script.data()); -script.remove(); -} -} -} - -if (scripts.length() > 0) { -// store script for retrieval by the browser -String fileName = location; -fileName = fileName.substring(fileName.lastIndexOf('/') + 1); -if (fileName.endsWith(".ftl")) { -fileName = fileName.substring(0, fileName.length() - 4); -} -String key = MultiBlockHtmlTemplateUtil.putScriptInCache(context, fileName, scripts.toString()); - -// construct script link -String webappName = (String) context.get("webappNa
[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: Allow logging to be disabled for getJs request (OFBIZ-11980)
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 c55f050 Improved: Allow logging to be disabled for getJs request (OFBIZ-11980) c55f050 is described below commit c55f050db25d313462666f72bf8507f36817101c Author: James Yong AuthorDate: Tue Sep 1 21:20:01 2020 +0800 Improved: Allow logging to be disabled for getJs request (OFBIZ-11980) Add documentation --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6f88607..8062797 100644 --- a/build.gradle +++ b/build.gradle @@ -179,7 +179,7 @@ dependencies { implementation 'org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1' implementation 'org.apache.httpcomponents:httpclient-cache:4.5.12' implementation 'org.apache.logging.log4j:log4j-api:2.13.3' // the API of log4j 2 -implementation 'org.apache.logging.log4j:log4j-core:2.13.3' +implementation 'org.apache.logging.log4j:log4j-core:2.13.3' // Somehow needed by Buildbot to compile OFBizDynamicThresholdFilter.java implementation 'org.apache.poi:poi:4.1.2' implementation 'org.apache.shiro:shiro-core:1.4.1' // So far we did not update from 1.4.1 because of a compile issue. You may try w/ a newer version than 1.5.2 implementation 'org.apache.sshd:sshd-core:1.7.0' // So far we did not update from 1.7.0 because of a compile issue. You may try w/ a newer version than 2.4.0
[ofbiz-framework] branch trunk updated: Improved: Allow logging to be disabled for getJs request (OFBIZ-11980)
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 61a714c Improved: Allow logging to be disabled for getJs request (OFBIZ-11980) 61a714c is described below commit 61a714c6d18dbec6c9ec57a118a352daa435176b Author: James Yong AuthorDate: Mon Aug 31 22:57:56 2020 +0800 Improved: Allow logging to be disabled for getJs request (OFBIZ-11980) Try fixing error compiling OFBizDynamicThresholdFilter.java in Buildbot Thanks Jacques for reporting --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index f031094..6f88607 100644 --- a/build.gradle +++ b/build.gradle @@ -179,6 +179,7 @@ dependencies { implementation 'org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1' implementation 'org.apache.httpcomponents:httpclient-cache:4.5.12' implementation 'org.apache.logging.log4j:log4j-api:2.13.3' // the API of log4j 2 +implementation 'org.apache.logging.log4j:log4j-core:2.13.3' implementation 'org.apache.poi:poi:4.1.2' implementation 'org.apache.shiro:shiro-core:1.4.1' // So far we did not update from 1.4.1 because of a compile issue. You may try w/ a newer version than 1.5.2 implementation 'org.apache.sshd:sshd-core:1.7.0' // So far we did not update from 1.7.0 because of a compile issue. You may try w/ a newer version than 2.4.0
[ofbiz-framework] branch trunk updated: Improved: Allow logging to be disabled for getJs request (OFBIZ-11980)
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 4a03567 Improved: Allow logging to be disabled for getJs request (OFBIZ-11980) 4a03567 is described below commit 4a03567996c03b93acdf9511586c6c3e0b79fd8c Author: James Yong AuthorDate: Sun Aug 30 21:34:34 2020 +0800 Improved: Allow logging to be disabled for getJs request (OFBIZ-11980) Hide non-error logs related to getJs request as it doesn't provide meaningful data. Thanks Jacques for initial review --- .../ofbiz/product/category/CatalogUrlFilter.java | 15 +- framework/base/config/log4j2.xml | 6 +- .../base/log4j/OFBizDynamicThresholdFilter.java| 243 + .../apache/ofbiz/webapp/control/ControlFilter.java | 10 +- 4 files changed, 270 insertions(+), 4 deletions(-) diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java index 6f9c6f9..13ef0af 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java @@ -33,6 +33,7 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.logging.log4j.ThreadContext; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.StringUtil; import org.apache.ofbiz.base.util.StringUtil.StringWrapper; @@ -344,8 +345,18 @@ public class CatalogUrlFilter implements Filter { //Check path alias UrlServletHelper.checkPathAlias(request, httpResponse, delegator, pathInfo); } -// we're done checking; continue on -chain.doFilter(request, response); +try { +String uriWithContext = httpRequest.getRequestURI(); +String context = httpRequest.getContextPath(); +String uri = uriWithContext.substring(context.length()); +// support OFBizDynamicThresholdFilter in log4j2.xml +ThreadContext.put("uri", uri); + +// we're done checking; continue on +chain.doFilter(request, response); +} finally { +ThreadContext.remove("uri"); +} } @Override diff --git a/framework/base/config/log4j2.xml b/framework/base/config/log4j2.xml index 9ee1e20..1b04cd1 100644 --- a/framework/base/config/log4j2.xml +++ b/framework/base/config/log4j2.xml @@ -17,7 +17,11 @@ KIND, either express or implied. See the License for the 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 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 stu
[ofbiz-framework] branch trunk updated: Improved: multi-block attribute for html-template tag (OFBIZ-11686)
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 fd85450 Improved: multi-block attribute for html-template tag (OFBIZ-11686) fd85450 is described below commit fd85450c4dd331b15056d3aca8127583633b5caa Author: James Yong AuthorDate: Tue Aug 25 21:59:46 2020 +0800 Improved: multi-block attribute for html-template tag (OFBIZ-11686) Not important to track server hits for getJs request --- framework/common/webcommon/WEB-INF/common-controller.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/common/webcommon/WEB-INF/common-controller.xml b/framework/common/webcommon/WEB-INF/common-controller.xml index 9291cdb..1142a2d 100644 --- a/framework/common/webcommon/WEB-INF/common-controller.xml +++ b/framework/common/webcommon/WEB-INF/common-controller.xml @@ -324,7 +324,7 @@ under the License. - +
[ofbiz-plugins] branch trunk updated: Improved: multi-block attribute for html-template tag (OFBIZ-11686)
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-plugins.git The following commit(s) were added to refs/heads/trunk by this push: new 1c9f2ab Improved: multi-block attribute for html-template tag (OFBIZ-11686) 1c9f2ab is described below commit 1c9f2ab9c65f5fae2ff346183fb27592acc69ae5 Author: James Yong AuthorDate: Tue Aug 25 21:58:26 2020 +0800 Improved: multi-block attribute for html-template tag (OFBIZ-11686) Not important to track server hits for getJs request --- ecommerce/webapp/ecommerce/WEB-INF/controller.xml | 2 +- webpos/webapp/webpos/WEB-INF/controller.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ecommerce/webapp/ecommerce/WEB-INF/controller.xml b/ecommerce/webapp/ecommerce/WEB-INF/controller.xml index 2aef59e..d3401a7 100644 --- a/ecommerce/webapp/ecommerce/WEB-INF/controller.xml +++ b/ecommerce/webapp/ecommerce/WEB-INF/controller.xml @@ -170,7 +170,7 @@ under the License. - + diff --git a/webpos/webapp/webpos/WEB-INF/controller.xml b/webpos/webapp/webpos/WEB-INF/controller.xml index dd62358..80d02e5 100644 --- a/webpos/webapp/webpos/WEB-INF/controller.xml +++ b/webpos/webapp/webpos/WEB-INF/controller.xml @@ -496,7 +496,7 @@ - +
[ofbiz-framework] branch trunk updated: Fix some checkstyle issues
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 f64a56c Fix some checkstyle issues f64a56c is described below commit f64a56cae3bee4028fb7c5067b7c9027eb9c4ad5 Author: James Yong AuthorDate: Tue Aug 25 21:19:02 2020 +0800 Fix some checkstyle issues --- .../org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java | 9 ++--- .../java/org/apache/ofbiz/product/category/SeoConfigUtil.java| 4 +++- .../org/apache/ofbiz/product/category/SeoControlServlet.java | 5 +++-- build.gradle | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java index 922dfd2..60fe57d 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java @@ -72,7 +72,8 @@ public class SeoCatalogUrlServlet extends HttpServlet { String productId = null; try { String lastPathElement = pathElements.get(pathElements.size() - 1); -if (lastPathElement.startsWith("p_") || EntityQuery.use(delegator).from("Product").where("productId", lastPathElement).cache().queryOne() != null) { +if (lastPathElement.startsWith("p_") +|| EntityQuery.use(delegator).from("Product").where("productId", lastPathElement).cache().queryOne() != null) { if (lastPathElement.startsWith("p_")) { productId = lastPathElement.substring(2); } else { @@ -130,7 +131,8 @@ public class SeoCatalogUrlServlet extends HttpServlet { request.setAttribute("productId", productId); } -RequestDispatcher rd = request.getRequestDispatcher("/" + (UtilValidate.isEmpty(SeoControlServlet.getControlServlet()) ? "" : (SeoControlServlet.getControlServlet() + "/")) +RequestDispatcher rd = request.getRequestDispatcher("/" ++ (UtilValidate.isEmpty(SeoControlServlet.getControlServlet()) ? "" : (SeoControlServlet.getControlServlet() + "/")) + (productId != null ? PRODUCT_REQUEST : CATEGORY_REQUEST)); rd.forward(request, response); } @@ -162,7 +164,8 @@ public class SeoCatalogUrlServlet extends HttpServlet { return urlBuilder.toString(); } -public static String makeCatalogUrl(String contextPath, List crumb, String productId, String currentCategoryId, String previousCategoryId) { +public static String makeCatalogUrl(String contextPath, List crumb, String productId, +String currentCategoryId, String previousCategoryId) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(contextPath); if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java index 4973b0b..27c104f 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java @@ -210,7 +210,9 @@ public final class SeoConfigUtil { userExceptionPatterns.add(pattern); Debug.logInfo("" + ELEMENT_URLPATTERN + ": " + urlpattern, MODULE); } catch (MalformedPatternException e) { -Debug.logWarning("Can NOT parse " + urlpattern + " in element " + ELEMENT_URLPATTERN + " of " + ELEMENT_EXCEPTIONS + ". Error: " + e.getMessage(), MODULE); +Debug.logWarning("Can NOT parse " + urlpattern + " in element " ++ ELEMENT_URLPATTERN + " of " + ELEMENT_EXCEPTIONS + ". Error: " ++ e.getMessage(), MODULE); } } } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java b/applications/product/src/main/java/org/apache/ofbiz/prod
[ofbiz-framework] branch trunk updated: Improved: multi-block attribute for html-template tag (OFBIZ-11686)
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 219fcc0 Improved: multi-block attribute for html-template tag (OFBIZ-11686) 219fcc0 is described below commit 219fcc01ce6166132dca4716404e45e4241afab0 Author: James Yong AuthorDate: Tue Aug 25 20:49:05 2020 +0800 Improved: multi-block attribute for html-template tag (OFBIZ-11686) Increase value for maxScriptCacheSizePerUserSession as ecommerce application using more inline script tags. Thanks: Jacques for reporting --- .../java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java index bc20bf2..4392d21 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java @@ -38,9 +38,8 @@ public final class MultiBlockHtmlTemplateUtil { private static final String MODULE = MultiBlockHtmlTemplateUtil.class.getName(); public static final String MULTI_BLOCK_WRITER = "multiBlockWriter"; private static final String SCRIPT_LINKS_FOR_FOOT = "ScriptLinksForFoot"; -private static int maxScriptCacheSizePerUserSession = 10; +private static int maxScriptCacheSizePerUserSession = 15; private static int estimatedConcurrentUserSessions = 250; -private static int estimatedScreensWithMultiBlockHtmlTemplate = 200; /** * Store inline script extracted from freemarker template for a user session. * Number of inline scripts for a user session will be constraint by {@link MultiBlockHtmlTemplateUtil#maxScriptCacheSizePerUserSession}
[ofbiz-framework] branch trunk updated: Fixed: multi-block attribute for html-template tag (OFBIZ-11686)
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 2d18b93 Fixed: multi-block attribute for html-template tag (OFBIZ-11686) 2d18b93 is described below commit 2d18b93a2eab5a7d79c6bd336f74d0a8246d93d8 Author: James Yong AuthorDate: Mon Aug 24 07:41:01 2020 +0800 Fixed: multi-block attribute for html-template tag (OFBIZ-11686) checkstyle issues --- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 48 ++ .../widget/model/MultiBlockHtmlTemplateUtil.java | 35 +++- 2 files changed, 26 insertions(+), 57 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index 1a160ad..77a2153 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -18,20 +18,15 @@ ***/ package org.apache.ofbiz.widget.model; -import java.io.IOException; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Stack; - -import javax.servlet.http.HttpServletRequest; - +import freemarker.ext.beans.BeansWrapper; +import freemarker.ext.beans.CollectionModel; +import freemarker.ext.beans.StringModel; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import freemarker.template.TemplateModel; +import freemarker.template.TemplateModelException; +import freemarker.template.Version; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.GeneralException; import org.apache.ofbiz.base.util.UtilCodec; @@ -51,15 +46,16 @@ import org.jsoup.nodes.Document; import org.jsoup.select.Elements; import org.w3c.dom.Element; -import freemarker.ext.beans.BeansWrapper; -import freemarker.ext.beans.CollectionModel; -import freemarker.ext.beans.StringModel; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import freemarker.template.TemplateModel; -import freemarker.template.TemplateModelException; -import freemarker.template.Version; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Stack; /** * Widget Library - Screen model HTML class. @@ -190,9 +186,7 @@ public class HtmlWidget extends ModelScreenWidget { /** * Render html template when multi-block=true. We use stack to store the string writer because a freemarker template may also render a sub screen * widget by using ${screens.render(link to the screen)}. So before rendering the sub screen widget, ScreenRenderer class will check for the - * existence of the stack and retrieve the correct string writer. The following tags are removed from the final rendering: 1. External and inline - * javascript tags 2. Css link tags - * + * existence of the stack and retrieve the correct string writer. Inline script tags are removed from the final rendering. * @param writer * @param locationExdr * @param context @@ -273,7 +267,7 @@ public class HtmlWidget extends ModelScreenWidget { public static class HtmlTemplate extends ModelScreenWidget { protected FlexibleStringExpander locationExdr; -protected boolean multiBlock; +private boolean multiBlock; public HtmlTemplate(ModelScreen modelScreen, Element htmlTemplateElement) { super(modelScreen, htmlTemplateElement); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java index 9da9124..bc20bf2 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java @@ -18,28 +18,15 @@ ***/ package org.apache.ofbiz.widget.model; -import java.io.IOException; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; +import org.apache.ofbiz.base.util.UtilGenerics; + +import
[ofbiz-framework] branch trunk updated: Fixed: multi-block attribute for html-template tag (OFBIZ-11686)
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 145eeba Fixed: multi-block attribute for html-template tag (OFBIZ-11686) 145eeba is described below commit 145eeba9ed301113a0453e71ad4e658c6b0081b2 Author: James Yong AuthorDate: Mon Aug 24 08:01:24 2020 +0800 Fixed: multi-block attribute for html-template tag (OFBIZ-11686) update lower value for checkstyleMain.maxErrors --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2e12fb6..1c38d4b 100644 --- a/build.gradle +++ b/build.gradle @@ -288,7 +288,7 @@ checkstyle { // the sum of errors found last time it was changed after using the // ‘checkstyle’ tool present in the framework and in the official // plugins. -tasks.checkstyleMain.maxErrors = 5424 +tasks.checkstyleMain.maxErrors = 5420 // Currently there are a lot of errors so we need to temporarily // hide them to avoid polluting the terminal output. showViolations = false
[ofbiz-framework] branch trunk updated: Improved: multi-block attribute for html-template tag (OFBIZ-11686)
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 4612e49 Improved: multi-block attribute for html-template tag (OFBIZ-11686) 4612e49 is described below commit 4612e49fa6af21a1a68180c8b079546ff94485bb Author: James Yong AuthorDate: Sun Aug 23 21:55:09 2020 +0800 Improved: multi-block attribute for html-template tag (OFBIZ-11686) Remove support to headerize script and css links from html-template as importLibrary js function is a more simple solution. --- framework/widget/dtd/widget-screen.xsd | 4 +- .../org/apache/ofbiz/widget/model/HtmlWidget.java | 34 --- .../ofbiz/widget/model/ModelScreenWidget.java | 10 +- .../widget/model/MultiBlockHtmlTemplateUtil.java | 301 + 4 files changed, 3 insertions(+), 346 deletions(-) diff --git a/framework/widget/dtd/widget-screen.xsd b/framework/widget/dtd/widget-screen.xsd index 3bf4f1b..99f32b1 100644 --- a/framework/widget/dtd/widget-screen.xsd +++ b/framework/widget/dtd/widget-screen.xsd @@ -522,9 +522,7 @@ under the License. -Multi-block processing of template targeted for the html body. -Inline script will be rendered as external script after html body tag. -External script tag with attribute data-import='head' will be rendered within html head tag. +Inline script will be rendered as external script at bottom of body tag. diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java index e1ee228..1a160ad 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java @@ -232,12 +232,6 @@ public class HtmlWidget extends ModelScreenWidget { scripts.append(script.data()); script.remove(); } -} else { -String dataImport = script.attr("data-import"); -if ("head".equals(dataImport)) { -// remove external script in the template that is meant to be imported in the html header -script.remove(); -} } } @@ -263,17 +257,6 @@ public class HtmlWidget extends ModelScreenWidget { MultiBlockHtmlTemplateUtil.addScriptLinkForFoot(request, url); } } -// extract css link tags -Elements csslinkElements = doc.select("link"); -if (csslinkElements != null && csslinkElements.size() > 0) { -for (org.jsoup.nodes.Element link : csslinkElements) { -String src = link.attr("href"); -if (UtilValidate.isNotEmpty(src)) { -// remove external style sheet in the template that will be added to the html header -link.remove(); -} -} -} // the 'template' block String body = doc.body().html(); @@ -296,23 +279,6 @@ public class HtmlWidget extends ModelScreenWidget { super(modelScreen, htmlTemplateElement); this.locationExdr = FlexibleStringExpander.getInstance(htmlTemplateElement.getAttribute("location")); this.multiBlock = !"false".equals(htmlTemplateElement.getAttribute("multi-block")); - -if (this.isMultiBlock()) { -String origLoc = this.locationExdr.getOriginal(); -Set urls = null; -if (origLoc.contains("${")) { -urls = new LinkedHashSet<>(); -urls.add(origLoc); -} else { -try { -urls = MultiBlockHtmlTemplateUtil.extractHtmlLinksFromRawHtmlTemplate(origLoc); -} catch (IOException e) { -String errMsg = "Error getting html imports from template at location [" + origLoc + "]: " + e.toString(); -Debug.logError(e, errMsg, MODULE); -} -} - MultiBlockHtmlTemplateUtil.addHtmlLinksToHtmlLinksForScreenCache(modelScreen.getSourceLocation(), modelScreen.getName(), urls); -} } public String getLocation(Map context) { diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/wid
[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')); +} +
[ofbiz-plugins] 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-plugins.git The following commit(s) were added to refs/heads/trunk by this push: new 429c9b4 Improved: Move page-specific script links to html template (OFBIZ-11799) 429c9b4 is described below commit 429c9b4acd503bfbfccdb3d7570f3fca6fd5fa3e Author: James Yong AuthorDate: Sat Aug 22 15:53:53 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load jstree and cookies js at ProductCategories.ftl --- ecommerce/template/catalog/ProductCategories.ftl | 36 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ecommerce/template/catalog/ProductCategories.ftl b/ecommerce/template/catalog/ProductCategories.ftl index e948baa..6487399 100644 --- a/ecommerce/template/catalog/ProductCategories.ftl +++ b/ecommerce/template/catalog/ProductCategories.ftl @@ -16,11 +16,6 @@ specific language governing permissions and limitations under the License. --> - - -
[ofbiz-framework] branch trunk updated: Reverted: Error when rendering renderSubmitField macro (OFBIZ-11968)
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 2eb3282 Reverted: Error when rendering renderSubmitField macro (OFBIZ-11968) 2eb3282 is described below commit 2eb32829881be4a3ef42d55231ce256773b1bdd5 Author: James Yong AuthorDate: Sat Aug 22 14:43:00 2020 +0800 Reverted: Error when rendering renderSubmitField macro (OFBIZ-11968) No issue after new checkout. Thanks Jacques and Dennis for the check --- themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl index 9b0f31a..b174450 100644 --- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl @@ -205,7 +205,7 @@ under the License. -<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id="" title="" name="" event="" confirmation="" containerId="" tabindex=""> +<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id title="" name="" event="" confirmation="" containerId="" tabindex=""> <#if buttonType=="text-link"> href="javascript:document.${formName}.submit()" <#if confirmation?has_content>onclick="return confirm('${confirmation?js_string}');"><#if title?has_content>${title} <#elseif buttonType=="image">
[ofbiz-framework] branch trunk updated: Improved: multi-block attribute for html-template tag (OFBIZ-11686)
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 c3c41b2 Improved: multi-block attribute for html-template tag (OFBIZ-11686) c3c41b2 is described below commit c3c41b28b44050f6f76f1f2a6756444c6e7f500e Author: James Yong AuthorDate: Fri Aug 21 17:59:00 2020 +0800 Improved: multi-block attribute for html-template tag (OFBIZ-11686) Moved <@scriptTagsFooter/> within the body tag. --- themes/common-theme/template/includes/CloseHtmlBody.ftl | 2 +- themes/common-theme/template/includes/LookupFooter.ftl | 4 ++-- themes/flatgrey/template/Footer.ftl | 2 +- themes/rainbowstone/template/includes/Footer.ftl| 2 +- themes/tomahawk/template/Footer.ftl | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/themes/common-theme/template/includes/CloseHtmlBody.ftl b/themes/common-theme/template/includes/CloseHtmlBody.ftl index 9ad25cb..fef39b4 100644 --- a/themes/common-theme/template/includes/CloseHtmlBody.ftl +++ b/themes/common-theme/template/includes/CloseHtmlBody.ftl @@ -16,6 +16,6 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - <@scriptTagsFooter/> + diff --git a/themes/common-theme/template/includes/LookupFooter.ftl b/themes/common-theme/template/includes/LookupFooter.ftl index e00660c..fef39b4 100644 --- a/themes/common-theme/template/includes/LookupFooter.ftl +++ b/themes/common-theme/template/includes/LookupFooter.ftl @@ -16,6 +16,6 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - - <@scriptTagsFooter/> +<@scriptTagsFooter/> + diff --git a/themes/flatgrey/template/Footer.ftl b/themes/flatgrey/template/Footer.ftl index 67d70f9..64df1b3 100644 --- a/themes/flatgrey/template/Footer.ftl +++ b/themes/flatgrey/template/Footer.ftl @@ -41,6 +41,6 @@ under the License. - <@scriptTagsFooter/> + diff --git a/themes/rainbowstone/template/includes/Footer.ftl b/themes/rainbowstone/template/includes/Footer.ftl index 2741617..795ace3 100644 --- a/themes/rainbowstone/template/includes/Footer.ftl +++ b/themes/rainbowstone/template/includes/Footer.ftl @@ -33,6 +33,6 @@ under the License. - <@scriptTagsFooter/> + diff --git a/themes/tomahawk/template/Footer.ftl b/themes/tomahawk/template/Footer.ftl index 1f27daa..a2d78a7 100644 --- a/themes/tomahawk/template/Footer.ftl +++ b/themes/tomahawk/template/Footer.ftl @@ -41,6 +41,6 @@ under the License. - <@scriptTagsFooter/> +
[ofbiz-framework] branch trunk updated: Fixed: Error when rendering renderSubmitField macro (OFBIZ-11968)
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 796e0d9 Fixed: Error when rendering renderSubmitField macro (OFBIZ-11968) 796e0d9 is described below commit 796e0d94ee96d537713855a98cda38345dc40d28 Author: James Yong AuthorDate: Fri Aug 21 15:44:39 2020 +0800 Fixed: Error when rendering renderSubmitField macro (OFBIZ-11968) Fixed error rendering renderSubmitField when accessing /humanres/control/FindPartySkills page --- themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl index b174450..9b0f31a 100644 --- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl @@ -205,7 +205,7 @@ under the License. -<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id title="" name="" event="" confirmation="" containerId="" tabindex=""> +<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id="" title="" name="" event="" confirmation="" containerId="" tabindex=""> <#if buttonType=="text-link"> href="javascript:document.${formName}.submit()" <#if confirmation?has_content>onclick="return confirm('${confirmation?js_string}');"><#if title?has_content>${title} <#elseif buttonType=="image">
[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} - + + +<a href="#impersonateContent" title="${uiLabelMap.CommonImpersonateTitle}" id="impersonateBtn"><img src="/images/img/impersonate-ico.png" alt="${uiLabelMap.CommonImpersonateTitle}"/></a> +<div id="impersonateContent"> +<div class="impersonateModal"> +<a href="#" class="btn-close" title="${uiLabelMap.CommonClose}">×</a> +<h3>${uiLabelMap.CommonImpersonateTitle}</h3> +<p>${uiLabelMap.CommonImpersonateUserLogin} : <strong>${context.userLogin.userLoginId!}</strong></p> +<a href="depersonateLogin" class="btn" title="${uiLabelMap.CommonImpersonateStop}">${uiLabelMap.CommonImpersonateStop}</a> +</div> +</div> + + +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} - + +<div class="content"> +<img src="/images/img/impersonate-ico.png" alt="${uiLabelMap.CommonImpersonateTitle}"/> +<p class="user">${impersonationMessage!}<p> +<p>${uiLabelMap.CommonSince} ${fromDate!}</p> +<p><a id="logout" class="user-pref-btn" href="<@ofbizUrl>logout</@ofbizUrl>">${uiLabelMap.CommonLogout}</a></p> +</div> + -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. - +
[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
[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 && jGrowlW
[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 --> <script type="application/javascript"> jQuery(document).ready(function () { -importLibrary(["/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>"], -function(){ +var importLibraryFiles = ["/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>"]; +importLibrary(importLibraryFiles, function(){ -multiple = jQuery("#${asm_multipleSelect!}"); +multiple = jQuery("#${asm_multipleSelect!}"); <#if asm_title??> -// set the dropdown "title" if?? -multiple.attr('title', '${asm_title}'); +// set the dropdown "title" if?? +multiple.attr('title', '${asm_title}'); </#if> -multiple.select2({ -tags: true, -multiple: true, -lang: <#if userLogin??>'${userLogin.lastLocale!"en"}'<#else>"en"</#if>, -width: "50%" -}); +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
[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 55df1c7 Improved: Move page-specific script links to html template (OFBIZ-11799) 55df1c7 is described below commit 55df1c7db06103ed0006cf741019f5ad2291fe0f Author: James Yong AuthorDate: Sun Aug 16 14:35:35 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load elrte js and css Tested on https://localhost:8443/content/control/findForumMessages?forumGroupId=WebStoreFORUM=1 https://localhost:8443/content/control/WebSiteCms?webSiteId=CmsSite --- .../content/template/website/WebSiteCMSNav.ftl | 20 +++-- .../webapp/common/js/util/OfbizUtil.js | 33 ++ themes/common-theme/widget/Theme.xml | 2 -- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/applications/content/template/website/WebSiteCMSNav.ftl b/applications/content/template/website/WebSiteCMSNav.ftl index f759898..f155685 100644 --- a/applications/content/template/website/WebSiteCMSNav.ftl +++ b/applications/content/template/website/WebSiteCMSNav.ftl @@ -18,12 +18,6 @@ --> - -<#if language?has_content && language != "en"> -" type="application/javascript"><#rt/> - - -
[ofbiz-framework] branch trunk updated: Improved: multi-block attribute for html-template tag (OFBIZ-11686)
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 11e958f Improved: multi-block attribute for html-template tag (OFBIZ-11686) 11e958f is described below commit 11e958ff8a2f7a9139b606b0283f1a1a6c212786 Author: James Yong AuthorDate: Sat Aug 15 22:01:19 2020 +0800 Improved: multi-block attribute for html-template tag (OFBIZ-11686) Return 404 response when getJs has no result. Also remove script from cache after read by getJs. --- .../common/src/main/java/org/apache/ofbiz/common/CommonEvents.java | 4 .../org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java index 9450567..3ecf80b 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java @@ -190,6 +190,10 @@ public class CommonEvents { response.setContentType("application/javascript"); // script.length is not reliable for unicode characters response.setContentLength(script.getBytes("UTF8").length); +// return 404 if script is empty +if (UtilValidate.isEmpty(script)) { +response.setStatus(HttpServletResponse.SC_NOT_FOUND); +} out = response.getWriter(); out.write(script); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java index 3717c58..abbc57f 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/MultiBlockHtmlTemplateUtil.java @@ -440,15 +440,15 @@ public final class MultiBlockHtmlTemplateUtil { } /** - * Get the script stored in cache. + * Remove script from cache after reading. * @param session * @param fileName * @return script to be sent back to browser */ public static String getScriptFromCache(HttpSession session, final String fileName) { Map scriptMap = UtilGenerics.cast(scriptCache.get(session.getId())); -if (scriptMap != null) { -return scriptMap.get(fileName); +if (scriptMap != null && scriptMap.containsKey(fileName)) { +return scriptMap.remove(fileName); } return ""; }
[ofbiz-framework] branch trunk updated: Fixed: Freemarker macro for JsLanguageFilesMapping (OFBIZ-11958)
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 8b2524d Fixed: Freemarker macro for JsLanguageFilesMapping (OFBIZ-11958) 8b2524d is described below commit 8b2524d4ada485a3b7c56c71a288286e06b52dd6 Author: James Yong AuthorDate: Sat Aug 15 20:35:46 2020 +0800 Fixed: Freemarker macro for JsLanguageFilesMapping (OFBIZ-11958) Fix missing type arguments for generic class Map --- .../org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java index 643dd2a..30e4893 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/JsLanguageFilesMappingTransform.java @@ -20,7 +20,7 @@ public class JsLanguageFilesMappingTransform implements TemplateTransformModel { private static final String MODULE = JsLanguageFilesMappingTransform.class.getName(); @Override -public Writer getWriter(Writer out, Map args) { +public Writer getWriter(Writer out, @SuppressWarnings("rawtypes") Map args) { final StringBuilder buf = new StringBuilder(); return new Writer(out) { @Override
[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 dd5c7b7 Improved: Move page-specific script links to html template (OFBIZ-11799) dd5c7b7 is described below commit dd5c7b715a5210e3e0e7b7b8f676b2fc9cb54938 Author: James Yong AuthorDate: Sat Aug 15 20:25:34 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load select2 js and css Tested on https://localhost:8443/example/control/FormWidgetExamples https://localhost:8443/ordermgr/control/FindRequest --- .../template/includes/SetMultipleSelectJs.ftl | 60 +++--- .../template/includes/SetMultipleSelectJsList.ftl | 55 ++-- 2 files changed, 57 insertions(+), 58 deletions(-) diff --git a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl index 4f9f122..ebded16 100644 --- a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl +++ b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl @@ -16,42 +16,42 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<#-- Define select2 js and css tags to be added to html head tag when multi-block=true. - Note select2 language js will be auto added by MultiBlockHtmlTemplateUtil#addLinksToLayoutSettings --> - - <#if asm_multipleSelect??> <#-- we check only this var and suppose the others are also present --> -jQuery(document).ready(function () { -multiple = jQuery("#${asm_multipleSelect!}"); +jQuery(document).ready(function () { +importLibrary(["/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>"], +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 () { - 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> +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> }); +});