Category Tree Menu - expand/collapse all nodes ?

Creating and modifying plugins.
Post Reply
jdrodrigues
Regular
Posts: 36
Joined: Sun Feb 12, 2006 9:27 pm
Location: London
Contact:

Category Tree Menu - expand/collapse all nodes ?

Post by jdrodrigues »

Hello All,

I'm having an interesting time using s9y to setup a website (for musicians, scheduled to go online within the next 3 weeks).

Does anyone know how to have 'expand all' & 'collapse all' links above the Category Tree Menu, as the Link List tree has ?

Thank you !

- Joel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Category Tree Menu - expand/collapse all nodes ?

Post by garvinhicking »

Hi!

I'm not exactly sure, but I think those two use different javascript for showing/collapsing the borders. Maybe you can have a look inside the plugin files and compare them?

If you don't succeed, please post again and I'll try to help during the week...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
jdrodrigues
Regular
Posts: 36
Joined: Sun Feb 12, 2006 9:27 pm
Location: London
Contact:

Post by jdrodrigues »

Yes, they do use diff. scripts. dtree.js used by Link List contains a function:


// Open or close all nodes

dTree.prototype.oAll = function(status) {
for (var n=0; n<this.aNodes.length; n++) {
if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
this.nodeStatus(status, n, this.aNodes[n]._ls)
this.aNodes[n]._io = status;
}
}
if (this.config.useCookies) this.updateCookie();
};


I'm not a javascript expert by any means, so it would take me a long time to figure out how to achieve this with Category Tree out on my own.

My reason for wanting this is primarily because I have found people can have difficultly cliking on the tiny little boxes to expand / collapse a sub-section of the menu.

The Link List way seems much more sensible, having the folders + link to click on to expand / collapse a sub-section.

It would be nice if the Category Tree plug-in allowed for all the options the Link List plug-in does right in the s9y admin area.

I will probably resort to using the Link List plug-in as a category browser.

Regards,
Joel
jdrodrigues
Regular
Posts: 36
Joined: Sun Feb 12, 2006 9:27 pm
Location: London
Contact:

Post by jdrodrigues »

On further consideration, I cannot use Link List as a category browser.

I'm looking for ideas at:

http://www.chipchapin.com/WebTools/Menu ... reeMenuXL/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

You are right, the category tree menu usees PEAR::HTML_TreeMenu. Maybe you can check with these developers if they've made an update, or file a feature request for them? It's an completely external script, so actually it's not really related to Serendipity. If the original developers could implement it, this would be far easier for us. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
jdrodrigues
Regular
Posts: 36
Joined: Sun Feb 12, 2006 9:27 pm
Location: London
Contact:

Post by jdrodrigues »

I've e-mailed Richard Heyes, the developer of HTML_TreeMenu to ask if he can help. I think the follwing function in TreeMenu.js can be adapted to create openAll() and closeAll() functions.

/**
* Reset branch status
*/
TreeMenu.prototype.resetBranches = function ()
...
jdrodrigues
Regular
Posts: 36
Joined: Sun Feb 12, 2006 9:27 pm
Location: London
Contact:

Post by jdrodrigues »

I haven't heard back from the developer and have had no luck (& not enough time) adding 'expand all' and 'collapse all' javascript link for the tree menu.

However I have done two things to make navigation not dependent so much on dexterity with the cursor and/or perfect vision - I refer to having to place the cursor over the little +/- boxes and clicking.

1. I added " 'expanded'=>true " to line 125 of serendipity_plugin_category_dhtml_menu.php. This makes the tree appear fully expanded on every page load.

The line is now :

$cat_nodes[$category['categoryid']] = new HTML_TreeNode(array('text'=>$category[1],'link'=>$link, 'expanded'=>true));


2. I added "onMDown" to line224 of TreeMenu.js. This makes a clicked node expand while also taking the user to the selected page.

The line is now :

var linkStart = nodes.link ? this.stringFormat('<a href="{0}" target="{1}">', nodes.link, linkTarget, onMDown) : '';

I am now trying to add an entry count to every node, as appears in the regular categiry menu.

- Joel
Post Reply