make scm-manager bookmarkable

This commit is contained in:
Sebastian Sdorra
2011-09-22 21:59:47 +02:00
parent 81a9dcab4c
commit ae37f890a1

View File

@@ -33,11 +33,13 @@ Ext.ns('Sonia');
Sonia.History = { Sonia.History = {
initialized: false,
historyElements: [], historyElements: [],
recentlyAdded: [], recentlyAdded: [],
recentlyChanged: [], recentlyChanged: [],
add: function(token){ add: function(token){
if (this.initialized){
if (token != Ext.History.getToken()){ if (token != Ext.History.getToken()){
if (this.isInvokeable(this.recentlyChanged, token)){ if (this.isInvokeable(this.recentlyChanged, token)){
if ( debug ){ if ( debug ){
@@ -47,6 +49,7 @@ Sonia.History = {
Ext.History.add(token, true); Ext.History.add(token, true);
} }
} }
}
}, },
createToken: function(elements){ createToken: function(elements){
@@ -116,6 +119,9 @@ Sonia.History = {
}, },
onChange: function(token){ onChange: function(token){
if (!this.initialized){
this.initialized = true;
}
if(token){ if(token){
if (this.isInvokeable(this.recentlyAdded, token)){ if (this.isInvokeable(this.recentlyAdded, token)){
var parts = token.split('|'); var parts = token.split('|');
@@ -147,6 +153,20 @@ Sonia.History = {
}; };
Ext.History.on('ready', function(history){
var token = history.getToken();
if (!token || token == 'null'){
Sonia.History.initialized = true;
} else {
setTimeout(function(){
if (debug){
console.debug('history ready, handle history token ' + token);
}
Sonia.History.onChange(token);
}, 750);
}
});
Ext.History.on('change', function(token){ Ext.History.on('change', function(token){
Sonia.History.onChange(token); Sonia.History.onChange(token);
}); });