sync clients have their own place

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2017-05-17 14:22:44 +02:00
parent 8c076e0bda
commit d56e86cfde
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
5 changed files with 152 additions and 56 deletions

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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>

View File

@ -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>