From 1c135b2da33b29a17c7007ab66eace92244dc41a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 7 Apr 2020 11:10:49 +0200 Subject: [PATCH] some fixes around videoconference avatars and adding an automatic alarm 5min before the conference --- api/src/Contacts/Photo.php | 4 ++-- calendar/inc/class.calendar_boupdate.inc.php | 4 ++-- calendar/inc/class.calendar_uiforms.inc.php | 14 +++++++++++++- calendar/js/app.js | 14 ++++++++++++++ calendar/js/app.ts | 19 +++++++++++++++++++ calendar/templates/default/edit.xet | 2 +- 6 files changed, 51 insertions(+), 6 deletions(-) diff --git a/api/src/Contacts/Photo.php b/api/src/Contacts/Photo.php index 7f43231f98..dc185798dc 100644 --- a/api/src/Contacts/Photo.php +++ b/api/src/Contacts/Photo.php @@ -108,8 +108,8 @@ class Photo return 'https://gravatar.com/'.md5(trim(strtolower($this->contact))); } return Api\Framework::getUrl(Api\Egw::link('/api/anon_lavatar.php', [ - 'firstname' => $this->contact['firstname'], - 'lastname' => $this->contact['lastname'], + 'firstname' => $this->contact['n_given'], + 'lastname' => $this->contact['n_family'], 'id' => $this->contact['id'], ])); } diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index c237562790..c5cd27583e 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -253,7 +253,7 @@ class calendar_boupdate extends calendar_bo { $event['##videoconference'] = EGroupware\Status\Videoconference\Call::genUniqueRoomID(); } - elseif(empty($event['videoconference'])) + elseif (isset($event['videoconference']) && !$event['videoconference']) { $event['##videoconference'] = ''; } @@ -967,7 +967,7 @@ class calendar_boupdate extends calendar_bo continue; // dont notify rejected participants or groups } - if($userid != $GLOBALS['egw_info']['user']['account_id'] || + if ($userid != $GLOBALS['egw_info']['user']['account_id'] || ($userid == $GLOBALS['egw_info']['user']['account_id'] && $user_prefs['calendar']['receive_own_updates']==1) || $msg_type == MSG_ALARM) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index cb638a0f28..df491ad92f 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -241,13 +241,25 @@ class calendar_uiforms extends calendar_ui $offset = 60 * $this->cal_prefs[$alarm_pref]; $alarms[1] = array( 'default' => 1, - 'offset' => $offset , + 'offset' => $offset, 'time' => $start - $offset, 'all' => false, 'owner' => $owner, 'id' => 1, ); } + // add automatic alarm 5min before videoconference for all participants + if (!empty($_GET['videoconference'])) + { + $offset = -5 * 60; + $alarms[1+count($alarms)] = array( + 'offset' => $offset, + 'time' => $start - $offset, + 'all' => true, + 'owner' => $owner, + 'id' => 2, + ); + } return array( 'participant_types' => $participant_types, diff --git a/calendar/js/app.js b/calendar/js/app.js index 9a7f2898bf..97540a54d0 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -3349,6 +3349,20 @@ var CalendarApp = /** @class */ (function (_super) { } return CalendarApp.DAYWISE_CACHE_ID + '::' + date + (_owner ? '-' + _owner : ''); }; + /** + * Videoconference checkbox checked + */ + CalendarApp.prototype.videoconferenceOnChange = function () { + var widget = this.et2.getWidgetById('videoconference'); + if (widget && widget.get_value()) { + // notify all participants + this.et2.getWidgetById('participants[notify_externals]').set_value('yes'); + // add alarm for all participants 5min before videoconference + 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(); + } + }; /** * These are the keys we keep to set & remember the status, others are discarded */ diff --git a/calendar/js/app.ts b/calendar/js/app.ts index d9995c9783..9f04bca7f3 100644 --- a/calendar/js/app.ts +++ b/calendar/js/app.ts @@ -4142,6 +4142,25 @@ class CalendarApp extends EgwApp } return CalendarApp.DAYWISE_CACHE_ID+'::'+date+(_owner ? '-' + _owner : ''); } + + /** + * Videoconference checkbox checked + */ + public videoconferenceOnChange() + { + let widget = this.et2.getWidgetById('videoconference'); + + if (widget && widget.get_value()) + { + // notify all participants + this.et2.getWidgetById('participants[notify_externals]').set_value('yes'); + + // add alarm for all participants 5min before videoconference + 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(); + } + } } app.classes.calendar = CalendarApp; \ No newline at end of file diff --git a/calendar/templates/default/edit.xet b/calendar/templates/default/edit.xet index c8fcb8ddf0..64fc6d8127 100644 --- a/calendar/templates/default/edit.xet +++ b/calendar/templates/default/edit.xet @@ -231,7 +231,7 @@