diff --git a/src/Configuration/ElFinderConfigurationReader.php b/src/Configuration/ElFinderConfigurationReader.php
index 0d6749e..44d2e85 100644
--- a/src/Configuration/ElFinderConfigurationReader.php
+++ b/src/Configuration/ElFinderConfigurationReader.php
@@ -339,13 +339,46 @@ private function configureDriver(array $parameter)
$settings['path'] = $parameter['ftp_settings']['path'];
break;
- case 'dropbox':
- $settings['consumerKey'] = $parameter['dropbox_settings']['app_key'] ?: $parameter['dropbox_settings']['consumer_key'];
- $settings['consumerSecret'] = $parameter['dropbox_settings']['app_secret'] ?: $parameter['dropbox_settings']['consumer_secret'];
- $settings['accessToken'] = $parameter['dropbox_settings']['access_token'];
- $settings['accessTokenSecret'] = $parameter['dropbox_settings']['access_token_secret'];
- $settings['dropboxUid'] = $parameter['dropbox_settings']['dropbox_uid'];
- $settings['metaCachePath'] = $parameter['dropbox_settings']['meta_cache_path'];
+ case 'dropbox2':
+ $settings['app_key'] = $parameter['dropbox2_settings']['app_key'];
+ $settings['app_secret'] = $parameter['dropbox2_settings']['app_secret'];
+ $settings['access_token'] = $parameter['dropbox2_settings']['access_token'];
+ $settings['aliasFormat'] = $parameter['dropbox2_settings']['aliasFormat'];
+ $settings['path'] = $parameter['dropbox2_settings']['path'];
+ $settings['separator'] = $parameter['dropbox2_settings']['separator'];
+ $settings['acceptedName'] = $parameter['dropbox2_settings']['acceptedName'];
+ $settings['rootCssClass'] = $parameter['dropbox2_settings']['rootCssClass'];
+ $settings['publishPermission'] = $parameter['dropbox2_settings']['publishPermission'];
+ $settings['getThumbSize'] = $parameter['dropbox2_settings']['getThumbSize'];
+
+ break;
+ case 'onedrive':
+ $settings['client_id'] = $parameter['onedrive_settings']['client_id'];
+ $settings['client_secret'] = $parameter['onedrive_settings']['client_secret'];
+ $settings['accessToken'] = $parameter['onedrive_settings']['accessToken'];
+ $settings['root'] = $parameter['onedrive_settings']['root'];
+ $settings['OneDriveApiClient'] = $parameter['onedrive_settings']['OneDriveApiClient'];
+ $settings['path'] = $parameter['onedrive_settings']['path'];
+ $settings['separator'] = $parameter['onedrive_settings']['separator'];
+ $settings['tmbPath'] = $parameter['onedrive_settings']['tmbPath'];
+ $settings['tmbURL'] = $parameter['onedrive_settings']['tmbURL'];
+ $settings['tmpPath'] = $parameter['onedrive_settings']['tmpPath'];
+ $settings['acceptedName'] = $parameter['onedrive_settings']['acceptedName'];
+ $settings['rootCssClass'] = $parameter['onedrive_settings']['rootCssClass'];
+ $settings['useApiThumbnail'] = $parameter['onedrive_settings']['useApiThumbnail'];
+
+ break;
+ case 'box':
+ $settings['client_id'] = $parameter['box_settings']['client_id'];
+ $settings['client_secret'] = $parameter['box_settings']['client_secret'];
+ $settings['accessToken'] = $parameter['box_settings']['accessToken'];
+ $settings['root'] = $parameter['box_settings']['root'];
+ $settings['path'] = $parameter['box_settings']['path'];
+ $settings['separator'] = $parameter['box_settings']['separator'];
+ $settings['tmbPath'] = $parameter['box_settings']['tmbPath'];
+ $settings['tmbURL'] = $parameter['box_settings']['tmbURL'];
+ $settings['acceptedName'] = $parameter['box_settings']['acceptedName'];
+ $settings['rootCssClass'] = $parameter['box_settings']['rootCssClass'];
break;
case 's3':
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php
index c985f75..9c3f4cb 100644
--- a/src/DependencyInjection/Configuration.php
+++ b/src/DependencyInjection/Configuration.php
@@ -219,21 +219,56 @@ public function getConfigTreeBuilder()
->scalarNode('glide_key')->defaultValue('')->end()
->append($this->createPluginsNode())
->append($this->createDriverOptionsNode())
- ->arrayNode('dropbox_settings')
+ ->arrayNode('dropbox2_settings')
->canBeEnabled()
->children()
- ->scalarNode('consumer_key')
- ->setDeprecated('You should use "app_key" to make the dropbox driver work prepoerly')
- ->end()
- ->scalarNode('consumer_secret')
- ->setDeprecated('You should use "app_secret" to make the dropbox driver work prepoerly')
- ->end()
->scalarNode('app_key')->end()
->scalarNode('app_secret')->end()
->scalarNode('access_token')->end()
- ->scalarNode('access_token_secret')->end()
- ->scalarNode('dropbox_uid')->end()
- ->scalarNode('meta_cache_path')->end()
+ ->scalarNode('aliasFormat')->defaultValue('%s@Dropbox')->end()
+ ->scalarNode('path')->defaultValue('/')->end()
+ ->scalarNode('separator')->defaultValue('/')->end()
+ ->scalarNode('acceptedName')->defaultValue('%s@Dropbox')->end()
+ ->scalarNode('rootCssClass')->defaultValue('elfinder-navbar-root-dropbox')->end()
+ ->arrayNode('publishPermission')
+ ->children()
+ ->scalarNode('requested_visibility')->defaultValue('public')->end()
+ ->end()
+ ->end()
+ ->scalarNode('getThumbSize')->defaultValue('medium')->end()
+ ->end()
+ ->end()
+ ->arrayNode('box_settings')
+ ->canBeEnabled()
+ ->children()
+ ->scalarNode('client_id')->end()
+ ->scalarNode('client_secret')->end()
+ ->scalarNode('accessToken')->end()
+ ->scalarNode('root')->defaultValue('Box.com')->end()
+ ->scalarNode('path')->defaultValue('/')->end()
+ ->scalarNode('separator')->defaultValue('/')->end()
+ ->scalarNode('tmbPath')->defaultValue('')->end()
+ ->scalarNode('tmbURL')->defaultValue('')->end()
+ ->scalarNode('tmpPath')->defaultValue('')->end()
+ ->scalarNode('acceptedName')->defaultValue('#^[^/\\?*:|"<>]*[^./\\?*:|"<>]$#')->end()
+ ->scalarNode('rootCssClass')->defaultValue('elfinder-navbar-root-box')->end()
+ ->end()
+ ->end()
+ ->arrayNode('onedrive_settings')
+ ->canBeEnabled()
+ ->children()
+ ->scalarNode('client_id')->end()
+ ->scalarNode('client_secret')->end()
+ ->scalarNode('accessToken')->end()
+ ->scalarNode('root')->defaultValue('OneDrive.com')->end()
+ ->scalarNode('OneDriveApiClient')->defaultValue('')->end()
+ ->scalarNode('path')->defaultValue('/')->end()
+ ->scalarNode('separator')->defaultValue('/')->end()
+ ->scalarNode('tmbPath')->defaultValue('')->end()
+ ->scalarNode('tmbURL')->defaultValue('')->end()
+ ->scalarNode('acceptedName')->defaultValue('#^[^/\\?*:|"<>]*[^./\\?*:|"<>]$#')->end()
+ ->scalarNode('rootCssClass')->defaultValue('elfinder-navbar-root-onedrive')->end()
+ ->booleanNode('useApiThumbnail')->defaultTrue()->end()
->end()
->end()
->arrayNode('ftp_settings')
diff --git a/tests/DependencyInjection/ConfigurationLoadTest.php b/tests/DependencyInjection/ConfigurationLoadTest.php
index 8f4c8af..8dedb16 100644
--- a/tests/DependencyInjection/ConfigurationLoadTest.php
+++ b/tests/DependencyInjection/ConfigurationLoadTest.php
@@ -8,8 +8,6 @@
/**
* Class ConfigurationLoadTest.
- *
- * @package FM\ElfinderBundle\Tests\DependencyInjection
*/
class ConfigurationLoadTest extends AbstractExtensionConfigurationTestCase
{
@@ -108,22 +106,55 @@ public function testSupportsAllConfigFormats($path)
'create' => array(),
'extract' => array(),
),
- 'glide_url' => '',
- 'glide_key' => '',
- 'alias' => 'foo',
- 'tree_deep' => 1,
- 'upload_allow' => array('image/png', 'image/jpg', 'image/jpeg'),
- 'upload_order' => array('deny', 'allow'),
- 'defaults' => array('read' => true, 'write' => true),
- 'upload_deny' => array('all'),
- 'upload_max_size' => 0,
- 'dropbox_settings' => array(
- 'consumer_key' => 'some_consumer',
- 'consumer_secret' => 'con$umer',
+ 'glide_url' => '',
+ 'glide_key' => '',
+ 'alias' => 'foo',
+ 'tree_deep' => 1,
+ 'upload_allow' => array('image/png', 'image/jpg', 'image/jpeg'),
+ 'upload_order' => array('deny', 'allow'),
+ 'defaults' => array('read' => true, 'write' => true),
+ 'upload_deny' => array('all'),
+ 'upload_max_size' => 0,
+ 'dropbox2_settings' => array(
+ 'aliasFormat' => '%s@Dropbox',
+ 'path' => '/',
+ 'separator' => '/',
+ 'acceptedName' => '%s@Dropbox',
+ 'rootCssClass' => 'elfinder-navbar-root-dropbox',
+ 'getThumbSize' => 'medium',
'app_key' => 'some_consumer',
'app_secret' => 'con$umer',
'enabled' => true,
),
+ 'box_settings' => array(
+ 'client_id' => 'some_consumer',
+ 'client_secret' => 'con$umer',
+ 'accessToken' => 'token',
+ 'root' => 'Box.com',
+ 'path' => '/',
+ 'separator' => '/',
+ 'tmbPath' => '',
+ 'tmbURL' => '',
+ 'tmpPath' => '',
+ 'acceptedName' => '#^[^/\?*:|"<>]*[^./\?*:|"<>]$#',
+ 'rootCssClass' => 'elfinder-navbar-root-box',
+ 'enabled' => true,
+ ),
+ 'onedrive_settings' => array(
+ 'client_id' => 'some_consumer',
+ 'client_secret' => 'con$umer',
+ 'accessToken' => 'token',
+ 'root' => 'OneDrive.com',
+ 'OneDriveApiClient' => '',
+ 'path' => '/',
+ 'separator' => '/',
+ 'tmbPath' => '',
+ 'tmbURL' => '',
+ 'acceptedName' => '#^[^/\?*:|"<>]*[^./\?*:|"<>]$#',
+ 'rootCssClass' => 'elfinder-navbar-root-onedrive',
+ 'useApiThumbnail' => true,
+ 'enabled' => true,
+ ),
'ftp_settings' => array(
'host' => '127.0.0.1',
'user' => 'root',
diff --git a/tests/Fixtures/config/config.php b/tests/Fixtures/config/config.php
index 6be8341..735d3d1 100644
--- a/tests/Fixtures/config/config.php
+++ b/tests/Fixtures/config/config.php
@@ -16,22 +16,30 @@
'debug' => true,
'roots' => array(
'uploads' => array(
- 'driver' => 'LocalFileSystem',
- 'path' => 'uploads',
- 'show_hidden' => true,
- 'trash_hash' => 'trash_hash',
- 'alias' => 'foo',
- 'check_subfolders' => 1,
- 'tree_deep' => 1,
- 'upload_allow' => array('image/png', 'image/jpg', 'image/jpeg'),
- 'upload_deny' => array('all'),
- 'upload_max_size' => 0,
- 'dropbox_settings' => array(
- 'consumer_key' => 'some_consumer',
- 'consumer_secret' => 'con$umer',
+ 'driver' => 'LocalFileSystem',
+ 'path' => 'uploads',
+ 'show_hidden' => true,
+ 'trash_hash' => 'trash_hash',
+ 'alias' => 'foo',
+ 'check_subfolders' => 1,
+ 'tree_deep' => 1,
+ 'upload_allow' => array('image/png', 'image/jpg', 'image/jpeg'),
+ 'upload_deny' => array('all'),
+ 'upload_max_size' => 0,
+ 'dropbox2_settings' => array(
'app_key' => 'some_consumer',
'app_secret' => 'con$umer',
),
+ 'box_settings' => array(
+ 'client_id' => 'some_consumer',
+ 'client_secret' => 'con$umer',
+ 'accessToken' => 'token',
+ ),
+ 'onedrive_settings' => array(
+ 'client_id' => 'some_consumer',
+ 'client_secret' => 'con$umer',
+ 'accessToken' => 'token',
+ ),
'ftp_settings' => array(
'host' => '127.0.0.1',
'user' => 'root',
diff --git a/tests/Fixtures/config/config.xml b/tests/Fixtures/config/config.xml
index e7527f6..e0dec95 100644
--- a/tests/Fixtures/config/config.xml
+++ b/tests/Fixtures/config/config.xml
@@ -25,12 +25,20 @@
upload-deny="all"
upload-max-size="0"
>
-
+
+