From be0aa87d66c3ef7bd59ba3fbc7a1ea39d651f3b5 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 17 Nov 2009 09:04:11 +0000 Subject: [PATCH] https://sourceforge.net/tracker/?func=detail&aid=2898957&group_id=176962&atid=955896 - improve IE support --- .../src/org/adempiere/webui/WLogin.java | 22 ++++++++++++++----- .../src/org/adempiere/webui/apps/AEnv.java | 19 ++++++++++++++++ .../org/adempiere/webui/panel/MenuPanel.java | 4 ++-- .../webui/panel/TreeSearchPanel.java | 17 ++++++++++++-- .../src/org/adempiere/webui/theme/ITheme.java | 1 + .../adempiere/webui/theme/ThemeManager.java | 7 ++++++ .../zkmax/zul/render/Combobox2Default.java | 3 ++- zkwebui/index.zul | 1 + zkwebui/theme.zs | 1 + zkwebui/theme/default/css/themeie.css.dsp | 6 +++++ 10 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 zkwebui/theme/default/css/themeie.css.dsp diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/WLogin.java b/zkwebui/WEB-INF/src/org/adempiere/webui/WLogin.java index 9d0a7f7f5d..20dee1e620 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/WLogin.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/WLogin.java @@ -19,19 +19,20 @@ import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.theme.ITheme; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.window.LoginWindow; -import org.zkoss.zk.au.out.AuScript; +import org.zkoss.zhtml.Text; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.UiException; import org.zkoss.zk.ui.metainfo.PageDefinition; -import org.zkoss.zk.ui.util.Clients; import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; import org.zkoss.zkex.zul.East; import org.zkoss.zkex.zul.North; import org.zkoss.zkex.zul.South; import org.zkoss.zkex.zul.West; +import org.zkoss.zul.Div; import org.zkoss.zul.Vbox; +import org.zkoss.zul.Window; /** * @@ -45,6 +46,7 @@ public class WLogin extends AbstractUIPart private IWebClient app; private Borderlayout layout; + private Window browserWarningWindow; public WLogin(IWebClient app) { @@ -81,10 +83,16 @@ public class WLogin extends AbstractUIPart if (!AEnv.isBrowserSupported()) { //TODO: localization - String msg = "You might experience slow performance and user interface anomalies using your current browser to access the application. We recommend the use of Firefox, Google Chrome or Apple Safari to access the application."; - String script = "alert('" + msg + "')"; - AuScript aus = new AuScript(null, script); - Clients.response(aus); + String msg = "You might experience slow performance and user interface anomalies using your current browser to access the application. We recommend the use of Firefox, Google Chrome or Apple Safari."; + browserWarningWindow = new Window(); + Div div = new Div(); + div.setStyle("font-size: 9pt"); + div.appendChild(new Text(msg)); + browserWarningWindow.appendChild(div); + browserWarningWindow.setPosition("top,right"); + browserWarningWindow.setWidth("550px"); + browserWarningWindow.setPage(page); + browserWarningWindow.doOverlapped(); } try { @@ -166,6 +174,8 @@ public class WLogin extends AbstractUIPart public void detach() { layout.detach(); layout = null; + if (browserWarningWindow != null) + browserWarningWindow.detach(); } public Component getComponent() { diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/zkwebui/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 26cd32f0ab..9d6394916d 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -597,6 +597,25 @@ public final class AEnv } return supported; } + + /** + * @return true if user agent is internet explorer + */ + public static boolean isInternetExplorer() + { + Execution execution = Executions.getCurrent(); + if (execution == null) + return false; + + Object n = execution.getNativeRequest(); + if (n instanceof ServletRequest) { + String userAgent = Servlets.getUserAgent((ServletRequest) n); + if (userAgent.indexOf("MSIE ") >= 0) { + return true; + } + } + return false; + } /** * diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java index 845aef57b9..32fe4ec1ec 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java @@ -91,8 +91,8 @@ public class MenuPanel extends Panel implements EventListener menuTree.setMultiple(false); menuTree.setId("mnuMain"); menuTree.setWidth("100%"); -// menuTree.setHeight("96%"); menuTree.setVflex(true); + menuTree.setFixedLayout(false); menuTree.setPageSize(-1); // Due to bug in the new paging functionality menuTree.setStyle("border: none"); @@ -143,7 +143,7 @@ public class MenuPanel extends Panel implements EventListener private void generateMenu(Treechildren treeChildren, MTreeNode mNode) { - Enumeration nodeEnum = mNode.children(); + Enumeration nodeEnum = mNode.children(); while(nodeEnum.hasMoreElements()) { diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/TreeSearchPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/TreeSearchPanel.java index 439afadb90..617c7f8805 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/TreeSearchPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/TreeSearchPanel.java @@ -19,6 +19,7 @@ package org.adempiere.webui.panel; import java.util.TreeMap; +import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.AutoComplete; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Panel; @@ -92,15 +93,27 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis lblSearch.setValue(Msg.getMsg(Env.getCtx(),"TreeSearch").replaceAll("&", "") + ":"); lblSearch.setTooltiptext(Msg.getMsg(Env.getCtx(),"TreeSearchText")); div.appendChild(lblSearch); - div.setStyle("display: inline-block; height: 20px; margin-bottom: 10px; vertical-align: middle"); + String divStyle = "height: 20px; vertical-align: middle;"; + if (!AEnv.isInternetExplorer()) + { + divStyle += "margin-bottom: 10px; display: inline-block;"; + } + div.setStyle(divStyle); cmbSearch = new AutoComplete(); cmbSearch.setAutodrop(true); cmbSearch.addEventListener(Events.ON_CHANGE, this); + if (AEnv.isInternetExplorer()) + { + cmbSearch.setWidth("200px"); + } this.appendChild(div); this.appendChild(cmbSearch); - this.setStyle("height: 20px;"); + if (!AEnv.isInternetExplorer()) + { + this.setStyle("height: 20px;"); + } } private void addTreeItem(Treeitem treeItem) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/theme/ITheme.java b/zkwebui/WEB-INF/src/org/adempiere/webui/theme/ITheme.java index 85ae15a56b..06789a6cad 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/theme/ITheme.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/theme/ITheme.java @@ -59,4 +59,5 @@ public interface ITheme { //stylesheet url public static final String THEME_STYLESHEET = "/css/theme.css.dsp"; + public static final String THEME_STYLESHEET_BY_BROWSER = "/css/theme*.css.dsp*"; } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/theme/ThemeManager.java b/zkwebui/WEB-INF/src/org/adempiere/webui/theme/ThemeManager.java index 91225237fd..34d759e0ac 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/theme/ThemeManager.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/theme/ThemeManager.java @@ -58,6 +58,13 @@ public final class ThemeManager { return ITheme.THEME_PATH_PREFIX + getTheme() + ITheme.THEME_STYLESHEET; } + /** + * @return url of theme stylesheet by browser + */ + public static String getStyleSheetByBrowser() { + return ITheme.THEME_PATH_PREFIX + getTheme() + ITheme.THEME_STYLESHEET_BY_BROWSER; + } + /** * @return title text for the browser window */ diff --git a/zkwebui/WEB-INF/src/org/zkoss/zkmax/zul/render/Combobox2Default.java b/zkwebui/WEB-INF/src/org/zkoss/zkmax/zul/render/Combobox2Default.java index f11d12fa9e..0973df423c 100644 --- a/zkwebui/WEB-INF/src/org/zkoss/zkmax/zul/render/Combobox2Default.java +++ b/zkwebui/WEB-INF/src/org/zkoss/zkmax/zul/render/Combobox2Default.java @@ -21,6 +21,7 @@ package org.zkoss.zkmax.zul.render; import java.io.IOException; import java.io.Writer; +import org.adempiere.webui.apps.AEnv; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Execution; import org.zkoss.zk.ui.Executions; @@ -46,7 +47,7 @@ public class Combobox2Default implements ComponentRenderer { final String zcls = self.getZclass(); final Execution exec = Executions.getCurrent(); - String tableStyle = "display:inline-block"; + String tableStyle = AEnv.isInternetExplorer() ? "display:inline" : "display:inline-block"; String inputAttrs = self.getInnerAttrs(); if (inputAttrs.indexOf("style") >= 0) { inputAttrs = inputAttrs.substring(0, inputAttrs.indexOf("style")); diff --git a/zkwebui/index.zul b/zkwebui/index.zul index e961e6a630..325881cf2d 100644 --- a/zkwebui/index.zul +++ b/zkwebui/index.zul @@ -6,6 +6,7 @@ Copyright (C) 2007 Ashley G Ramdass. + diff --git a/zkwebui/theme.zs b/zkwebui/theme.zs index 5ed7986b82..b662b03e05 100644 --- a/zkwebui/theme.zs +++ b/zkwebui/theme.zs @@ -1,3 +1,4 @@ import org.adempiere.webui.theme.ThemeManager; var themeStyleSheet = ThemeManager.getStyleSheet(); +var themeStyleSheetByBrowser = ThemeManager.getStyleSheetByBrowser(); var browserIcon = ThemeManager.getBrowserIcon(); diff --git a/zkwebui/theme/default/css/themeie.css.dsp b/zkwebui/theme/default/css/themeie.css.dsp new file mode 100644 index 0000000000..afd84a16d5 --- /dev/null +++ b/zkwebui/theme/default/css/themeie.css.dsp @@ -0,0 +1,6 @@ +<%@ page contentType="text/css;charset=UTF-8" %> +<%@ taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" %> + +.login-box-body { + padding-bottom: 20px; +}