[cvs] [Wiki] changed: CustomizingPreferences
Wiki Guest
wikiguest at horde.org
Sun Mar 22 08:30:22 UTC 2009
guest [62.147.190.49] Sun, 22 Mar 2009 04:30:21 -0400
Modified page: http://wiki.horde.org/CustomizingPreferences
New Revision: 3.3
Change log: explain a change_hook over show_sidebar when in CAS SSO
@@ -512,8 +512,60 @@
return $names[0];
}
}
</code>
+
+-----
+
+Here is an example of the use of _prefs_change_hook_
+
+We are using a CAS SSO as an Auth Method. So we don't have any horde
login page. So what?. Remember that in the login page, you can select
which mail frontend you want to use and also get rid of sidebar if
dimp is selected. It tooks time to understand how to do that.
post_authenticate can't do the job as user prefs are not loaded.
+
+So:
+We have to leave show_sidebar unlock, but people can't modify. To do
that, we don't display the value in prefs.php
+<code type=php>
+$prefGroups['display'] = array(
+ 'column' => _("Other Information"),
+ 'label' => _("Display Options"),
+ 'desc' => _("Set your startup application, color scheme, page
refreshing, and other display options."),
+ 'members' => array('initial_application', 'show_last_login', 'theme',
+ # 'summary_refresh_time', 'show_sidebar',
'sidebar_width', # DOM
+ 'summary_refresh_time', 'sidebar_width',
+ 'moz_sidebar', 'menu_view', 'menu_refresh_time',
+ 'widget_accesskey')
+);
+</code>
+
+To select dimp, we need a change in registry.php
+
+<code type=php>
+$this->applications['dimp'] = array(
+ 'fileroot' => dirname(__FILE__) . '/../dimp',
+ 'webroot' => $this->applications['horde']['webroot'] . '/dimp',
+ 'name' => _("Dynamic Mail"),
+ 'status' => 'active',
+ 'target' => '_parent',
+);
+<code>
+
+And then, the change hook:
+
+<code type=php>
+if (!function_exists('_prefs_change_hook_initial_application')) {
+ function _prefs_change_hook_initial_application()
+ {
+ $initapp=$GLOBALS['prefs']->getValue('initial_application');
+ if (strcmp($initapp,'dimp')==0){
+ $GLOBALS['prefs']->setValue('show_sidebar',false);
+ }
+ else {
+ $GLOBALS['prefs']->setValue('show_sidebar',true);
+ }
+ }
+}
+</code>
+
+Dominique LALOT
-----
add your customizations here...
More information about the cvs
mailing list