Ext.namespace("Zarafa.plugins.browsercompatibility");
Zarafa.plugins.browsercompatibility.BrowserCompatibility=Ext.extend(Zarafa.core.Plugin,{baseSupportedBrowsers:undefined,constructor:function(c){c=c||{};Ext.applyIf(c,{name:"browsercompatibility"});Zarafa.plugins.browsercompatibility.BrowserCompatibility.superclass.constructor.call(this,c);this.baseSupportedBrowsers={Firefox:5,Safari:5.1,Explorer:9,ZDI:0}},initPlugin:function(){Zarafa.plugins.browsercompatibility.BrowserCompatibility.superclass.initPlugin.apply(this,arguments);container.getHierarchyStore().on("load",
this.checkBrowser,this,{single:true})},checkBrowser:function(){var c=Zarafa.plugins.browsercompatibility.BrowserDetect.getCurrentBrowserName(),h=Zarafa.plugins.browsercompatibility.BrowserDetect.getCurrentBrowserVersion(),g=Zarafa.plugins.browsercompatibility.BrowserDetect.getCurrentRenderingEngineVersion(),i=Zarafa.plugins.browsercompatibility.BrowserDetect.getCurrentOS(),b="";if(Ext.isDefined(this.baseSupportedBrowsers[c]))if(this.baseSupportedBrowsers[c]<=parseFloat(h))return;else{if(c=="Explorer")if(h==
8&&g!=4)b=_("Running InternetExplorer in compatibility mode is not supported");else if(h==7&&g>=4)b=_("Running InternetExplorer in compatibility mode is not supported");if(b==="")b=String.format(_("{0} version {1} is not supported by WebApp.<br/>Use version {2} or above."),c,h,this.baseSupportedBrowsers[c])}else{g="Firefox 5";if(i=="Linux")g="Firefox 5";else if(i=="Windows")g="Internet Explorer 9";else if(i=="Mac")g="Safari 5.1";b=String.format(_("{0} version {1} is not supported by WebApp.<br/>It is recommended to use {2} or above on {3}."),
c,h,g,i)}container.getNotifier().notify("info.browsercompatibility",_("Unsupported Browser"),b)}});Zarafa.onReady(function(){container.getSettingsModel().get("zarafa/v1/plugins/browsercompatibility/enable")===true&&container.registerPlugin(new Zarafa.plugins.browsercompatibility.BrowserCompatibility)});Ext.namespace("Zarafa.plugins.browsercompatibility");
Zarafa.plugins.browsercompatibility.BrowserDetect=function(){var c=undefined,h=undefined,g=undefined,i=undefined,b=[{string:navigator.userAgent,subString:"ZDI",identity:"ZDI",versionSearch:"ZDI"},{string:navigator.userAgent,subString:"Chrome",identity:"Chrome",renderingEngineVersion:"AppleWebKit"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.userAgent,subString:"Apple",identity:"Safari",versionSearch:"Version",renderingEngineVersion:"AppleWebKit"},
{prop:window.opera,identity:"Opera",versionSearch:"Version",renderingEngineVersion:"Presto"},{string:navigator.vendor,subString:"iCab",identity:"iCab",renderingEngineVersion:"AppleWebKit"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror",renderingEngineVersion:"KHTML"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox",renderingEngineVersion:"Gecko"},{string:navigator.vendor,subString:"Camino",identity:"Camino",renderingEngineVersion:"Gecko"},{string:navigator.userAgent,
subString:"Netscape",identity:"Netscape",renderingEngineVersion:"Gecko"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE",renderingEngineVersion:"Trident"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv",renderingEngineVersion:"Gecko"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla",renderingEngineVersion:"Gecko"}],k=[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,
subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}];return{getCurrentBrowserName:function(){var a;if(!(a=c)){var d;a:{a=0;for(var j=b.length;a<j;a++){var e=b[a].string,f=b[a].prop;if(e){if(e.indexOf(b[a].subString)!=-1){d=b[a].identity;break a}}else if(f){d=b[a].identity;break a}}}a=c=d}return a},getCurrentBrowserVersion:function(){var a;if(!(a=h)){var d;a:{a=0;for(var j=b.length;a<j;a++){var e=
b[a].string,f=b[a].prop,l=b[a].versionSearch||b[a].identity;if(e){f=e.indexOf(l);if(f!=-1){d=parseFloat(e.substring(f+l.length+1));break a}}else if(f){d=e.version();break a}}}a=h=d}return a},getCurrentRenderingEngineVersion:function(){var a;if(!(a=i)){var d;a:{a=0;for(var j=b.length;a<j;a++){var e=b[a].string,f=b[a].renderingEngineVersion;if(e){var l=e.indexOf(f);if(l!=-1){d=parseFloat(e.substring(l+f.length+1));break a}}}}a=i=d}return a},getCurrentOS:function(){var a;if(!(a=g)){var d;a:{a=0;for(var j=
k.length;a<j;a++){var e=k[a].string,f=k[a].prop;if(e){if(e.indexOf(k[a].subString)!=-1){d=k[a].identity;break a}}else if(f){d=k[a].identity;break a}}}a=g=d}return a}}};Zarafa.plugins.browsercompatibility.BrowserDetect=new Zarafa.plugins.browsercompatibility.BrowserDetect;
