diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php
index 60d14ad5cb..86b2e2da3b 100644
--- a/calendar/inc/class.calendar_boupdate.inc.php
+++ b/calendar/inc/class.calendar_boupdate.inc.php
@@ -248,6 +248,16 @@ class calendar_boupdate extends calendar_bo
// See if we need to reset any participant statuses
$this->check_reset_stati($event, $old_event);
+ // generate a video-room-url, if we need one and not already have one
+ if ($event['videoconference'] && empty($event['##videoconference']) && class_exists('EGroupware\\Status\\Videoconference\\Call'))
+ {
+ $event['##videoconference'] = EGroupware\Status\Videoconference\Call::genUniqueRoomID();
+ }
+ elseif(empty($event['videoconference']))
+ {
+ $event['##videoconference'] = '';
+ }
+
//echo "saving $event[id]="; _debug_array($event);
$event2save = $event;
@@ -681,9 +691,10 @@ class calendar_boupdate extends calendar_bo
* @param int|string $user_or_email
* @param string $ical_method ='REQUEST'
* @param string $role ='REQ-PARTICIPANT'
+ * @param string $notify_externals =null event-specific overwrite, default preferences
* @return boolean true if user requested to be notified, false if not
*/
- static public function email_update_requested($user_or_email, $ical_method='REQUEST', $role='REQ-PARTICIPANT')
+ static public function email_update_requested($user_or_email, $ical_method='REQUEST', $role='REQ-PARTICIPANT',$notify_externals=null)
{
// check if email is from a user
if (is_numeric($user_or_email))
@@ -703,7 +714,7 @@ class calendar_boupdate extends calendar_bo
{
$prefs = array(
'calendar' => array(
- 'receive_updates' => $GLOBALS['egw_info']['user']['preferences']['calendar']['notify_externals'],
+ 'receive_updates' => $notify_externals ?: $GLOBALS['egw_info']['user']['preferences']['calendar']['notify_externals'],
)
);
}
@@ -803,7 +814,7 @@ class calendar_boupdate extends calendar_bo
* @param array $to_notify numerical user-ids as keys (!) (value is not used)
* @param array $old_event Event before the change
* @param array $new_event =null Event after the change
- * @param int/string $user =0 User/participant who started the notify, default current user
+ * @param int|string $user =0 User/participant who started the notify, default current user
* @return bool true/false
*/
function send_update($msg_type,$to_notify,$old_event,$new_event=null,$user=0)
@@ -813,6 +824,7 @@ class calendar_boupdate extends calendar_bo
{
$to_notify = array();
}
+ $notify_externals = $new_event ? $new_event['##notify_externals'] : $old_event['##notify_externals'];
$disinvited = $msg_type == MSG_DISINVITE ? array_keys($to_notify) : array();
$owner = $old_event ? $old_event['owner'] : $new_event['owner'];
@@ -879,7 +891,7 @@ class calendar_boupdate extends calendar_bo
}
// unless we notfiy externals about everything aka 'responses'
// we will notify only an external chair, if only one exists
- if ($GLOBALS['egw_info']['user']['calendar']['notify_externals'] !== 'responses')
+ if (($notify_externals ?: $GLOBALS['egw_info']['user']['calendar']['notify_externals']) !== 'responses')
{
// check if we have *only* an external chair
$chair = null;
@@ -912,6 +924,9 @@ class calendar_boupdate extends calendar_bo
calendar_so::split_status($statusid, $quantity, $role);
if ($this->debug > 0) error_log(__METHOD__." trying to notify $userid, with $statusid ($role)");
+ // hack to add videoconference in event description, by allways setting $cleared_event
+ $cleared_event = $this->read($event['id'], null, true, 'server');
+
if (!is_numeric($userid))
{
$res_info = $this->resource_info($userid);
@@ -922,7 +937,7 @@ class calendar_boupdate extends calendar_bo
{
// --> use only details from (private-)cleared event only containing resource ($userid)
// reading server timezone, to be able to use cleared event for iCal generation further down
- $cleared_event = $this->read($event['id'], null, true, 'server');
+ //$cleared_event = $this->read($event['id'], null, true, 'server');
$this->clear_private_infos($cleared_event, array($userid));
}
$userid = $res_info['responsible'];
@@ -935,6 +950,7 @@ class calendar_boupdate extends calendar_bo
{
$preferences = new Api\Preferences($owner);
$owner_prefs = $preferences->read_repository();
+ if (!empty($notify_externals)) $owner_prefs['calendar']['notify_externals'] = $notify_externals;
}
if ($role != 'CHAIR' && // always notify externals CHAIRs
(empty($owner_prefs['calendar']['notify_externals']) ||
@@ -971,6 +987,7 @@ class calendar_boupdate extends calendar_bo
{
$preferences = new Api\Preferences($owner);
$GLOBALS['egw_info']['user']['preferences'] = $owner_prefs = $preferences->read_repository();
+ if (!empty($notify_externals)) $owner_prefs['calendar']['notify_externals'] = $notify_externals;
}
$part_prefs = $owner_prefs;
$part_prefs['calendar']['receive_updates'] = $owner_prefs['calendar']['notify_externals'];
@@ -1031,6 +1048,26 @@ class calendar_boupdate extends calendar_bo
$olddate->setTimezone($timezone);
$details['olddate'] = $olddate->format($timeformat);
}
+ // generate a personal videoconference url, if we need one
+ if (!empty($event['##videoconference']) && class_exists('EGroupware\\Status\\Videoconference\\Call'))
+ {
+ $details['videoconference'] = EGroupware\Status\Videoconference\Call::genMeetingUrl($event['##videoconference'], [
+ 'name' => $fullname,
+ 'email' => is_numeric($userid) ? Api\Accounts::id2name($userid, 'account_email') : $userid,
+ // todo: contacts and email-addresses (eg. Gravatar-Url)
+ 'avatar' => Api\Framework::getUrl(Api\Egw::link('/api/avatar.php', array('account_id' => $userid))),
+ 'account_id' => $userid
+ ]);
+ $event_arr['videoconference'] = [
+ 'field' => lang('Videoconference'),
+ 'data' => $details['videoconference'],
+ ];
+ // hack to add videoconference-url to ical, only if description was NOT cleared
+ if (isset($cleared_event['description']))
+ {
+ $cleared_event['description'] = lang('Videoconference').': '.$details['videoconference']."\n\n".$event['description'];
+ }
+ }
//error_log(__METHOD__."() userid=$userid, timezone=".$timezone->getName().", startdate=$details[startdate], enddate=$details[enddate], updated=$details[updated], olddate=$details[olddate]");
list($subject,$notify_body) = explode("\n",$GLOBALS['egw']->preferences->parse_notify($notify_msg,$details),2);
@@ -1113,7 +1150,8 @@ class calendar_boupdate extends calendar_bo
'user_id' => $userid,
'type' => $m_type,
'id' => $event['id'],
- 'app' => 'calendar'
+ 'app' => 'calendar',
+ 'videoconference' => $details['videoconference'],
));
}
if ($m_type === MSG_ALARM) $notification->set_popupdata('calendar', array('egw_pr_notify' => 1, 'type' => $m_type));
diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php
index 749c611016..cb638a0f28 100644
--- a/calendar/inc/class.calendar_uiforms.inc.php
+++ b/calendar/inc/class.calendar_uiforms.inc.php
@@ -262,8 +262,8 @@ class calendar_uiforms extends calendar_ui
'recur_exception' => array(),
'title' => $title ? $title : '',
'category' => $cat_id,
- 'videoconference' => !empty($_GET['videoconference']),
- 'notify_externals' => !empty($_GET['videoconference']) ? 'yes' : $this->cal_prefs['notify_externals'],
+ '##videoconference' => !empty($_GET['videoconference']),
+ '##notify_externals' => !empty($_GET['videoconference']) ? 'yes' : $this->cal_prefs['notify_externals'],
);
}
@@ -434,6 +434,9 @@ class calendar_uiforms extends calendar_ui
case 'cal_resources':
case 'status_date':
break;
+ case 'notify_externals':
+ $event['##notify_externals'] = $data;
+ break;
case 'participant':
foreach($data as $participant)
{
@@ -536,7 +539,7 @@ class calendar_uiforms extends calendar_ui
break;
default: // existing participant row
- if (!is_array($data)) continue; // widgets in participant tab, above participant list
+ if (!is_array($data)) continue 2; // widgets in participant tab, above participant list
$quantity = $status = $role = null;
foreach(array('uid','status','quantity','role') as $name)
{
@@ -1509,7 +1512,7 @@ class calendar_uiforms extends calendar_ui
'mail' => array('label' => 'Mail all participants', 'title' => 'Compose a mail to all participants after the event is saved'),
'sendrequest' => array('label' => 'Meetingrequest to all participants', 'title' => 'Send meetingrequest to all participants after the event is saved'),
),
- 'participants[nofify_externals]' => [
+ 'participants[notify_externals]' => [
'yes' => ['label' => 'Yes', 'title' => 'Notify all externals (non-users) about this event'],
'no' => ['label' => 'No', 'title' => 'Do NOT notify externals (non-users) about this event'],
'never' => ['label' => 'Never', 'title' => 'Never notify externals (non-users) about events I create'],
@@ -1680,6 +1683,11 @@ class calendar_uiforms extends calendar_ui
}
}
}
+ // set videoconference from existence of url in cfs
+ if (!isset($event['videoconference']) && !empty($event['##videoconference']))
+ {
+ $event['videoconference'] = !empty($event['##videoconference']);
+ }
$etpl = new Etemplate();
if (!$etpl->read($preserv['template']))
@@ -1818,6 +1826,15 @@ class calendar_uiforms extends calendar_ui
}
}
$content['participants']['status_date'] = $preserv['actual_date'];
+ // set notify_externals in participants from cfs
+ if (!empty($event['##notify_externals']))
+ {
+ $content['participants']['notify_externals'] = $event['##notify_externals'];
+ }
+ else
+ {
+ $content['participants']['notify_externals'] = $this->cal_prefs['notify_externals'];
+ }
$preserved = array_merge($preserv,$content);
$event['new_alarm']['options'] = $content['new_alarm']['options'];
if ($event['alarm'])
@@ -1987,7 +2004,9 @@ class calendar_uiforms extends calendar_ui
}
else
{
- $etpl->exec('calendar.calendar_uiforms.process_edit',$content,$sel_options,$readonlys,$preserved,$preserved['no_popup'] ? 0 : 2);
+ $etpl->exec('calendar.calendar_uiforms.process_edit',$content,$sel_options,$readonlys,$preserved+[
+ '##videoconference' => $content['##videoconference'],
+ ],$preserved['no_popup'] ? 0 : 2);
}
}
diff --git a/calendar/templates/default/edit.xet b/calendar/templates/default/edit.xet
index ad693415fb..c8fcb8ddf0 100644
--- a/calendar/templates/default/edit.xet
+++ b/calendar/templates/default/edit.xet
@@ -53,7 +53,9 @@
-
+
+
+
@@ -62,9 +64,6 @@
-
-
-
@@ -232,7 +231,7 @@
-
+