[imp] Custom folder icons not shown in sidebar

Jan Schneider jan at horde.org
Fri Dec 9 07:38:36 PST 2005


Zitat von Oliver Kuhl <okuhl at netcologne.de>:

> Hi,
>
> I use _imp_hook_mbox_icons() to set a custom icon for the INBOX.Spam
> folder. This works fine in /imp/folders.php, but the icon is not changed
> in the sidebar.
>
> I looked into /imp/lib/Block/tree_folders.php and found out, that
> $mbox_icons is never set, because the hook is called nowhere. After
> inserting the hook call, $mbox_icons is there, but the value does not
> fit. While in folders.php a complete <img> must be returned, in
> tree_folders.php only the filename is needed, i.e. spam.png.
>
> As workaround, I modified the hook-function to
> _imp_hook_mbox_icons($filename_only = false) {[...]}, so the result
> value fits now. But this really is an evil workaround, I think.
>
> So what is your opinion about this issue? Should the hook always return
> the filename only and the <img> will be generated in folders.php, or
> should the hook maybe return an array with every information needed,
> just like this?
>
>          $newmailboxes['INBOX.Spam'] = array(
>              'spam.png',
>              _("Spam"),
>              'width="16" height="16" style="vertical-align:middle"',
>              $GLOBALS['registry']->getImageDir('imp').'/folders'
>          );
>
>          return $newmailboxes;
>
> Whatever, the change must be made somewhere. Just to make sure, my patch
> will fit you developer's ideas, please tell me how you think about it.

I would say that the hook should return the full image path, i.e.  
$GLOBALS['registry']->getImageDir('imp') . '/folders/spam.png'.

But this will break bc, which is fine in hooks, as long as it is well  
documented. That means that you need both versions in hooks.php.dist,  
and a note in doc/UPGRADING.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/


More information about the imp mailing list