[dev] Category preferences

Chuck Hagenbuch chuck at horde.org
Sat Jan 10 08:44:51 PST 2004


Quoting Jason Rust <jrust at rustyparts.com>:

> I'm having a problem with category preferences working.  I've submitted
> a couple of patches to try and fix the issue, but both of them are
> kludgey and introduce other problems.  The visible result of the problem
> is that I have a shared calendar, and I have set the event_categories
> and event_colors for this calendar in prefs.php and locked them.  When
> the creator of that calendar views the calendar the categories all show
> up fine.  When anybody else views the calendar they just see Unfiled.
> The reason is that Kronolith calls getPrefByShare() to get the list of
> categories.  getPrefByShare() loads up an instance of Prefs using the
> owner of the calendar as $owner.  It then calls $_prefs->getPref() which
> is supposed to look up the pref in the database and return it.  However,
> because this pref is stored only in prefs.php it returns null, and
> because $_prefs->retrieve() is never called for this instance of prefs
> those defaults are never loaded in.  Look at line 564 of Share.php and
> line 131 of Prefs/sql.php to see exactly how it is happening.

I think we need to scrap the whole getPref() thing. The way it's implemented is
a kludge on top of the prefs system, and the problems you're having
straightening it out just indicate that to me. For one thing, if we were to fix
it to read defaults, it still wouldn't obey preferences hooks properly, and
even if we put in the calls to the hook functions, a hook might be looking at
Auth::getAuth() - which would be wrong. Icky.

The fix for your particular case is to implement the Label API as described in
horde/docs/TODO, and to use that to store the category information for
calendars, instead of preferences.

The general fix, I'm not sure of. We need some sort of system for loading other
users' Identity objects, at least, and I don't know the best way to handle
that. Maybe a Horde Profile API.

-chuck

--
Charles Hagenbuch, <chuck at horde.org>
"I'm really... I'm not too fascinated by green food." - Average Joe


More information about the dev mailing list