/*
 * Tine 2.0 - ExampleApplication 
 * Copyright (c) 2007-2014 Metaways Infosystems GmbH (http://www.metaways.de)
 * http://www.gnu.org/licenses/agpl.html AGPL Version 3
 */
Ext.ns("Tine","Tine.Example");Tine.Example.Application=Ext.extend(Tine.Tinebase.Application,{addButtonText:"New Example"});Tine.Example.MainScreen=Ext.extend(Tine.widgets.MainScreen,{activeContentType:"Example"});Tine.Example.ExampleTreePanel=function(a){Ext.apply(this,a);this.id="ExampleTreePanel";this.recordClass=Tine.Example.Model.Example;this.filterMode="filterToolbar";Tine.Example.ExampleTreePanel.superclass.constructor.call(this)};Ext.extend(Tine.Example.ExampleTreePanel,Tine.widgets.container.TreePanel,{afterRender:function(){this.supr().afterRender.apply(this,arguments)}});Tine.Example.ExampleFilterPanel=function(a){Ext.apply(this,a);Tine.Example.ExampleFilterPanel.superclass.constructor.call(this)};Ext.extend(Tine.Example.ExampleFilterPanel,Tine.widgets.persistentfilter.PickerPanel,{filter:[{field:"model",operator:"equals",value:"Example_Model_ExampleFilter"}]});Ext.namespace("Tine.ExampleApplication");Tine.ExampleApplication.ExampleGridPanel=Ext.extend(Tine.widgets.grid.GridPanel,{initComponent:function(){this.initDetailsPanel();Tine.ExampleApplication.ExampleGridPanel.superclass.initComponent.call(this)},initDetailsPanel:function(){this.detailsPanel=new Tine.ExampleApplication.ExampleDetailsPanel({grid:this,app:this.app})}});Ext.ns("Tine.ExampleApplication");Tine.ExampleApplication.ExampleRecordEditDialog=Ext.extend(Tine.widgets.dialog.EditDialog,{windowHeight:470,windowWidth:800,displayNotes:true,getFormItems:function(){return{xtype:"tabpanel",border:false,plain:true,activeTab:0,border:false,items:[{title:this.app.i18n._("ExampleRecord"),autoScroll:true,border:false,frame:true,layout:"border",items:[{region:"center",xtype:"columnform",labelAlign:"top",formDefaults:{xtype:"textfield",anchor:"100%",labelSeparator:"",columnWidth:0.333},items:[[{columnWidth:1,fieldLabel:this.app.i18n._("Name"),name:"name",allowBlank:false}],[new Tine.Tinebase.widgets.keyfield.ComboBox({app:"ExampleApplication",keyFieldName:"exampleStatus",fieldLabel:this.app.i18n._("Status"),name:"status",columnWidth:0.5}),new Tine.Tinebase.widgets.keyfield.ComboBox({app:"ExampleApplication",keyFieldName:"exampleReason",fieldLabel:this.app.i18n._("Reason"),name:"reason",columnWidth:0.5})]]},{layout:"accordion",animate:true,region:"east",width:210,split:true,collapsible:true,collapseMode:"mini",header:false,margins:"0 5 0 5",border:true,items:[new Tine.widgets.tags.TagPanel({app:"ExampleApplication",border:false,bodyStyle:"border:1px solid #B5B8C8;"})]}]},new Tine.widgets.activities.ActivitiesTabPanel({app:this.appName,record_id:this.record.id,record_model:this.appName+"_Model_"+this.recordClass.getMeta("modelName")})]}}});Ext.ns("Tine.ExampleApplication");Tine.ExampleApplication.ExampleDetailsPanel=Ext.extend(Tine.widgets.grid.DetailsPanel,{app:null,defaultHeight:100,initComponent:function(){this.summaryRecord=new Ext.data.Record({count:0},0);Tine.ExampleApplication.ExampleDetailsPanel.superclass.initComponent.call(this)},getDefaultInfosPanel:function(){return this.getMultiRecordsPanel()},getMultiRecordsPanel:function(){if(!this.multiRecordsPanel){this.multiRecordsPanel=new Ext.ux.display.DisplayPanel(this.wrapPanel([{xtype:"ux.displayfield",name:"count",fieldLabel:this.app.i18n._("Total Example Records")}],160))}return this.multiRecordsPanel},getSingleRecordPanel:function(){if(!this.singleRecordPanel){this.singleRecordPanel=new Ext.ux.display.DisplayPanel(this.wrapPanel([{xtype:"ux.displayfield",name:"name",fieldLabel:this.app.i18n._("Name")},{xtype:"ux.displayfield",name:"status",fieldLabel:this.app.i18n._("Status"),renderer:Tine.Tinebase.widgets.keyfield.Renderer.get("ExampleApplication","exampleStatus","text")}],80))}return this.singleRecordPanel},updateDetails:function(b,a){this.getSingleRecordPanel().loadRecord.defer(100,this.getSingleRecordPanel(),[b])},showDefault:function(a){this.showMulti(this.grid.getSelectionModel())},showMulti:function(c,a){if(c.getCount()===0){var b=this.grid.store.proxy.jsonReader.jsonData.totalcount}else{var b=c.getCount()}this.summaryRecord.set("count",b);this.getMultiRecordsPanel().loadRecord.defer(100,this.getMultiRecordsPanel(),[this.summaryRecord])}});Ext.namespace("Tine.ExampleApplication");Tine.ExampleApplication.AdminPanel=Ext.extend(Ext.TabPanel,{border:false,activeTab:0,initComponent:function(){this.app=Tine.Tinebase.appMgr.get("ExampleApplication");this.items=[new Tine.Admin.config.GridPanel({configApp:this.app})];Tine.ExampleApplication.AdminPanel.superclass.initComponent.call(this)}});Tine.ExampleApplication.AdminPanel.openWindow=function(a){var b=Tine.WindowFactory.getWindow({width:600,height:470,name:"exampleapp-admin-panel",contentPanelConstructor:"Tine.ExampleApplication.AdminPanel",contentPanelConstructorConfig:a})};