From 176afc49e19662766785c2ad1ceb276e8764303c Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Fri, 4 Oct 2024 11:52:01 +0200 Subject: [PATCH] update admin settings panel --- solid/appinfo/info.xml | 3 +- solid/lib/Sections/SolidAdmin.php | 32 +++++++++++++++++++++ solid/lib/Settings.php | 32 --------------------- solid/lib/Settings/SolidAdmin.php | 47 +++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 33 deletions(-) create mode 100644 solid/lib/Sections/SolidAdmin.php delete mode 100644 solid/lib/Settings.php create mode 100644 solid/lib/Settings/SolidAdmin.php diff --git a/solid/appinfo/info.xml b/solid/appinfo/info.xml index 3c0abed..83a87d1 100644 --- a/solid/appinfo/info.xml +++ b/solid/appinfo/info.xml @@ -21,7 +21,8 @@ When you do this, the Solid App can store data in your Nextcloud account through - \OCA\Solid\Settings + OCA\Solid\Settings\SolidAdmin + OCA\Solid\Sections\SolidAdmin diff --git a/solid/lib/Sections/SolidAdmin.php b/solid/lib/Sections/SolidAdmin.php new file mode 100644 index 0000000..9d57740 --- /dev/null +++ b/solid/lib/Sections/SolidAdmin.php @@ -0,0 +1,32 @@ +l = $l; + $this->urlGenerator = $urlGenerator; + } + + public function getIcon(): string { + return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg'); + } + + public function getID(): string { + return 'solid'; + } + + public function getName(): string { + return $this->l->t('Solid'); + } + + public function getPriority(): int { + return 98; + } +} \ No newline at end of file diff --git a/solid/lib/Settings.php b/solid/lib/Settings.php deleted file mode 100644 index 7ab6dfb..0000000 --- a/solid/lib/Settings.php +++ /dev/null @@ -1,32 +0,0 @@ -config = $config; - } - - public function getForm() { - $response = new TemplateResponse('solid', 'admin'); - $response->setParams([ - 'privateKey' => $this->config->getPrivateKey(), - 'encryptionKey' => $this->config->getEncryptionKey() - ]); - return $response; - } - - public function getSection() { - return 'security'; - } - - public function getPriority() { - return 50; - } -} diff --git a/solid/lib/Settings/SolidAdmin.php b/solid/lib/Settings/SolidAdmin.php new file mode 100644 index 0000000..3aac4ef --- /dev/null +++ b/solid/lib/Settings/SolidAdmin.php @@ -0,0 +1,47 @@ +config = $config; + $this->l = $l; + $this->serverConfig = $serverConfig; + } + + /** + * @return TemplateResponse + */ + public function getForm() { + $parameters = [ + 'privateKey' => $this->serverConfig->getPrivateKey(), + 'encryptionKey' => $this->serverConfig->getEncryptionKey() + ]; + + return new TemplateResponse('solid', 'admin', $parameters, ''); + } + + public function getSection() { + return 'solid'; // Name of the previously created section. + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 70; + } +}