Re: where the little prefs come from

Michael J Rubinsky <[email protected]> Sun, 24 Jun 2018 20:00:14 +0000
Newsgroups gmane.comp.horde.devel
Message-ID <20180624200014.Horde.0cdsT4DvQ_Rq9K-WAA-vvRD@tarn.theupstairsroom.com>
Quoting Sebastian Birnbach <[email protected]>:

> 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 <[email protected]>:
>
>> 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: [email protected]



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject.

-- 
dev mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
(unnamed) (application/pgp-keys, 9.1 KB) - not displayed
signature.asc (application/pgp-signature, 821 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4

iQIcBAABAgAGBQJbL/hOAAoJEJGSgkbRsxbbaqcP/2CUs046dgixYksc/gVnHjNx
q/9E1/AIktXbDc/mtFv7t/RzkFJk8/iK9w5lbByXWHPBud6l3OKwwPV5DedBIVVT
plaDHGnMf5zIokBPhCRWNqli40dM+ZNehkXaFm0BN9E+qHGEkILYLUPJffRNI46s
9//1KlZwACDhil2mUKM+5ns1BgeEclhdqaOh5iA9MRep2z3GSYUkk84LLgcwO4Ts
1hlwf2c4S43RB0xFInSQerBFXf07eBAuSHydqL+IKR5BZuoVKgA/YYI9OGeiqTBO
1kYYKtVK7cc6wMqBxxZC1jh7hOIOzl5et4LKSJzEi2EFoTkko4jt6SQYd9N+oktB
o90GF1SDO15UcOH1yvuc8e45yZuL51mcVZHhQEudvBawcxhm1ujXpij8QuUgzgnV
ewlXvd+c8Yt8aOMMYAzmRoXA/HzkrgJrWqA6Gcd7nRSpQr/O9fxPkVV/kaR+BnpC
14Qeh/JWiih69HOy4s2EjjjLbLG+koWT7rFYHLAltHhPM8MCoNQm5SuXs6lSqfsW
Atu4Fu6Ho01Qy1lzGUnH/GYw4ZYjgc6qJrT4MjnKazwd8uc0WNp/FZOdg10T/ewx
qf/Ki9ZUzzjTZ3NIO5iZCcufq4Uj+XGwrC52EUj08aYHnG+jJxD25XfZqhGCrmth
HEL7QW/9tIJm3vWuWe+5
=5uz5
-----END PGP SIGNATURE-----