Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117793509
D183.1775260391.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D183.1775260391.diff
View Options
diff --git a/plugins/libcalendaring/alarm.mp3 b/plugins/libcalendaring/alarm.mp3
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/plugins/libcalendaring/alarm.wav b/plugins/libcalendaring/alarm.wav
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/plugins/libcalendaring/libcalendaring.js b/plugins/libcalendaring/libcalendaring.js
--- a/plugins/libcalendaring/libcalendaring.js
+++ b/plugins/libcalendaring/libcalendaring.js
@@ -570,13 +570,19 @@
if (this.alarm_dialog)
this.alarm_dialog.dialog('destroy').remove();
- this.alarm_dialog = $('<div>').attr('id', 'alarm-display');
+ var i, actions, adismiss, asnooze, alarm, html,
+ audio_alarms = [], records = [], event_ids = [], buttons = {};
- var i, actions, adismiss, asnooze, alarm, html, event_ids = [], buttons = {};
for (i=0; i < alarms.length; i++) {
alarm = alarms[i];
alarm.start = this.parseISO8601(alarm.start);
alarm.end = this.parseISO8601(alarm.end);
+
+ if (alarm.action == 'AUDIO') {
+ audio_alarms.push(alarm);
+ continue;
+ }
+
event_ids.push(alarm.id);
html = '<h3 class="event-title">' + Q(alarm.title) + '</h3>';
@@ -594,9 +600,17 @@
});
actions = $('<div>').addClass('alarm-actions').append(adismiss.data('id', alarm.id)).append(asnooze.data('id', alarm.id));
- $('<div>').addClass('alarm-item').html(html).append(actions).appendTo(this.alarm_dialog);
+ records.push($('<div>').addClass('alarm-item').html(html).append(actions));
}
+ if (audio_alarms.length)
+ this.audio_alarms(audio_alarms);
+
+ if (!records.length)
+ return;
+
+ this.alarm_dialog = $('<div>').attr('id', 'alarm-display').append(records);
+
buttons[rcmail.gettext('close')] = function() {
$(this).dialog('close');
};
@@ -636,6 +650,38 @@
};
/**
+ * Display a notification and play a sound for a set of alarms
+ */
+ this.audio_alarms = function(alarms)
+ {
+ var elem, txt = [],
+ src = rcmail.assets_path('plugins/libcalendaring/alarm'),
+ plugin = navigator.mimeTypes ? navigator.mimeTypes['audio/mp3'] : {};
+
+ // first generate and display notification text
+ $.each(alarms, function() { txt.push(this.title); });
+
+ rcmail.display_message(rcmail.gettext('alarmtitle','libcalendaring') + ': ' + Q(txt.join(', ')), 'notice', 10000);
+
+ // Internet Explorer does not support wav files,
+ // support in other browsers depends on enabled plugins,
+ // so we use wav as a fallback
+ src += bw.ie || (plugin && plugin.enabledPlugin) ? '.mp3' : '.wav';
+
+ // HTML5
+ try {
+ elem = $('<audio>').attr('src', src);
+ elem.get(0).play();
+ }
+ // old method
+ catch (e) {
+ elem = $('<embed id="libcalsound" src="' + src + '" hidden=true autostart=true loop=false />');
+ elem.appendTo($('body'));
+ window.setTimeout("$('#libcalsound').remove()", 10000);
+ }
+ };
+
+ /**
* Show a drop-down menu with a selection of snooze times
*/
this.snooze_dropdown = function(link, event)
diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
--- a/plugins/libcalendaring/libcalendaring.php
+++ b/plugins/libcalendaring/libcalendaring.php
@@ -727,7 +727,8 @@
'id' => $alarm['id'],
'start' => $alarm['start'] ? $this->adjust_timezone($alarm['start'])->format('c') : '',
'end' => $alarm['end'] ? $this->adjust_timezone($alarm['end'])->format('c') : '',
- 'allDay' => ($alarm['allday'] == 1)?true:false,
+ 'allDay' => $alarm['allday'] == 1,
+ 'action' => $alarm['action'],
'title' => $alarm['title'],
'location' => $alarm['location'],
'calendar' => $alarm['calendar'],
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 11:53 PM (7 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18827320
Default Alt Text
D183.1775260391.diff (4 KB)
Attached To
Mode
D183: Implemented sound reminders (#T1310)
Attached
Detach File
Event Timeline