summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas <thomas@brotherli.ch>2011-10-14 11:55:56 (GMT)
committerThomas <thomas@brotherli.ch>2011-10-14 11:55:56 (GMT)
commit00628dd5d5648b25d02f725a7b27def5e805a255 (patch)
tree1a39e09dd18da0104556012414ea66a4738718d1
parent97d8eade5590cc132a743db724ba1d6f3ac2ee75 (diff)
downloadroundcubemail-plugins-kolab-00628dd5d5648b25d02f725a7b27def5e805a255.tar.gz
Allow user to select calendar when saving an invitation event (#430)
-rw-r--r--plugins/calendar/calendar.php17
-rw-r--r--plugins/calendar/calendar_base.js3
-rw-r--r--plugins/calendar/localization/de_CH.inc1
-rw-r--r--plugins/calendar/localization/de_DE.inc1
-rw-r--r--plugins/calendar/localization/en_US.inc1
-rw-r--r--plugins/calendar/skins/default/calendar.css8
6 files changed, 28 insertions, 3 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index f909277..e896965 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -684,6 +684,20 @@ class calendar extends rcube_plugin
}
}
}
+ else {
+ // get a list of writeable calendars
+ $calendars = $this->driver->list_calendars();
+ $calendar_select = new html_select(array('name' => 'calendar', 'id' => 'calendar-saveto'));
+ $numcals = 0;
+ foreach ($calendars as $calendar) {
+ if (!$calendar['readonly']) {
+ $calendar_select->add($calendar['name'], $calendar['id']);
+ $numcals++;
+ }
+ }
+ if ($numcals <= 1)
+ $calendar_select = null;
+ }
if ($status == 'unknown') {
$html = html::div('rsvp-status', $this->gettext('notanattendee'));
@@ -702,6 +716,7 @@ class calendar extends rcube_plugin
'status' => $status,
'action' => $action,
'html' => $html,
+ 'select' => $calendar_select ? html::span('calendar-select', $this->gettext('saveincalendar') . '&nbsp;' . $calendar_select->show($this->rc->config->get('calendar_default_calendar'))) : '',
));
return;
@@ -2082,7 +2097,7 @@ class calendar extends rcube_plugin
// successfully parsed events?
if (!empty($events) && ($event = $events[$index])) {
// find writeable calendar to store event
- $cal_id = $this->rc->config->get('calendar_default_calendar');
+ $cal_id = !empty($_REQUEST['_calendar']) ? get_input_value('_calendar', RCUBE_INPUT_POST) : $this->rc->config->get('calendar_default_calendar');
$calendars = $this->driver->list_calendars();
$calendar = $calendars[$cal_id] ? $calendars[$cal_id] : null;
if (!$calendar || $calendar['readonly']) {
diff --git a/plugins/calendar/calendar_base.js b/plugins/calendar/calendar_base.js
index a323efc..91c2cc0 100644
--- a/plugins/calendar/calendar_base.js
+++ b/plugins/calendar/calendar_base.js
@@ -211,6 +211,7 @@ rcube_calendar.add_event_from_mail = function(mime_id, status)
'_uid': rcmail.env.uid,
'_mbox': rcmail.env.mailbox,
'_part': mime_id,
+ '_calendar': $('#calendar-saveto').val(),
'_status': status
}, lock);
return false;
@@ -265,7 +266,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
else
$('#loading-'+p.id).hide();
- $('#'+p.action+'-'+p.id).show();
+ $('#'+p.action+'-'+p.id).show().append(p.select);
});
// register create-from-mail command to message_commands array
diff --git a/plugins/calendar/localization/de_CH.inc b/plugins/calendar/localization/de_CH.inc
index 6b888c2..34f8909 100644
--- a/plugins/calendar/localization/de_CH.inc
+++ b/plugins/calendar/localization/de_CH.inc
@@ -172,6 +172,7 @@ $labels['youhavetentative'] = 'Sie haben die Einladung mit Vorbehalt angenommen'
$labels['youhavedeclined'] = 'Sie haben die Einladung abgelehnt';
$labels['notanattendee'] = 'Sie sind nicht in der Liste der Teilnehmer aufgeführt';
$labels['eventcancelled'] = 'Der Termin wurde vom Organisator abgesagt';
+$labels['saveincalendar'] = 'speichern in';
// event dialog tabs
$labels['tabsummary'] = 'Übersicht';
diff --git a/plugins/calendar/localization/de_DE.inc b/plugins/calendar/localization/de_DE.inc
index 8c37f2c..9a16e87 100644
--- a/plugins/calendar/localization/de_DE.inc
+++ b/plugins/calendar/localization/de_DE.inc
@@ -172,6 +172,7 @@ $labels['youhavetentative'] = 'Sie haben die Einladung mit Vorbehalt angenommen'
$labels['youhavedeclined'] = 'Sie haben die Einladung abgelehnt';
$labels['notanattendee'] = 'Sie sind nicht in der Liste der Teilnehmer aufgeführt';
$labels['eventcancelled'] = 'Der Termin wurde vom Organisator abgesagt';
+$labels['saveincalendar'] = 'speichern in';
// event dialog tabs
$labels['tabsummary'] = 'Übersicht';
diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc
index f676efc..8050bb8 100644
--- a/plugins/calendar/localization/en_US.inc
+++ b/plugins/calendar/localization/en_US.inc
@@ -172,6 +172,7 @@ $labels['youhavetentative'] = 'You have tentatively accepted this invitation';
$labels['youhavedeclined'] = 'You have declined this invitation';
$labels['notanattendee'] = 'You\'re not listed as an attendee of this event';
$labels['eventcancelled'] = 'The event has been cancelled';
+$labels['saveincalendar'] = 'save in';
// event dialog tabs
$labels['tabsummary'] = 'Summary';
diff --git a/plugins/calendar/skins/default/calendar.css b/plugins/calendar/skins/default/calendar.css
index 2c0c797..d060f0c 100644
--- a/plugins/calendar/skins/default/calendar.css
+++ b/plugins/calendar/skins/default/calendar.css
@@ -1193,11 +1193,17 @@ div.calendar-invitebox .rsvp-buttons {
}
#event-rsvp input.button,
-div.calendar-invitebox input.button {
+div.calendar-invitebox input.button,
+div.calendar-invitebox select {
font-size: 11px;
margin-right: 0.5em;
}
+div.calendar-invitebox .calendar-select {
+ font-size: 11px;
+ margin-left: 1em;
+}
+
div.calendar-invitebox .rsvp-status.loading {
color: #666;
padding: 1px 0 2px 24px;