diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-14 13:57:49 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-11-21 22:54:21 +0000 |
commit | 28876bf46363116218c48021ddf556c53d5256f5 (patch) | |
tree | ad1f57f042af3f2fc69f6c1886bd8e491ee2e4fa /apps/files_external/templates | |
parent | a1704c86233312c4574bc368b78b73fb6b605c2b (diff) | |
download | nextcloud-server-28876bf46363116218c48021ddf556c53d5256f5.tar.gz nextcloud-server-28876bf46363116218c48021ddf556c53d5256f5.zip |
Display applicable global storages in personal mount list
Diffstat (limited to 'apps/files_external/templates')
-rw-r--r-- | apps/files_external/templates/settings.php | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 14136a9bad7..f7caf3d2caa 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -3,6 +3,21 @@ use \OCA\Files_External\Lib\DefinitionParameter; use \OCA\Files_External\Service\BackendService; + script('files_external', 'settings'); + style('files_external', 'settings'); + + // load custom JS + foreach ($_['backends'] as $backend) { + if ($backend->getCustomJs()) { + script('files_external', $backend->getCustomJs()); + } + } + foreach ($_['authMechanisms'] as $authMechanism) { + if ($authMechanism->getCustomJs()) { + script('files_external', $authMechanism->getCustomJs()); + } + } + function writeParameterInput($parameter, $options, $classes = []) { $value = ''; if (isset($options[$parameter->getName()])) { @@ -56,7 +71,7 @@ <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'])); ?>'> + <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> <thead> <tr> <th></th> @@ -64,7 +79,7 @@ <th><?php p($l->t('External storage')); ?></th> <th><?php p($l->t('Authentication')); ?></th> <th><?php p($l->t('Configuration')); ?></th> - <?php if ($_['isAdminPage']) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?> + <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?> <th> </th> <th> </th> </tr> @@ -84,7 +99,9 @@ <?php p($l->t('Add storage')); ?> </option> <?php - $sortedBackends = $_['backends']; + $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { + return $backend->isVisibleFor($_['visibilityType']); + }); uasort($sortedBackends, function($a, $b) { return strcasecmp($a->getText(), $b->getText()); }); @@ -97,7 +114,7 @@ </td> <td class="authentication" data-mechanisms='<?php p(json_encode($_['authMechanisms'])); ?>'></td> <td class="configuration"></td> - <?php if ($_['isAdminPage']): ?> + <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?> <td class="applicable" align="right"> <input type="hidden" class="applicableUsers" style="width:20em;" value="" /> </td> @@ -122,7 +139,7 @@ </table> <br /> - <?php if ($_['isAdminPage']): ?> + <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?> <br /> <input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox" value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> /> @@ -130,7 +147,12 @@ <p id="userMountingBackends"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>> <?php p($l->t('Allow users to mount the following external storage')); ?><br /> - <?php $i = 0; foreach ($_['userBackends'] as $backend): ?> + <?php + $userBackends = array_filter($_['backends'], function($backend) { + return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); + }); + ?> + <?php $i = 0; foreach ($userBackends as $backend): ?> <?php if ($deprecateTo = $backend->getDeprecateTo()): ?> <input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" /> <?php else: ?> |