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 <[hidden email]> 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> </#if> + <#assign unsafeEventMessage = requestAttributes._UNSAFE_EVENT_MESSAGE_!> <#-- display the error messages --> <#if (errorMessage?has_content || errorMessageList?has_content)> @@ -59,8 +60,8 @@ under the License. </#if> <#-- display the event messages --> - <#if (eventMessage?has_content || eventMessageList?has_content)> - <div id="content-messages" class="content-messages eventMessage" + <#if (eventMessage?has_content || eventMessageList?has_content || unsafeEventMessage?has_content)> + <div id="content-messages" class="content-messages eventMessage hidden" onclick="document.getElementById('content-messages').parentNode.removeChild(this)"> <#noescape><p>${uiLabelMap.CommonFollowingOccurred}:</p></#noescape> <#if eventMessage?has_content> @@ -71,6 +72,9 @@ under the License. <p>${StringUtil.wrapString(eventMsg)}</p> </#list> </#if> + <#if unsafeEventMessage?has_content> + <#noescape><p>${StringUtil.wrapString(unsafeEventMessage)}</p></#noescape> + </#if> </div> </#if> @@ -91,14 +95,18 @@ under the License. </#if> <#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")> - <script>showjGrowl( + <script> +setTimeout(function(){ + showjGrowl( "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}", - "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}");</script> + "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}"); +}, 10); + </script> </#if> </#escape> |
Free forum by Nabble | Edit this page |