Some bugfixes for the D Cat Sidebar plugin.

Discussion corner for Developers of Serendipity.
Post Reply
frodeste
Regular
Posts: 56
Joined: Thu Aug 04, 2005 9:16 pm
Location: Tønsberg, Norway
Contact:

Some bugfixes for the D Cat Sidebar plugin.

Post by frodeste »

I have made a few changes to the serendipity_plugin_category_dhtml_menu.php that I would like to share. Her is the diff:

diff -c serendipity_plugin_category_dhtml_menu.php.org serendipity_plugin_category_dhtml_menu.php
*** serendipity_plugin_category_dhtml_menu.php.org Sun Nov 6 09:46:54 2005
--- serendipity_plugin_category_dhtml_menu.php Sun Nov 6 09:45:26 2005
***************
*** 1,6 ****
--- 1,7 ----
<?php
/**
* @author Jackson Miller <docblock@jaxn.org>
+ * @modified by Frode Stenstrom www.stenstrom.no
* @license PHP
* @package additional_plugins
* @version $Id: serendipity_plugin_category_dhtml_menu.php,v 1.8 2005/08/01 18:20:07 garvinhicking Exp $
***************
*** 43,49 ****
'php' => '4.1.0'
));
$propbag->add('author', 'Jackson Miller');
! $propbag->add('version', '1.3');
$propbag->add('groups', array('FRONTEND_VIEWS'));
}

--- 44,50 ----
'php' => '4.1.0'
));
$propbag->add('author', 'Jackson Miller');
! $propbag->add('version', '1.4');
$propbag->add('groups', array('FRONTEND_VIEWS'));
}

***************
*** 108,114 ****
$which_category = $this->get_config('authorid');

// build an accessible array of categories
! foreach (serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category) as $cat) {
$categories[$cat['categoryid']] = $cat;
}

--- 109,115 ----
$which_category = $this->get_config('authorid');

// build an accessible array of categories
! foreach (serendipity_fetchCategories(empty($which_category) ? ALL_CATEGORIES : $which_category) as $cat) {
$categories[$cat['categoryid']] = $cat;
}

***************
*** 118,124 ****
}

// node for all categories
! $all_cats = new HTML_TreeNode(array('text'=>'All','link'=>($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] : '')));

// create a top level for "all categories"
// this serves as the title
--- 119,125 ----
}

// node for all categories
! $all_cats = new HTML_TreeNode(array('text'=>ALL_CATEGORIES,'link'=>($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] : '')));

// create a top level for "all categories"
// this serves as the title



Basically, I have modifies to code to respect and use existing translations of ALL_CATEGORIES.

I am trying to solve why the category tree is allways expanded. I would like for it to behave the same way that the LINK list plugin does. If anyone knows how to do this, drop me a PM og email to Frode@Stenstrom. Jackson Miller, are you listening? :) I'd be glad to help, but its been a while since I did any serious programming.
-- frodeste
www.stenstrom.no
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Some bugfixes for the D Cat Sidebar plugin.

Post by garvinhicking »

Thanks for sharing your patch! However I thing you used an old version, as these code changes have already been applied a couple of days ago :-)

Sadly I don't know much about TreeMenu, so I don'T know how the expansion is handled. I think Jackson has his mail address somewhere, so you could mail him?

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/
frodeste
Regular
Posts: 56
Joined: Thu Aug 04, 2005 9:16 pm
Location: Tønsberg, Norway
Contact:

Re: Some bugfixes for the D Cat Sidebar plugin.

Post by frodeste »

garvinhicking wrote:Thanks for sharing your patch! However I thing you used an old version, as these code changes have already been applied a couple of days ago :-)

Regards,
Garvin
Argh... :) You beat me again. I download the nightly builds almost every day (and I check SPARTACUS for updates). Of well.

I guess I have to look into the show all/close all of the tree now..
-- frodeste
www.stenstrom.no
frodeste
Regular
Posts: 56
Joined: Thu Aug 04, 2005 9:16 pm
Location: Tønsberg, Norway
Contact:

Re: Some bugfixes for the D Cat Sidebar plugin.

Post by frodeste »

garvinhicking wrote:Thanks for sharing your patch! However I thing you used an old version, as these code changes have already been applied a couple of days ago :-)

Regards,
Garvin
I just downloaded the latest version and do have one comment. For the text 'All' (English) the @define('PLUGIN_DHTMLMENU_ALL_CATS_LABEL','All'); is beeing used. I find this to be redundant as the text definition ALL_CATEGORIES is already defined in the lang/* files.

I think this only causes extra translation work. :)

Also, won't this line:
foreach (serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category) as $cat) {
$categories[$cat['categoryid']] = $cat;
}

Fail if the word 'all' does not match what might be translated in other languages?
-- frodeste
www.stenstrom.no
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Some bugfixes for the D Cat Sidebar plugin.

Post by garvinhicking »

Hi!

You're right about the double constant, thanks!

The 'all' parameter for the command call is a hard-coded string, so that must stay "all" :)

Thanks & 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/
Post Reply