From: John Molakvoæ Date: Wed, 9 Aug 2023 12:59:35 +0000 (+0200) Subject: chore(files): add Headers, remove legacy methods and cleanup X-Git-Tag: v28.0.0beta1~522^2~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=410f58e43e8db767eaf0b272ab6ffde1841cd6a2;p=nextcloud-server.git chore(files): add Headers, remove legacy methods and cleanup Signed-off-by: John Molakvoæ --- 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, diff --git a/apps/files/lib/Event/LoadAdditionalScriptsEvent.php b/apps/files/lib/Event/LoadAdditionalScriptsEvent.php index 5291a776e81..1e2080622f4 100644 --- a/apps/files/lib/Event/LoadAdditionalScriptsEvent.php +++ b/apps/files/lib/Event/LoadAdditionalScriptsEvent.php @@ -31,18 +31,7 @@ use OCP\EventDispatcher\Event; /** * This event is triggered when the files app is rendered. - * It can be used to add additional scripts to the files app. * * @since 17.0.0 */ -class LoadAdditionalScriptsEvent extends Event { - private $hiddenFields = []; - - public function addHiddenField(string $name, string $value): void { - $this->hiddenFields[$name] = $value; - } - - public function getHiddenFields(): array { - return $this->hiddenFields; - } -} +class LoadAdditionalScriptsEvent extends Event {} \ No newline at end of file diff --git a/apps/files/src/components/FilesListFooter.vue b/apps/files/src/components/FilesListFooter.vue deleted file mode 100644 index b4a2d7eda30..00000000000 --- a/apps/files/src/components/FilesListFooter.vue +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - diff --git a/apps/files/src/components/FilesListHeader.vue b/apps/files/src/components/FilesListHeader.vue index d36c9dd46a6..74dc224a39b 100644 --- a/apps/files/src/components/FilesListHeader.vue +++ b/apps/files/src/components/FilesListHeader.vue @@ -20,194 +20,51 @@ - --> - - + diff --git a/apps/files/src/components/FilesListHeaderActions.vue b/apps/files/src/components/FilesListHeaderActions.vue deleted file mode 100644 index e419c8e5abd..00000000000 --- a/apps/files/src/components/FilesListHeaderActions.vue +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - diff --git a/apps/files/src/components/FilesListHeaderButton.vue b/apps/files/src/components/FilesListHeaderButton.vue deleted file mode 100644 index 9aac83a185d..00000000000 --- a/apps/files/src/components/FilesListHeaderButton.vue +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - diff --git a/apps/files/src/components/FilesListTableFooter.vue b/apps/files/src/components/FilesListTableFooter.vue new file mode 100644 index 00000000000..4bda140770d --- /dev/null +++ b/apps/files/src/components/FilesListTableFooter.vue @@ -0,0 +1,175 @@ + + + + + + diff --git a/apps/files/src/components/FilesListTableHeader.vue b/apps/files/src/components/FilesListTableHeader.vue new file mode 100644 index 00000000000..52060d2589e --- /dev/null +++ b/apps/files/src/components/FilesListTableHeader.vue @@ -0,0 +1,213 @@ + + + + + + diff --git a/apps/files/src/components/FilesListTableHeaderActions.vue b/apps/files/src/components/FilesListTableHeaderActions.vue new file mode 100644 index 00000000000..f55487d183b --- /dev/null +++ b/apps/files/src/components/FilesListTableHeaderActions.vue @@ -0,0 +1,226 @@ + + + + + + diff --git a/apps/files/src/components/FilesListTableHeaderButton.vue b/apps/files/src/components/FilesListTableHeaderButton.vue new file mode 100644 index 00000000000..ebd1abb4314 --- /dev/null +++ b/apps/files/src/components/FilesListTableHeaderButton.vue @@ -0,0 +1,122 @@ + + + + + + diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index 014f0a89f00..69cab260963 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -20,28 +20,18 @@ - -->