adding checkbox support to distributed tree panels
git-svn-id: https://beef.googlecode.com/svn/trunk@627 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
ZombieTabs = function(zombie_tree_list) {
|
||||
|
||||
var tree_items = new Array;
|
||||
//a variable to store the list of trees.
|
||||
this.tree_items = new Array;
|
||||
|
||||
//we store the list of trees in a correct array format for ExtJs
|
||||
for(tree in zombie_tree_list) {
|
||||
tree_items.push(zombie_tree_list[tree]);
|
||||
this.tree_items.push(zombie_tree_list[tree]);
|
||||
}
|
||||
|
||||
MainPanel.superclass.constructor.call(this, {
|
||||
@@ -18,7 +20,7 @@ ZombieTabs = function(zombie_tree_list) {
|
||||
minSize: 175,
|
||||
maxSize: 400,
|
||||
deferredRender: false,
|
||||
items: tree_items
|
||||
items: this.tree_items
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ var ZombiesMgr = function(zombies_tree_lists) {
|
||||
//add an offline browser to the tree
|
||||
for(var i in offline_hooked_browsers) {
|
||||
var offline_hooked_browser = this.zombieFactory(i, offline_hooked_browsers);
|
||||
hooked_browsers_tree.addZombie(offline_hooked_browser, false);
|
||||
hooked_browsers_tree.addZombie(offline_hooked_browser, false, ((tree_type != 'basic') ? true : false));
|
||||
}
|
||||
|
||||
//add an online browser to the tree
|
||||
for(var i in online_hooked_browsers) {
|
||||
var online_hooked_browser = this.zombieFactory(i, online_hooked_browsers);
|
||||
hooked_browsers_tree.addZombie(online_hooked_browser, true);
|
||||
hooked_browsers_tree.addZombie(online_hooked_browser, true, ((tree_type != 'basic') ? true : false));
|
||||
//TODO: add the rules here
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ zombiesTreeList = function(id) {
|
||||
rootVisible:false,
|
||||
lines:false,
|
||||
autoScroll:true,
|
||||
useArrows:true,
|
||||
root: new Ext.tree.TreeNode('My Zombies'),
|
||||
collapseFirst:false
|
||||
});
|
||||
@@ -72,8 +73,9 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
|
||||
* Adds a new hooked browser to the tree.
|
||||
* @param: {Literal Object} the hooked browser object generated by the zombie manager.
|
||||
* @param: {Boolean} true if the hooked browser is online, false if offline.
|
||||
*
|
||||
*/
|
||||
addZombie : function(hooked_browser, online) {
|
||||
addZombie : function(hooked_browser, online, checkbox) {
|
||||
var hb_id, mother_node, node;
|
||||
|
||||
if(online) {
|
||||
@@ -101,14 +103,15 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
|
||||
Ext.apply(hooked_browser, {
|
||||
iconCls: 'feed-icon',
|
||||
leaf:true,
|
||||
id: hb_id
|
||||
id: hb_id,
|
||||
checked: ((checkbox) ? false : null)
|
||||
});
|
||||
|
||||
//creates a new node for that hooed browser
|
||||
node = new Ext.tree.TreeNode(hooked_browser);
|
||||
|
||||
//creates a sub-branch for that HB if necessary
|
||||
mother_node = this.addSubFolder(mother_node, hooked_browser[this.tree_configuration['sub-branch']]);
|
||||
mother_node = this.addSubFolder(mother_node, hooked_browser[this.tree_configuration['sub-branch']], checkbox);
|
||||
|
||||
if(online) {
|
||||
//add the hooked browser to the online branch
|
||||
@@ -127,8 +130,9 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
|
||||
* Adds a sub-branch or sub-folder to the tree.
|
||||
* @param: {Ext.tree.TreeNode} the mother node.
|
||||
* @param: {String} the name of the new sub branch.
|
||||
* @param: {Boolean} true if the sub-branch should have a checkbox; false if not.
|
||||
*/
|
||||
addSubFolder: function(mother_node, folder) {
|
||||
addSubFolder: function(mother_node, folder, checkbox) {
|
||||
if(!folder) return mother_node;
|
||||
|
||||
if(mother_node.hasChildNodes()) {
|
||||
@@ -141,9 +145,10 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
|
||||
} else {
|
||||
sub_folder_node = new Ext.tree.TreeNode({
|
||||
id: 'sub-folder-'+folder,
|
||||
text: folder
|
||||
text: folder,
|
||||
checked: ((checkbox) ? false : null)
|
||||
});
|
||||
|
||||
|
||||
mother_node.appendChild(sub_folder_node);
|
||||
mother_node = sub_folder_node;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user