diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/js/settings.js | 35 | ||||
-rw-r--r-- | apps/files_external/personal.php | 1 | ||||
-rw-r--r-- | apps/files_external/settings.php | 1 | ||||
-rw-r--r-- | apps/files_external/templates/settings.php | 2 |
4 files changed, 32 insertions, 7 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index ae3aef4ef35..232d5b96d5b 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -15,6 +15,10 @@ var MOUNT_OPTIONS_DROPDOWN_TEMPLATE = '<div class="drop dropdown mountOptionsDropdown">' + // FIXME: options are hard-coded for now ' <div class="optionRow">' + + ' <label for="mountOptionsEncrypt">{{t "files_external" "Enable encryption"}}</label>' + + ' <input id="mountOptionsEncrypt" name="encrypt" type="checkbox" value="true" checked="checked"/>' + + ' </div>' + + ' <div class="optionRow">' + ' <label for="mountOptionsPreviews">{{t "files_external" "Enable previews"}}</label>' + ' <input id="mountOptionsPreviews" name="previews" type="checkbox" value="true" checked="checked"/>' + ' </div>' + @@ -422,8 +426,9 @@ MountOptionsDropdown.prototype = { * * @param {Object} $container container * @param {Object} mountOptions mount options + * @param {Array} enabledOptions enabled mount options */ - show: function($container, mountOptions) { + show: function($container, mountOptions, enabledOptions) { if (MountOptionsDropdown._last) { MountOptionsDropdown._last.hide(); } @@ -438,7 +443,7 @@ MountOptionsDropdown.prototype = { this.$el = $el; $el.addClass('hidden'); - this.setOptions(mountOptions); + this.setOptions(mountOptions, enabledOptions); this.$el.appendTo($container); MountOptionsDropdown._last = this; @@ -484,8 +489,9 @@ MountOptionsDropdown.prototype = { * Sets the mount options to the dropdown controls * * @param {Object} options mount options + * @param {Array} enabledOptions enabled mount options */ - setOptions: function(options) { + setOptions: function(options, enabledOptions) { var $el = this.$el; _.each(options, function(value, key) { var $optionEl = $el.find('input, select').filterAttr('name', key); @@ -498,6 +504,13 @@ MountOptionsDropdown.prototype = { $optionEl.val(value); } }); + $el.find('.optionRow').each(function(i, row){ + var $row = $(row); + var optionId = $row.find('input, select').attr('name'); + if (enabledOptions.indexOf(optionId) === -1) { + $row.hide(); + } + }); } }; @@ -554,6 +567,8 @@ MountConfigListView.prototype = { */ _allBackends: null, + _encryptionEnabled: false, + /** * @param {Object} $el DOM object containing the list * @param {Object} [options] @@ -573,6 +588,8 @@ MountConfigListView.prototype = { this._userListLimit = options.userListLimit; } + this._encryptionEnabled = options.encryptionEnabled; + // read the backend config that was carefully crammed // into the data-configurations attribute of the select this._allBackends = this.$el.find('.selectBackend').data('configurations'); @@ -935,8 +952,11 @@ MountConfigListView.prototype = { var storage = this.getStorageConfig($tr); var $toggle = $tr.find('.mountOptionsToggle'); var dropDown = new MountOptionsDropdown(); - dropDown.show($toggle, storage.mountOptions || []); - + var enabledOptions = ['previews', 'filesystem_check_changes']; + if (this._encryptionEnabled) { + enabledOptions.push('encrypt'); + } + dropDown.show($toggle, storage.mountOptions || [], enabledOptions); $('body').on('mouseup.mountOptionsDropdown', function(event) { var $target = $(event.target); if ($toggle.has($target).length) { @@ -963,7 +983,10 @@ MountConfigListView.prototype = { }; $(document).ready(function() { - var mountConfigListView = new MountConfigListView($('#externalStorage')); + var encryptionEnabled = JSON.parse($('#files_external').attr('data-encryption-enabled')); + var mountConfigListView = new MountConfigListView($('#externalStorage'), { + encryptionEnabled: encryptionEnabled + }); $('#sslCertificate').on('click', 'td.remove>img', function() { var $tr = $(this).closest('tr'); diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php index e09f0f803ac..b2ab32411f9 100644 --- a/apps/files_external/personal.php +++ b/apps/files_external/personal.php @@ -48,6 +48,7 @@ if (!$hasId) { } $tmpl = new OCP\Template('files_external', 'settings'); +$tmpl->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled()); $tmpl->assign('isAdminPage', false); $tmpl->assign('mounts', $mounts); $tmpl->assign('dependencies', OC_Mount_Config::checkDependencies()); diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php index ee4982a9ad4..daf205d3d57 100644 --- a/apps/files_external/settings.php +++ b/apps/files_external/settings.php @@ -68,6 +68,7 @@ if (!$hasId) { } $tmpl = new OCP\Template('files_external', 'settings'); +$tmpl->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled()); $tmpl->assign('isAdminPage', true); $tmpl->assign('mounts', $mounts); $tmpl->assign('backends', $backends); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 967c59debe6..b886c2e1b1b 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -1,4 +1,4 @@ -<form id="files_external" class="section"> +<form 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']<>'')) print_unescaped(''.$_['dependencies'].''); ?> <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['isAdminPage'])); ?>'> |