From 666ed010506f4018f3061214c66f5489597d3cfc Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms Date: Wed, 28 Jan 2026 09:36:05 +0100 Subject: display file sources as a ViewsWidget and highlight the currently selected file source, show widget only if more than one file source is available, fixes #6202 Closes #6202 Merge request studip/studip!4694 --- app/controllers/files.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/files.php b/app/controllers/files.php index b8ccf17..6e208d2 100644 --- a/app/controllers/files.php +++ b/app/controllers/files.php @@ -57,17 +57,17 @@ class FilesController extends AuthenticatedController /** * Helper method for filling the sidebar with actions. */ - private function buildSidebar(FolderType $folder, $view = true) + private function buildSidebar(FolderType $folder, $view = true, $active_plugin_id = null) { $sidebar = Sidebar::get(); - $sources = new LinksWidget(); + $sources = new ViewsWidget(); $sources->setTitle(_("Dateiquellen")); $sources->addLink( _("Stud.IP-Dateien"), $this->url_for("files/index"), Icon::create('files') - ); + )->setActive(!$active_plugin_id); foreach (PluginManager::getInstance()->getPlugins(FilesystemPlugin::class) as $plugin) { if ($plugin->isPersonalFileArea()) { $subnav = $plugin->getFileSelectNavigation(); @@ -75,11 +75,13 @@ class FilesController extends AuthenticatedController $subnav->getTitle(), URLHelper::getURL("dispatch.php/files/system/".$plugin->getPluginId()), $subnav->getImage() - ); + )->setActive($plugin->getPluginId() == $active_plugin_id); } } - $sidebar->addWidget($sources); + if (count($sources->getElements()) > 1) { + $sidebar->addWidget($sources); + } $actions = new ActionsWidget(); @@ -685,7 +687,7 @@ class FilesController extends AuthenticatedController _('Ordner nicht gefunden!') ); } else { - $this->buildSidebar($this->topFolder, false); + $this->buildSidebar($this->topFolder, false, $plugin_id); } $this->render_action('index'); } -- cgit v1.0