-
Notifications
You must be signed in to change notification settings - Fork 147
Migrate BBCodeMediaProviderListPage to grid view
#6190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bb2fc1e
Migrate `BBCodeMediaProviderListPage` to grid view
Cyperghost cd7929d
Apply suggestions from code review
Cyperghost 5a7bfaf
Import interactions
Cyperghost 44586b8
Merge remote-tracking branch 'origin/6.2' into 6.2-bb-code-media-prov…
Cyperghost ce0afb3
Add row counter
Cyperghost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...p/install/files/lib/event/gridView/admin/BBCodeMediaProviderGridViewInitialized.class.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <?php | ||
|
|
||
| namespace wcf\event\gridView\admin; | ||
|
|
||
| use wcf\event\IPsr14Event; | ||
| use wcf\system\gridView\admin\BBCodeMediaProviderGridView; | ||
|
|
||
| /** | ||
| * Indicates that the bb code media provider grid view has been initialized. | ||
| * | ||
| * @author Olaf Braun | ||
| * @copyright 2001-2025 WoltLab GmbH | ||
| * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
| * @since 6.2 | ||
| */ | ||
| final class BBCodeMediaProviderGridViewInitialized implements IPsr14Event | ||
| { | ||
| public function __construct(public readonly BBCodeMediaProviderGridView $gridView) | ||
| { | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
...tall/files/lib/event/interaction/admin/BBCodeMediaProviderInteractionCollecting.class.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <?php | ||
|
|
||
| namespace wcf\event\interaction\admin; | ||
|
|
||
| use wcf\event\IPsr14Event; | ||
| use wcf\system\interaction\admin\BBCodeMediaProviderInteractions; | ||
|
|
||
| /** | ||
| * Indicates that the provider for bb code media provider interactions has been initialized. | ||
| * | ||
| * @author Olaf Braun | ||
| * @copyright 2001-2025 WoltLab GmbH | ||
| * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
| * @since 6.2 | ||
| */ | ||
| final class BBCodeMediaProviderInteractionCollecting implements IPsr14Event | ||
| { | ||
| public function __construct(public readonly BBCodeMediaProviderInteractions $provider) | ||
| { | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
...iles/lib/system/endpoint/controller/core/bbcodes/media/providers/DeleteProvider.class.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <?php | ||
|
|
||
| namespace wcf\system\endpoint\controller\core\bbcodes\media\providers; | ||
|
|
||
| use Laminas\Diactoros\Response\JsonResponse; | ||
| use Psr\Http\Message\ResponseInterface; | ||
| use Psr\Http\Message\ServerRequestInterface; | ||
| use wcf\data\bbcode\media\provider\BBCodeMediaProvider; | ||
| use wcf\data\bbcode\media\provider\BBCodeMediaProviderAction; | ||
| use wcf\http\Helper; | ||
| use wcf\system\endpoint\DeleteRequest; | ||
| use wcf\system\endpoint\IController; | ||
| use wcf\system\WCF; | ||
|
|
||
| /** | ||
| * API endpoint for deleting bb code media provider. | ||
| * | ||
| * @author Olaf Braun | ||
| * @copyright 2001-2025 WoltLab GmbH | ||
| * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
| * @since 6.2 | ||
| */ | ||
| #[DeleteRequest('/core/bb-codes/media/providers/{id:\d+}')] | ||
| final class DeleteProvider implements IController | ||
| { | ||
| #[\Override] | ||
| public function __invoke(ServerRequestInterface $request, array $variables): ResponseInterface | ||
| { | ||
| $provider = Helper::fetchObjectFromRequestParameter($variables['id'], BBCodeMediaProvider::class); | ||
|
|
||
| $this->assertMediaProviderCanBeDeleted(); | ||
|
|
||
| (new BBCodeMediaProviderAction([$provider], 'delete'))->executeAction(); | ||
|
|
||
| return new JsonResponse([]); | ||
| } | ||
|
|
||
| private function assertMediaProviderCanBeDeleted(): void | ||
| { | ||
| WCF::getSession()->checkPermissions(['admin.content.bbcode.canManageBBCode']); | ||
| } | ||
| } | ||
47 changes: 47 additions & 0 deletions
47
...les/lib/system/endpoint/controller/core/bbcodes/media/providers/DisableProvider.class.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?php | ||
|
|
||
| namespace wcf\system\endpoint\controller\core\bbcodes\media\providers; | ||
|
|
||
| use Laminas\Diactoros\Response\JsonResponse; | ||
| use Psr\Http\Message\ResponseInterface; | ||
| use Psr\Http\Message\ServerRequestInterface; | ||
| use wcf\data\bbcode\media\provider\BBCodeMediaProvider; | ||
| use wcf\data\bbcode\media\provider\BBCodeMediaProviderAction; | ||
| use wcf\http\Helper; | ||
| use wcf\system\endpoint\IController; | ||
| use wcf\system\endpoint\PostRequest; | ||
| use wcf\system\exception\PermissionDeniedException; | ||
| use wcf\system\WCF; | ||
|
|
||
| /** | ||
| * API endpoint for disabling bb code media provider. | ||
| * | ||
| * @author Olaf Braun | ||
| * @copyright 2001-2025 WoltLab GmbH | ||
| * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
| * @since 6.2 | ||
| */ | ||
| #[PostRequest('/core/bb-codes/media/providers/{id:\d+}/disable')] | ||
Cyperghost marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| final class DisableProvider implements IController | ||
| { | ||
| #[\Override] | ||
| public function __invoke(ServerRequestInterface $request, array $variables): ResponseInterface | ||
| { | ||
| $provider = Helper::fetchObjectFromRequestParameter($variables['id'], BBCodeMediaProvider::class); | ||
|
|
||
| $this->assertMediaProviderCanBeDisabled($provider); | ||
|
|
||
| (new BBCodeMediaProviderAction([$provider], 'toggle'))->executeAction(); | ||
|
|
||
| return new JsonResponse([]); | ||
| } | ||
|
|
||
| private function assertMediaProviderCanBeDisabled(BBCodeMediaProvider $provider): void | ||
| { | ||
| WCF::getSession()->checkPermissions(['admin.content.bbcode.canManageBBCode']); | ||
|
|
||
| if ($provider->isDisabled) { | ||
| throw new PermissionDeniedException(); | ||
| } | ||
| } | ||
| } | ||
47 changes: 47 additions & 0 deletions
47
...iles/lib/system/endpoint/controller/core/bbcodes/media/providers/EnableProvider.class.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?php | ||
|
|
||
| namespace wcf\system\endpoint\controller\core\bbcodes\media\providers; | ||
|
|
||
| use Laminas\Diactoros\Response\JsonResponse; | ||
| use Psr\Http\Message\ResponseInterface; | ||
| use Psr\Http\Message\ServerRequestInterface; | ||
| use wcf\data\bbcode\media\provider\BBCodeMediaProvider; | ||
| use wcf\data\bbcode\media\provider\BBCodeMediaProviderAction; | ||
| use wcf\http\Helper; | ||
| use wcf\system\endpoint\IController; | ||
| use wcf\system\endpoint\PostRequest; | ||
| use wcf\system\exception\PermissionDeniedException; | ||
| use wcf\system\WCF; | ||
|
|
||
| /** | ||
| * API endpoint for enabling bb code media provider. | ||
| * | ||
| * @author Olaf Braun | ||
| * @copyright 2001-2025 WoltLab GmbH | ||
| * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
| * @since 6.2 | ||
| */ | ||
| #[PostRequest('/core/bb-codes/media/providers/{id:\d+}/enable')] | ||
Cyperghost marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| final class EnableProvider implements IController | ||
| { | ||
| #[\Override] | ||
| public function __invoke(ServerRequestInterface $request, array $variables): ResponseInterface | ||
| { | ||
| $provider = Helper::fetchObjectFromRequestParameter($variables['id'], BBCodeMediaProvider::class); | ||
|
|
||
| $this->assertMediaProviderCanBeEnabled($provider); | ||
|
|
||
| (new BBCodeMediaProviderAction([$provider], 'toggle'))->executeAction(); | ||
|
|
||
| return new JsonResponse([]); | ||
| } | ||
|
|
||
| private function assertMediaProviderCanBeEnabled(BBCodeMediaProvider $provider): void | ||
| { | ||
| WCF::getSession()->checkPermissions(['admin.content.bbcode.canManageBBCode']); | ||
|
|
||
| if (!$provider->isDisabled) { | ||
| throw new PermissionDeniedException(); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.