From: Michael Gapczynski Date: Thu, 24 May 2012 15:06:03 +0000 (-0400) Subject: Initial work on UI for mounting external storage X-Git-Tag: v4.5.0beta1~74^2~430^2~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bee724c53e243bda82c9490154fcd13079e41082;p=nextcloud-server.git Initial work on UI for mounting external storage --- diff --git a/apps/files_external/appinfo/app.php b/apps/files_external/appinfo/app.php index 784ed032d47..2940a070258 100644 --- a/apps/files_external/appinfo/app.php +++ b/apps/files_external/appinfo/app.php @@ -10,3 +10,4 @@ OC::$CLASSPATH['OC_Filestorage_FTP']='apps/files_external/lib/ftp.php'; OC::$CLASSPATH['OC_Filestorage_DAV']='apps/files_external/lib/webdav.php'; OC::$CLASSPATH['OC_Filestorage_Google']='apps/files_external/lib/google.php'; OC::$CLASSPATH['OC_Filestorage_SWIFT']='apps/files_external/lib/swift.php'; +OCP\App::registerAdmin('files_external', 'settings'); diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml index c324730593f..e0301365d16 100644 --- a/apps/files_external/appinfo/info.xml +++ b/apps/files_external/appinfo/info.xml @@ -4,7 +4,7 @@ External storage support Mount external storage sources AGPL - Robin Appelman + Robin Appelman, Michael Gapczynski 4 true diff --git a/apps/files_external/css/settings.css b/apps/files_external/css/settings.css new file mode 100644 index 00000000000..b11af752ec8 --- /dev/null +++ b/apps/files_external/css/settings.css @@ -0,0 +1,6 @@ +.error { color: #FF3B3B; } +td.type { width:8em; } +td.mount, td.options, td.applicable { width:10em; } +#addStorage>td { border:none; } +#addStorage>td:not(.selectStorage) { visibility:hidden; } +#selectStorage { margin-left:-10px; } \ No newline at end of file diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js new file mode 100644 index 00000000000..9a558ad6e43 --- /dev/null +++ b/apps/files_external/js/settings.js @@ -0,0 +1,59 @@ +$(document).ready(function(){ + + function applicableChange(applicable) { + if (applicable == 'Global') { + + } + console.log(applicable); + } + + $('#selectStorage').live('change', function() { + var tr = $(this).parent().parent(); + $('#externalStorage tbody').last().append($(tr).clone()); + var selected = $(this).val(); + $(this).parent().text(selected); + var backends = $(this).data('configurations').split(';'); + var configuration = []; + // Find selected backend configuration parameters + $.each(backends, function(index, backend) { + if (backend.split(':')[0] == selected) { + configuration = backend.split(':')[1].split(','); + // break; + } + }); + var td = $(tr).find('td.configuration'); + $.each(configuration, function(index, config) { + if (config.indexOf('*') != -1) { + td.append(''); + } else { + td.append(''); + } + }); + $(tr).find('td').last().attr('class', 'remove'); + $(tr).removeAttr('id'); + $(this).remove(); + }); + + $('td.remove>img').live('click', function() { + $(this).parent().parent().remove(); + // TODO remove storage + }); + + $('#externalStorage select[multiple]').each(function(index,element){ + applyMultiplySelect($(element)); + }); + + function applyMultiplySelect(element) { + var checkHandeler=false; + element.multiSelect({ + oncheck:applicableChange, + onuncheck:applicableChange, + minWidth: 120, + }); + } + + $('#allowUserMounting').bind('change', function() { + // TODO save setting + }); + +}); \ No newline at end of file diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php new file mode 100644 index 00000000000..ce1b308d757 --- /dev/null +++ b/apps/files_external/settings.php @@ -0,0 +1,35 @@ +. +*/ + +OCP\Util::addscript('files_external', 'settings'); +OCP\Util::addstyle('files_external', 'settings'); +$tmpl = new OCP\Template('files_external', 'settings'); +$tmpl->assign('allowUserMounting', 'yes'); +$tmpl->assign('isAdminPage', true); +$tmpl->assign('storage', array()); +$tmpl->assign('groups', OC_Group::getGroups()); +$tmpl->assign('backends', array('Amazon S3', 'FTP', 'Google Drive', 'SWIFT', 'WebDAV')); +$tmpl->assign('configurations', ''); +$tmpl->assign('options', array('Encrypt', 'Version control', 'Allow sharing')); +return $tmpl->fetchPage(); + +?> \ No newline at end of file diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php new file mode 100644 index 00000000000..e34c0322390 --- /dev/null +++ b/apps/files_external/templates/settings.php @@ -0,0 +1,74 @@ +
+
+ t('External Storage'); ?> + + + + + + + + + '.$l->t('Applicable').''; ?> + + + + + 'addStorage', 'mount' => ''))); ?> + + data-storage-id=""> + + + + + + + + + + + + + + + +
t('Type'); ?>t('Configuration'); ?>t('Mount Location'); ?>t('Options'); ?> 
+ + > + + $value): ?> + + + + + + + + + + + + ><?php echo $l->t('Delete'); ?>
+ + +
+ /> +
+ t('Allow users to mount their own external storage'); ?> + +
+
\ No newline at end of file