summaryrefslogtreecommitdiffstats
path: root/lib/private/Settings
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-05-17 14:22:44 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-23 12:36:38 +0200
commitd56e86cfde49910d3af564fb7e6dd553279dfc3c (patch)
treef4147c0a529dad4ff8f99994e4e2d3ecdf1baebf /lib/private/Settings
parent8c076e0bda8f0580929f6f3150b18d9ed710dd87 (diff)
downloadnextcloud-server-d56e86cfde49910d3af564fb7e6dd553279dfc3c.tar.gz
nextcloud-server-d56e86cfde49910d3af564fb7e6dd553279dfc3c.zip
sync clients have their own place
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/Settings')
-rw-r--r--lib/private/Settings/Manager.php8
-rw-r--r--lib/private/Settings/Personal/PersonalInfo.php20
-rw-r--r--lib/private/Settings/Personal/SyncClients.php85
3 files changed, 93 insertions, 20 deletions
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index f914ac634f7..19937bd7afd 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -368,7 +368,7 @@ class Manager implements IManager {
try {
if ($section === 'personal-info') {
/** @var ISettings $form */
- $form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->defaults, $this->l);
+ $form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->l);
$forms[$form->getPriority()] = [$form];
}
if($section === 'sessions') {
@@ -381,6 +381,11 @@ class Manager implements IManager {
$form = new Personal\AppPasswords();
$forms[$form->getPriority()] = [$form];
}
+ if($section === 'sync-clients') {
+ /** @var ISettings $form */
+ $form = new Personal\SyncClients($this->config, $this->defaults);
+ $forms[$form->getPriority()] = [$form];
+ }
} catch (QueryException $e) {
// skip
}
@@ -417,6 +422,7 @@ class Manager implements IManager {
0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
5 => [new Section('sessions', $this->l->t('Sessions'), 0, $this->url->imagePath('settings', 'admin.svg'))],
10 => [new Section('app-passwords', $this->l->t('App passwords'), 0, $this->url->imagePath('settings', 'password.svg'))],
+ 15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))],
];
return $sections;
diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php
index 14c96d2fc4f..ea7cecaa794 100644
--- a/lib/private/Settings/Personal/PersonalInfo.php
+++ b/lib/private/Settings/Personal/PersonalInfo.php
@@ -52,8 +52,7 @@ class PersonalInfo implements ISettings {
'en', 'es', 'fr', 'de', 'de_DE', 'ja', 'ar', 'ru', 'nl', 'it',
'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko'
];
- /** @var \OC_Defaults */
- private $defaults;
+
/** @var IL10N */
private $l;
@@ -63,7 +62,6 @@ class PersonalInfo implements ISettings {
* @param IGroupManager $groupManager
* @param AccountManager $accountManager
* @param IFactory $l10nFactory
- * @param \OC_Defaults $defaults
* @param IL10N $l
*/
public function __construct(
@@ -72,7 +70,6 @@ class PersonalInfo implements ISettings {
IGroupManager $groupManager,
AccountManager $accountManager,
IFactory $l10nFactory,
- \OC_Defaults $defaults,
IL10N $l
) {
$this->config = $config;
@@ -80,7 +77,6 @@ class PersonalInfo implements ISettings {
$this->accountManager = $accountManager;
$this->groupManager = $groupManager;
$this->l10nFactory = $l10nFactory;
- $this->defaults = $defaults;
$this->l = $l;
}
@@ -134,7 +130,6 @@ class PersonalInfo implements ISettings {
'activelanguage' => $activeLanguage,
'commonlanguages' => $commonLanguages,
'languages' => $languages,
- 'clients' => $this->getClientLinks(),
];
@@ -242,17 +237,4 @@ class PersonalInfo implements ISettings {
return [$userLang, $commonLanguages, $languages];
}
- /**
- * returns an array containing links to the various clients
- *
- * @return array
- */
- private function getClientLinks() {
- $clients = [
- 'desktop' => $this->config->getSystemValue('customclient_desktop', $this->defaults->getSyncClientUrl()),
- 'android' => $this->config->getSystemValue('customclient_android', $this->defaults->getAndroidClientUrl()),
- 'ios' => $this->config->getSystemValue('customclient_ios', $this->defaults->getiOSClientUrl())
- ];
- return $clients;
- }
}
diff --git a/lib/private/Settings/Personal/SyncClients.php b/lib/private/Settings/Personal/SyncClients.php
new file mode 100644
index 00000000000..c4efcb63fe5
--- /dev/null
+++ b/lib/private/Settings/Personal/SyncClients.php
@@ -0,0 +1,85 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\Settings\Personal;
+
+
+use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IConfig;
+use OCP\Settings\ISettings;
+
+class SyncClients implements ISettings {
+
+ /** @var IConfig */
+ private $config;
+ /** @var \OC_Defaults */
+ private $defaults;
+
+ public function __construct(IConfig $config, \OC_Defaults $defaults) {
+ $this->config = $config;
+ $this->defaults = $defaults;
+ }
+
+ /**
+ * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
+ * @since 9.1
+ */
+ public function getForm() {
+ $parameters = [ 'clients' => $this->getClientLinks() ];
+ return new TemplateResponse('settings', 'settings/personal/sync-clients', $parameters);
+ }
+
+ /**
+ * @return string the section ID, e.g. 'sharing'
+ * @since 9.1
+ */
+ public function getSection() {
+ return 'sync-clients';
+ }
+
+ /**
+ * @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
+ * @since 9.1
+ */
+ public function getPriority() {
+ return 20;
+ }
+
+ /**
+ * returns an array containing links to the various clients
+ *
+ * @return array
+ */
+ private function getClientLinks() {
+ $clients = [
+ 'desktop' => $this->config->getSystemValue('customclient_desktop', $this->defaults->getSyncClientUrl()),
+ 'android' => $this->config->getSystemValue('customclient_android', $this->defaults->getAndroidClientUrl()),
+ 'ios' => $this->config->getSystemValue('customclient_ios', $this->defaults->getiOSClientUrl())
+ ];
+ return $clients;
+ }
+}