diff --git a/composer.json b/composer.json index 72e3ae4..6911aa3 100644 --- a/composer.json +++ b/composer.json @@ -19,14 +19,15 @@ } ], "require": { - "php": "^7.4 || ^8.0", + "php": "^8.1", "ext-curl": "*", "ext-json": "*", "composer/installers": "^1.0 || ^2.0", "davaxi/sparkline": "^2.0", "jaybizzle/crawler-detect": "^1.2", "league/csv": "^9.0", - "symfony/stopwatch": "^4.0 || ^5.0 || ^6.0" + "symfony/stopwatch": "^4.0 || ^5.0 || ^6.0", + "winter/wn-backend-module": "~1.2.8" }, "replace": { "vdlp/oc-redirect-plugin": "<=3.1.1" diff --git a/controllers/Categories.php b/controllers/Categories.php index 1df21b2..b62fbb2 100644 --- a/controllers/Categories.php +++ b/controllers/Categories.php @@ -6,7 +6,6 @@ use Backend\Behaviors; use Backend\Classes\Controller; -use BackendMenu; /** * @mixin Behaviors\FormController @@ -20,15 +19,11 @@ final class Categories extends Controller ]; public $requiredPermissions = ['winter.redirect.access_redirects']; - public string $formConfig = 'config_form.yaml'; - public string $listConfig = 'config_list.yaml'; public function __construct() { parent::__construct(); $this->addCss('/plugins/winter/redirect/assets/css/redirect.css'); - - BackendMenu::setContext('Winter.Redirect', 'redirect', 'categories'); } } diff --git a/controllers/Logs.php b/controllers/Logs.php index 748ec14..d294a5e 100644 --- a/controllers/Logs.php +++ b/controllers/Logs.php @@ -8,7 +8,6 @@ use Backend\Behaviors\ListController; use Backend\Classes\Controller; -use BackendMenu; use Illuminate\Contracts\Translation\Translator; use Illuminate\Http\Request; use Winter\Storm\Flash\FlashBag; @@ -26,7 +25,6 @@ final class Logs extends Controller ]; public $requiredPermissions = ['winter.redirect.access_redirects']; - public string $listConfig = 'config_list.yaml'; private Request $request; private Translator $translator; private FlashBag $flash; @@ -36,8 +34,6 @@ public function __construct(Request $request, Translator $translator, LoggerInte { parent::__construct(); - BackendMenu::setContext('Winter.Redirect', 'redirect', 'logs'); - $this->addCss('/plugins/winter/redirect/assets/css/redirect.css'); $this->request = $request; diff --git a/controllers/Redirects.php b/controllers/Redirects.php index e0cff38..ed6a2ed 100644 --- a/controllers/Redirects.php +++ b/controllers/Redirects.php @@ -51,17 +51,13 @@ final class Redirects extends Controller Behaviors\RelationController::class, ]; - public string $formConfig = 'config_form.yaml'; + public $formLayout = 'sidebar'; public array $listConfig = [ 'list' => 'config_list.yaml', 'requestLog' => 'request-log/config_list.yaml', ]; - public string $reorderConfig = 'config_reorder.yaml'; - public string $importExportConfig = 'config_import_export.yaml'; - public string $relationConfig = 'config_relation.yaml'; - public $requiredPermissions = ['winter.redirect.access_redirects']; private Request $request; @@ -106,14 +102,19 @@ public function index(): void } } + public function create() + { + $this->formLayout = 'standard'; + + parent::create(); + } + /** * @throws ModelNotFoundException * @noinspection PhpStrictTypeCheckingInspection */ public function update($recordId = null, $context = null) { - $this->bodyClass = 'compact-container'; - /** @var Models\Redirect $redirect */ $redirect = Models\Redirect::query()->findOrFail($recordId); @@ -170,18 +171,6 @@ public function getCacheManager(): CacheManagerInterface return $this->cacheManager; } - public function create_onSave(?string $context = null): RedirectResponse - { - /** @noinspection PhpPossiblePolymorphicInvocationInspection */ - $redirect = parent::create_onSave($context); - - if ($this->request->has('new')) { - return Backend::redirect('winter/redirect/redirects/create'); - } - - return $redirect; - } - public function index_onDelete(): array { $redirectIds = $this->getCheckedIds(); diff --git a/controllers/Statistics.php b/controllers/Statistics.php index b5dbcf3..db83390 100644 --- a/controllers/Statistics.php +++ b/controllers/Statistics.php @@ -6,7 +6,6 @@ use Backend\Classes\Controller; use Backend\Models\BrandSetting; -use BackendMenu; use Carbon\Carbon; use Carbon\Exceptions\InvalidFormatException; use JsonException; @@ -25,8 +24,6 @@ public function __construct() { parent::__construct(); - BackendMenu::setContext('Winter.Redirect', 'redirect', 'statistics'); - $this->pageTitle = 'winter.redirect::lang.title.statistics'; $this->addCss('/plugins/winter/redirect/assets/css/redirect.css'); diff --git a/controllers/categories/_list_toolbar.htm b/controllers/categories/_list_toolbar.php similarity index 100% rename from controllers/categories/_list_toolbar.htm rename to controllers/categories/_list_toolbar.php diff --git a/controllers/categories/create.htm b/controllers/categories/create.htm deleted file mode 100644 index 7d7c7ac..0000000 --- a/controllers/categories/create.htm +++ /dev/null @@ -1,48 +0,0 @@ - - - - -fatalError): ?> - - 'layout']); ?> - -
- formRender(); ?> -
- -
-
- - - - - -
-
- - - - - -

fatalError); ?>

-

- - diff --git a/controllers/categories/index.htm b/controllers/categories/index.htm deleted file mode 100644 index e8b8aa9..0000000 --- a/controllers/categories/index.htm +++ /dev/null @@ -1,2 +0,0 @@ - -listRender(); ?> diff --git a/controllers/categories/update.htm b/controllers/categories/update.htm deleted file mode 100644 index 5542380..0000000 --- a/controllers/categories/update.htm +++ /dev/null @@ -1,56 +0,0 @@ - - - - -fatalError): ?> - - 'layout']); ?> - -
- formRender(); ?> -
- -
-
- - - - - - -
-
- - - - - -

fatalError); ?>

-

- - diff --git a/controllers/logs/_list_toolbar.htm b/controllers/logs/_list_toolbar.php similarity index 100% rename from controllers/logs/_list_toolbar.htm rename to controllers/logs/_list_toolbar.php diff --git a/controllers/logs/index.htm b/controllers/logs/index.htm deleted file mode 100644 index e8b8aa9..0000000 --- a/controllers/logs/index.htm +++ /dev/null @@ -1,2 +0,0 @@ - -listRender(); ?> diff --git a/controllers/redirects/_field_statistics.htm b/controllers/redirects/_field_statistics.php similarity index 100% rename from controllers/redirects/_field_statistics.htm rename to controllers/redirects/_field_statistics.php diff --git a/controllers/redirects/_tab_logs.htm b/controllers/redirects/_field_tab_logs.php similarity index 100% rename from controllers/redirects/_tab_logs.htm rename to controllers/redirects/_field_tab_logs.php diff --git a/controllers/redirects/_list_toolbar.htm b/controllers/redirects/_list_toolbar.htm deleted file mode 100644 index cb5ba16..0000000 --- a/controllers/redirects/_list_toolbar.htm +++ /dev/null @@ -1,77 +0,0 @@ -
- - - - - - - - - - - - - - -
- - - -
- - -
diff --git a/controllers/redirects/_list_toolbar.php b/controllers/redirects/_list_toolbar.php new file mode 100644 index 0000000..54a75b9 --- /dev/null +++ b/controllers/redirects/_list_toolbar.php @@ -0,0 +1,110 @@ +
+ + + + + + + + + + + + + + + + +
diff --git a/controllers/redirects/_popup_actions.htm b/controllers/redirects/_popup_actions.php similarity index 100% rename from controllers/redirects/_popup_actions.htm rename to controllers/redirects/_popup_actions.php diff --git a/controllers/redirects/_redirect_test.htm b/controllers/redirects/_redirect_test.php similarity index 100% rename from controllers/redirects/_redirect_test.htm rename to controllers/redirects/_redirect_test.php diff --git a/controllers/redirects/_redirect_test_result.htm b/controllers/redirects/_redirect_test_result.php similarity index 100% rename from controllers/redirects/_redirect_test_result.htm rename to controllers/redirects/_redirect_test_result.php diff --git a/controllers/redirects/_reorder_toolbar.htm b/controllers/redirects/_reorder_toolbar.htm deleted file mode 100644 index 6f7b303..0000000 --- a/controllers/redirects/_reorder_toolbar.htm +++ /dev/null @@ -1,6 +0,0 @@ -
- - - -
diff --git a/controllers/redirects/_sparkline.htm b/controllers/redirects/_sparkline.php similarity index 100% rename from controllers/redirects/_sparkline.htm rename to controllers/redirects/_sparkline.php diff --git a/controllers/redirects/_status_code_info.htm b/controllers/redirects/_status_code_info.php similarity index 100% rename from controllers/redirects/_status_code_info.htm rename to controllers/redirects/_status_code_info.php diff --git a/controllers/redirects/_warning.htm b/controllers/redirects/_warning.php similarity index 100% rename from controllers/redirects/_warning.htm rename to controllers/redirects/_warning.php diff --git a/controllers/redirects/create.htm b/controllers/redirects/create.htm deleted file mode 100644 index 5646fd1..0000000 --- a/controllers/redirects/create.htm +++ /dev/null @@ -1,57 +0,0 @@ - - - - -fatalError): ?> - - 'layout']); ?> - -
- formRender(); ?> -
- -
-
- - - - - - -
-
- - - - - -

fatalError); ?>

-

- - diff --git a/controllers/redirects/export.htm b/controllers/redirects/export.htm deleted file mode 100644 index 0845476..0000000 --- a/controllers/redirects/export.htm +++ /dev/null @@ -1,24 +0,0 @@ - - - - - 'layout']); ?> -
- exportRender(); ?> -
-
-
- -
-
- diff --git a/controllers/redirects/import.htm b/controllers/redirects/import.htm deleted file mode 100644 index d02e6f7..0000000 --- a/controllers/redirects/import.htm +++ /dev/null @@ -1,22 +0,0 @@ - - - - - 'layout']); ?> -
- importRender(); ?> -
-
- -
- diff --git a/controllers/redirects/index.htm b/controllers/redirects/index.php similarity index 100% rename from controllers/redirects/index.htm rename to controllers/redirects/index.php diff --git a/controllers/redirects/reorder.htm b/controllers/redirects/reorder.htm deleted file mode 100644 index 39b91c9..0000000 --- a/controllers/redirects/reorder.htm +++ /dev/null @@ -1,8 +0,0 @@ - - - - -reorderRender(); ?> diff --git a/controllers/redirects/request-log/_list_toolbar.htm b/controllers/redirects/request-log/_list_toolbar.php similarity index 100% rename from controllers/redirects/request-log/_list_toolbar.htm rename to controllers/redirects/request-log/_list_toolbar.php diff --git a/controllers/redirects/request-log/_modal.htm b/controllers/redirects/request-log/_modal.php similarity index 100% rename from controllers/redirects/request-log/_modal.htm rename to controllers/redirects/request-log/_modal.php diff --git a/controllers/redirects/update.htm b/controllers/redirects/update.htm deleted file mode 100644 index 61d0b72..0000000 --- a/controllers/redirects/update.htm +++ /dev/null @@ -1,79 +0,0 @@ - - - - -fatalError): ?> - - -
- -
- - makePartial('warning', ['warningMessage' => $warningMessage]); ?> - - formRenderOutsideFields() ?> - formRenderPrimaryTabs() ?> -
- -
-
- - - - - - -
-
-
- - - - -
- formRenderSecondaryTabs() ?> -
- - - - 'layout stretch']) ?> - makeLayout('form-with-sidebar') ?> - - - - - -
- -
-
-

fatalError); ?>

-

-
- - diff --git a/controllers/statistics/_hits-per-day.htm b/controllers/statistics/_hits-per-day.php similarity index 100% rename from controllers/statistics/_hits-per-day.htm rename to controllers/statistics/_hits-per-day.php diff --git a/controllers/statistics/_loading-indicator.htm b/controllers/statistics/_loading-indicator.php similarity index 100% rename from controllers/statistics/_loading-indicator.htm rename to controllers/statistics/_loading-indicator.php diff --git a/controllers/statistics/_redirect-hits-per-month.htm b/controllers/statistics/_redirect-hits-per-month.php similarity index 100% rename from controllers/statistics/_redirect-hits-per-month.htm rename to controllers/statistics/_redirect-hits-per-month.php diff --git a/controllers/statistics/_score-board.htm b/controllers/statistics/_score-board.php similarity index 100% rename from controllers/statistics/_score-board.htm rename to controllers/statistics/_score-board.php diff --git a/controllers/statistics/_top-crawlers-this-month.htm b/controllers/statistics/_top-crawlers-this-month.php similarity index 100% rename from controllers/statistics/_top-crawlers-this-month.htm rename to controllers/statistics/_top-crawlers-this-month.php diff --git a/controllers/statistics/_top-redirects-this-month.htm b/controllers/statistics/_top-redirects-this-month.php similarity index 100% rename from controllers/statistics/_top-redirects-this-month.htm rename to controllers/statistics/_top-redirects-this-month.php diff --git a/controllers/statistics/index.htm b/controllers/statistics/index.php similarity index 100% rename from controllers/statistics/index.htm rename to controllers/statistics/index.php diff --git a/controllers/testlab/_test_button.htm b/controllers/testlab/_test_button.php similarity index 100% rename from controllers/testlab/_test_button.htm rename to controllers/testlab/_test_button.php diff --git a/controllers/testlab/_tester_failed.htm b/controllers/testlab/_tester_failed.php similarity index 100% rename from controllers/testlab/_tester_failed.htm rename to controllers/testlab/_tester_failed.php diff --git a/controllers/testlab/_tester_result.htm b/controllers/testlab/_tester_result.php similarity index 100% rename from controllers/testlab/_tester_result.htm rename to controllers/testlab/_tester_result.php diff --git a/controllers/testlab/_tester_result_items.htm b/controllers/testlab/_tester_result_items.php similarity index 100% rename from controllers/testlab/_tester_result_items.htm rename to controllers/testlab/_tester_result_items.php diff --git a/controllers/testlab/index.htm b/controllers/testlab/index.php similarity index 100% rename from controllers/testlab/index.htm rename to controllers/testlab/index.php diff --git a/lang/en/lang.php b/lang/en/lang.php index 22f5a14..28cf0e8 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -224,7 +224,6 @@ 'new_redirect' => 'New redirect', 'create_redirects' => 'Create redirects', 'create_redirect' => 'Create redirect', - 'create_and_new' => 'Create and new', 'delete' => 'Delete', 'enable' => 'Enable', 'disable' => 'Disable', diff --git a/lang/es/lang.php b/lang/es/lang.php index a983462..033f477 100644 --- a/lang/es/lang.php +++ b/lang/es/lang.php @@ -221,7 +221,6 @@ 'new_redirect' => 'Nueva redirección', // changed since 2.0.3 'create_redirects' => 'Crear redirecciones', // since 2.0.3 'create_redirect' => 'Crear redirección', - 'create_and_new' => 'Crear y nuevo', 'delete' => 'Borrar', 'enable' => 'Activar', 'disable' => 'Desactivar', diff --git a/lang/fr/lang.php b/lang/fr/lang.php index a7041e4..3c8a3a4 100644 --- a/lang/fr/lang.php +++ b/lang/fr/lang.php @@ -226,7 +226,6 @@ 'new_redirect' => 'Ajouter', 'create_redirects' => 'Créer redirection', 'create_redirect' => 'Créer une redirection', - 'create_and_new' => 'Créer et nouveau', 'delete' => 'Supprimer', 'enable' => 'Activer', 'disable' => 'Désactiver', diff --git a/lang/nl/lang.php b/lang/nl/lang.php index e93cc0f..76b377c 100644 --- a/lang/nl/lang.php +++ b/lang/nl/lang.php @@ -222,7 +222,6 @@ 'new_redirect' => 'Nieuwe redirect', 'create_redirects' => 'Maak redirects', 'create_redirect' => 'Maak redirect', - 'create_and_new' => 'Maken en nieuw', 'delete' => 'Verwijderen', 'enable' => 'Inschakelen', 'disable' => 'Uitschakelen', diff --git a/lang/pl/lang.php b/lang/pl/lang.php index 4f052b9..140b16b 100644 --- a/lang/pl/lang.php +++ b/lang/pl/lang.php @@ -224,7 +224,6 @@ 'new_redirect' => 'Nowe przekierowanie', 'create_redirects' => 'Utwórz przekierowania', 'create_redirect' => 'Utwórz przekierowanie', - 'create_and_new' => 'Utwórz i nowe', 'delete' => 'Usuń', 'enable' => 'Włącz', 'disable' => 'Wyłącz', diff --git a/lang/ru/lang.php b/lang/ru/lang.php index efb8330..334edaf 100644 --- a/lang/ru/lang.php +++ b/lang/ru/lang.php @@ -224,7 +224,6 @@ 'new_redirect' => 'Новый редирект', 'create_redirects' => 'Создание редиректов', 'create_redirect' => 'Создать редирект', - 'create_and_new' => 'Создать и новый', 'delete' => 'Удалить', 'enable' => 'Включить', 'disable' => 'Отключить', diff --git a/lang/sv/lang.php b/lang/sv/lang.php index 44e12ce..5a982d5 100755 --- a/lang/sv/lang.php +++ b/lang/sv/lang.php @@ -216,7 +216,6 @@ 'new_redirect' => 'Ny ompekning', 'create_redirects' => 'Skapa ompekning', 'create_redirect' => 'Create redirect', // TODO - 'create_and_new' => 'Create and new', // TODO 'delete' => 'Radera', 'enable' => 'Aktivera', 'disable' => 'Inaktivera', diff --git a/models/Redirect.php b/models/Redirect.php index d5fd2f1..7ab4631 100644 --- a/models/Redirect.php +++ b/models/Redirect.php @@ -14,7 +14,6 @@ use Winter\Storm\Support\Arr; use Winter\Storm\Database\Builder; use Winter\Storm\Database\Model; -use Winter\Storm\Database\Relations\HasMany; use Winter\Storm\Database\Traits\Sortable; use Winter\Storm\Database\Traits\Validation; @@ -209,11 +208,6 @@ public function isMatchTypeRegex(): bool return $this->attributes['match_type'] === self::TYPE_REGEX; } - public function clients(): HasMany - { - return $this->hasMany(Client::class); - } - public function setSortableOrder($itemIds, array $itemOrders = null): void { $itemIds = array_map(static function ($itemId) { @@ -351,7 +345,6 @@ public function beforeSave(): void $this->setAttribute('to_url', null); $this->setAttribute('cms_page', null); break; - } } diff --git a/models/redirect/fields.yaml b/models/redirect/fields.yaml index 8e95d4a..fb71e4b 100644 --- a/models/redirect/fields.yaml +++ b/models/redirect/fields.yaml @@ -227,6 +227,7 @@ tabs: tab_logs: tab: winter.redirect::lang.tab.tab_logs type: partial + path: field_tab_logs # # Advanced #