diff --git a/README.md b/README.md index e46daa7..44d92b4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,17 @@ # Restore Jumpbox -A development extension that restores the public forum jumpbox on prosilver forum and topic pages after the removal proposed in [phpBB PR #6927](https://github.com/phpbb/phpbb/pull/6927). +[![Tests](https://github.com/phpbbmodders/restorejumpbox/actions/workflows/tests.yml/badge.svg)](https://github.com/phpbbmodders/restorejumpbox/actions/workflows/tests.yml) [![Lint](https://github.com/phpbbmodders/restorejumpbox/actions/workflows/lint.yml/badge.svg)](https://github.com/phpbbmodders/restorejumpbox/actions/workflows/lint.yml) -For testing on phpBB 4.0 with the removal applied, place the extension in `ext/phpbbmodders/restorejumpbox` and enable **Restore Jumpbox** in the ACP. +Restores the public forum jumpbox on phpBB 4.0. -In **ACP → General → Load settings**, set **Show the public jumpbox** to **No** to hide the selector while keeping its permission-filtered links available to phpbb-tui. +phpBB 4.0 removes the "Jump to" forum selector, as proposed in [phpBB PR #6927](https://github.com/phpbb/phpbb/pull/6927). This extension puts it back on prosilver's forum and topic pages. + +## Features + +- **"Jump to" selector** at the bottom of forum and topic pages, listing only the forums the visitor is allowed to see, in board order with subforums nested. +- **Show the public jumpbox** setting under **ACP → General → Load settings**. Set it to **No** to hide the selector while keeping its forum links in the page for clients that read them, such as [phpbb-tui](https://github.com/drdewes/phpbb-tui). +- Keyboard support: Escape closes the open selector and returns focus to its button, and screen readers are told whether it is open. +- Steps aside on phpBB builds that still have their own jumpbox, so the board never shows two. ## Screenshots @@ -14,19 +21,38 @@ In **ACP → General → Load settings**, set **Show the public jumpbox** to **N [Full screenshot gallery](docs/images/screenshots/README.md) +## Requirements + +- phpBB 4.0 (4.0.0-a2-dev or later in the 4.0 series). phpBB 3.3 still has its own jumpbox and does not need this extension. +- PHP 8.2 or later +- The prosilver style, or a style based on it + +## Installation + +1. Copy the extension to `ext/phpbbmodders/restorejumpbox` +2. In the Administration Control Panel, go to **Customise → Manage extensions** +3. Enable the **Restore Jumpbox** extension +4. Optionally change **Show the public jumpbox** under **General → Load settings** + ## TODO -See the [scope and acceptance checks](docs/TODO.md). +Ideas not yet built, practical and speculative alike: [`docs/TODO.md`](docs/TODO.md). ## Contributing -- [Report a bug](https://github.com/phpbbmodders/restorejumpbox/issues). -- [Ask a question or propose a feature](https://github.com/phpbbmodders/restorejumpbox/discussions). +Contributions are welcome! + +- **Bug reports**: [Open an issue](https://github.com/phpbbmodders/restorejumpbox/issues). +- **Everything else** (questions, feature requests, ideas, general discussion): [Use Discussions](https://github.com/phpbbmodders/restorejumpbox/discussions), or the [community forum](https://www.phpbbmodders.com/community/). +- Pull requests are welcome for bug fixes or discussed features. ## Acknowledgments -- Initial scope drafted with [Codex](https://openai.com/codex/). +- First version written with [Codex](https://openai.com/codex/). +- Code review, bug fixes, and documentation assisted by [Claude](https://www.anthropic.com/claude). ## License -Licensed under the [GNU General Public License v2.0](license.txt). +This extension is licensed under the **GNU General Public License v2.0**. + +See [license.txt](license.txt) for more information. diff --git a/config/services.yml b/config/services.yml index 23efe2d..894edb3 100644 --- a/config/services.yml +++ b/config/services.yml @@ -3,6 +3,7 @@ services: class: phpbbmodders\restorejumpbox\event\listener arguments: - '@config' + - '@language' - '@request' - '@template' - '@user' diff --git a/docs/TODO.md b/docs/TODO.md index 15f518d..2ea060a 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -1,16 +1,20 @@ -# Initial scope +# TODO -[phpBB PR #6927, proposed revision 5f96997](https://github.com/phpbb/phpbb/pull/6927/files), removes the public jumpbox and its ACP load setting on the 4.0 development branch. It retains the Moderator Control Panel jumpbox and the forced-display path in `make_jumpbox()`. +The first milestone, the selector on prosilver forum and topic pages with an ACP visibility setting, is built. These items are still open. -## First milestone +## Before declaring phpBB 4.0 compatibility -- Restore the forum selector on prosilver forum and topic pages. Treat other removed placements and the old “Return to” links as follow-ups. -- Use phpBB events and an extension-owned template. Confirm that the target 4.0 revision supplies suitable events and that the retained helper can populate the public selector with the current visitor's permissions. -- Preserve the category order, nesting, forum URLs and anchor classes parsed by [phpbb-tui](https://github.com/drdewes/phpbb-tui). Its fallback checks forum pages linked from the index, so an index placement is optional for the first milestone. -- Verify that enabling the extension restores the selector and disabling it removes it. Leave the core ACP setting and removed search-results event outside this milestone. +- Recheck the final diff of [phpBB PR #6927](https://github.com/phpbb/phpbb/pull/6927) once it is merged. This extension was built against revision 5f96997; if the merged version keeps different events, template variables or `make_jumpbox()` behavior, adjust to match. +- Recheck against phpBB 4.0's new default style when it replaces prosilver. The templates here are prosilver only. -## Acceptance checks +## Other places the removal touched -- On a phpBB 4.0 test board with the removal applied, verify nested navigation on forum and topic pages for a guest and a signed-in user. Check that restricted forums are absent for users who cannot list them. -- Run phpbb-tui against the board and compare its forum tree with the permitted hierarchy, including nested forums missing from the index. Check the Moderator Control Panel selector with the extension enabled. -- Recheck the final upstream diff and supported style before implementing or declaring 4.0 compatibility. +PR #6927 also removes the jumpbox, or the "Return to" links next to it, from these pages. Bringing it back on any of them needs a suitable template event; where core has none, write the request for one under `docs/events/`: + +- Search results +- Posting, the forum login page and the FAQ/help page +- Memberlist, team page, user profile and Who is online + +## Ideas + +- An index page placement, for clients that cannot reach nested forums from the board index. diff --git a/event/listener.php b/event/listener.php index 630cd26..322c030 100644 --- a/event/listener.php +++ b/event/listener.php @@ -9,6 +9,7 @@ namespace phpbbmodders\restorejumpbox\event; use phpbb\config\config; +use phpbb\language\language; use phpbb\request\request_interface; use phpbb\template\template; use phpbb\user; @@ -18,6 +19,7 @@ class listener implements EventSubscriberInterface { public function __construct( private config $config, + private language $language, private request_interface $request, private template $template, private user $user, @@ -42,7 +44,7 @@ public function add_visibility_setting(\phpbb\event\data $event): void return; } - $this->user->add_lang_ext('phpbbmodders/restorejumpbox', 'acp'); + $this->language->add_lang('acp', 'phpbbmodders/restorejumpbox'); $display_vars = $event['display_vars']; $visibility_setting = [ 'lang' => 'RESTOREJUMPBOX_VISIBLE', diff --git a/migrations/add_visibility_setting.php b/migrations/add_visibility_setting.php index 0706a09..0615a5d 100644 --- a/migrations/add_visibility_setting.php +++ b/migrations/add_visibility_setting.php @@ -10,6 +10,11 @@ class add_visibility_setting extends \phpbb\db\migration\migration { + public static function depends_on(): array + { + return ['\phpbb\db\migration\data\v400\v400a1']; + } + public function update_data(): array { return [