From 520fbf4f963092cb1abec96f6e2ade84f3837220 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Fri, 29 Nov 2024 08:08:37 +0000 Subject: [PATCH] make table of unregistered plugins sortable, fixes #4927 Closes #4927 Merge request studip/studip!3698 --- app/controllers/admin/plugin.php | 6 +++++- app/views/admin/plugin/unregistered.php | 10 +++++----- lib/classes/PluginAdministration.php | 9 ++++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/controllers/admin/plugin.php b/app/controllers/admin/plugin.php index 37b08cc5f06..bc073a86719 100644 --- a/app/controllers/admin/plugin.php +++ b/app/controllers/admin/plugin.php @@ -509,7 +509,11 @@ class Admin_PluginController extends AuthenticatedController public function unregistered_action() { - $this->unknown_plugins = $this->plugin_admin->scanPluginDirectory(); + $plugins = $this->plugin_admin->scanPluginDirectory(); + usort($plugins, function ($a, $b) { + return $a['pluginname'] <=> $b['pluginname']; + }); + $this->unknown_plugins = $plugins; } /** diff --git a/app/views/admin/plugin/unregistered.php b/app/views/admin/plugin/unregistered.php index 8d0b3db41c0..800d247dda4 100644 --- a/app/views/admin/plugin/unregistered.php +++ b/app/views/admin/plugin/unregistered.php @@ -4,16 +4,16 @@ * @var array $unknown_plugins */ ?> -<table class="default"> +<table class="default sortable-table" data-sortlist="[[0, 0]]"> <caption> <?= _('Im Pluginverzeichnis vorhandene Plugins registrieren') ?> </caption> <thead> <tr> - <th><?= _('Name') ?></th> - <th><?= _('Pluginklasse') ?></th> - <th><?= _('Version') ?></th> - <th><?= _('Ursprung') ?></th> + <th data-sort="text"><?= _('Name') ?></th> + <th data-sort="text"><?= _('Pluginklasse') ?></th> + <th data-sort="digit"><?= _('Version') ?></th> + <th data-sort="text"><?= _('Ursprung') ?></th> <th><?= _('Registrieren') ?></th> </tr> </thead> diff --git a/lib/classes/PluginAdministration.php b/lib/classes/PluginAdministration.php index 747d74e819a..f906842632f 100644 --- a/lib/classes/PluginAdministration.php +++ b/lib/classes/PluginAdministration.php @@ -405,9 +405,12 @@ class PluginAdministration $basepath = Config::get()->PLUGINS_PATH; $plugin_manager = PluginManager::getInstance(); $iterator = new RegexIterator( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($basepath, FilesystemIterator::FOLLOW_SYMLINKS | FilesystemIterator::UNIX_PATHS)), - '/plugin\.manifest$/', RecursiveRegexIterator::MATCH); + new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($basepath, FilesystemIterator::FOLLOW_SYMLINKS | FilesystemIterator::UNIX_PATHS) + ), + '/plugin\.manifest$/', + RegexIterator::MATCH + ); foreach ($iterator as $manifest_file) { $manifest = $plugin_manager->getPluginManifest($manifest_file->getPath()); if (!isset($manifest['pluginclassname'])) { -- GitLab