2020-04-26 11:36:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace OCA\BigBlueButton\AppInfo;
|
|
|
|
|
2020-09-23 12:33:09 +02:00
|
|
|
use \OCA\BigBlueButton\Activity\MeetingListener;
|
2020-09-07 22:18:23 +02:00
|
|
|
use \OCA\BigBlueButton\Activity\RoomListener;
|
2020-09-18 17:13:46 +02:00
|
|
|
use \OCA\BigBlueButton\Activity\RoomShareListener;
|
2020-09-22 16:02:18 +02:00
|
|
|
use \OCA\BigBlueButton\Event\MeetingEndedEvent;
|
2020-09-23 12:33:09 +02:00
|
|
|
use \OCA\BigBlueButton\Event\MeetingStartedEvent;
|
2020-09-22 16:02:18 +02:00
|
|
|
use \OCA\BigBlueButton\Event\RecordingReadyEvent;
|
2020-09-23 12:33:09 +02:00
|
|
|
use \OCA\BigBlueButton\Event\RoomCreatedEvent;
|
|
|
|
use \OCA\BigBlueButton\Event\RoomDeletedEvent;
|
|
|
|
use \OCA\BigBlueButton\Event\RoomShareCreatedEvent;
|
|
|
|
use \OCA\BigBlueButton\Event\RoomShareDeletedEvent;
|
2020-09-24 11:05:51 +02:00
|
|
|
use \OCA\BigBlueButton\Listener\UserDeletedListener;
|
2020-09-23 12:33:09 +02:00
|
|
|
use \OCA\BigBlueButton\Middleware\HookMiddleware;
|
|
|
|
use \OCA\BigBlueButton\Middleware\JoinMiddleware;
|
2022-10-16 14:11:28 +02:00
|
|
|
use \OCA\BigBlueButton\Search\Provider;
|
2020-09-23 12:33:09 +02:00
|
|
|
use \OCP\AppFramework\App;
|
|
|
|
use \OCP\IConfig;
|
|
|
|
use \OCP\Settings\IManager as ISettingsManager;
|
2020-09-24 11:05:51 +02:00
|
|
|
use \OCP\User\Events\UserDeletedEvent;
|
2022-10-26 20:31:16 +02:00
|
|
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
|
|
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
|
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
|
|
|
use OCP\INavigationManager;
|
|
|
|
use OCP\IURLGenerator;
|
|
|
|
use OCP\Util;
|
2020-06-04 09:52:49 +02:00
|
|
|
|
2022-10-16 14:11:28 +02:00
|
|
|
class Application extends App implements IBootstrap {
|
2020-09-07 22:18:23 +02:00
|
|
|
public const ID = 'bbb';
|
2022-10-16 14:11:28 +02:00
|
|
|
public const ORDER = 80;
|
2020-09-07 22:18:23 +02:00
|
|
|
|
2020-06-19 09:28:58 +02:00
|
|
|
public function __construct(array $urlParams = []) {
|
2020-09-07 22:18:23 +02:00
|
|
|
parent::__construct(self::ID, $urlParams);
|
2022-10-26 20:31:16 +02:00
|
|
|
}
|
2020-06-04 09:52:49 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
public function register(IRegistrationContext $context): void {
|
|
|
|
if ((@include_once __DIR__ . '/../../vendor/autoload.php') === false) {
|
|
|
|
throw new \Exception('Cannot include autoload. Did you run install dependencies using composer?');
|
|
|
|
}
|
2020-06-04 09:52:49 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
$context->registerEventListener(RoomCreatedEvent::class, RoomListener::class);
|
|
|
|
$context->registerEventListener(RoomDeletedEvent::class, RoomListener::class);
|
2020-09-22 16:02:18 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
$context->registerEventListener(RoomShareCreatedEvent::class, RoomShareListener::class);
|
|
|
|
$context->registerEventListener(RoomShareDeletedEvent::class, RoomShareListener::class);
|
2020-08-26 10:57:31 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
$context->registerEventListener(MeetingStartedEvent::class, MeetingListener::class);
|
|
|
|
$context->registerEventListener(MeetingEndedEvent::class, MeetingListener::class);
|
|
|
|
$context->registerEventListener(RecordingReadyEvent::class, MeetingListener::class);
|
2020-08-26 10:57:31 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
|
2021-02-24 14:36:37 +01:00
|
|
|
|
2022-10-26 20:45:23 +02:00
|
|
|
$context->registerSearchProvider(Provider::class);
|
2022-10-16 14:11:28 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
$context->registerMiddleware(JoinMiddleware::class);
|
|
|
|
$context->registerMiddleware(HookMiddleware::class);
|
2024-10-21 17:54:44 +02:00
|
|
|
|
|
|
|
$context->registerCapability(Capabilities::class);
|
2022-10-16 14:11:28 +02:00
|
|
|
}
|
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
public function boot(IBootContext $context): void {
|
|
|
|
$context->injectFn([$this, 'registerAdminPage']);
|
2022-10-16 14:11:28 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
Util::addScript('bbb', 'filelist');
|
2020-08-26 10:57:31 +02:00
|
|
|
}
|
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
public function registerAdminPage(ISettingsManager $settingsManager, INavigationManager $navigationManager, IURLGenerator $urlGenerator, IConfig $config):void {
|
|
|
|
if ($config->getAppValue(self::ID, 'app.navigation') === 'true') {
|
|
|
|
$this->registerAsNavigationEntry($navigationManager, $urlGenerator, $config);
|
|
|
|
} else {
|
|
|
|
$this->registerAsPersonalSetting($settingsManager);
|
2021-04-19 13:15:37 +02:00
|
|
|
}
|
2022-10-26 20:31:16 +02:00
|
|
|
}
|
2021-04-19 13:15:37 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
private function registerAsPersonalSetting(ISettingsManager $settingsManager): void {
|
2020-09-02 10:07:20 +02:00
|
|
|
$settingsManager->registerSetting(ISettingsManager::KEY_PERSONAL_SETTINGS, \OCA\BigBlueButton\Settings\Personal::class);
|
2020-08-26 10:57:31 +02:00
|
|
|
}
|
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
private function registerAsNavigationEntry(INavigationManager $navigationManager, IURLGenerator $urlGenerator, IConfig $config): void {
|
|
|
|
$name = $config->getAppValue(self::ID, 'app.navigation.name', 'BBB');
|
2020-08-26 10:57:31 +02:00
|
|
|
|
2022-10-26 20:31:16 +02:00
|
|
|
$navigationManager->add(function () use ($urlGenerator, $name) {
|
2020-08-26 10:57:31 +02:00
|
|
|
return [
|
2020-09-07 22:18:23 +02:00
|
|
|
'id' => self::ID,
|
2020-08-26 10:57:31 +02:00
|
|
|
'order' => 80,
|
2022-10-26 20:31:16 +02:00
|
|
|
'href' => $urlGenerator->linkToRoute('bbb.page.index'),
|
|
|
|
'icon' => $urlGenerator->imagePath('bbb', 'app.svg'),
|
2021-02-24 14:36:37 +01:00
|
|
|
'name' => $name,
|
2020-08-26 10:57:31 +02:00
|
|
|
];
|
|
|
|
});
|
2020-06-04 09:52:49 +02:00
|
|
|
}
|
|
|
|
}
|