[cvs] [Wiki] changed: CustomizingPreferences
Ben Chavet
ben at horde.org
Thu Feb 24 06:52:56 PST 2005
ben Thu, 24 Feb 2005 06:52:56 -0800
Modified page: http://wiki.horde.org/display.php?page=CustomizingPreferences
New Revision: 1.5
@@ -108,8 +108,37 @@
}
</code>
CW
+
+I have an "events calendar" that all of my users have read-only access to. This hook makes sure they see that calendar by default.
+I had previously just put the pref value in prefs.php, but then a new user's default calendar would not be created and they would not
+have a "New Event" link in their menu. (don't forget to add the {{'hook' => 'true'}} to {{$prefs['display_cals']}}).
+
+<code type="php">
+if (!function_exists('_prefs_hook_display_cals')) {
+ function _prefs_hook_display_cals($user = null)
+ {
+ require_once 'Horde/Share.php';
+ $kronolith_shares = &Horde_Share::singleton('kronolith');
+ if (!$kronolith_shares->exists(Auth::getAuth())) {
+ require_once 'Horde/Identity.php';
+ $identity = &Identity::singleton();
+ $name = $identity->getValue('fullname');
+ if (trim($name) == '') {
+ $name = Auth::removeHook(Auth::getAuth());
+ }
+ $share = $kronolith_shares->newShare(Auth::getAuth());
+ $share->set('name', sprintf(_("%s's Calendar"), $name));
+ $kronolith_shares->addShare($share);
+ }
+
+ return 'a:2:{i:0;s:' . strlen(Auth::getAuth()) . ':"' . Auth::getAuth() . '";i:1;s:32:"ac2bc478568fa773d9a7530b1a71398b";}';
+ }
+}
+</code>
+
+BC
----
add your customizations here...
More information about the cvs
mailing list