Merge pull request #902 from nextcloud/stable10-787

[stable10] Files external settings polish
This commit is contained in:
Lukas Reschke 2016-08-26 14:58:46 +02:00 committed by GitHub
commit 25ed51743a
8 changed files with 64 additions and 32 deletions

View File

@ -3,9 +3,9 @@
<id>files_external</id>
<name>External storage support</name>
<description>
This application enables administrators to configure connections to external storage providers, such as FTP servers, S3 or SWIFT object stores, Google Drive, Dropbox, other ownCloud servers, WebDAV servers, and more. Administrators can choose which types of storage to enable and can mount these storage locations for a user, a group, or the entire system. Users will see a new folder appear in their root ownCloud directory, which they can access and use like any other ownCloud folder. External Storage also allows users to share files stored in these external locations. In these cases, the credentials for the owner of the file are used when the recipient requests the file from external storage, thereby ensuring that the recipient can access the shared file.
This application enables administrators to configure connections to external storage providers, such as FTP servers, S3 or SWIFT object stores, Google Drive, Dropbox, other ownCloud servers, WebDAV servers, and more. Administrators can choose which types of storage to enable and can mount these storage locations for a user, a group, or the entire system. Users will see a new folder appear in their root ownCloud directory, which they can access and use like any other ownCloud folder. External storage also allows users to share files stored in these external locations. In these cases, the credentials for the owner of the file are used when the recipient requests the file from external storage, thereby ensuring that the recipient can access the shared file.
External Storage can be configured using the GUI or at the command line. This second option provides the advanced user with more flexibility for configuring bulk external storage mounts and setting mount priorities. More information is available in the External Storage GUI documentation and the External Storage Configuration File documentation.
External storage can be configured using the GUI or at the command line. This second option provides the advanced user with more flexibility for configuring bulk external storage mounts and setting mount priorities. More information is available in the external storage GUI documentation and the external storage Configuration File documentation.
</description>
<licence>AGPL</licence>
<author>Robin Appelman, Michael Gapczynski, Vincent Petry</author>

View File

@ -1,3 +1,16 @@
#global_credentials {
padding: 0 30px;
margin-bottom: 0px;
}
#files_external {
margin-bottom: 0px;
}
#externalStorage {
margin: 15px 0 20px 0;
}
#externalStorage td.status {
/* overwrite conflicting core styles */
display: table-cell;

View File

@ -945,6 +945,11 @@ MountConfigListView.prototype = _.extend({
$tr.find('.configuration').text(t('files_external', 'Admin defined'));
}
});
var mainForm = $('#files_external');
if (result.length === 0 && mainForm.attr('data-can-create') === 'false') {
mainForm.hide();
$('a[href="#external-storage"]').parent().hide();
}
onCompletion.resolve();
}
});

View File

@ -68,7 +68,18 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
* Register settings templates
*/
public function registerSettings() {
\OCP\App::registerPersonal('files_external', 'personal');
$container = $this->getContainer();
$userSession = $container->getServer()->getUserSession();
if (!$userSession->isLoggedIn()) {
return;
}
$backendService = $container->query('OCA\\Files_External\\Service\\BackendService');
/** @var \OCA\Files_External\Service\UserGlobalStoragesService $userGlobalStoragesService */
$userGlobalStoragesService = $container->query('OCA\Files_External\Service\UserGlobalStoragesService');
if (count($userGlobalStoragesService->getStorages()) > 0 || $backendService->isUserMountingAllowed()) {
\OCP\App::registerPersonal('files_external', 'personal');
}
}
/**

View File

@ -48,7 +48,7 @@ class GlobalAuth extends AuthMechanism {
->setIdentifier('password::global')
->setVisibility(BackendService::VISIBILITY_DEFAULT)
->setScheme(self::SCHEME_PASSWORD)
->setText($l->t('Global Credentials'));
->setText($l->t('Global credentials'));
}
public function getAuth($uid) {

View File

@ -37,7 +37,7 @@ class OwnCloud extends Backend {
->setIdentifier('owncloud')
->addIdentifierAlias('\OC\Files\Storage\OwnCloud') // legacy compat
->setStorageClass('\OCA\Files_External\Lib\Storage\OwnCloud')
->setText($l->t('ownCloud'))
->setText($l->t('Nextcloud'))
->addParameters([
(new DefinitionParameter('host', $l->t('URL'))),
(new DefinitionParameter('root', $l->t('Remote subfolder')))

View File

@ -285,7 +285,7 @@ class OC_Mount_Config {
foreach ($backends as $backend) {
foreach ($backend->checkDependencies() as $dependency) {
if ($message = $dependency->getMessage()) {
$message .= '<br />' . $l->t('<b>Note:</b> ') . $message;
$message .= '<p>' . $message . '</p>';
} else {
$dependencyGroups[$dependency->getDependency()][] = $backend;
}
@ -294,9 +294,9 @@ class OC_Mount_Config {
foreach ($dependencyGroups as $module => $dependants) {
$backends = implode(', ', array_map(function($backend) {
return '<i>' . $backend->getText() . '</i>';
return '"' . $backend->getText() . '"';
}, $dependants));
$message .= '<br />' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends);
$message .= '<p>' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends) . '</p>';
}
return $message;
@ -313,11 +313,11 @@ class OC_Mount_Config {
private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) {
switch (strtolower($module)) {
case 'curl':
return (string)$l->t('<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
return (string)$l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
case 'ftp':
return (string)$l->t('<b>Note:</b> The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
return (string)$l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
default:
return (string)$l->t('<b>Note:</b> "%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', array($module, $backend));
return (string)$l->t('"%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', array($module, $backend));
}
}

View File

@ -4,6 +4,8 @@
use \OCA\Files_External\Lib\DefinitionParameter;
use \OCA\Files_External\Service\BackendService;
$canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting'];
$l->t("Enable encryption");
$l->t("Enable previews");
$l->t("Enable sharing");
@ -84,25 +86,10 @@
}
}
?>
<form autocomplete="false" class="section" action="#"
id="global_credentials">
<h2><?php p($l->t('External Storage')); ?></h2>
<p><?php p($l->t('Global Credentials')); ?></p>
<input type="text" name="username"
autocomplete="false"
value="<?php p($_['globalCredentials']['user']); ?>"
placeholder="<?php p($l->t('Username')) ?>"/>
<input type="password" name="password"
autocomplete="false"
value="<?php p($_['globalCredentials']['password']); ?>"
placeholder="<?php p($l->t('Password')) ?>"/>
<input type="hidden" name="uid"
value="<?php p($_['globalCredentialsUid']); ?>"/>
<input type="submit" value="<?php p($l->t('Save')) ?>"/>
</form>
<form id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
<?php if (isset($_['dependencies']) and ($_['dependencies']<>'')) print_unescaped(''.$_['dependencies'].''); ?>
<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
<h2><?php p($l->t('External storage')); ?></h2>
<?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?>
<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
<thead>
<tr>
@ -118,7 +105,7 @@
</thead>
<tbody>
<tr id="addMountPoint"
<?php if ($_['visibilityType'] === BackendService::VISIBILITY_PERSONAL && $_['allowUserMounting'] === false): ?>
<?php if (!$canCreateMounts): ?>
style="display: none;"
<?php endif; ?>
>
@ -173,10 +160,8 @@
</tr>
</tbody>
</table>
<br />
<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?>
<br />
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox"
value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> />
<label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span>
@ -200,3 +185,21 @@
</p>
<?php endif; ?>
</form>
<?php if ($canCreateMounts): ?>
<form autocomplete="false" class="section" action="#"
id="global_credentials">
<p><?php p($l->t('Global credentials')); ?></p>
<input type="text" name="username"
autocomplete="false"
value="<?php p($_['globalCredentials']['user']); ?>"
placeholder="<?php p($l->t('Username')) ?>"/>
<input type="password" name="password"
autocomplete="false"
value="<?php p($_['globalCredentials']['password']); ?>"
placeholder="<?php p($l->t('Password')) ?>"/>
<input type="hidden" name="uid"
value="<?php p($_['globalCredentialsUid']); ?>"/>
<input type="submit" value="<?php p($l->t('Save')) ?>"/>
</form>
<?php endif; ?>