Let backends decide whether they support alarms; minor improvements in event listing and UI
This commit is contained in:
parent
bff88b8cd5
commit
3c542abc3f
8 changed files with 26 additions and 8 deletions
|
@ -189,10 +189,10 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
||||||
$('select.edit-alarm-type').val(alarm[0]);
|
$('select.edit-alarm-type').val(alarm[0]);
|
||||||
|
|
||||||
if (alarm[1].match(/@(\d+)/)) {
|
if (alarm[1].match(/@(\d+)/)) {
|
||||||
var ondate = new Date(parseInt(RegExp.$1));
|
var ondate = new Date(parseInt(RegExp.$1) * 1000);
|
||||||
$('select.edit-alarm-offset').val('@');
|
$('select.edit-alarm-offset').val('@');
|
||||||
$('input.edit-alarm-date').val($.fullCalendar.formatDate(ondate, settings['date_format']));
|
$('input.edit-alarm-date').val($.fullCalendar.formatDate(ondate, settings['date_format']));
|
||||||
$('input.edit-alarmtime').val($.fullCalendar.formatDate(ondate, settings['time_format']));
|
$('input.edit-alarm-time').val($.fullCalendar.formatDate(ondate, settings['time_format']));
|
||||||
}
|
}
|
||||||
else if (alarm[1].match(/([-+])(\d+)([mhd])/)) {
|
else if (alarm[1].match(/([-+])(\d+)([mhd])/)) {
|
||||||
$('input.edit-alarm-value').val(RegExp.$2);
|
$('input.edit-alarm-value').val(RegExp.$2);
|
||||||
|
@ -203,6 +203,10 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
||||||
$('select.edit-alarm-type, select.edit-alarm-offset').change();
|
$('select.edit-alarm-type, select.edit-alarm-offset').change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// enable/disable alarm property according to backend support
|
||||||
|
$('#edit-alarms')[(calendar.alarms ? 'show' : 'hide')]();
|
||||||
|
|
||||||
|
|
||||||
// set recurrence form
|
// set recurrence form
|
||||||
var recurrence = $('#edit-recurrence-frequency').val(event.recurrence ? event.recurrence.FREQ : '').change();
|
var recurrence = $('#edit-recurrence-frequency').val(event.recurrence ? event.recurrence.FREQ : '').change();
|
||||||
var interval = $('select.edit-recurrence-interval').val(event.recurrence ? event.recurrence.INTERVAL : 1);
|
var interval = $('select.edit-recurrence-interval').val(event.recurrence ? event.recurrence.INTERVAL : 1);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
abstract class calendar_driver
|
abstract class calendar_driver
|
||||||
{
|
{
|
||||||
// backend features
|
// backend features
|
||||||
|
public $alarms = false;
|
||||||
public $attendees = false;
|
public $attendees = false;
|
||||||
public $attachments = false;
|
public $attachments = false;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
class database_driver extends calendar_driver
|
class database_driver extends calendar_driver
|
||||||
{
|
{
|
||||||
// features this backend supports
|
// features this backend supports
|
||||||
|
public $alarms = true;
|
||||||
public $attendees = true;
|
public $attendees = true;
|
||||||
public $attachments = true;
|
public $attachments = true;
|
||||||
|
|
||||||
|
@ -306,10 +307,10 @@ class database_driver extends calendar_driver
|
||||||
$result = $this->rc->db->query(sprintf(
|
$result = $this->rc->db->query(sprintf(
|
||||||
"SELECT * FROM events
|
"SELECT * FROM events
|
||||||
WHERE calendar_id IN (%s)
|
WHERE calendar_id IN (%s)
|
||||||
AND start >= %s AND end <= %s",
|
AND start <= %s AND end >= %s",
|
||||||
$this->calendar_ids,
|
$this->calendar_ids,
|
||||||
$this->rc->db->fromunixtime($start),
|
$this->rc->db->fromunixtime($end),
|
||||||
$this->rc->db->fromunixtime($end)
|
$this->rc->db->fromunixtime($start)
|
||||||
));
|
));
|
||||||
|
|
||||||
while ($result && ($event = $this->rc->db->fetch_assoc($result))) {
|
while ($result && ($event = $this->rc->db->fetch_assoc($result))) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Kolab_calendar
|
||||||
$events = array();
|
$events = array();
|
||||||
foreach ($this->events as $id => $event) {
|
foreach ($this->events as $id => $event) {
|
||||||
// TODO: also list recurring events
|
// TODO: also list recurring events
|
||||||
if ($event['start'] >= $start && $event['end'] <= $end) {
|
if ($event['start'] <= $end && $event['end'] >= $start) {
|
||||||
$events[] = $event;
|
$events[] = $event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,8 @@ class Kolab_calendar
|
||||||
{
|
{
|
||||||
$start_time = date('H:i:s', $rec['start-date']);
|
$start_time = date('H:i:s', $rec['start-date']);
|
||||||
$allday = $start_time == '00:00:00' && $start_time == date('H:i:s', $rec['end-date']);
|
$allday = $start_time == '00:00:00' && $start_time == date('H:i:s', $rec['end-date']);
|
||||||
|
if ($allday) // in Roundcube all-day events only go until 23:59:59 of the last day
|
||||||
|
$rec['end-date']--;
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'id' => $rec['uid'],
|
'id' => $rec['uid'],
|
||||||
|
@ -169,6 +171,10 @@ class Kolab_calendar
|
||||||
{
|
{
|
||||||
$object = array();
|
$object = array();
|
||||||
|
|
||||||
|
// set end-date to 00:00:00 of the following day
|
||||||
|
if ($event['all_day'])
|
||||||
|
$event['end']++;
|
||||||
|
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ require_once(dirname(__FILE__) . '/kolab_calendar.php');
|
||||||
class kolab_driver extends calendar_driver
|
class kolab_driver extends calendar_driver
|
||||||
{
|
{
|
||||||
// features this backend supports
|
// features this backend supports
|
||||||
|
public $alarms = true;
|
||||||
public $attendees = false;
|
public $attendees = false;
|
||||||
public $attachments = false;
|
public $attachments = false;
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ class calendar_ui
|
||||||
$li = '';
|
$li = '';
|
||||||
foreach ((array)$calendars as $id => $prop) {
|
foreach ((array)$calendars as $id => $prop) {
|
||||||
unset($prop['user_id']);
|
unset($prop['user_id']);
|
||||||
|
$prop['alarms'] = $this->calendar->driver->alarms;
|
||||||
$prop['attendees'] = $this->calendar->driver->attendees;
|
$prop['attendees'] = $this->calendar->driver->attendees;
|
||||||
$prop['attachments'] = $this->calendar->driver->attachments;
|
$prop['attachments'] = $this->calendar->driver->attachments;
|
||||||
$jsenv[$id] = $prop;
|
$jsenv[$id] = $prop;
|
||||||
|
|
|
@ -321,6 +321,10 @@ td.topalign {
|
||||||
padding: 0.2em 0;
|
padding: 0.2em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.edit-alarm-set {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
a.dropdown-link {
|
a.dropdown-link {
|
||||||
color: #CC0000;
|
color: #CC0000;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|
|
@ -101,9 +101,9 @@
|
||||||
<input type="text" name="enddate" size="10" id="edit-enddate" />
|
<input type="text" name="enddate" size="10" id="edit-enddate" />
|
||||||
<input type="text" name="endtime" size="6" id="edit-endtime" />
|
<input type="text" name="endtime" size="6" id="edit-endtime" />
|
||||||
</div>
|
</div>
|
||||||
<div class="event-section">
|
<div class="event-section" id="edit-alarms">
|
||||||
<label for="edit-alarm"><roundcube:label name="calendar.alarms" /></label>
|
<label for="edit-alarm"><roundcube:label name="calendar.alarms" /></label>
|
||||||
<roundcube:object name="plugin.alarm_select" id="edit-alarm" />
|
<roundcube:object name="plugin.alarm_select" />
|
||||||
</div>
|
</div>
|
||||||
<div class="event-section" id="calendar-select">
|
<div class="event-section" id="calendar-select">
|
||||||
<label for="edit-calendar"><roundcube:label name="calendar.calendar" /></label>
|
<label for="edit-calendar"><roundcube:label name="calendar.calendar" /></label>
|
||||||
|
|
Loading…
Add table
Reference in a new issue