diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-05-17 14:22:44 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-06-23 12:36:38 +0200 |
commit | d56e86cfde49910d3af564fb7e6dd553279dfc3c (patch) | |
tree | f4147c0a529dad4ff8f99994e4e2d3ecdf1baebf | |
parent | 8c076e0bda8f0580929f6f3150b18d9ed710dd87 (diff) | |
download | nextcloud-server-d56e86cfde49910d3af564fb7e6dd553279dfc3c.tar.gz nextcloud-server-d56e86cfde49910d3af564fb7e6dd553279dfc3c.zip |
sync clients have their own place
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r-- | lib/private/Settings/Manager.php | 8 | ||||
-rw-r--r-- | lib/private/Settings/Personal/PersonalInfo.php | 20 | ||||
-rw-r--r-- | lib/private/Settings/Personal/SyncClients.php | 85 | ||||
-rw-r--r-- | settings/templates/settings/personal/personal.info.php | 36 | ||||
-rw-r--r-- | settings/templates/settings/personal/sync-clients.php | 59 |
5 files changed, 152 insertions, 56 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; + } +} diff --git a/settings/templates/settings/personal/personal.info.php b/settings/templates/settings/personal/personal.info.php index 0e628e7e61c..9fe0e546db8 100644 --- a/settings/templates/settings/personal/personal.info.php +++ b/settings/templates/settings/personal/personal.info.php @@ -315,39 +315,3 @@ if($_['passwordChangeSupported']) { <em><?php p($l->t('Help translate'));?></em> </a> </form> - - -<div id="clientsbox" class="section clientsbox"> - <h2><?php p($l->t('Get the apps to sync your files'));?></h2> - <a href="<?php p($_['clients']['desktop']); ?>" rel="noreferrer" target="_blank"> - <img src="<?php print_unescaped(image_path('core', 'desktopapp.svg')); ?>" - alt="<?php p($l->t('Desktop client'));?>" /> - </a> - <a href="<?php p($_['clients']['android']); ?>" rel="noreferrer" target="_blank"> - <img src="<?php print_unescaped(image_path('core', 'googleplay.png')); ?>" - alt="<?php p($l->t('Android app'));?>" /> - </a> - <a href="<?php p($_['clients']['ios']); ?>" rel="noreferrer" target="_blank"> - <img src="<?php print_unescaped(image_path('core', 'appstore.svg')); ?>" - alt="<?php p($l->t('iOS app'));?>" /> - </a> - - <p> - <?php print_unescaped(str_replace( - [ - '{contributeopen}', - '{linkclose}', - ], - [ - '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">', - '</a>', - ], - $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> - </p> - - <?php if(OC_APP::isEnabled('firstrunwizard')) {?> - <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again'));?></a></p> - <?php }?> -</div> - - diff --git a/settings/templates/settings/personal/sync-clients.php b/settings/templates/settings/personal/sync-clients.php new file mode 100644 index 00000000000..ac76ef4f592 --- /dev/null +++ b/settings/templates/settings/personal/sync-clients.php @@ -0,0 +1,59 @@ +<?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/>. + * + */ + +/** @var array $_ */ + +?> + +<div id="clientsbox" class="section clientsbox"> + <h2><?php p($l->t('Get the apps to sync your files'));?></h2> + <a href="<?php p($_['clients']['desktop']); ?>" rel="noreferrer" target="_blank"> + <img src="<?php print_unescaped(image_path('core', 'desktopapp.svg')); ?>" + alt="<?php p($l->t('Desktop client'));?>" /> + </a> + <a href="<?php p($_['clients']['android']); ?>" rel="noreferrer" target="_blank"> + <img src="<?php print_unescaped(image_path('core', 'googleplay.png')); ?>" + alt="<?php p($l->t('Android app'));?>" /> + </a> + <a href="<?php p($_['clients']['ios']); ?>" rel="noreferrer" target="_blank"> + <img src="<?php print_unescaped(image_path('core', 'appstore.svg')); ?>" + alt="<?php p($l->t('iOS app'));?>" /> + </a> + + <p> + <?php print_unescaped(str_replace( + [ + '{contributeopen}', + '{linkclose}', + ], + [ + '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">', + '</a>', + ], + $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> + </p> + + <?php if(OC_APP::isEnabled('firstrunwizard')) {?> + <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again'));?></a></p> + <?php }?> +</div> |