Ext.namespace("Zarafa.widgets");
Zarafa.widgets.FBWidget=Ext.extend(Zarafa.core.ui.widget.Widget,{defaultFbActivitySite:"http://zarafa.com",constructor:function(a){a=a||{};Ext.applyIf(a,{name:"fb",height:600,hasConfig:true});Zarafa.widgets.FBWidget.superclass.constructor.call(this,a);a=this.get("site_url");if(Ext.isEmpty(a)){a=this.defaultFbActivitySite;this.set("site_url",a)}this.setTitle(_("Facebook")+" - "+a)},config:function(){(new Ext.Window({title:_("Configure widget"),layout:"fit",width:350,height:120,items:[{xtype:"form",
frame:true,ref:"formPanel",labelWidth:180,items:[{xtype:"textfield",anchor:"100%",fieldLabel:_("Site name to track the activity"),allowBlank:false,vtype:"url",ref:"../siteUrlField",name:"site_url",value:this.get("site_url")}],buttons:[{text:_("Save"),scope:this,ref:"../../savebutton",handler:this.saveUserUrlToSettings},{text:_("Cancel"),scope:this,ref:"../../cancelbutton",handler:this.closeConfigWindow}]}]})).show(this)},initEvents:function(){Zarafa.widgets.FBWidget.superclass.initEvents.apply(this,
arguments);this.mon(this,"bodyresize",this.reloadIframe,this)},saveUserUrlToSettings:function(a){a=a.refOwner;var b=a.siteUrlField.getValue();if(a.formPanel.getForm().isValid()){this.set("site_url",b);this.reloadIframe();this.setTitle(_("Facebook")+" - "+b);a.close()}},closeConfigWindow:function(a){a.refOwner.close()},reloadIframe:function(){var a=this.body.getWidth(),b=this.body.getHeight();this.body.dom.innerHTML='<iframe src="'+("http://www.facebook.com/plugins/activity.php?site="+this.get("site_url")+
"&amp;width="+a+"&amp;height="+b+"&amp;header=true&amp;colorscheme=light&amp;font=segoe+ui&amp;border_color&amp;recommendations=false")+'" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'+a+"px; height:"+b+'px;" allowTransparency="true"></iframe>'}});Zarafa.onReady(function(){container.registerWidget(Zarafa.widgets.FBWidget,"fb",_("Facebook"),"plugins/facebookwidget/resources/images/facebook.png")});
