mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 15:49:06 +01:00
* Calendar: allow to schedule a videoconference via Jitsi
This commit is contained in:
parent
8995574feb
commit
075362984a
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,9 @@
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th"></row>
|
||||
<row>
|
||||
<select label="Notify externals" id="notify_externals" span="all" align="right"/>
|
||||
</row>
|
||||
<row disabled="@no_add" height="60" class="et2_toolbar">
|
||||
<calendar-owner id="participant" allowFreeEntries="true" span="4" empty_label="Add new participants or resource" onchange="app.calendar.participantOnChange"/>
|
||||
<hbox width="100%">
|
||||
@ -62,9 +64,6 @@
|
||||
<button id="add" align="right" image="add" novalidate="1" statustext="Please first select participants on the left and then use plus button to add them" background_image="1" readonly="true" ro_image="add"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<select label="Notify externals" id="nofify_externals" span="all" align="right"/>
|
||||
</row>
|
||||
<row class="th thb">
|
||||
<description value="Type"/>
|
||||
<description value="Participants"/>
|
||||
@ -232,7 +231,7 @@
|
||||
<label for="location" value="Location"/>
|
||||
<hbox span="2">
|
||||
<textbox id="location" maxlength="255" class="et2_fullWidth"/>
|
||||
<checkbox label="Videoconference" id="videoconference"/>
|
||||
<checkbox label="Videoconference" id="videoconference" onchange="if (this.checked) document.getElementById('calendar-edit_notify_externals').value='yes';"/>
|
||||
</hbox>
|
||||
<description/>
|
||||
<taglist-cat id="category" height="190" empty_label="Categories" multiple="toggle" class="et2_fullWidth" rows="1" />
|
||||
|
Loading…
Reference in New Issue
Block a user