Ext.namespace("Zarafa.plugins.browsercompatibility");Zarafa.plugins.browsercompatibility.ABOUT='<p>Copyright (C) 2005 - 2015  Zarafa B.V. &lt;info@zarafa.com&gt; and its licensors</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,Chrome:28},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,i=e.getCurrentBrowserName(),h=e.getCurrentOS(),f="";if(Ext.isDefined(this.baseSupportedBrowsers[i])){h=
e.getCurrentBrowserVersion();if(this.baseSupportedBrowsers[i]<=parseFloat(h))return;else{if(i=="Explorer"){e=e.getCurrentRenderingEngineVersion();if(h==8&&e!=4)f=_("Running Internet Explorer in compatibility mode is not supported.");else if(h==7&&e>=4)f=_("Running Internet Explorer in compatibility mode is not supported.")}if(Ext.isEmpty(f))f=String.format(_("{0} version {1} is not supported by WebApp.<br/>Use version {2} or above."),i,h,this.baseSupportedBrowsers[i])}}else{f="";f=h=="Mac"?"Apple Safari or Google Chrome":
"Mozilla Firefox or Google Chrome";f=String.format(_("{0} is not supported by WebApp.<br/>It is recommended to use latest version of {1} on {2}."),i,f,h)}container.getNotifier().notify("info.browsercompatibility",_("Unsupported Browser"),f,{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,i=undefined,h=undefined,f=undefined,b=[{string:navigator.userAgent,subString:"ZDI",identity:"ZDI",versionSearch:"ZDI"},{string:navigator.userAgent,subString:"OPR",identity:"Opera",versionSearch:"OPR",renderingEngineVersion:"AppleWebKit"},{string:navigator.userAgent,subString:"Chromium",identity:"Chromium",renderingEngineVersion:"AppleWebKit"},{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:"Trident",identity:"Explorer",versionSearch:"rv",
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,g=b[a].prop;if(d){if(d.indexOf(b[a].subString)!=-1){c=b[a].identity;break a}}else if(g){c=b[a].identity;break a}}}a=e=c}return a},getCurrentBrowserVersion:function(){var a;if(!(a=i)){var c;a:{a=0;for(var j=b.length;a<j;a++){var d=b[a].string,g=b[a].prop,l=b[a].versionSearch||b[a].identity;if(d){g=d.indexOf(l);if(g!=-1){c=parseFloat(d.substring(g+l.length+1));break a}}else if(g){c=
d.version();break a}}}a=i=c}return a},getCurrentRenderingEngineVersion:function(){var a;if(!(a=f)){var c;a:{a=0;for(var j=b.length;a<j;a++){var d=b[a].string,g=b[a].renderingEngineVersion;if(d){var l=d.indexOf(g);if(l!=-1){c=parseFloat(d.substring(l+g.length+1));break a}}}}a=f=c}return a},getCurrentOS:function(){var a;if(!(a=h)){var c;a:{a=0;for(var j=k.length;a<j;a++){var d=k[a].string,g=k[a].prop;if(d){if(d.indexOf(k[a].subString)!=-1){c=k[a].identity;break a}}else if(g){c=k[a].identity;break a}}}a=
h=c}return a}}};Zarafa.plugins.browsercompatibility.BrowserDetect=new Zarafa.plugins.browsercompatibility.BrowserDetect;
