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:40:13 +0100 |
| commit | 09299021ee258856c9d751115923fea9edea261e (patch) | |
| tree | ea47cb7a9cd45917307c46ba3ac714c35e79374b | |
| parent | 88e831d252b42eefd6f45804c33c54868ed29f5b (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 | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/controllers/files.php b/app/controllers/files.php index f885edd..fd961d1 100644 --- a/app/controllers/files.php +++ b/app/controllers/files.php @@ -57,29 +57,31 @@ 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", "clickable") - ); - foreach (PluginManager::getInstance()->getPlugins('FilesystemPlugin') as $plugin) { + Icon::create('files') + )->setActive(!$active_plugin_id); + foreach (PluginManager::getInstance()->getPlugins(FilesystemPlugin::class) as $plugin) { if ($plugin->isPersonalFileArea()) { $subnav = $plugin->getFileSelectNavigation(); $sources->addLink( $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(); @@ -688,7 +690,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'); } |
