Calendar: Add videoconference link to ical/groupdav event description

This commit is contained in:
nathangray 2020-06-09 10:26:59 -06:00
parent ba6d379287
commit 634eee092b
2 changed files with 24 additions and 3 deletions

View File

@ -677,6 +677,20 @@ class calendar_groupdav extends Api\CalDAV\Handler
//error_log(__METHOD__.'('.array2string($event).", $user) clearing alarms");
$event['alarm'] = array();
}
else if ($event['##videoconference'])
{
// Add video conference link to description for user's own calendar
$avatar = new Api\Contacts\Photo("account:$user",
// disable sharing links currently, as sharing links from a different EGroupware user destroy the session
true);
$link = EGroupware\Status\Videoconference\Call::genMeetingUrl($event['##videoconference'], [
'name' => Api\Accounts::username($user),
'email' => Api\Accounts::id2name($user, 'account_email'),
'avatar' => (string)$avatar,
'account_id' => $user
], [], $event['start_date'], $event['end_date']);
$event['description'] = lang('Videoconference').":\n$link\n\n".$event['description'];
}
$events = array($event);

View File

@ -2428,7 +2428,7 @@ class calendar_ical extends calendar_boupdate
if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'() '.get_class($component)." found\n",3,$this->logfile);
error_log(__FILE__ . '[' . __LINE__ . '] ' . __METHOD__ . '() ' . get_class($component) . " found\n", 3, $this->logfile);
}
// eg. Mozilla holiday calendars contain only a X-WR-TIMEZONE on vCalendar component
@ -2438,8 +2438,8 @@ class calendar_ical extends calendar_boupdate
}
if (!is_a($component, 'Horde_Icalendar_Vevent') ||
!($event = $this->vevent2egw($component, $container ? $container->getAttributeDefault('VERSION', '2.0') : '2.0',
$this->supportedFields, $principalURL, null, $container)))
!($event = $this->vevent2egw($component, $container ? $container->getAttributeDefault('VERSION', '2.0') : '2.0',
$this->supportedFields, $principalURL, null, $container)))
{
return false;
}
@ -2460,6 +2460,13 @@ class calendar_ical extends calendar_boupdate
$event['end']--;
}
// Remove videoconference link appended to description in calendar_groupdav->iCal()
if (class_exists('EGroupware\Status\Videoconference\Call'))
{
$regex = "/^(\r?\n)?(Videoconference|" . lang('Videoconference') . "):\r?\n" . str_replace('/','\/',EGroupware\Status\Videoconference\Call::getMeetingRegex()) ."(\r?\n)*/im";
$event['description'] = preg_replace($regex, '', $event['description']);
}
// handle the alarms
$alarms = $event['alarm'];
foreach ($component->getComponents() as $valarm)