From d181ea9a1765c7f337f41801017c7a644e406425 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 26 Jul 2011 09:38:44 +0200 Subject: [PATCH] Only load default identity on main calendar screen --- plugins/calendar/calendar.php | 15 +++++---------- plugins/calendar/lib/calendar_ui.php | 2 ++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index ae75a937..aa4d7eac 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -466,13 +466,6 @@ class calendar extends rcube_plugin case "new": // create UID for new event $event['uid'] = $this->generate_uid(); - - // set current user as organizer - if (FALSE && !$event['attendees']) { - $identity = $this->rc->user->get_identity(); - $event['attendees'][] = array('role' => 'ORGANIZER', 'name' => $identity['name'], 'email' => $identity['email']); - } - $this->prepare_event($event, $action); if ($success = $this->driver->new_event($event)) $this->cleanup_event($event); @@ -601,7 +594,7 @@ class calendar extends rcube_plugin $end = get_input_value('end', RCUBE_INPUT_GET); if (!$start) $start = mktime(0, 0, 0, 1, date('n'), date('Y')-1); if (!$end) $end = mktime(0, 0, 0, 31, 12, date('Y')+10); - $calendar_name = get_input_value('source', RCUBE_INPUT_GET); + $calendar_name = get_input_value('source', RCUBE_INPUT_GET); $events = $this->driver->load_events($start, $end, null, $calendar_name, 0); header("Content-Type: text/calendar"); @@ -668,8 +661,10 @@ class calendar extends rcube_plugin $settings['hidden_calendars'] = array_filter(explode(',', $this->rc->config->get('hidden_calendars', ''))); // get user identity to create default attendee - $identity = $this->rc->user->get_identity(); - $settings['event_owner'] = array('name' => $identity['name'], 'email' => $identity['email']); + if ($this->ui->screen == 'calendar') { + $identity = $this->rc->user->get_identity(); + $settings['event_owner'] = array('name' => $identity['name'], 'email' => $identity['email']); + } return $settings; } diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php index 30d44ea5..061e71d5 100644 --- a/plugins/calendar/lib/calendar_ui.php +++ b/plugins/calendar/lib/calendar_ui.php @@ -26,11 +26,13 @@ class calendar_ui { private $rc; private $calendar; + public $screen; function __construct($calendar) { $this->calendar = $calendar; $this->rc = $calendar->rc; + $this->screen = $this->rc->task == 'calendar' ? ($this->rc->action ? $this->rc->action: 'calendar') : 'other'; } /**