From 88b68c86c57d5fe61cfc5df3454a49e26498d5fb Mon Sep 17 00:00:00 2001 From: 3Liz Bot <63838475+3liz-bot@users.noreply.github.com> Date: Tue, 1 Oct 2024 09:16:36 +0200 Subject: [PATCH] [Backport release_3_8] fix typo, improve html for module view (#4817) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix typo, improve html for module view * declare Url repositoryAdmin liz global lizUrl * plugin homepage must be non empty to do a link * fix end2end modules line count --------- Co-authored-by: Raphaƫl Martin --- .../modules/admin/lib/ModulesInfo/ModulesChecker.php | 6 ++---- .../modules/admin/templates/server_information.tpl | 12 ++++++++---- lizmap/modules/view/controllers/lizMap.classic.php | 4 ++++ tests/end2end/playwright/server-information.spec.js | 4 +++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lizmap/modules/admin/lib/ModulesInfo/ModulesChecker.php b/lizmap/modules/admin/lib/ModulesInfo/ModulesChecker.php index 125a5feee6..439a7058c4 100644 --- a/lizmap/modules/admin/lib/ModulesInfo/ModulesChecker.php +++ b/lizmap/modules/admin/lib/ModulesInfo/ModulesChecker.php @@ -26,9 +26,7 @@ class ModulesChecker public function getList($withCore = false) { $moduleConfig = \jApp::config()->modules; - - // file_get_contents(\jApp::varConfigPath('installer.ini.php')); - $installreRadr = new IniReader(\jApp::varConfigPath('installer.ini.php')); + $installReader = new IniReader(\jApp::varConfigPath('installer.ini.php')); $enabledModuleName = array(); foreach ($moduleConfig as $paramName => $value) { @@ -38,7 +36,7 @@ public function getList($withCore = false) if ($coreModule && !$withCore) { continue; } - $version = $installreRadr->getValue($moduleSlug.'.version', 'modules'); + $version = $installReader->getValue($moduleSlug.'.version', 'modules'); $enabledModuleName[] = new ModuleMetaData($moduleSlug, $version, $coreModule); } } diff --git a/lizmap/modules/admin/templates/server_information.tpl b/lizmap/modules/admin/templates/server_information.tpl index e9f34217bb..452d1810f1 100644 --- a/lizmap/modules/admin/templates/server_information.tpl +++ b/lizmap/modules/admin/templates/server_information.tpl @@ -37,17 +37,21 @@ {if empty($modules)}

{@admin.server.information.no.module@}

{else} - +
+ + + {foreach $modules as $module} - - + + {/foreach} + {/if}
{@admin.server.information.module@} {@admin.server.information.module.version@}
{$module->slug}{$module->version}{$module->slug}{$module->version}
@@ -167,7 +171,7 @@ {* Fixed in lizmap_server plugin 1.3.2 https://github.com/3liz/qgis-lizmap-server-plugin/commit/eb6a773ba035f877e9fa91db5ef87911a2648ee1 *} {$version['name']} - {if $version['homepage']} + {if array_key_exists('homepage', $version) && $version['homepage']} {@admin.server.information.qgis.plugin.help@} {/if} diff --git a/lizmap/modules/view/controllers/lizMap.classic.php b/lizmap/modules/view/controllers/lizMap.classic.php index 88c44ab88d..9488dacd07 100644 --- a/lizmap/modules/view/controllers/lizMap.classic.php +++ b/lizmap/modules/view/controllers/lizMap.classic.php @@ -189,6 +189,7 @@ public function index() // Add bottom dock js $rep->addJSLink($bp.'assets/js/bottom-dock.js', array('defer' => '')); + // TODO : refacto, quite the same URLs are declared in lizAjax.classic.php // Pass some configuration options to the web page through javascript var $lizUrls = array( 'params' => array('repository' => $repository, 'project' => $project), @@ -224,6 +225,9 @@ function f($x) $lizUrls['removeCache'] = jUrl::get('admin~maps:removeLayerCache'); } + if (jAcl2::check('lizmap.admin.access') || jAcl2::check('lizmap.admin.server.information.view')) { + $lizUrls['repositoryAdmin'] = jUrl::getFull('admin~maps:index'); + } $webDavProfile = RemoteStorageRequest::getProfile('webdav'); if ($webDavProfile) { $lizUrls['webDavUrl'] = $webDavProfile['baseUri']; diff --git a/tests/end2end/playwright/server-information.spec.js b/tests/end2end/playwright/server-information.spec.js index afab482699..c52a779705 100644 --- a/tests/end2end/playwright/server-information.spec.js +++ b/tests/end2end/playwright/server-information.spec.js @@ -25,7 +25,9 @@ test.describe('Server information', () => { await expect(await lwcRow.locator('td').innerText()).not.toEqual(''); } // Check that Lizmap modules contains 2 lines (header and 1 module lizmapdemo) - const modulesRows = page.locator('#lizmap_server_information table.table-lizmap-modules tr:nth-child(1n+2)') + const modulesHeadRows = page.locator('#lizmap_server_information table.table-lizmap-modules thead tr'); + await expect(modulesHeadRows).toHaveCount(1); + const modulesRows = page.locator('#lizmap_server_information table.table-lizmap-modules tbody tr'); await expect(modulesRows).toHaveCount(1); for (const row of await modulesRows.all()) { await modulesRows.scrollIntoViewIfNeeded();