diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2023-08-09 14:59:35 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-08-17 18:56:37 +0200 |
commit | 410f58e43e8db767eaf0b272ab6ffde1841cd6a2 (patch) | |
tree | 5f0d2812ce7cce75b6b72c3652c81f7ae3c26bfd /apps/files/lib/Controller/ViewController.php | |
parent | 998b3a2581fb873b03bcf4dc02eafb19390b3cd6 (diff) | |
download | nextcloud-server-410f58e43e8db767eaf0b272ab6ffde1841cd6a2.tar.gz nextcloud-server-410f58e43e8db767eaf0b272ab6ffde1841cd6a2.zip |
chore(files): add Headers, remove legacy methods and cleanup
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/lib/Controller/ViewController.php')
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 59 |
1 files changed, 4 insertions, 55 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 01f85a7c939..24f236a0893 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -187,8 +187,6 @@ class ViewController extends Controller { } } - $nav = new \OCP\Template('files', 'appnavigation', ''); - // Load the files we need \OCP\Util::addStyle('files', 'merged'); \OCP\Util::addScript('files', 'merged-index', 'files'); @@ -203,15 +201,6 @@ class ViewController extends Controller { $favElements['folders'] = []; } - $navItems = \OCA\Files\App::getNavigationManager()->getAll(); - - // parse every menu and add the expanded user value - foreach ($navItems as $key => $item) { - $navItems[$key]['expanded'] = $this->config->getUserValue($userId, 'files', 'show_' . $item['id'], '0') === '1'; - } - - $nav->assign('navigationItems', $navItems); - $contentItems = []; try { @@ -222,7 +211,6 @@ class ViewController extends Controller { } $this->initialState->provideInitialState('storageStats', $storageInfo); - $this->initialState->provideInitialState('navigation', $navItems); $this->initialState->provideInitialState('config', $this->userConfig->getConfigs()); $this->initialState->provideInitialState('viewConfigs', $this->viewConfig->getConfigs()); $this->initialState->provideInitialState('favoriteFolders', $favElements['folders'] ?? []); @@ -231,34 +219,9 @@ class ViewController extends Controller { $filesSortingConfig = json_decode($this->config->getUserValue($userId, 'files', 'files_sorting_configs', '{}'), true); $this->initialState->provideInitialState('filesSortingConfig', $filesSortingConfig); - // render the container content for every navigation item - foreach ($navItems as $item) { - $content = ''; - if (isset($item['script'])) { - $content = $this->renderScript($item['appname'], $item['script']); - } - // parse submenus - if (isset($item['sublist'])) { - foreach ($item['sublist'] as $subitem) { - $subcontent = ''; - if (isset($subitem['script'])) { - $subcontent = $this->renderScript($subitem['appname'], $subitem['script']); - } - $contentItems[$subitem['id']] = [ - 'id' => $subitem['id'], - 'content' => $subcontent - ]; - } - } - $contentItems[$item['id']] = [ - 'id' => $item['id'], - 'content' => $content - ]; - } - - $this->eventDispatcher->dispatchTyped(new ResourcesLoadAdditionalScriptsEvent()); $event = new LoadAdditionalScriptsEvent(); $this->eventDispatcher->dispatchTyped($event); + $this->eventDispatcher->dispatchTyped(new ResourcesLoadAdditionalScriptsEvent()); $this->eventDispatcher->dispatchTyped(new LoadSidebar()); // Load Viewer scripts if (class_exists(LoadViewer::class)) { @@ -268,23 +231,9 @@ class ViewController extends Controller { $this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false); $this->initialState->provideInitialState('templates', $this->templateManager->listCreators()); - $params = []; - $params['usedSpacePercent'] = (int) $storageInfo['relative']; - $params['owner'] = $storageInfo['owner'] ?? ''; - $params['ownerDisplayName'] = $storageInfo['ownerDisplayName'] ?? ''; - $params['isPublic'] = false; - $params['allowShareWithLink'] = $this->shareManager->shareApiAllowLinks() ? 'yes' : 'no'; - $params['defaultFileSorting'] = $filesSortingConfig['files']['mode'] ?? 'basename'; - $params['defaultFileSortingDirection'] = $filesSortingConfig['files']['direction'] ?? 'asc'; - $params['showgridview'] = $this->config->getUserValue($userId, 'files', 'show_grid', false); - $showHidden = (bool) $this->config->getUserValue($userId, 'files', 'show_hidden', false); - $params['showHiddenFiles'] = $showHidden ? 1 : 0; - $cropImagePreviews = (bool) $this->config->getUserValue($userId, 'files', 'crop_image_previews', true); - $params['cropImagePreviews'] = $cropImagePreviews ? 1 : 0; - $params['fileNotFound'] = $fileNotFound ? 1 : 0; - $params['appNavigation'] = $nav; - $params['appContents'] = $contentItems; - $params['hiddenFields'] = $event->getHiddenFields(); + $params = [ + 'fileNotFound' => $fileNotFound ? 1 : 0 + ]; $response = new TemplateResponse( Application::APP_ID, |