From a2ae6decc72097d6b1f5b67478750be2145cacb7 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 3 Nov 2009 17:28:27 +0100 Subject: [PATCH] Update quick event adding interface. --- kronolith/js/kronolith.js | 18 ++++++++++++++++++ kronolith/lib/Kronolith.php | 23 ++++++++++++++--------- kronolith/templates/index/index.inc | 17 ++++++++++++----- kronolith/themes/screen.css | 18 ++++++++++-------- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 352a45378..016693d7b 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -804,6 +804,23 @@ KronolithCore = { }, /** + * Propagates a SELECT drop down list with the editable calendars. + * + * @param string id The id of the SELECT element. + */ + updateCalendarDropDown: function(id) + { + $(id).update(); + $H(Kronolith.conf.calendars.internal).each(function(cal) { + if (cal.value.edit) { + $(id).insert(new Element('OPTION', { 'value': cal.key }) + .setStyle({ 'backgroundColor': cal.value.bg, 'color': cal.value.fg }) + .update(cal.value.name.escapeHTML())); + } + }); + }, + + /** * Sets the load signature and show the loading spinner. * * @param string cal The loading calendar. @@ -1897,6 +1914,7 @@ KronolithCore = { return; case 'kronolithQuickEvent': + this.updateCalendarDropDown('kronolithQuickinsertCalendars'); $('kronolithQuickinsert').appear({ duration: 0.3, afterFinish: function() { diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 6f69873ab..5078b085a 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -148,15 +148,20 @@ class Kronolith // Turn debugging on? 'debug' => !empty($conf['js']['debug']), ); - foreach ($GLOBALS['all_calendars'] as $id => $calendar) { - $owner = $calendar->get('owner') == Horde_Auth::getAuth(); - $code['conf']['calendars']['internal'][$id] = array( - 'name' => ($owner ? '' : '[' . Horde_Auth::convertUsername($calendar->get('owner'), false) . '] ') - . $calendar->get('name'), - 'owner' => $owner, - 'fg' => self::foregroundColor($calendar), - 'bg' => self::backgroundColor($calendar), - 'show' => in_array($id, $GLOBALS['display_calendars'])); + foreach (array(true, false) as $my) { + foreach ($GLOBALS['all_calendars'] as $id => $calendar) { + $owner = $calendar->get('owner') == Horde_Auth::getAuth(); + if (($my && $owner) || (!$my && !$owner)) { + $code['conf']['calendars']['internal'][$id] = array( + 'name' => ($owner ? '' : '[' . Horde_Auth::convertUsername($calendar->get('owner'), false) . '] ') + . $calendar->get('name'), + 'owner' => $owner, + 'fg' => self::foregroundColor($calendar), + 'bg' => self::backgroundColor($calendar), + 'show' => in_array($id, $GLOBALS['display_calendars']), + 'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), PERMS_READ)); + } + } } foreach ($GLOBALS['all_external_calendars'] as $api => $categories) { foreach ($categories as $id => $name) { diff --git a/kronolith/templates/index/index.inc b/kronolith/templates/index/index.inc index b16a7d454..69e4687a6 100644 --- a/kronolith/templates/index/index.inc +++ b/kronolith/templates/index/index.inc @@ -34,7 +34,7 @@
- + ">+
@@ -133,10 +133,17 @@ require dirname(__FILE__) . '/agenda.inc'; diff --git a/kronolith/themes/screen.css b/kronolith/themes/screen.css index b2175e01f..401e893c4 100644 --- a/kronolith/themes/screen.css +++ b/kronolith/themes/screen.css @@ -468,12 +468,17 @@ body.kronolithAjax { } #kronolithAddEvents span { /* We need some style here. */ - margin-bottom: 5px; - padding-right: 10px; + float: left; font-weight: bold; cursor: pointer; } +span#kronolithNewEvent { + width: 121px; + margin-right: 10px; + text-align: center; +} span#kronolithQuickEvent { + width: 16px; background: transparent url("graphics/new.png") no-repeat; color: transparent; } @@ -490,10 +495,10 @@ span#kronolithQuickEvent { #kronolithQuickinsert { position: absolute; z-index: 110; - left: 105px; + left: 163px; top: 10px; - width: 250px; - height: 75px; + width: 350px; + height: auto; margin: 0; padding: 0; background: transparent url("graphics/back_quick.png") no-repeat left top; @@ -502,9 +507,6 @@ span#kronolithQuickEvent { padding: 5px; margin: 5px 5px 5px 15px; } -#kronolithQuickinsertQ { - width: 150px; -} /* Navigation bar */ #kronolithBar { -- 2.11.0