throw "no node name specified";
}
+ if (!me.phstateid) {
+ throw "no parent history state specified";
+ }
+
+ var sp = Ext.state.Manager.getProvider();
+ var state = sp.get(me.phstateid);
+ var hsregex = /^ceph-(\S+)$/;
+
+ if (state && state.value) {
+ var res = hsregex.exec(state.value);
+ if (res && res[1]) {
+ me.activeTab = res[1];
+ }
+ }
+
Ext.apply(me, {
plain: true,
tabPosition: 'bottom',
if (first) {
first.fireEvent('show', first);
}
+ },
+ tabchange: function(tp, newcard, oldcard) {
+ var first = tp.items.get(0);
+ var ntab;
+
+ // Note: '' is alias for first tab.
+ if (newcard.itemId === first.itemId) {
+ ntab = 'ceph';
+ } else {
+ ntab = 'ceph-' + newcard.itemId;
+ }
+
+ var state = { value: ntab };
+ sp.set(me.phstateid, state);
}
}
});
me.callParent();
+ var statechange = function(sp, key, state) {
+ if ((key === me.phstateid) && state) {
+ var first = me.items.get(0);
+ var atab = me.getActiveTab().itemId;
+ var res = hsregex.exec(state.value);
+ var ntab = (res && res[1]) ? res[1] : first.itemId;
+ if (ntab && (atab != ntab)) {
+ me.setActiveTab(ntab);
+ }
+ }
+ };
+
+ me.mon(sp, 'statechange', statechange);
}
});
\ No newline at end of file
var activeTab;
+ var hsregex = /^([^\-\s]+)(-\S+)?$/;
+
if (stateid) {
var state = sp.get(stateid);
if (state && state.value) {
- activeTab = state.value;
+ var res = hsregex.exec(state.value);
+ if (res && res[1]) {
+ activeTab = res[1];
+ }
}
}
},
tabchange: function(tp, newcard, oldcard) {
var ntab = newcard.itemId;
+
// Note: '' is alias for first tab.
// First tab can be 'search' or something else
if (newcard.itemId === items[0].itemId) {
ntab = '';
}
var state = { value: ntab };
- if (stateid) {
+ if (stateid && !newcard.phstateid) {
sp.set(stateid, state);
}
}
me.callParent();
var statechange = function(sp, key, state) {
- if (stateid && key === stateid) {
+ if (stateid && (key === stateid) && state) {
var atab = tab.getActiveTab().itemId;
- var ntab = state.value || items[0].itemId;
- if (state && ntab && (atab != ntab)) {
+ var res = hsregex.exec(state.value);
+ var ntab = (res && res[1]) ? res[1] : items[0].itemId;
+ if (ntab && (atab != ntab)) {
tab.setActiveTab(ntab);
}
}