From 0547855d24af6dbf9a42b77c1ca9de038fdbdee9 Mon Sep 17 00:00:00 2001 From: Thijs Kinkhorst <thijs@kinkhorst.com> Date: Tue, 18 Jan 2022 13:54:55 +0000 Subject: [PATCH] Show overview of modules in the admin plugin This is now combined with the "SAML 2.0 IdP" enabled/disabled flag which was a bit lonely before, as it's the only flag of its type. --- modules/admin/lib/Controller/Config.php | 10 ++++++++++ modules/admin/templates/config.twig | 13 +++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/admin/lib/Controller/Config.php b/modules/admin/lib/Controller/Config.php index 8bba958e6..fdaa7bc5e 100644 --- a/modules/admin/lib/Controller/Config.php +++ b/modules/admin/lib/Controller/Config.php @@ -137,6 +137,7 @@ class Config ], 'funcmatrix' => $this->getPrerequisiteChecks(), 'logouturl' => $this->authUtils->getAdminLogoutURL(), + 'modulelist' => $this->getModuleList(), ]; Module::callHooks('configpage', $t); @@ -144,6 +145,15 @@ class Config return $this->menu->insert($t); } + protected function getModuleList(): array + { + $modules = Module::getModules(); + $modulestates = []; + foreach ($modules as $module) { + $modulestates[$module] = Module::isModuleEnabled($module); + } + return $modulestates; + } /** * Display the output of phpinfo(). diff --git a/modules/admin/templates/config.twig b/modules/admin/templates/config.twig index 0487bbc12..4b5c687e2 100644 --- a/modules/admin/templates/config.twig +++ b/modules/admin/templates/config.twig @@ -24,11 +24,20 @@ </div> <h2>{% trans %}Configuration{% endtrans %}</h2> <div class="enablebox mini"> - <table> + <table class="pure-table"> + <thead><tr><th>{% trans %}Module/function{% endtrans %}</th><th>{% trans %}Enabled?{% endtrans %}</th></tr></thead> + <tbody> <tr class="{%- if enablematrix.saml20idp %}enabled{% else %}disabled{% endif -%}"> <td>SAML 2.0 IdP</td> - <td><i class="fa fa-{%- if enablematrix.saml20idp %}check{% else %}ban{% endif %}"></i></td> + <td><i class="fa fa-{%- if enablematrix.saml20idp %}check" title="{% trans %}enabled{% endtrans %}"{% else %}ban" title="{% trans %}disabled{% endtrans %}"{% endif %}></i></td> </tr> + {% for module, enabled in modulelist %} + <tr class="{%- if enabled %}enabled{% else %}disabled{% endif -%}"> + <td>{{ module }}</td> + <td><i class="fa fa-{%- if enabled %}check" title="{% trans %}enabled{% endtrans %}"{% else %}ban" title="{% trans %}disabled{% endtrans %}"{% endif %}></i></td> + </tr> + {% endfor %} + </tbody> </table> </div> <ul> -- GitLab