Ext.namespace("Zarafa.plugins.sugarcrm");Zarafa.plugins.sugarcrm.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/" target="_blank">http://www.gnu.org/licenses/</a>.</p>';
Ext.namespace("Zarafa.plugins.sugarcrm");
Zarafa.plugins.sugarcrm.SugarCRMPlugin=Ext.extend(Zarafa.core.Plugin,{initPlugin:function(){Zarafa.plugins.sugarcrm.SugarCRMPlugin.superclass.initPlugin.apply(this,arguments);this.registerInsertionPoint("context.mail.contextmenu.options",this.putAcrhiveMenuIconInContextMenu,this)},putAcrhiveMenuIconInContextMenu:function(){return{xtype:"zarafa.conditionalitem",text:_("Archive to SugarCRM"),iconCls:"icon_sugarcrm_archive",singleSelectOnly:true,handler:this.showArchiveToSugarCRMDialog,scope:this}},
showArchiveToSugarCRMDialog:function(a){a=a.getRecords()[0];container.getRequest().singleRequest("sugarcrmmodule","archive",{entryid:a.get("entryid"),parent_entryid:a.get("parent_entryid"),store_entryid:a.get("store_entryid"),profile:"sugarcrm"},new Zarafa.plugins.sugarcrm.data.SugarCRMResponseHandler)}});Zarafa.onReady(function(){container.registerPlugin(new Zarafa.core.PluginMetaData({name:"sugarcrm",displayName:_("SugarCRM Plugin"),about:Zarafa.plugins.sugarcrm.ABOUT,pluginConstructor:Zarafa.plugins.sugarcrm.SugarCRMPlugin}))});
Ext.namespace("Zarafa.plugins.sugarcrm.data");Zarafa.plugins.sugarcrm.data.SugarCRMResponseHandler=Ext.extend(Zarafa.core.data.AbstractResponseHandler,{doItem:function(a){var b=a.serverurl;Ext.isEmpty(b)?Ext.MessageBox.show({title:_("Warning"),msg:a.message,icon:Ext.MessageBox.WARNING,buttons:Ext.MessageBox.OK}):window.open(b,"","width=720,height=520,resizable=yes,scrollbars=yes")}});Ext.reg("sugarcrm.responsehandler",Zarafa.plugins.sugarcrm.data.SugarCRMResponseHandler);
