Update admins settings to be more compliant with nextcloud

master
Loic Blot 2017-07-03 21:45:09 +02:00
parent 8f41dd3fd0
commit 229f28b8af
3 changed files with 16 additions and 10 deletions

View File

@ -21,6 +21,6 @@
<ocsid>170605</ocsid> <ocsid>170605</ocsid>
<namespace>Weather</namespace> <namespace>Weather</namespace>
<settings> <settings>
<admin>\OCA\Weather\Settings\Admin</admin> <admin>OCA\Weather\Settings\AdminSettings</admin>
</settings> </settings>
</info> </info>

View File

@ -13,32 +13,34 @@ namespace OCA\Weather\Settings;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N; use OCP\IL10N;
use OCP\IURLGenerator; use OCP\IConfig;
use OCP\Settings\ISettings; use OCP\Settings\ISettings;
class Admin implements ISettings { class AdminSettings implements ISettings {
/** @var IConfig */
private $config;
/** @var IL10N */ /** @var IL10N */
private $l; private $l;
/** @var IURLGenerator */
private $urlGenerator;
/** /**
* @param IL10N $l10n * @param IL10N $l10n
*/ */
public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { public function __construct(IConfig $config, IL10N $l10n) {
$this->l = $l10n; $this->l = $l10n;
$this->urlGenerator = $urlGenerator; $this->config = $config;
} }
/** /**
* @return TemplateResponse * @return TemplateResponse
*/ */
public function getForm() { 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', $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" * keep the server setting at the top, right after "server settings"
*/ */
public function getPriority() { public function getPriority() {
return 0; return 50;
} }
}; };
?> ?>

View File

@ -1,3 +1,7 @@
<?php
/** @var $l \OCP\IL10N */
/** @var $_ array */
?>
<div id="weather" class="section"> <div id="weather" class="section">
<h2><?php p($l->t('Weather')) ?></h2> <h2><?php p($l->t('Weather')) ?></h2>
<p> <p>