diff --git a/appinfo/info.xml b/appinfo/info.xml index afbd31b..a83cc12 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -36,7 +36,5 @@ Developer wanted! If you have time it would be awesome if you could help to enha OCA\BigBlueButton\Settings\Admin - OCA\BigBlueButton\Settings\Personal - OCA\BigBlueButton\Settings\Section diff --git a/appinfo/routes.php b/appinfo/routes.php index 73b137f..eb31180 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -6,6 +6,7 @@ return [ 'roomShare' => ['url' => '/roomShares'], ], 'routes' => [ + ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], ['name' => 'server#records', 'url' => '/server/{roomUid}/records', 'verb' => 'GET'], ['name' => 'server#check', 'url' => '/server/check', 'verb' => 'POST'], ['name' => 'server#version', 'url' => '/server/version', 'verb' => 'GET'], diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index b5d8d7c..2ae43a9 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -2,6 +2,7 @@ namespace OCA\BigBlueButton\AppInfo; +use \OCP\IConfig; use \OCP\AppFramework\App; use \OCA\BigBlueButton\Middleware\JoinMiddleware; @@ -16,5 +17,34 @@ class Application extends App { $container = $this->getContainer(); $container->registerMiddleWare(JoinMiddleware::class); + + $config = $container->query(IConfig::class); + + if ($config->getAppValue('bbb', 'app.navigation') === 'true') { + $this->registerAsNavigationEntry(); + } else { + $this->registerAsPersonalSetting(); + } + } + + private function registerAsPersonalSetting() { + $settingsManager = $this->getContainer()->getServer()->getSettingsManager(); + + $settingsManager->registerSection('personal', \OCA\BigBlueButton\Settings\Section::class); + $settingsManager->registerSetting('personal', \OCA\BigBlueButton\Settings\Personal::class); + } + + private function registerAsNavigationEntry() { + $server = $this->getContainer()->getServer(); + + $server->getNavigationManager()->add(function () use ($server) { + return [ + 'id' => 'bbb', + 'order' => 80, + 'href' => $server->getURLGenerator()->linkToRoute('bbb.page.index'), + 'icon' => $server->getURLGenerator()->imagePath('bbb', 'app.svg'), + 'name' => 'BigBlueButton', + ]; + }); } } diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php new file mode 100644 index 0000000..c42440e --- /dev/null +++ b/lib/Controller/PageController.php @@ -0,0 +1,21 @@ +appName, 'manager'); + } +} diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index f9a450d..2ffb63f 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -27,6 +27,7 @@ class Admin implements ISettings { $parameters = [ 'api.url' => $this->config->getAppValue('bbb', 'api.url'), 'api.secret' => $this->config->getAppValue('bbb', 'api.secret'), + 'app.navigation' => $this->config->getAppValue('bbb', 'app.navigation') === 'true' ? 'checked' : '', ]; return new TemplateResponse('bbb', 'admin', $parameters); diff --git a/templates/admin.php b/templates/admin.php index c5d6c20..f3a28dd 100644 --- a/templates/admin.php +++ b/templates/admin.php @@ -17,4 +17,9 @@ script('bbb', 'admin');
+ +

+ > + +

diff --git a/ts/Manager/App.scss b/ts/Manager/App.scss index 84bf883..3a9c12a 100644 --- a/ts/Manager/App.scss +++ b/ts/Manager/App.scss @@ -19,6 +19,10 @@ border-radius: 50%; } +#bbb-root { + width: 100%; +} + #bbb-warning { padding: 1em; background-color: rgb(255, 255, 123); @@ -53,6 +57,10 @@ p { margin-bottom: 1em; } + + form { + margin-bottom: 2em; + } } #bbb-react-root { diff --git a/ts/admin.ts b/ts/admin.ts index 714e689..17826a1 100644 --- a/ts/admin.ts +++ b/ts/admin.ts @@ -71,4 +71,12 @@ $(() => { $('#bbb-result').append(warningElement); }); }); + + $('#bbb-settings [name="app.navigation"]').change((ev) => { + ev.preventDefault(); + + console.log('checkbox changed to', ev.target.checked); + + OCP.AppConfig.setValue('bbb', 'app.navigation', ev.target.checked); + }); });