From ab3c6e20a68ac1620b8ad91d6a8b089f5b084bc7 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Fri, 31 May 2024 16:31:25 +0200 Subject: [PATCH] align Smarty template registration --- .../Controller/Admin/MailCheckBase.php | 3 ++- .../Controller/Admin/MailCheckMenu.php | 3 ++- .../Controller/Admin/MailConfigCheck.php | 3 ++- Application/Controller/Admin/MailInfoPage.php | 3 ++- Application/Controller/Admin/MailTester.php | 3 ++- Application/Controller/Admin/SmtpChecker.php | 3 ++- Application/Controller/Admin/SpfChecker.php | 3 ++- Application/Model/Constants.php | 8 +++++++ Application/views/admin/de/module_lang.php | 3 --- Application/views/admin/en/module_lang.php | 3 --- .../de/d3_mailconfigchecker_lang.php | 22 +++++++++++++++++++ .../en/d3_mailconfigchecker_lang.php | 22 +++++++++++++++++++ Application/views/de/translations.php | 13 +++++++++++ Application/views/en/translations.php | 13 +++++++++++ metadata.php | 20 ++++++++--------- .../smarty/admin}/inc/bootstrap.tpl | 0 .../tpl => views/smarty/admin}/mailTester.tpl | 2 +- .../smarty/admin}/mailcheckbase.tpl | 0 .../smarty/admin}/mailcheckmenu.tpl | 0 .../smarty/admin}/mailconfigcheck.tpl | 2 +- .../smarty/admin}/mailinfopage.tpl | 2 +- .../tpl => views/smarty/admin}/smtpCheck.tpl | 2 +- .../tpl => views/smarty/admin}/spfCheck.tpl | 2 +- 23 files changed, 107 insertions(+), 28 deletions(-) create mode 100644 Application/Model/Constants.php delete mode 100644 Application/views/admin/de/module_lang.php delete mode 100644 Application/views/admin/en/module_lang.php create mode 100644 Application/views/admin_smarty/de/d3_mailconfigchecker_lang.php create mode 100644 Application/views/admin_smarty/en/d3_mailconfigchecker_lang.php rename {Application/views/admin/tpl => views/smarty/admin}/inc/bootstrap.tpl (100%) rename {Application/views/admin/tpl => views/smarty/admin}/mailTester.tpl (97%) rename {Application/views/admin/tpl => views/smarty/admin}/mailcheckbase.tpl (100%) rename {Application/views/admin/tpl => views/smarty/admin}/mailcheckmenu.tpl (100%) rename {Application/views/admin/tpl => views/smarty/admin}/mailconfigcheck.tpl (97%) rename {Application/views/admin/tpl => views/smarty/admin}/mailinfopage.tpl (90%) rename {Application/views/admin/tpl => views/smarty/admin}/smtpCheck.tpl (98%) rename {Application/views/admin/tpl => views/smarty/admin}/spfCheck.tpl (98%) diff --git a/Application/Controller/Admin/MailCheckBase.php b/Application/Controller/Admin/MailCheckBase.php index e10ce6d..8e2a7c4 100644 --- a/Application/Controller/Admin/MailCheckBase.php +++ b/Application/Controller/Admin/MailCheckBase.php @@ -19,11 +19,12 @@ declare(strict_types=1); namespace D3\MailConfigChecker\Application\Controller\Admin; +use D3\MailConfigChecker\Application\Model\Constants; use OxidEsales\Eshop\Application\Controller\Admin\AdminController; class MailCheckBase extends AdminController { - protected $_sThisTemplate = 'mailCheckBase.tpl'; + protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/mailCheckBase'; /** * @return string diff --git a/Application/Controller/Admin/MailCheckMenu.php b/Application/Controller/Admin/MailCheckMenu.php index 7471320..3cde037 100644 --- a/Application/Controller/Admin/MailCheckMenu.php +++ b/Application/Controller/Admin/MailCheckMenu.php @@ -19,11 +19,12 @@ declare(strict_types=1); namespace D3\MailConfigChecker\Application\Controller\Admin; +use D3\MailConfigChecker\Application\Model\Constants; use OxidEsales\Eshop\Application\Controller\Admin\AdminListController; class MailCheckMenu extends AdminListController { - protected $_sThisTemplate = 'mailCheckMenu.tpl'; + protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/mailCheckMenu'; public function render() { diff --git a/Application/Controller/Admin/MailConfigCheck.php b/Application/Controller/Admin/MailConfigCheck.php index ad02f2b..12aad82 100644 --- a/Application/Controller/Admin/MailConfigCheck.php +++ b/Application/Controller/Admin/MailConfigCheck.php @@ -17,6 +17,7 @@ namespace D3\MailConfigChecker\Application\Controller\Admin; use Assert\Assert; use Assert\InvalidArgumentException; +use D3\MailConfigChecker\Application\Model\Constants; use D3\MailConfigChecker\Application\Model\Exception\d3TranslatableLazyAssertionException; use Exception; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; @@ -26,7 +27,7 @@ use OxidEsales\Eshop\Core\Registry; class MailConfigCheck extends AdminDetailsController { - protected $_sThisTemplate = 'mailConfigCheck.tpl'; + protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/mailConfigCheck'; protected $testMailAddress = 'test@example.com'; public function render() diff --git a/Application/Controller/Admin/MailInfoPage.php b/Application/Controller/Admin/MailInfoPage.php index bb0c601..226a77b 100644 --- a/Application/Controller/Admin/MailInfoPage.php +++ b/Application/Controller/Admin/MailInfoPage.php @@ -15,9 +15,10 @@ namespace D3\MailConfigChecker\Application\Controller\Admin; +use D3\MailConfigChecker\Application\Model\Constants; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; class MailInfoPage extends AdminDetailsController { - protected $_sThisTemplate = 'mailInfoPage.tpl'; + protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/mailInfoPage'; } diff --git a/Application/Controller/Admin/MailTester.php b/Application/Controller/Admin/MailTester.php index 3e93f4b..397db97 100644 --- a/Application/Controller/Admin/MailTester.php +++ b/Application/Controller/Admin/MailTester.php @@ -16,6 +16,7 @@ namespace D3\MailConfigChecker\Application\Controller\Admin; use Assert\Assert; +use D3\MailConfigChecker\Application\Model\Constants; use D3\MailConfigChecker\Application\Model\Exception\d3TranslatableLazyAssertionException; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; use OxidEsales\Eshop\Application\Model\Shop; @@ -24,7 +25,7 @@ use OxidEsales\Eshop\Core\Registry; class MailTester extends AdminDetailsController { - protected $_sThisTemplate = 'mailTester.tpl'; + protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/mailTester'; public function sendMail() { diff --git a/Application/Controller/Admin/SmtpChecker.php b/Application/Controller/Admin/SmtpChecker.php index 6e5a969..311a8f3 100644 --- a/Application/Controller/Admin/SmtpChecker.php +++ b/Application/Controller/Admin/SmtpChecker.php @@ -17,6 +17,7 @@ namespace D3\MailConfigChecker\Application\Controller\Admin; use Assert\Assert; use Assert\InvalidArgumentException; +use D3\MailConfigChecker\Application\Model\Constants; use Net_SMTP; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; use OxidEsales\Eshop\Application\Model\Shop; @@ -70,7 +71,7 @@ class SmtpChecker extends AdminDetailsController public function getTemplateName() { - return 'smtpCheck.tpl'; + return '@'.Constants::OXID_MODULE_ID.'/admin/smtpCheck'; } public function render() diff --git a/Application/Controller/Admin/SpfChecker.php b/Application/Controller/Admin/SpfChecker.php index 798ac38..c94bbc1 100644 --- a/Application/Controller/Admin/SpfChecker.php +++ b/Application/Controller/Admin/SpfChecker.php @@ -16,6 +16,7 @@ declare(strict_types=1); namespace D3\MailConfigChecker\Application\Controller\Admin; use Assert\InvalidArgumentException; +use D3\MailConfigChecker\Application\Model\Constants; use D3\MailConfigChecker\Application\Model\SpfResult; use Mika56\SPFCheck\DNS\DNSRecordGetter; use Mika56\SPFCheck\Model\Query; @@ -27,7 +28,7 @@ use OxidEsales\Eshop\Core\Registry; class SpfChecker extends AdminDetailsController { - protected $_sThisTemplate = 'spfCheck.tpl'; + protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/spfCheck'; public function render() { diff --git a/Application/Model/Constants.php b/Application/Model/Constants.php new file mode 100644 index 0000000..7f83042 --- /dev/null +++ b/Application/Model/Constants.php @@ -0,0 +1,8 @@ + + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + +// @codeCoverageIgnoreStart + +$sLangName = 'Deutsch'; + +$aLang = include __DIR__."/../../de/translations.php"; + +// @codeCoverageIgnoreEnd diff --git a/Application/views/admin_smarty/en/d3_mailconfigchecker_lang.php b/Application/views/admin_smarty/en/d3_mailconfigchecker_lang.php new file mode 100644 index 0000000..0508c4d --- /dev/null +++ b/Application/views/admin_smarty/en/d3_mailconfigchecker_lang.php @@ -0,0 +1,22 @@ + + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + +// @codeCoverageIgnoreStart + +$sLangName = 'English'; + +$aLang = include __DIR__."/../../en/translations.php"; + +// @codeCoverageIgnoreEnd diff --git a/Application/views/de/translations.php b/Application/views/de/translations.php index 68b220c..88bd999 100644 --- a/Application/views/de/translations.php +++ b/Application/views/de/translations.php @@ -1,5 +1,18 @@ + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + return [ 'charset' => 'UTF-8', 'D3_MENU_MAILCHECKER' => 'E-Mail Prüfung', diff --git a/Application/views/en/translations.php b/Application/views/en/translations.php index d5ec530..241ee87 100644 --- a/Application/views/en/translations.php +++ b/Application/views/en/translations.php @@ -1,5 +1,18 @@ + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + return [ "charset" => "UTF-8", "D3_MENU_MAILCHECKER" => "Email checking", diff --git a/metadata.php b/metadata.php index 9b57179..3f5fb45 100644 --- a/metadata.php +++ b/metadata.php @@ -20,17 +20,17 @@ use D3\MailConfigChecker\Application\Controller\Admin\MailInfoPage; use D3\MailConfigChecker\Application\Controller\Admin\MailTester; use D3\MailConfigChecker\Application\Controller\Admin\SpfChecker; use D3\MailConfigChecker\Application\Controller\Admin\SmtpChecker; +use D3\MailConfigChecker\Application\Model\Constants; $sMetadataVersion = '2.1'; -$sModuleId = 'd3mailconfigchecker'; $logo = '(D3)'; /** * Module information */ $aModule = [ - 'id' => $sModuleId, + 'id' => Constants::OXID_MODULE_ID, 'title' => [ 'de' => $logo.' E-Mail Konfigurationsprüfung', 'en' => $logo.' Mail Configuration Check Tool', @@ -54,13 +54,13 @@ $aModule = [ 'd3mailtester' => MailTester::class, ], 'templates' => [ - 'mailCheckBase.tpl' => 'd3/mailconfigchecker/Application/views/admin/tpl/mailcheckbase.tpl', - 'mailCheckMenu.tpl' => 'd3/mailconfigchecker/Application/views/admin/tpl/mailcheckmenu.tpl', - 'mailInfoPage.tpl' => 'd3/mailconfigchecker/Application/views/admin/tpl/mailinfopage.tpl', - 'mailConfigCheck.tpl' => 'd3/mailconfigchecker/Application/views/admin/tpl/mailconfigcheck.tpl', - 'smtpCheck.tpl' => 'd3/mailconfigchecker/Application/views/admin/tpl/smtpCheck.tpl', - 'spfCheck.tpl' => 'd3/mailconfigchecker/Application/views/admin/tpl/spfCheck.tpl', - 'mailTester.tpl' => 'd3/mailconfigchecker/Application/views/admin/tpl/mailTester.tpl', - 'inc_bootstrap.tpl' => 'd3/mailconfigchecker/Application/views/admin/tpl/inc/bootstrap.tpl', + '@' . Constants::OXID_MODULE_ID . '/admin/mailCheckBase.tpl' => 'views/smarty/admin/mailcheckbase.tpl', + '@' . Constants::OXID_MODULE_ID . '/admin/mailCheckMenu.tpl' => 'views/smarty/admin/mailcheckmenu.tpl', + '@' . Constants::OXID_MODULE_ID . '/admin/mailInfoPage.tpl' => 'views/smarty/admin/mailinfopage.tpl', + '@' . Constants::OXID_MODULE_ID . '/admin/mailConfigCheck.tpl' => 'views/smarty/admin/mailconfigcheck.tpl', + '@' . Constants::OXID_MODULE_ID . '/admin/smtpCheck.tpl' => 'views/smarty/admin/smtpCheck.tpl', + '@' . Constants::OXID_MODULE_ID . '/admin/spfCheck.tpl' => 'views/smarty/admin/spfCheck.tpl', + '@' . Constants::OXID_MODULE_ID . '/admin/mailTester.tpl' => 'views/smarty/admin/mailTester.tpl', + '@' . Constants::OXID_MODULE_ID . '/admin/inc_bootstrap.tpl' => 'views/smarty/admin/inc/bootstrap.tpl', ], ]; diff --git a/Application/views/admin/tpl/inc/bootstrap.tpl b/views/smarty/admin/inc/bootstrap.tpl similarity index 100% rename from Application/views/admin/tpl/inc/bootstrap.tpl rename to views/smarty/admin/inc/bootstrap.tpl diff --git a/Application/views/admin/tpl/mailTester.tpl b/views/smarty/admin/mailTester.tpl similarity index 97% rename from Application/views/admin/tpl/mailTester.tpl rename to views/smarty/admin/mailTester.tpl index 9899d49..f214200 100644 --- a/Application/views/admin/tpl/mailTester.tpl +++ b/views/smarty/admin/mailTester.tpl @@ -1,5 +1,5 @@ [{include file="headitem.tpl" title="d3mxd3cleartmp"|oxmultilangassign}] -[{include file="inc_bootstrap.tpl"}] +[{include file="@d3mailconfigchecker/admin/inc_bootstrap"}] [{if $readonly}] [{assign var="readonly" value="readonly disabled"}] diff --git a/Application/views/admin/tpl/mailcheckbase.tpl b/views/smarty/admin/mailcheckbase.tpl similarity index 100% rename from Application/views/admin/tpl/mailcheckbase.tpl rename to views/smarty/admin/mailcheckbase.tpl diff --git a/Application/views/admin/tpl/mailcheckmenu.tpl b/views/smarty/admin/mailcheckmenu.tpl similarity index 100% rename from Application/views/admin/tpl/mailcheckmenu.tpl rename to views/smarty/admin/mailcheckmenu.tpl diff --git a/Application/views/admin/tpl/mailconfigcheck.tpl b/views/smarty/admin/mailconfigcheck.tpl similarity index 97% rename from Application/views/admin/tpl/mailconfigcheck.tpl rename to views/smarty/admin/mailconfigcheck.tpl index 696239e..efbf30d 100644 --- a/Application/views/admin/tpl/mailconfigcheck.tpl +++ b/views/smarty/admin/mailconfigcheck.tpl @@ -1,5 +1,5 @@ [{include file="headitem.tpl" title="d3mxd3cleartmp"|oxmultilangassign}] -[{include file="inc_bootstrap.tpl"}] +[{include file="@d3mailconfigchecker/admin/inc_bootstrap"}]