From 2bef3ef34bc81737c1667187aa3b21ecf1442e03 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Thu, 17 Sep 2015 17:00:15 +0100 Subject: Hide deprecated backends in external storage GUI Selecting/deselecting the deprecate-to backends in the user mountable storages selection will also change the corresponding deprecated backend. --- apps/files_external/js/settings.js | 13 ++++++++++++- apps/files_external/templates/settings.php | 9 +++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'apps/files_external') diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 4319677f4f4..5da34c52193 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -1113,7 +1113,18 @@ $(document).ready(function() { $('input[name="allowUserMountingBackends\\[\\]"]').bind('change', function() { OC.msg.startSaving('#userMountingMsg'); - var userMountingBackends = $('input[name="allowUserMountingBackends\\[\\]"]:checked').map(function(){return $(this).val();}).get(); + + var userMountingBackends = $('input[name="allowUserMountingBackends\\[\\]"]:checked').map(function(){ + return $(this).val(); + }).get(); + var deprecatedBackends = $('input[name="allowUserMountingBackends\\[\\]"][data-deprecate-to]').map(function(){ + if ($.inArray($(this).data('deprecate-to'), userMountingBackends) !== -1) { + return $(this).val(); + } + return null; + }).get(); + userMountingBackends = userMountingBackends.concat(deprecatedBackends); + OC.AppConfig.setValue('files_external', 'user_mounting_backends', userMountingBackends.join()); OC.msg.finishedSaving('#userMountingMsg', {status: 'success', data: {message: t('files_external', 'Saved')}}); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index d8b07273028..141994d0050 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -157,6 +157,7 @@ }); ?> + getDeprecateTo()) continue; // ignore deprecated backends ?> @@ -197,8 +198,12 @@

class="hidden"> t('Allow users to mount the following external storage')); ?>
- isVisibleFor(BackendService::VISIBILITY_PERSONAL)) print_unescaped(' checked="checked"'); ?> /> -
+ getDeprecateTo()): ?> + + + isVisibleFor(BackendService::VISIBILITY_PERSONAL)) print_unescaped(' checked="checked"'); ?> /> +
+

-- cgit v1.2.3