diff --git a/appinfo/info.xml b/appinfo/info.xml index 55d3b0a9..4dc27130 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -42,5 +42,6 @@ This app allows users to register a new account. OCA\Registration\Settings\RegistrationSettings + OCA\Registration\Settings\RegistrationSettingsSection diff --git a/img/app-dark.svg b/img/app-dark.svg new file mode 100644 index 00000000..2589e24c --- /dev/null +++ b/img/app-dark.svg @@ -0,0 +1 @@ + diff --git a/img/app.svg b/img/app.svg index 4c8bb1b7..c0062b9b 100644 --- a/img/app.svg +++ b/img/app.svg @@ -1,7 +1 @@ - - - - - - - \ No newline at end of file + diff --git a/lib/Settings/RegistrationSettings.php b/lib/Settings/RegistrationSettings.php index 5414213e..2794281a 100644 --- a/lib/Settings/RegistrationSettings.php +++ b/lib/Settings/RegistrationSettings.php @@ -25,6 +25,7 @@ namespace OCA\Registration\Settings; +use OCA\Registration\AppInfo\Application; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IGroupManager; @@ -44,7 +45,6 @@ public function __construct(string $appName, $this->appName = $appName; $this->config = $config; $this->groupManager = $groupManager; - $this->appName = $appName; } public function getForm(): TemplateResponse { @@ -86,7 +86,7 @@ public function getForm(): TemplateResponse { } public function getSection(): string { - return 'additional'; + return Application::APP_ID; } public function getPriority(): int { diff --git a/lib/Settings/RegistrationSettingsSection.php b/lib/Settings/RegistrationSettingsSection.php new file mode 100644 index 00000000..36343af0 --- /dev/null +++ b/lib/Settings/RegistrationSettingsSection.php @@ -0,0 +1,77 @@ + + * + * @author Jonas Rittershofer + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Registration\Settings; + +use OCA\Registration\AppInfo\Application; +use OCP\IL10N; +use OCP\IURLGenerator; +use OCP\Settings\IIconSection; + +class RegistrationSettingsSection implements IIconSection { + /** @var IL10N */ + private $l10n; + + /** @var IURLGenerator */ + private $urlGenerator; + + public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { + $this->l10n = $l10n; + $this->urlGenerator = $urlGenerator; + } + + /** + * Section ID to be set in Settings + * @return string + */ + public function getID(): string { + return Application::APP_ID; + } + + /** + * Section Name to be displayed + * @return string + */ + public function getName(): string { + return $this->l10n->t('Registration'); + } + + /** + * Return Priority of section 0-100 + * @return int + */ + public function getPriority(): int { + return 80; + } + + /** + * Pass the relative path to the icon + * @return string + */ + public function getIcon(): string { + return $this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg'); + } +}