[dev] Preference namespaces

Brent J. Nordquist bjn@horde.org
Tue, 20 Feb 2001 07:29:42 -0600 (CST)


On Tue, 20 Feb 2001, Jon Parise <jon@csh.rit.edu> wrote:

> First off, every application has its own namespace (eg. 'imp',
> 'kronolith', etc.).  There is also a "global" namespace which is
> identified by an empty namespace string (so, by default, all
> preferences are "global" unless marked otherwise).

Just to make sure I'm understanding you:  "global" as in "applies to all
applications (and the framework itself)", not as in "applies to all users
at a site".  That threw me the first time through.

> It looks like the only sane way to enforce
> those settings is by adding a new attribute to each preference defined
> in config/prefs.php.  An entry would then look like this, in the case
> of a "local" preference:
>
>     $_prefs['save_sent_mail'] = array('value' => 1,
>                                       'changeable' => true,
>                                       'shared' => false,
>                                       'type' => 'checkbox',
>                                       'desc' => _("Save sent mail"));

Doesn't there have to be a 'namespace' attribute?  'shared' => false
doesn't really tell you which application this preference belongs to...
and if you have 'namespace' => 'imp' (or => '') then you wouldn't actually
need a 'shared' attribute.

> Hopefully, this is making sense so far.  I think this will result in a
> fairly clear and flexible implementation, allowing site administrators
> to arrange their users' preferences as they prefer.
>
> I think it would make more sense for the "local" values to
> override the "global" values, should we get two results for 'language'
> or 'full_name'.  Does that make sense, too?

Yes.  I agree, having a two-level system, "local" overriding "global", is
the right way to go, flexible, etc.

-- 
Brent J. Nordquist <bjn@horde.org>
Yahoo!: Brent_Nordquist / AIM: BrentJNordquist / ICQ: 76158942