From e6bdecbfee4b38dfdaafe723c672c86970bdae4a Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 30 Jun 2024 19:07:41 +0700 Subject: [PATCH 1/5] [ticket/17359] Distinct disabled and available extensions list PHPBB-17359 --- phpBB/adm/style/acp_ext_list.html | 28 +++++++++++++++++++++++++++ phpBB/includes/acp/acp_extensions.php | 6 +++--- phpBB/language/en/acp/extensions.php | 1 + 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 9e019fa1c27..0cfd21dc7e4 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -95,6 +95,34 @@

{L_EXTENSIONS_ADMIN}

+ + + + {L_EXTENSIONS_AVAILABLE} + + + + {available.META_DISPLAY_NAME} + + + {available.META_VERSION} + + + {available.META_VERSION} + + + + {L_DETAILS} + + + + title="{available.actions.L_ACTION_EXPLAIN}">{available.actions.L_ACTION} +  |  + + + + + diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 17281a111ac..f481f764d1c 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -575,7 +575,7 @@ public function list_available_exts() catch (exception_interface $e) { $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); - $this->template->assign_block_vars('disabled', array( + $this->template->assign_block_vars('available', array( 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), 'S_VERSIONCHECK' => false, )); @@ -589,9 +589,9 @@ public function list_available_exts() $block_vars['NAME'] = $name; $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); - $this->template->assign_block_vars('disabled', $block_vars); + $this->template->assign_block_vars('available', $block_vars); - $this->output_actions('disabled', array( + $this->output_actions('available', array( 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), )); } diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index a96a7a2a2bb..16668b5161b 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -47,6 +47,7 @@ 'DETAILS' => 'Details', + 'EXTENSIONS_AVAILABLE' => 'Available Extensions', 'EXTENSIONS_DISABLED' => 'Disabled Extensions', 'EXTENSIONS_ENABLED' => 'Enabled Extensions', From 9e1162469334044130feac244d64169a8bfd7a64 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 30 Jun 2024 19:59:45 +0700 Subject: [PATCH 2/5] [ticket/17359] Fix tests PHPBB-17359 --- tests/functional/extension_acp_test.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 2f26c53ce5e..3ecdd6e05c4 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -84,7 +84,8 @@ public function test_list() $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); $this->assertCount(1, $crawler->filter('.ext_enabled')); - $this->assertCount(7, $crawler->filter('.ext_disabled')); + $this->assertCount(3, $crawler->filter('.ext_disabled')); + $this->assertCount(4, $crawler->filter('.ext_available')); $this->assertStringContainsString('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text()); $this->assertContainsLang('EXTENSION_DISABLE', $crawler->filter('.ext_enabled')->eq(0)->text()); @@ -98,9 +99,9 @@ public function test_list() $this->assertStringContainsString('The “vendor/test3” extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text()); - $this->assertStringContainsString('phpBB Bar Extension', $crawler->filter('.ext_disabled')->eq(3)->text()); - $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(3)->text()); - $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(3)->text()); + $this->assertStringContainsString('phpBB Bar Extension', $crawler->filter('.ext_available')->eq(0)->text()); + $this->assertContainsLang('DETAILS', $crawler->filter('.ext_available')->eq(0)->text()); + $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_available')->eq(0)->text()); // Check that invalid extensions are not listed. $this->assertStringNotContainsString('phpBB BarFoo Extension', $crawler->filter('.table1')->text()); From 8aef7b5659c6e04a620bb43139a40db232869047 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 30 Jun 2024 20:35:58 +0700 Subject: [PATCH 3/5] [ticket/17359] Fix template events PHPBB-17359 --- phpBB/adm/style/acp_ext_list.html | 4 ++-- phpBB/docs/events.md | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 0cfd21dc7e4..526c1eb3c41 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -98,11 +98,11 @@

{L_EXTENSIONS_ADMIN}

- {L_EXTENSIONS_AVAILABLE} + {L_EXTENSIONS_AVAILABLE} - {available.META_DISPLAY_NAME} + {available.META_DISPLAY_NAME} {available.META_VERSION} diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 07e3b83beb9..c0f313f540b 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -70,6 +70,18 @@ acp_ext_details_notice * Since: 3.1.11-RC1 * Purpose: Add extension detail notices after version check information. +acp_ext_list_available_name_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.13-RC1 +* Purpose: Add content after the name of available extensions in the list + +acp_ext_list_available_title_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.13-RC1 +* Purpose: Add text after available extensions section title. + acp_ext_list_disabled_name_after === * Location: adm/style/acp_ext_list.html From e53db0775a73d1f8a639f7151fe1dda791089e47 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 1 Jul 2024 00:54:20 +0700 Subject: [PATCH 4/5] [ticket/17359] Get rid of template code duplication PHPBB-17359 --- phpBB/adm/style/acp_ext_list.html | 127 +++++++++++------------------- 1 file changed, 46 insertions(+), 81 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 526c1eb3c41..0984214c6f7 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -42,87 +42,52 @@

{L_EXTENSIONS_ADMIN}

- - - {L_EXTENSIONS_ENABLED} - - - - {enabled.META_DISPLAY_NAME} - - - {enabled.META_VERSION} - - - {enabled.META_VERSION} - - - {L_DETAILS} - - - title="{enabled.actions.L_ACTION_EXPLAIN}">{enabled.actions.L_ACTION} -  |  - - - - - - - - - {L_EXTENSIONS_DISABLED} - - - - {disabled.META_DISPLAY_NAME} - - - {disabled.META_VERSION} - - - {disabled.META_VERSION} - - - - {L_DETAILS} - - - - title="{disabled.actions.L_ACTION_EXPLAIN}">{disabled.actions.L_ACTION} -  |  - - - - - - - - - {L_EXTENSIONS_AVAILABLE} - - - - {available.META_DISPLAY_NAME} - - - {available.META_VERSION} - - - {available.META_VERSION} - - - - {L_DETAILS} - - - - title="{available.actions.L_ACTION_EXPLAIN}">{available.actions.L_ACTION} -  |  - - - - - + {% for list in ['enabled', 'disabled', 'available'] %} + {% set blockname = attribute(loops, list) %} + {% if blockname|length %} + + {{ lang('EXTENSIONS_' ~ list|upper) }} + {% if list == 'enabled' %} + {% EVENT acp_ext_list_enabled_title_after %} + {% elseif list == 'disabled' %} + {% EVENT acp_ext_list_disabled_title_after %} + {% elseif list == 'available' %} + {% EVENT acp_ext_list_available_title_after %} + {% endif %} + + + {% for data in blockname %} + + {{ data.META_DISPLAY_NAME }} + {% if list == 'enabled' %} + {% EVENT acp_ext_list_enabled_name_after %} + {% elseif list == 'disabled' %} + {% EVENT acp_ext_list_disabled_name_after %} + {% elseif list == 'available' %} + {% EVENT acp_ext_list_available_name_after %} + {% endif %} + + + {% if data.S_VERSIONCHECK %} + {{ data.META_VERSION }} + {% if not data.S_UP_TO_DATE %}{% endif %} + {% else %} + {{ data.META_VERSION }} + {% endif %} + + + {% if data.U_DETAILS %}{{ lang ('DETAILS') }}{% endif %} + + + {% for actions in data.actions %} + {{ actions.L_ACTION }} + {% if not actions.S_LAST_ROW %} | {% endif %} + {% endfor %} + + + {% endfor %} + {% endif %} + {% endfor %} From 629a909b6559bad4da63ebc4b98252e1cf13442f Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 13 Aug 2024 15:33:18 +0700 Subject: [PATCH 5/5] [ticket/17359] Adjust template event target phpBB version PHPBB-17359 --- phpBB/docs/events.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index c0f313f540b..2578c967abe 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -73,13 +73,13 @@ acp_ext_details_notice acp_ext_list_available_name_after === * Location: adm/style/acp_ext_list.html -* Since: 3.1.13-RC1 +* Since: 3.3.14-RC1 * Purpose: Add content after the name of available extensions in the list acp_ext_list_available_title_after === * Location: adm/style/acp_ext_list.html -* Since: 3.1.13-RC1 +* Since: 3.3.14-RC1 * Purpose: Add text after available extensions section title. acp_ext_list_disabled_name_after