GO.mediawiki.MainPanel=function(a){if(!a){a={}}a.tbar=new Ext.Toolbar({cls:"go-head-tb",items:[new Ext.Button({iconCls:"btn-refresh",cls:"x-btn-text-icon",text:GO.lang.cmdRefresh,handler:function(){GO.mediawiki.iFrameComponent.setUrl(GO.mediawiki.settings.externalUrl)},scope:this})]});if(GO.settings.modules.mediawiki.write_permission){a.tbar.addItem("-");this.settingsButton=new Ext.Button({iconCls:"btn-settings",text:GO.lang.administration,cls:"x-btn-text-icon",handler:function(){if(!this.settingsDialog){this.settingsDialog=new GO.mediawiki.SettingsDialog()}this.settingsDialog.show()},scope:this});a.tbar.addItem(this.settingsButton)}GO.mediawiki.iFrameComponent=new GO.panel.IFrameComponent({url:GO.mediawiki.settings.externalUrl});a.layout="fit";a.items=[GO.mediawiki.iFrameComponent];a.title=GO.mediawiki.settings.title;GO.mediawiki.MainPanel.superclass.constructor.call(this,a)};Ext.extend(GO.mediawiki.MainPanel,Ext.Panel,{beforeRender:function(){Ext.Ajax.request({url:GO.settings.modules.mediawiki.url+"json.php",params:{task:"load_settings"},scope:this,success:function(a,b){var c=Ext.decode(a.responseText);if(c.success){GO.mediawiki.settings.externalUrl=c.data.external_url;GO.mediawiki.iFrameComponent.setUrl(GO.mediawiki.settings.external_url);GO.mediawiki.settings.title=c.data.title;this.title=c.title}else{Ext.Msg.alert(GO.lang.strError,c.feedback)}}})}});GO.moduleManager.addModule("mediawiki",GO.mediawiki.MainPanel,{title:GO.mediawiki.settings.title,iconCls:"go-tab-icon-tasks"});GO.mediawiki.SettingsDialog=function(a){if(!a){a={}}this.buildForm();a.layout="fit";a.modal=false;a.resizable=false;a.width=550;a.autoHeight=true;a.closeAction="hide";a.title=GO.lang.cmdSettings;a.items=this.formPanel;a.buttons=[{text:GO.lang.cmdOk,handler:function(){this.submitForm(true);this.hide()},scope:this},{text:GO.lang.cmdClose,handler:function(){this.hide()},scope:this}];GO.mediawiki.SettingsDialog.superclass.constructor.call(this,a)};Ext.extend(GO.mediawiki.SettingsDialog,Ext.Window,{show:function(a){if(!this.rendered){this.render(Ext.getBody())}this.formPanel.form.reset();this.formPanel.load({url:GO.settings.modules.mediawiki.url+"json.php",success:function(b,c){GO.mediawiki.SettingsDialog.superclass.show.call(this)},failure:function(b,c){Ext.Msg.alert(GO.lang.strError,c.result.feedback)},scope:this})},submitForm:function(a){this.formPanel.form.submit({url:GO.settings.modules.mediawiki.url+"action.php",params:{task:"save_settings"},waitMsg:GO.lang.waitMsgSave,success:function(c,d){var b=Ext.decode(d.response.responseText);if(b.success){GO.mediawiki.settings.externalUrl=b.data.external_url;GO.mediawiki.settings.title=b.data.title;GO.mediawiki.iFrameComponent.setUrl(GO.mediawiki.settings.externalUrl)}else{Ext.Msg.alert(GO.lang.strError,d.result.feedback)}},scope:this})},buildForm:function(){this.panel=new Ext.Panel({border:false,layout:"form",bodyStyle:"padding:5px",waitMsgTarget:true,labelAlign:"top",autoHeight:true,items:[this.externalUrlField=new Ext.form.TextField({name:"external_url",fieldLabel:GO.mediawiki.lang.externalUrl,anchor:"100%",allowBlank:false}),this.titleField=new Ext.form.TextField({name:"title",fieldLabel:GO.mediawiki.lang.title,anchor:"100%",allowBlank:false})]});this.formPanel=new Ext.form.FormPanel({waitMsgTarget:true,baseParams:{task:"load_settings"},url:GO.settings.modules.mediawiki.url+"json.php",border:false,autoHeight:true,items:this.panel})}});