- alert user if browser is not supported.
This commit is contained in:
Heng Sin Low 2009-10-26 10:05:14 +00:00
parent 4c187787c3
commit 7eb7736830
2 changed files with 35 additions and 0 deletions

View File

@ -14,14 +14,17 @@
package org.adempiere.webui;
import org.adempiere.webui.apps.AEnv;
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.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;
@ -75,6 +78,15 @@ public class WLogin extends AbstractUIPart
LoginWindow loginWindow = new LoginWindow(app);
loginWindow.setParent(vb);
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);
}
try {
String right = ThemeManager.getLoginRightPanel();
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(right);

View File

@ -561,6 +561,29 @@ public final class AEnv
return false;
}
}
/**
* @return boolean
*/
public static boolean isBrowserSupported() {
Execution execution = Executions.getCurrent();
if (execution == null)
return false;
Object n = execution.getNativeRequest();
boolean supported = false;
if (n instanceof ServletRequest) {
String userAgent = Servlets.getUserAgent((ServletRequest) n);
if (userAgent.indexOf("Firefox") >= 0) {
supported = true;
} else if (userAgent.indexOf("AppleWebKit") >= 0) {
if (userAgent.indexOf("Chrome") >= 0 || userAgent.indexOf("Safari") >= 0) {
supported = true;
}
}
}
return supported;
}
/**
*