GO.dokuwiki.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(){this.checkHost(GO.dokuwiki.settings.externalUrl);GO.dokuwiki.iFrameComponent.setUrl(GO.dokuwiki.settings.externalUrl)},scope:this})]});if(GO.settings.modules.dokuwiki.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.dokuwiki.SettingsDialog()}this.settingsDialog.show()},scope:this});a.tbar.addItem(this.settingsButton)}GO.dokuwiki.iFrameComponent=new GO.panel.IFrameComponent({url:GO.dokuwiki.settings.externalUrl});a.layout="fit";a.items=[GO.dokuwiki.iFrameComponent];a.title=GO.dokuwiki.settings.title;a.listeners={scope:this,render:function(){this.checkHost(GO.dokuwiki.settings.externalUrl)}};GO.dokuwiki.MainPanel.superclass.constructor.call(this,a)};Ext.extend(GO.dokuwiki.MainPanel,Ext.Panel,{checkHost:function(a){if(GO.util.empty(a)){return true}var c=window.location.hostname;var b=a.match(/:\/\/(www\.)?(.[^/:]+)/)[2];if(c!=b){Ext.MessageBox.show({title:"Wrong Domain",msg:"Login and Logout functions will not work properly because Dokuwiki is on a different domain than Group-Office.<br /><br />Group-Office Domain: "+c+"<br />Dokuwiki Domain: "+b,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})}}});GO.moduleManager.addModule("dokuwiki",GO.dokuwiki.MainPanel,{title:GO.dokuwiki.settings.title,iconCls:"go-tab-icon-dokuwiki"});GO.dokuwiki.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.dokuwiki.SettingsDialog.superclass.constructor.call(this,a)};Ext.extend(GO.dokuwiki.SettingsDialog,Ext.Window,{show:function(a){if(!this.rendered){this.render(Ext.getBody())}this.formPanel.form.reset();this.formPanel.load({url:GO.settings.modules.dokuwiki.url+"json.php",success:function(b,c){GO.dokuwiki.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.dokuwiki.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.dokuwiki.settings.externalUrl=b.data.external_url;GO.dokuwiki.settings.title=b.data.title;GO.dokuwiki.iFrameComponent.setUrl(GO.dokuwiki.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.dokuwiki.lang.externalUrl,anchor:"100%",allowBlank:false}),this.titleField=new Ext.form.TextField({name:"title",fieldLabel:GO.dokuwiki.lang.title,anchor:"100%",allowBlank:false})]});this.formPanel=new Ext.form.FormPanel({waitMsgTarget:true,baseParams:{task:"load_settings"},url:GO.settings.modules.dokuwiki.url+"json.php",border:false,autoHeight:true,items:this.panel})}});