[dev] Preference namespaces

Jon Parise jon@csh.rit.edu
Tue, 20 Feb 2001 11:42:00 -0500


On Tue, Feb 20, 2001 at 07:29:42AM -0600, Brent J. Nordquist 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.

Yes, "global" preferences apply to all applications.
 
> > 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.

I was thinking that if 'shared' were set to 'false', we'd assume the
namespace of the application.  If we allow the user to define the
namespace string themself, there could be multiple namespaces per
application, and that would me preference retrieval a bit more
complicated (and klunky).

So, using the 'shared' boolean over the 'namespace' string is more of
a constraint.
 
-- 
Jon Parise (jon@csh.rit.edu)  .  Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/  :  Computer Science House Member