diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-08-16 20:28:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-16 20:28:16 +0200 |
commit | 2d861c9feaa233b89f4d75e1bf4af6b04b05b081 (patch) | |
tree | cd3590b175e6ee923ef1265e002fd1aaa60504fa /apps/updatenotification | |
parent | 9db189174c26326bbb58d96f614a415cd15542d1 (diff) | |
parent | 4943441bde11e78827fdeb599ca4cd7b783672ce (diff) | |
download | nextcloud-server-2d861c9feaa233b89f4d75e1bf4af6b04b05b081.tar.gz nextcloud-server-2d861c9feaa233b89f4d75e1bf4af6b04b05b081.zip |
Merge pull request #796 from nextcloud/implement_712
Admin page split
Diffstat (limited to 'apps/updatenotification')
-rw-r--r-- | apps/updatenotification/admin.php | 26 | ||||
-rw-r--r-- | apps/updatenotification/appinfo/app.php | 1 | ||||
-rw-r--r-- | apps/updatenotification/appinfo/info.xml | 6 | ||||
-rw-r--r-- | apps/updatenotification/lib/Controller/AdminController.php | 28 | ||||
-rw-r--r-- | apps/updatenotification/templates/admin.php | 4 | ||||
-rw-r--r-- | apps/updatenotification/tests/Controller/AdminControllerTest.php | 8 |
6 files changed, 41 insertions, 32 deletions
diff --git a/apps/updatenotification/admin.php b/apps/updatenotification/admin.php deleted file mode 100644 index 81c7a8fb557..00000000000 --- a/apps/updatenotification/admin.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Lukas Reschke <lukas@statuscode.ch> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * 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, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -$app = new \OCA\UpdateNotification\AppInfo\Application(); -/** @var OCA\UpdateNotification\Controller\AdminController $controller */ -$controller = $app->getContainer()->query('AdminController'); -return $controller->displayPanel()->render(); diff --git a/apps/updatenotification/appinfo/app.php b/apps/updatenotification/appinfo/app.php index 0f49d2525e5..f5bcf345669 100644 --- a/apps/updatenotification/appinfo/app.php +++ b/apps/updatenotification/appinfo/app.php @@ -38,7 +38,6 @@ if(\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { \OCP\Util::addScript('updatenotification', 'notification'); OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'getJavaScript'); } - \OC_App::registerAdmin('updatenotification', 'admin'); } } diff --git a/apps/updatenotification/appinfo/info.xml b/apps/updatenotification/appinfo/info.xml index 4070e90f221..2fe400a3587 100644 --- a/apps/updatenotification/appinfo/info.xml +++ b/apps/updatenotification/appinfo/info.xml @@ -5,7 +5,7 @@ <description>Displays update notifications for ownCloud and provides the SSO for the updater.</description> <licence>AGPL</licence> <author>Lukas Reschke</author> - <version>1.1.0</version> + <version>1.1.1</version> <namespace>UpdateNotification</namespace> <default_enable/> <dependencies> @@ -15,4 +15,8 @@ <background-jobs> <job>OCA\UpdateNotification\Notification\BackgroundJob</job> </background-jobs> + + <settings> + <admin>OCA\UpdateNotification\Controller\AdminController</admin> + </settings> </info> diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php index ada04bdd68c..ebb3fa642f1 100644 --- a/apps/updatenotification/lib/Controller/AdminController.php +++ b/apps/updatenotification/lib/Controller/AdminController.php @@ -34,8 +34,9 @@ use OCP\IDateTimeFormatter; use OCP\IL10N; use OCP\IRequest; use OCP\Security\ISecureRandom; +use OCP\Settings\ISettings; -class AdminController extends Controller { +class AdminController extends Controller implements ISettings { /** @var IJobList */ private $jobList; /** @var ISecureRandom */ @@ -144,4 +145,29 @@ class AdminController extends Controller { return new DataResponse($newToken); } + + /** + * @return TemplateResponse returns the instance with all parameters set, ready to be rendered + */ + public function getForm() { + return $this->displayPanel(); + } + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection() { + return 'server'; + } + + /** + * @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 1; + } } diff --git a/apps/updatenotification/templates/admin.php b/apps/updatenotification/templates/admin.php index b1cc76534e3..3c3d6cbd4cd 100644 --- a/apps/updatenotification/templates/admin.php +++ b/apps/updatenotification/templates/admin.php @@ -13,9 +13,7 @@ /** @var string $currentChannel */ $currentChannel = $_['currentChannel']; ?> -<form id="oca_updatenotification_section" class="section"> - <h2><?php p($l->t('Updater')); ?></h2> - +<form id="oca_updatenotification_section" class="followupsection"> <?php if($isNewVersionAvailable === true): ?> <strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong> <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>"> diff --git a/apps/updatenotification/tests/Controller/AdminControllerTest.php b/apps/updatenotification/tests/Controller/AdminControllerTest.php index 20b0c534c46..336edffc957 100644 --- a/apps/updatenotification/tests/Controller/AdminControllerTest.php +++ b/apps/updatenotification/tests/Controller/AdminControllerTest.php @@ -197,4 +197,12 @@ class AdminControllerTest extends TestCase { $expected = new DataResponse('MyGeneratedToken'); $this->assertEquals($expected, $this->adminController->createCredentials()); } + + public function testGetSection() { + $this->assertSame('server', $this->adminController->getSection()); + } + + public function testGetPriority() { + $this->assertSame(1, $this->adminController->getPriority()); + } } |