Calendar: When videoconference is checked, check for 5 minute alarm for all to avoid adding more than one

This commit is contained in:
nathangray 2020-05-04 15:03:03 -06:00
parent c50fd8e6bf
commit 3de7d34844
2 changed files with 26 additions and 0 deletions

View File

@ -3358,6 +3358,19 @@ var CalendarApp = /** @class */ (function (_super) {
// notify all participants
this.et2.getWidgetById('participants[notify_externals]').set_value('yes');
// add alarm for all participants 5min before videoconference
var start = new Date(widget.getRoot().getWidgetById('start').getValue());
var alarms = this.et2.getArrayMgr('content').getEntry('alarm') || {};
for (var _i = 0, alarms_1 = alarms; _i < alarms_1.length; _i++) {
var alarm = alarms_1[_i];
// Check for already existing alarm
if (!alarm || typeof alarm != "object" || !alarm.all)
continue;
var alarm_time = new Date(alarm.time);
if (start.getTime() - alarm_time.getTime() == 5 * 60 * 1000) {
// Alarm exists
return;
}
}
this.et2.getWidgetById('new_alarm[options]').set_value('300');
this.et2.getWidgetById('new_alarm[owner]').set_value('0'); // all participants
this.et2.getWidgetById('button[add_alarm]').click();

View File

@ -4160,6 +4160,19 @@ class CalendarApp extends EgwApp
this.et2.getWidgetById('participants[notify_externals]').set_value('yes');
// add alarm for all participants 5min before videoconference
let start = new Date(widget.getRoot().getWidgetById('start').getValue());
let alarms = this.et2.getArrayMgr('content').getEntry('alarm') || {};
for(let alarm of alarms)
{
// Check for already existing alarm
if(!alarm || typeof alarm != "object" || !alarm.all) continue;
let alarm_time = new Date(alarm.time);
if(start.getTime() - alarm_time.getTime() == 5 * 60 * 1000)
{
// Alarm exists
return;
}
}
this.et2.getWidgetById('new_alarm[options]').set_value('300');
this.et2.getWidgetById('new_alarm[owner]').set_value('0'); // all participants
this.et2.getWidgetById('button[add_alarm]').click();