[Kolab-devel] [issue3850] new hook to create display names for personal/shared calendars individually
issues at kolab.org
issues at kolab.org
Thu Sep 10 10:32:38 CEST 2009
New submission from Sönke Schwardt-Krummrich <schwardt at univention.de>:
In some cases displaying owner and full name of shared calendars is not
appreciated or confusing for users
(e.g. "[some.admin at example.com] user:someadmin:vacation-calendar"). The optional
hook, added with this patch, provides the ability to format the display name to
ones own needs (e.g. a simple "vacation-calendar") while other calendars remain
untouched. This patch also adds an additional hook for modifying display names of
personal calendars.
----------
files: t_kronolith_HK_UV_calendarDisplayNameHook.diff
keyword: web client
messages: 21585
nosy: schwardt
status: unread
title: new hook to create display names for personal/shared calendars individually
______________________________________
Kolab issue tracker <issues at kolab.org>
<https://issues.kolab.org/issue3850>
______________________________________
-------------- next part --------------
Patch by schwardt at univention.de (Wed Sep 9 17:29:45 2009 +0200):
kronolith: added hook to create display names for personal/shared calendars individually
In some cases displaying owner and full name of shared calendars is not
appreciated or confusing for users
(e.g. "[some.admin at example.com] user:someadmin:vacation-calendar"). The optional
hook, added with this patch, provides the ability to format the display name to
ones own needs (e.g. a simple "vacation-calendar") while other calendars remain
untouched. This patch adds an additional hook for modifying display names of
personal calendars.
--- a/horde-webmail/kronolith/config/conf.xml
+++ b/horde-webmail/kronolith/config/conf.xml
@@ -111,4 +111,15 @@
</values>
</configmultienum>
</configsection>
+
+ <configtab name="hooks" desc="Custom Hooks">
+ <configsection name="hooks">
+ <configboolean name="build_personal_calendar_display_name" required="false" desc="Should we use a custom
+ hook for displaying personal calendar names? If so, make sure you define
+ _kronolith_build_personal_calendar_display_name() in hooks.php. There is an example in hooks.php.dist.">false</configboolean>
+ <configboolean name="build_shared_calendar_display_name" required="false" desc="Should we use a custom
+ hook for displaying shared calendar names? If so, make sure you define
+ _kronolith_build_shared_calendar_display_name() in hooks.php. There is an example in hooks.php.dist.">false</configboolean>
+ </configsection>
+ </configtab>
</configuration>
new file mode 100644
--- /dev/null
+++ b/horde-webmail/kronolith/config/hooks.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * KRONOLITH Hooks configuration file.
+ *
+ * THE HOOKS PROVIDED IN THIS FILE ARE EXAMPLES ONLY. DO NOT ENABLE THEM
+ * BLINDLY IF YOU DO NOT KNOW WHAT YOU ARE DOING. YOU HAVE TO CUSTOMIZE THEM
+ * TO MATCH YOUR SPECIFIC NEEDS AND SYSTEM ENVIRONMENT.
+ *
+ * For more information please see the horde/config/hooks.php.dist file.
+ *
+ * $Id$
+ */
+
+// Example hook for building display name of personal calendars in kronolith
+
+// if (!function_exists('_kronolith_build_personal_calendar_display_name')) {
+// function _kronolith_build_personal_calendar_display_name($id = null, $cal = null)
+// {
+// return '[' . htmlspecialchars(Auth::removeHook($cal->get('owner'))) . '] ' . htmlspecialchars($cal->get('name')) ;
+// }
+// }
+
+// Example hook for building display name of shared calendars in kronolith
+
+// if (!function_exists('_kronolith_build_shared_calendar_display_name')) {
+// function _kronolith_build_shared_calendar_display_name($id = null, $cal = null)
+// {
+// return '[' . htmlspecialchars(Auth::removeHook($cal->get('owner'))) . '] ' . htmlspecialchars($cal->get('name')) ;
+// }
+// }
+
+if (file_exists(dirname(__FILE__) . '/hooks.local.php')) {
+ require_once(dirname(__FILE__) . '/hooks.local.php');
+}
new file mode 100644
--- /dev/null
+++ b/horde-webmail/kronolith/config/hooks.php.dist
@@ -0,0 +1,34 @@
+<?php
+/**
+ * KRONOLITH Hooks configuration file.
+ *
+ * THE HOOKS PROVIDED IN THIS FILE ARE EXAMPLES ONLY. DO NOT ENABLE THEM
+ * BLINDLY IF YOU DO NOT KNOW WHAT YOU ARE DOING. YOU HAVE TO CUSTOMIZE THEM
+ * TO MATCH YOUR SPECIFIC NEEDS AND SYSTEM ENVIRONMENT.
+ *
+ * For more information please see the horde/config/hooks.php.dist file.
+ *
+ * $Id$
+ */
+
+// Example hook for building display name of personal calendars in kronolith
+
+// if (!function_exists('_kronolith_build_personal_calendar_display_name')) {
+// function _kronolith_build_personal_calendar_display_name($id = null, $cal = null)
+// {
+// return '[' . htmlspecialchars(Auth::removeHook($cal->get('owner'))) . '] ' . htmlspecialchars($cal->get('name')) ;
+// }
+// }
+
+// Example hook for building display name of shared calendars in kronolith
+
+// if (!function_exists('_kronolith_build_shared_calendar_display_name')) {
+// function _kronolith_build_shared_calendar_display_name($id = null, $cal = null)
+// {
+// return '[' . htmlspecialchars(Auth::removeHook($cal->get('owner'))) . '] ' . htmlspecialchars($cal->get('name')) ;
+// }
+// }
+
+if (file_exists(dirname(__FILE__) . '/hooks.local.php')) {
+ require_once(dirname(__FILE__) . '/hooks.local.php');
+}
--- a/horde-webmail/kronolith/templates/panel.inc
+++ b/horde-webmail/kronolith/templates/panel.inc
@@ -41,7 +41,14 @@ foreach (Kronolith::listCalendars() as $id => $cal) {
<h4><?php echo _("My Calendars:") ?></h4>
<ul id="mycalendars">
<?php foreach ($my_calendars as $id => $cal): ?>
- <li><label><input type="checkbox" class="checkbox" name="display_cal[]" value="<?php echo htmlspecialchars($id) ?>"<?php echo (in_array($id, $display_calendars) ? ' checked="checked"' : '') . ' /> ' . htmlspecialchars($cal->get('name')) ?></label> <?php echo $info_img ?></li>
+ <?php
+ if (!empty($GLOBALS['conf']['hooks']['build_personal_calendar_display_name'])) {
+ $folderlabel = Horde::callHook('_kronolith_build_personal_calendar_display_name', array($id, $cal), 'kronolith');
+ } else {
+ $folderlabel = htmlspecialchars($cal->get('name')) ;
+ }
+ ?>
+ <li><label><input type="checkbox" class="checkbox" name="display_cal[]" value="<?php echo htmlspecialchars($id) ?>"<?php echo (in_array($id, $display_calendars) ? ' checked="checked"' : '') . ' /> ' . $folderlabel ?></label> <?php echo $info_img ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
@@ -50,7 +57,14 @@ foreach (Kronolith::listCalendars() as $id => $cal) {
<h4><?php echo _("Shared Calendars:") ?></h4>
<ul id="sharedcalendars">
<?php foreach ($shared_calendars as $id => $cal): ?>
- <li><label><input type="checkbox" class="checkbox" name="display_cal[]" value="<?php echo htmlspecialchars($id) ?>"<?php echo (in_array($id, $display_calendars) ? ' checked="checked"' : '') . ' /> [' . htmlspecialchars(Auth::removeHook($cal->get('owner'))) . '] ' . htmlspecialchars($cal->get('name')) ?></label> <?php echo $info_img ?></li>
+ <?php
+ if ($GLOBALS['conf']['hooks']['build_shared_calendar_display_name']) {
+ $folderlabel = Horde::callHook('_kronolith_build_shared_calendar_display_name', array($id, $cal), 'kronolith');
+ } else {
+ $folderlabel = '[' . htmlspecialchars(Auth::removeHook($cal->get('owner'))) . '] ' . htmlspecialchars($cal->get('name')) ;
+ }
+ ?>
+ <li><label><input type="checkbox" class="checkbox" name="display_cal[]" value="<?php echo htmlspecialchars($id) ?>"<?php echo (in_array($id, $display_calendars) ? ' checked="checked"' : '') . ' /> '.$folderlabel ?></label> <?php echo $info_img ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
More information about the devel
mailing list