added init event to scm main

This commit is contained in:
Sebastian Sdorra
2011-04-29 08:37:57 +02:00
parent 6ba58a5548
commit 5cede455ae
2 changed files with 16 additions and 2 deletions

View File

@@ -52,6 +52,14 @@ var loginCallbacks = [];
*/ */
var logoutCallbacks = []; var logoutCallbacks = [];
/**
* functions called after initialisation
*/
var initCallbacks = [];
/**
* The base url for the rest api
*/
var restUrl = "api/rest/"; var restUrl = "api/rest/";
var userSearchStore = new Ext.data.JsonStore({ var userSearchStore = new Ext.data.JsonStore({

View File

@@ -62,12 +62,16 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
mainTabPanel: null, mainTabPanel: null,
constructor : function(config) { constructor : function(config) {
this.addEvents('login', 'logout'); this.addEvents('login', 'logout', 'init');
this.mainTabPanel = Ext.getCmp('mainTabPanel'); this.mainTabPanel = Ext.getCmp('mainTabPanel');
this.addListener('login', this.postLogin, this); this.addListener('login', this.postLogin, this);
Sonia.scm.Main.superclass.constructor.call(this, config); Sonia.scm.Main.superclass.constructor.call(this, config);
}, },
init: function(){
this.fireEvent('load', this);
},
postLogin: function(){ postLogin: function(){
this.createMainMenu(); this.createMainMenu();
this.createRepositoryPanel(); this.createRepositoryPanel();
@@ -357,7 +361,6 @@ Ext.onReady(function(){
}); });
main = new Sonia.scm.Main(); main = new Sonia.scm.Main();
main.checkLogin();
/** /**
* Adds a tab to main TabPanel * Adds a tab to main TabPanel
@@ -368,7 +371,10 @@ Ext.onReady(function(){
main.addTabPanel(id, xtype, title); main.addTabPanel(id, xtype, title);
} }
main.addListeners('init', initCallbacks);
main.addListeners('login', loginCallbacks); main.addListeners('login', loginCallbacks);
main.addListeners('logout', logoutCallbacks); main.addListeners('logout', logoutCallbacks);
main.init();
main.checkLogin();
}); });