mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Make sure the Status app hooks methods are there before calling them
This commit is contained in:
parent
bea4b0dcf9
commit
107be6dab4
@ -235,8 +235,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
|
||||
// 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')
|
||||
&& !EGroupware\Status\Hooks::isVideoconferenceDisabled())
|
||||
if ($event['videoconference'] && empty($event['##videoconference']) && !calendar_hooks::isVideoconferenceDisabled())
|
||||
{
|
||||
$event['##videoconference'] = EGroupware\Status\Videoconference\Call::genUniqueRoomID();
|
||||
}
|
||||
@ -245,8 +244,8 @@ class calendar_boupdate extends calendar_bo
|
||||
$event['##videoconference'] = '';
|
||||
}
|
||||
// update videoconference resource amounts based on number of participants
|
||||
if ($event['videoconference'] && !empty($event['##videoconference']) && class_exists('EGroupware\\Status\\Videoconference\\Call')
|
||||
&& !EGroupware\Status\Hooks::isVideoconferenceDisabled() && ($videoconferenceResId = \EGroupware\Status\Hooks::getVideoconferenceResourceId()))
|
||||
if ($event['videoconference'] && !empty($event['##videoconference']) && !calendar_hooks::isVideoconferenceDisabled()
|
||||
&& ($videoconferenceResId = \EGroupware\Status\Hooks::getVideoconferenceResourceId()))
|
||||
{
|
||||
$participant_total = 0;
|
||||
foreach(['u','e','c'] as $p_type)
|
||||
@ -1114,8 +1113,7 @@ class calendar_boupdate extends calendar_bo
|
||||
$details['olddate'] = $olddate->format($timeformat);
|
||||
}
|
||||
// generate a personal videoconference url, if we need one
|
||||
if (!empty($event['##videoconference']) && class_exists('EGroupware\\Status\\Videoconference\\Call')
|
||||
&& !EGroupware\Status\Hooks::isVideoconferenceDisabled())
|
||||
if (!empty($event['##videoconference']) && !calendar_hooks::isVideoconferenceDisabled())
|
||||
{
|
||||
$avatar = new Api\Contacts\Photo(is_numeric($userid) ? "account:$userid" :
|
||||
(isset($res_info) && $res_info['type'] === 'c' ? $res_info['res_id'] : $userid),
|
||||
|
@ -904,7 +904,7 @@ END:VALARM';
|
||||
if ($params['data']['type'] == 6)
|
||||
{
|
||||
if (!empty($params['data']['videoconference'])
|
||||
&& $GLOBALS['egw_info']['user']['apps']['status'] && !EGroupware\Status\Hooks::isVideoconferenceDisabled())
|
||||
&& !self::isVideoconferenceDisabled())
|
||||
{
|
||||
return [
|
||||
array(
|
||||
@ -938,6 +938,39 @@ END:VALARM';
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper function to check Status app videoconference status
|
||||
* it makes sure first the Status app is there before calling its method.
|
||||
*
|
||||
* @return false|mixed
|
||||
*/
|
||||
public static function isVideoconferenceDisabled()
|
||||
{
|
||||
if ($GLOBALS['egw_info']['user']['apps']['status'] && class_exists(\EGroupware\Status\Hooks::class)
|
||||
&& method_exists(\EGroupware\Status\Hooks::class, 'isVideoconferenceDisabled'))
|
||||
{
|
||||
return EGroupware\Status\Hooks::isVideoconferenceDisabled();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper function to check Status app videoConference recording status
|
||||
* it makes sure first the Status app is there before calling its method.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isVCRecordingSupported()
|
||||
{
|
||||
if ($GLOBALS['egw_info']['user']['apps']['status'] && class_exists(\EGroupware\Status\Hooks::class)
|
||||
&& method_exists(\EGroupware\Status\Hooks::class, 'isVCRecordingSupported'))
|
||||
{
|
||||
return EGroupware\Status\Hooks::isVCRecordingSupported();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Not part of the class, since config hooks are still using the old style
|
||||
|
@ -1957,7 +1957,7 @@ class calendar_uiforms extends calendar_ui
|
||||
if (!empty($preserved['lock_token'])) $content['lock_token'] = $preserved['lock_token'];
|
||||
|
||||
//Disable videoconference if the module is not enabled
|
||||
$etpl->disableElement('videoconference', $GLOBALS['egw_info']['user']['apps']['status'] && EGroupware\Status\Hooks::isVideoconferenceDisabled());
|
||||
$etpl->disableElement('videoconference', calendar_hooks::isVideoconferenceDisabled());
|
||||
|
||||
// non_interactive==true from $_GET calls immediate save action without displaying the edit form
|
||||
if(isset($_GET['non_interactive']) && (bool)$_GET['non_interactive'] === true)
|
||||
|
@ -1005,15 +1005,15 @@ class calendar_uilist extends calendar_ui
|
||||
'caption' => 'Join',
|
||||
'icon' => 'status/videoconference_join',
|
||||
'onExecute' => 'javaScript:app.calendar.videoConferenceAction',
|
||||
'enabled' => !EGroupware\Status\Hooks::isVideoconferenceDisabled(),
|
||||
'enabled' => !calendar_hooks::isVideoconferenceDisabled(),
|
||||
'allowOnMultiple' => false,
|
||||
],
|
||||
'recordings' => [
|
||||
'caption' => 'Recordings',
|
||||
'icon' => 'status/videoconference_recordings',
|
||||
'onExecute' => 'javaScript:app.calendar.videoConferenceAction',
|
||||
'enabled' => !EGroupware\Status\Hooks::isVideoconferenceDisabled()
|
||||
|| EGroupware\Status\Hooks::isVCRecordingSupported(),
|
||||
'enabled' => !calendar_hooks::isVideoconferenceDisabled()
|
||||
|| calendar_hooks::isVCRecordingSupported(),
|
||||
'allowOnMultiple' => false,
|
||||
]
|
||||
]
|
||||
|
@ -378,7 +378,8 @@ class calendar_uiviews extends calendar_ui
|
||||
);
|
||||
|
||||
// Don't show videoconference action if videoconference is disabled or BBB is not configured
|
||||
if (\EGroupware\Status\Hooks::isVCRecordingSupported() && !EGroupware\Status\Hooks::isVideoconferenceDisabled())
|
||||
if (calendar_hooks::isVCRecordingSupported()
|
||||
&& !calendar_hooks::isVideoconferenceDisabled())
|
||||
{
|
||||
// Add toggle for video calls
|
||||
$status_config = Api\Config::read("status");
|
||||
|
Loading…
Reference in New Issue
Block a user