diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2026-01-28 09:36:05 +0100 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2026-01-28 09:36:05 +0100 |
| commit | 666ed010506f4018f3061214c66f5489597d3cfc (patch) | |
| tree | fa37c3b8c92af93da7886b3faffecae1a9a4081c | |
| parent | 60426a66da804e7970aeeabd62e2975248d76a32 (diff) | |
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
| -rw-r--r-- | app/controllers/files.php | 14 |
1 files 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'); } |
