diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-08-11 19:18:36 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-08-19 10:08:23 +0100 |
commit | df8f5425dc32a98f2c5c656215fa0e8564d6a282 (patch) | |
tree | 9d51b78436dc8f5a755503571476631876702cff /apps | |
parent | b6eb952ac61326a15108820b0dd0a1712f00dfdb (diff) | |
download | nextcloud-server-df8f5425dc32a98f2c5c656215fa0e8564d6a282.tar.gz nextcloud-server-df8f5425dc32a98f2c5c656215fa0e8564d6a282.zip |
Load custom JS for all backends/auth mechanisms
Loading custom JS on a per-backend basis added needless complexity and
made dealing with async required. Now all backends/auth mechanisms load
custom JS in PHP
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/js/settings.js | 3 | ||||
-rw-r--r-- | apps/files_external/personal.php | 17 | ||||
-rw-r--r-- | apps/files_external/settings.php | 17 | ||||
-rw-r--r-- | apps/files_external/templates/settings.php | 9 |
4 files changed, 30 insertions, 16 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index c15f36d8bd7..6bf0143f1c0 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -731,9 +731,6 @@ MountConfigListView.prototype = { var priorityEl = $('<input type="hidden" class="priority" value="' + backendConfiguration['priority'] + '" />'); $tr.append(priorityEl); - if (backendConfiguration['custom'] && $el.find('tbody tr.'+backend.replace(/\\/g, '\\\\')).length === 1) { - OC.addScript('files_external', backendConfiguration['custom']); - } $td.children().not('[type=hidden]').first().focus(); $tr.find('td').last().attr('class', 'remove'); diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php index 696ca51b2ed..8717d91d4f1 100644 --- a/apps/files_external/personal.php +++ b/apps/files_external/personal.php @@ -34,11 +34,24 @@ $userStoragesService = $appContainer->query('OCA\Files_external\Service\UserStor OCP\Util::addScript('files_external', 'settings'); OCP\Util::addStyle('files_external', 'settings'); +$backends = $backendService->getBackendsVisibleFor(BackendService::VISIBILITY_PERSONAL); +$authMechanisms = $backendService->getAuthMechanismsVisibleFor(BackendService::VISIBILITY_PERSONAL); +foreach ($backends as $backend) { + if ($backend->getCustomJs()) { + \OCP\Util::addScript('files_external', $backend->getCustomJs()); + } +} +foreach ($authMechanisms as $authMechanism) { + if ($authMechanism->getCustomJs()) { + \OCP\Util::addScript('files_external', $authMechanism->getCustomJs()); + } +} + $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled()); $tmpl->assign('isAdminPage', false); $tmpl->assign('storages', $userStoragesService->getAllStorages()); $tmpl->assign('dependencies', OC_Mount_Config::dependencyMessage($backendService->getBackends())); -$tmpl->assign('backends', $backendService->getBackendsVisibleFor(BackendService::VISIBILITY_PERSONAL)); -$tmpl->assign('authMechanisms', $backendService->getAuthMechanisms()); +$tmpl->assign('backends', $backends); +$tmpl->assign('authMechanisms', $authMechanisms); return $tmpl->fetchPage(); diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php index 2ad31a31137..9cecc0c6a49 100644 --- a/apps/files_external/settings.php +++ b/apps/files_external/settings.php @@ -41,12 +41,25 @@ OCP\Util::addStyle('files_external', 'settings'); \OC_Util::addVendorScript('select2/select2'); \OC_Util::addVendorStyle('select2/select2'); +$backends = $backendService->getBackendsVisibleFor(BackendService::VISIBILITY_ADMIN); +$authMechanisms = $backendService->getAuthMechanismsVisibleFor(BackendService::VISIBILITY_ADMIN); +foreach ($backends as $backend) { + if ($backend->getCustomJs()) { + \OCP\Util::addScript('files_external', $backend->getCustomJs()); + } +} +foreach ($authMechanisms as $authMechanism) { + if ($authMechanism->getCustomJs()) { + \OCP\Util::addScript('files_external', $authMechanism->getCustomJs()); + } +} + $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled()); $tmpl->assign('isAdminPage', true); $tmpl->assign('storages', $globalStoragesService->getAllStorages()); -$tmpl->assign('backends', $backendService->getBackendsVisibleFor(BackendService::VISIBILITY_ADMIN)); -$tmpl->assign('authMechanisms', $backendService->getAuthMechanisms()); +$tmpl->assign('backends', $backends); +$tmpl->assign('authMechanisms', $authMechanisms); $tmpl->assign('userBackends', $backendService->getBackendsAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL)); $tmpl->assign('dependencies', OC_Mount_Config::dependencyMessage($backendService->getBackends())); $tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed()); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 589574bbae4..611c5807a5f 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -106,15 +106,6 @@ foreach ($storage->getAuthMechanism()->getParameters() as $parameter) { writeParameterInput($parameter, $options, ['auth-param']); } - - $customJs = $storage->getBackend()->getCustomJs(); - if (isset($customJs)) { - \OCP\Util::addScript('files_external', $customJs); - } - $customJsAuth = $storage->getAuthMechanism()->getCustomJs(); - if (isset($customJsAuth)) { - \OCP\Util::addScript('files_external', $customJsAuth); - } ?> </td> <?php if ($_['isAdminPage']): ?> |