From 229f28b8af4d42162ca10aa9e66ffe0afe6a8c18 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 3 Jul 2017 21:45:09 +0200 Subject: [PATCH] Update admins settings to be more compliant with nextcloud --- appinfo/info.xml | 2 +- lib/Settings/{Admin.php => AdminSettings.php} | 20 ++++++++++--------- templates/admin.php | 4 ++++ 3 files changed, 16 insertions(+), 10 deletions(-) rename lib/Settings/{Admin.php => AdminSettings.php} (73%) diff --git a/appinfo/info.xml b/appinfo/info.xml index a4e0632..f4a0bb5 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -21,6 +21,6 @@ 170605 Weather - \OCA\Weather\Settings\Admin + OCA\Weather\Settings\AdminSettings diff --git a/lib/Settings/Admin.php b/lib/Settings/AdminSettings.php similarity index 73% rename from lib/Settings/Admin.php rename to lib/Settings/AdminSettings.php index 410091f..93358ce 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/AdminSettings.php @@ -13,32 +13,34 @@ namespace OCA\Weather\Settings; use OCP\AppFramework\Http\TemplateResponse; use OCP\IL10N; -use OCP\IURLGenerator; +use OCP\IConfig; use OCP\Settings\ISettings; -class Admin implements ISettings { +class AdminSettings implements ISettings { + /** @var IConfig */ + private $config; + /** @var IL10N */ private $l; - /** @var IURLGenerator */ - private $urlGenerator; - /** * @param IL10N $l10n */ - public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { + public function __construct(IConfig $config, IL10N $l10n) { $this->l = $l10n; - $this->urlGenerator = $urlGenerator; + $this->config = $config; } /** * @return TemplateResponse */ public function getForm() { - $params = [ + /*$params = [ + "openweathermap_api_key" => $this->config->getAppValue('weather', 'openweathermap_api_key', ''), ]; return new TemplateResponse('weather', 'admin', $params); + */ return new TemplateResponse('weather', 'admin', []); } /** @@ -56,7 +58,7 @@ class Admin implements ISettings { * keep the server setting at the top, right after "server settings" */ public function getPriority() { - return 0; + return 50; } }; ?> diff --git a/templates/admin.php b/templates/admin.php index 5775542..d56b57f 100644 --- a/templates/admin.php +++ b/templates/admin.php @@ -1,3 +1,7 @@ +

t('Weather')) ?>