Merge pull request #13364 from is-apps/files_external_cleanup

Clean up files_external
This commit is contained in:
Vincent Petry 2015-02-09 13:20:42 +01:00
commit 2bb65dd9b1
3 changed files with 82 additions and 57 deletions

View File

@ -26,39 +26,41 @@ if (OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes') == '
OCP\App::registerPersonal('files_external', 'personal'); OCP\App::registerPersonal('files_external', 'personal');
} }
\OCA\Files\App::getNavigationManager()->add( \OCA\Files\App::getNavigationManager()->add([
array( "id" => 'extstoragemounts',
"id" => 'extstoragemounts', "appname" => 'files_external',
"appname" => 'files_external', "script" => 'list.php',
"script" => 'list.php', "order" => 30,
"order" => 30, "name" => $l->t('External storage')
"name" => $l->t('External storage') ]);
)
);
// connecting hooks // connecting hooks
OCP\Util::connectHook('OC_Filesystem', 'post_initMountPoints', '\OC_Mount_Config', 'initMountPointsHook'); OCP\Util::connectHook('OC_Filesystem', 'post_initMountPoints', '\OC_Mount_Config', 'initMountPointsHook');
OCP\Util::connectHook('OC_User', 'post_login', 'OC\Files\Storage\SMB_OC', 'login'); OCP\Util::connectHook('OC_User', 'post_login', 'OC\Files\Storage\SMB_OC', 'login');
OC_Mount_Config::registerBackend('\OC\Files\Storage\Local', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\Local', [
'backend' => (string)$l->t('Local'), 'backend' => (string)$l->t('Local'),
'priority' => 150, 'priority' => 150,
'configuration' => array( 'configuration' => [
'datadir' => (string)$l->t('Location')))); 'datadir' => (string)$l->t('Location')
],
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', [
'backend' => (string)$l->t('Amazon S3'), 'backend' => (string)$l->t('Amazon S3'),
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'key' => (string)$l->t('Key'), 'key' => (string)$l->t('Key'),
'secret' => '*'.$l->t('Secret'), 'secret' => '*'.$l->t('Secret'),
'bucket' => (string)$l->t('Bucket')), 'bucket' => (string)$l->t('Bucket'),
'has_dependencies' => true)); ],
'has_dependencies' => true,
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', [
'backend' => (string)$l->t('Amazon S3 and compliant'), 'backend' => (string)$l->t('Amazon S3 and compliant'),
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'key' => (string)$l->t('Access Key'), 'key' => (string)$l->t('Access Key'),
'secret' => '*'.$l->t('Secret Key'), 'secret' => '*'.$l->t('Secret Key'),
'bucket' => (string)$l->t('Bucket'), 'bucket' => (string)$l->t('Bucket'),
@ -66,48 +68,56 @@ OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array(
'port' => '&'.$l->t('Port'), 'port' => '&'.$l->t('Port'),
'region' => '&'.$l->t('Region'), 'region' => '&'.$l->t('Region'),
'use_ssl' => '!'.$l->t('Enable SSL'), 'use_ssl' => '!'.$l->t('Enable SSL'),
'use_path_style' => '!'.$l->t('Enable Path Style')), 'use_path_style' => '!'.$l->t('Enable Path Style')
'has_dependencies' => true)); ],
'has_dependencies' => true,
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\Dropbox', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\Dropbox', [
'backend' => 'Dropbox', 'backend' => 'Dropbox',
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'configured' => '#configured', 'configured' => '#configured',
'app_key' => (string)$l->t('App key'), 'app_key' => (string)$l->t('App key'),
'app_secret' => '*'.$l->t('App secret'), 'app_secret' => '*'.$l->t('App secret'),
'token' => '#token', 'token' => '#token',
'token_secret' => '#token_secret'), 'token_secret' => '#token_secret'
],
'custom' => 'dropbox', 'custom' => 'dropbox',
'has_dependencies' => true)); 'has_dependencies' => true,
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\FTP', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\FTP', [
'backend' => 'FTP', 'backend' => 'FTP',
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'host' => (string)$l->t('Host'), 'host' => (string)$l->t('Host'),
'user' => (string)$l->t('Username'), 'user' => (string)$l->t('Username'),
'password' => '*'.$l->t('Password'), 'password' => '*'.$l->t('Password'),
'root' => '&'.$l->t('Remote subfolder'), 'root' => '&'.$l->t('Remote subfolder'),
'secure' => '!'.$l->t('Secure ftps://')), 'secure' => '!'.$l->t('Secure ftps://')
'has_dependencies' => true)); ],
'has_dependencies' => true,
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\Google', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\Google', [
'backend' => 'Google Drive', 'backend' => 'Google Drive',
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'configured' => '#configured', 'configured' => '#configured',
'client_id' => (string)$l->t('Client ID'), 'client_id' => (string)$l->t('Client ID'),
'client_secret' => '*'.$l->t('Client secret'), 'client_secret' => '*'.$l->t('Client secret'),
'token' => '#token'), 'token' => '#token',
],
'custom' => 'google', 'custom' => 'google',
'has_dependencies' => true)); 'has_dependencies' => true,
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\Swift', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\Swift', [
'backend' => (string)$l->t('OpenStack Object Storage'), 'backend' => (string)$l->t('OpenStack Object Storage'),
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'user' => (string)$l->t('Username'), 'user' => (string)$l->t('Username'),
'bucket' => (string)$l->t('Bucket'), 'bucket' => (string)$l->t('Bucket'),
'region' => '&'.$l->t('Region (optional for OpenStack Object Storage)'), 'region' => '&'.$l->t('Region (optional for OpenStack Object Storage)'),
@ -117,63 +127,74 @@ OC_Mount_Config::registerBackend('\OC\Files\Storage\Swift', array(
'service_name' => '&'.$l->t('Service Name (required for OpenStack Object Storage)'), 'service_name' => '&'.$l->t('Service Name (required for OpenStack Object Storage)'),
'url' => '&'.$l->t('URL of identity endpoint (required for OpenStack Object Storage)'), 'url' => '&'.$l->t('URL of identity endpoint (required for OpenStack Object Storage)'),
'timeout' => '&'.$l->t('Timeout of HTTP requests in seconds'), 'timeout' => '&'.$l->t('Timeout of HTTP requests in seconds'),
), ],
'has_dependencies' => true)); 'has_dependencies' => true,
]);
if (!OC_Util::runningOnWindows()) { if (!OC_Util::runningOnWindows()) {
OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB', [
'backend' => 'SMB / CIFS', 'backend' => 'SMB / CIFS',
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'host' => (string)$l->t('Host'), 'host' => (string)$l->t('Host'),
'user' => (string)$l->t('Username'), 'user' => (string)$l->t('Username'),
'password' => '*'.$l->t('Password'), 'password' => '*'.$l->t('Password'),
'share' => (string)$l->t('Share'), 'share' => (string)$l->t('Share'),
'root' => '&'.$l->t('Remote subfolder')), 'root' => '&'.$l->t('Remote subfolder'),
'has_dependencies' => true)); ],
'has_dependencies' => true,
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB_OC', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB_OC', [
'backend' => (string)$l->t('SMB / CIFS using OC login'), 'backend' => (string)$l->t('SMB / CIFS using OC login'),
'priority' => 90, 'priority' => 90,
'configuration' => array( 'configuration' => [
'host' => (string)$l->t('Host'), 'host' => (string)$l->t('Host'),
'username_as_share' => '!'.$l->t('Username as share'), 'username_as_share' => '!'.$l->t('Username as share'),
'share' => '&'.$l->t('Share'), 'share' => '&'.$l->t('Share'),
'root' => '&'.$l->t('Remote subfolder')), 'root' => '&'.$l->t('Remote subfolder'),
'has_dependencies' => true)); ],
'has_dependencies' => true,
]);
} }
OC_Mount_Config::registerBackend('\OC\Files\Storage\DAV', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\DAV', [
'backend' => 'WebDAV', 'backend' => 'WebDAV',
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'host' => (string)$l->t('URL'), 'host' => (string)$l->t('URL'),
'user' => (string)$l->t('Username'), 'user' => (string)$l->t('Username'),
'password' => '*'.$l->t('Password'), 'password' => '*'.$l->t('Password'),
'root' => '&'.$l->t('Remote subfolder'), 'root' => '&'.$l->t('Remote subfolder'),
'secure' => '!'.$l->t('Secure https://')), 'secure' => '!'.$l->t('Secure https://'),
'has_dependencies' => true)); ],
'has_dependencies' => true,
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\OwnCloud', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\OwnCloud', [
'backend' => 'ownCloud', 'backend' => 'ownCloud',
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'host' => (string)$l->t('URL'), 'host' => (string)$l->t('URL'),
'user' => (string)$l->t('Username'), 'user' => (string)$l->t('Username'),
'password' => '*'.$l->t('Password'), 'password' => '*'.$l->t('Password'),
'root' => '&'.$l->t('Remote subfolder'), 'root' => '&'.$l->t('Remote subfolder'),
'secure' => '!'.$l->t('Secure https://')))); 'secure' => '!'.$l->t('Secure https://'),
],
]);
OC_Mount_Config::registerBackend('\OC\Files\Storage\SFTP', array( OC_Mount_Config::registerBackend('\OC\Files\Storage\SFTP', [
'backend' => 'SFTP', 'backend' => 'SFTP',
'priority' => 100, 'priority' => 100,
'configuration' => array( 'configuration' => [
'host' => (string)$l->t('Host'), 'host' => (string)$l->t('Host'),
'user' => (string)$l->t('Username'), 'user' => (string)$l->t('Username'),
'password' => '*'.$l->t('Password'), 'password' => '*'.$l->t('Password'),
'root' => '&'.$l->t('Remote subfolder')))); 'root' => '&'.$l->t('Remote subfolder'),
],
]);
$mountProvider = new \OCA\Files_External\Config\ConfigAdapter(); $mountProvider = new \OCA\Files_External\Config\ConfigAdapter();
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider); \OC::$server->getMountProviderCollection()->registerProvider($mountProvider);

View File

@ -65,7 +65,10 @@ $(document).ready(function() {
|| $(tr).find('.chzn-select').val() != null)) || $(tr).find('.chzn-select').val() != null))
{ {
if ($(tr).find('.dropbox').length == 0) { if ($(tr).find('.dropbox').length == 0) {
$(config).append('<a class="button dropbox">'+t('files_external', 'Grant access')+'</a>'); $(config).append($(document.createElement('input'))
.addClass('button dropbox')
.attr('type', 'button')
.attr('value', t('files_external', 'Grant access')));
} else { } else {
$(tr).find('.dropbox').show(); $(tr).find('.dropbox').show();
} }

View File

@ -85,8 +85,9 @@ $(document).ready(function() {
|| $(tr).find('.chzn-select').val() != null)) || $(tr).find('.chzn-select').val() != null))
{ {
if ($(tr).find('.google').length == 0) { if ($(tr).find('.google').length == 0) {
$(config).append($('<a/>').addClass('button google') $(config).append($(document.createElement('input')).addClass('button google')
.text(t('files_external', 'Grant access'))); .attr('type', 'button')
.attr('value', t('files_external', 'Grant access')));
} else { } else {
$(tr).find('.google').show(); $(tr).find('.google').show();
} }