This is an automated email from the ASF dual-hosted git repository.
mbrohl 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 2895da2 Implemented: _WARNING_MESSAGE_
2895da2 is described below
commit 2895da2220fabc81c9bcf8e0436486288e398b6f
Author: Dennis Balkir <[email protected]>
AuthorDate: Mon Mar 9 14:26:30 2020 +0100
Implemented: _WARNING_MESSAGE_
(OFBIZ-10587)
Added warning message as a message type, by adding it in the
messages.ftl and the request-handler
Thanks to Niklas Fallik for reporting
---
.../ofbiz/webapp/control/RequestHandler.java | 1 +
themes/common-theme/template/includes/Messages.ftl | 31 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
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 0e91bb1..5a47fe3 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
@@ -553,6 +553,7 @@ public class RequestHandler {
for (Map.Entry<String, Object> entry:
preRequestMap.entrySet()) {
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)) {
request.setAttribute(key, entry.getValue());
}
diff --git a/themes/common-theme/template/includes/Messages.ftl
b/themes/common-theme/template/includes/Messages.ftl
index de71d22..78f82ab 100644
--- a/themes/common-theme/template/includes/Messages.ftl
+++ b/themes/common-theme/template/includes/Messages.ftl
@@ -19,6 +19,7 @@ under the License.
<#escape x as x?html>
<#if requestAttributes.errorMessageList?has_content><#assign
errorMessageList=requestAttributes.errorMessageList></#if>
<#if requestAttributes.eventMessageList?has_content><#assign
eventMessageList=requestAttributes.eventMessageList></#if>
+ <#if requestAttributes.warningMessageList?has_content><#assign
warningMessageList=requestAttributes.warningMessageList></#if>
<#if requestAttributes.serviceValidationException??><#assign
serviceValidationException = requestAttributes.serviceValidationException></#if>
<#if requestAttributes.uiLabelMap?has_content><#assign uiLabelMap =
requestAttributes.uiLabelMap></#if>
@@ -34,6 +35,12 @@ under the License.
<#if !eventMessageList?has_content>
<#assign eventMessageList = requestAttributes._EVENT_MESSAGE_LIST_!>
</#if>
+ <#if !warningMessage?has_content>
+ <#assign warningMessage = requestAttributes._WARNING_MESSAGE_?if_exists>
+ </#if>
+ <#if !warningMessageList?has_content>
+ <#assign warningMessageList =
requestAttributes._WARNING_MESSAGE_LIST_?if_exists>
+ </#if>
<#-- display the error messages -->
<#if (errorMessage?has_content || errorMessageList?has_content)>
@@ -80,4 +87,28 @@ under the License.
"${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}",
"${uiLabelMap.CommonHideAllNotifications}",
"${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}",
"${jGrowlSpeed}");</script>
</#if>
+
+ <#-- display the warning messages -->
+ <#if (warningMessage?has_content || warningMessageList?has_content)>
+ <div id="content-messages" class="content-messages errorMessage"
+
onclick="document.getElementById('content-messages').parentNode.removeChild(this)">
+
<#noescape><p>${uiLabelMap.CommonFollowingErrorsOccurred}:</p></#noescape>
+ <#if warningMessage?has_content>
+ <p>${StringUtil.wrapString(warningMessage)}</p>
+ </#if>
+ <#if warningMessageList?has_content>
+ <#list warningMessageList as warningMsg>
+ <p>${StringUtil.wrapString(warningMsg)}</p>
+ </#list>
+ </#if>
+ </div>
+ </#if>
+ <#assign jGrowlPosition = modelTheme.getProperty("jgrowlPosition")>
+ <#assign jGrowlWidth = modelTheme.getProperty("jgrowlWidth")>
+ <#assign jGrowlHeight = modelTheme.getProperty("jgrowlHeight")>
+ <#assign jGrowlSpeed = modelTheme.getProperty("jgrowlSpeed")>
+
+ <script>showjGrowl(
+ "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}",
"${uiLabelMap.CommonHideAllNotifications}",
+ "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}",
"${jGrowlSpeed}");</script>
</#escape>