[dev] Registry_Application's prefs methods flawed?

Michael M Slusarz slusarz at horde.org
Thu Dec 16 23:16:38 UTC 2010


Quoting Jan Schneider <jan at horde.org>:

> While fixing some issue with populating preference values in  
> Kronolith, I noticed that the prefs methods in the  
> Horde_Registry_Application sub-classes uses pref groups ($ui->group)  
> to determine which preference to manipulate ($ui->override). This  
> seems flawed because the individual prefs can be assigned different  
> groups in the config/prefs.php configuration files.

This is expected, and it is a compromise.  It is not possible to move  
things around between pref groups easily at this time because the  
conditional logic is hardcoded in the App_Registry_Application file,  
as you discovered.  This was a compromise since the alternative would  
be to have all of this conditional code living in prefs.php instead,  
or (more likely) having each individual preference be overloaded with  
configuration options.  Or, even more extreme, have each preference  
live in a separate class/object.  Unfortunately, prefs are one of  
those things that need to be exposed to ALL admins so we have to keep  
the API somewhat workable.

IMHO, we really shouldn't be having prefs appear on multiple screens  
anyway.  It just adds to the prefs clutter and is duplicative and  
confusing.  If its one of those things where one pref might control  
prefs living in a different group, then we are probably Doing It  
Wrong; these prefs should logically be broken into and a new, separate  
group.  I would rather see usage of linkage between groups pages via  
links rather than a duplicated pref entry.  And some prefs simply  
can't be split up (identity prefs) because they rely on other elements  
in the page (javascript; specific handling based on the group name).

Conversely, if you really do want to have prefs appear in multiple  
groups, then you can simply add the necessary code to deal with that  
individual pref in the App_Registry_Application methods.  The valid  
list of prefs for the current group can always be obtained via:
$ui->getChangeablePrefs($ui->group)

michael

-- 
___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list