Ext.namespace("Zarafa.plugins.browsercompatibility");Zarafa.plugins.browsercompatibility.ABOUT='<p>Copyright (C) 2005-2013  Zarafa B.V. &lt;info@zarafa.com&gt;</p><p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p><p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.</p><p>You should have received a copy of the GNU Affero General Public License along with this program.  If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p>';
Ext.namespace("Zarafa.plugins.browsercompatibility");
Zarafa.plugins.browsercompatibility.BrowserCompatibility=Ext.extend(Zarafa.core.Plugin,{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 e=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[e]))if(this.baseSupportedBrowsers[e]<=parseFloat(h))return;else{if(e=="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."),
e,h,this.baseSupportedBrowsers[e])}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}."),e,h,g,i)}container.getNotifier().notify("info.browsercompatibility",_("Unsupported Browser"),b,{persistent:true,listeners:{click:this.onNotifierClick,scope:this}})},onNotifierClick:function(e){container.getNotifier().notify("info.browsercompatibility",
null,null,{reference:e,destroy:true})}});Zarafa.onReady(function(){container.registerPlugin(new Zarafa.core.PluginMetaData({name:"browsercompatibility",displayName:_("Browser Compatibility Plugin"),about:Zarafa.plugins.browsercompatibility.ABOUT,pluginConstructor:Zarafa.plugins.browsercompatibility.BrowserCompatibility}))});Ext.namespace("Zarafa.plugins.browsercompatibility");
Zarafa.plugins.browsercompatibility.BrowserDetect=function(){var e=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=e)){var c;a:{a=0;for(var j=b.length;a<j;a++){var d=b[a].string,f=b[a].prop;if(d){if(d.indexOf(b[a].subString)!=-1){c=b[a].identity;break a}}else if(f){c=b[a].identity;break a}}}a=e=c}return a},getCurrentBrowserVersion:function(){var a;if(!(a=h)){var c;a:{a=0;for(var j=b.length;a<j;a++){var d=
b[a].string,f=b[a].prop,l=b[a].versionSearch||b[a].identity;if(d){f=d.indexOf(l);if(f!=-1){c=parseFloat(d.substring(f+l.length+1));break a}}else if(f){c=d.version();break a}}}a=h=c}return a},getCurrentRenderingEngineVersion:function(){var a;if(!(a=i)){var c;a:{a=0;for(var j=b.length;a<j;a++){var d=b[a].string,f=b[a].renderingEngineVersion;if(d){var l=d.indexOf(f);if(l!=-1){c=parseFloat(d.substring(l+f.length+1));break a}}}}a=i=c}return a},getCurrentOS:function(){var a;if(!(a=g)){var c;a:{a=0;for(var j=
k.length;a<j;a++){var d=k[a].string,f=k[a].prop;if(d){if(d.indexOf(k[a].subString)!=-1){c=k[a].identity;break a}}else if(f){c=k[a].identity;break a}}}a=g=c}return a}}};Zarafa.plugins.browsercompatibility.BrowserDetect=new Zarafa.plugins.browsercompatibility.BrowserDetect;
