[dev] where the little prefs come from

Michael J Rubinsky mrubinsk at horde.org
Sun Jun 24 20:00:14 UTC 2018


Quoting Sebastian Birnbach <birnbacs at gmail.com>:

> Update:
>
> Horde_Prefs::setValue() checks the scope, which is the application's name.
> It is empty for the users where saving does not work and 'horde' (the
> default) for those where it does.
>
> How can I set scope for my prefs?
>
> config.local.php reads:

There is no config.local.php file. Did you mean prefs.local.php?



> $prefGroups['display'] = array(
>     'column' => _("Abakus Prefs"),
>     'label' => _("Display Preferences"),
>     'desc' => _("display style, which tab to open first etc."),
>     'members' => array('opentab', 'numjobs')
> );
>
> $_prefs['opentab'] = array(
>     'locked' => false,
>     'type' => 'enum',
>     'enum' => array(
>                     'coredata' => _('coredata'),
>                     'contacts' => _('contacts'),
>                     'notes' => _('notes'),
>                     'templates' => _('templates'),
>                     'billing' => _('billing'),
>                     ),
>     'default' => 'coredata',
>     'desc' => _("the tab to display when opening a dossier")
> );
>
> $_prefs['numjobs'] = array(
>     'locked' => false,
>     'type' => 'enum',
>     'enum' => array(
>                     0 => '0',
>                     6 => '6',
>                     12 => '12',
>                     18 => '18',
>                     24 => '24',
>                     36 => '36',
>                     48 => '48',
>                     ),
>     'default' => '12',
>     'desc' => _("how many jobs will be shown in the sidebar")
> );
>
>
>
> 2018-06-24 14:01 GMT+02:00 Sebastian Birnbach <birnbacs at gmail.com>:
>
>> For my own application I created preferences in config/prefs.local.php.
>> They show up as user-editable settings for all users but are editable only
>> for some.

So, this is your own application? Curious why you are overriding your  
own application's prefs file with a local file.  Just so we are on the  
same page: prefs for your own application should go in  
{app_root}/config/prefs.php. The *.local.php files are for  
overriding/changing prefs that are provided in the case that those  
changes would be overwritten when the application is updated.

The scope for the prefs for YOUR application should not be 'horde' -  
it should be your application's name. It sounds like there is many  
something wrong with the way your app is being registered in the  
registry or the prefs.local.php file is being placed in the wrong  
directory maybe...


>> I found that for those users who can change settings there is a
>> corresponding DB entry in the prefs container (SQL table horde_prefs). If
>> the entry is missing, saving those prefs fails.
>>
>> I debugged into /usr/local/share/pear/Horde/Prefs.php#setValue() and see
>> that a preference value is not saved if it does not already exist.

I don't see what code you are talking about here. You may be confusing  
the check for the existence of the preference (as in, the preference  
is defined in the application) with checking if there is already a  
value set in the backend.

>>
>> So, how are prefs initially created? Is there some priming to be done
>> after editing prefs.local.php? And how comes some users' prefs did get
>> created?
>>
>>
>> Kind regards
>>
>>   birnbacs
>>
>>
> --
> dev mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 9272 bytes
Desc: PGP Public Key
URL: <https://lists.horde.org/archives/dev/attachments/20180624/0202b8bc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 821 bytes
Desc: PGP Digital Signature
URL: <https://lists.horde.org/archives/dev/attachments/20180624/0202b8bc/attachment-0001.bin>


More information about the dev mailing list