refactor Smarty template integration

This commit is contained in:
Daniel Seifert 2024-12-03 14:43:55 +01:00
parent 9965278a2c
commit 882a776aa8
23 changed files with 307 additions and 31 deletions

View File

@ -23,9 +23,10 @@ declare(strict_types=1);
namespace O3\TinyMCE\Application\Controller\Admin; namespace O3\TinyMCE\Application\Controller\Admin;
use O3\TinyMCE\Application\Model\Constants;
use OxidEsales\Eshop\Application\Controller\Admin\AdminController; use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
class TinyFileManager extends AdminController class TinyFileManager extends AdminController
{ {
protected $_sThisTemplate = "TinyFilemanager.tpl"; protected $_sThisTemplate = '@' . Constants::OXID_MODULE_ID.'/admin/TinyFilemanager.tpl';
} }

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE; namespace O3\TinyMCE\Application\Core\TinyMCE;
use O3\TinyMCE\Application\Model\Constants;
use OxidEsales\Eshop\Core\Config; use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Exception\FileException; use OxidEsales\Eshop\Core\Exception\FileException;
use OxidEsales\Eshop\Core\Language; use OxidEsales\Eshop\Core\Language;
@ -62,7 +63,7 @@ class Loader
$this->registerIncludes(); $this->registerIncludes();
$smarty = Registry::getUtilsView()->getSmarty(); $smarty = Registry::getUtilsView()->getSmarty();
return $smarty->fetch('EditorSwitch.tpl'); return $smarty->fetch('@' . Constants::OXID_MODULE_ID.'/admin/EditorSwitch.tpl');
} }
/** /**

View File

@ -0,0 +1,29 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Model;
class Constants
{
public const OXID_MODULE_ID = 'o3-tinymce-editor';
}

View File

@ -1,3 +0,0 @@
<?php
include("../en/module_options.php");

View File

@ -1,3 +0,0 @@
<?php
include("../en/module_options.php");

View File

@ -1,3 +0,0 @@
<?php
include("../en/module_options.php");

View File

@ -1,3 +0,0 @@
<?php
include("../en/module_options.php");

View File

@ -1,3 +0,0 @@
<?php
include("../en/module_options.php");

View File

@ -1,3 +0,0 @@
<?php
include("../en/module_options.php");

View File

@ -0,0 +1,32 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
$sLangName = 'English';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = include __DIR__."/../../en/tinymce_translations.php";
// @codeCoverageIgnoreEnd

View File

@ -0,0 +1,32 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
$sLangName = 'English';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = include __DIR__."/../../en/tinymce_translations.php";
// @codeCoverageIgnoreEnd

View File

@ -0,0 +1,32 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
$sLangName = 'Deutsch';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = include __DIR__."/../../de/tinymce_translations.php";
// @codeCoverageIgnoreEnd

View File

@ -0,0 +1,32 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
$sLangName = 'Deutsch';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = include __DIR__."/../../de/tinymce_translations.php";
// @codeCoverageIgnoreEnd

View File

@ -0,0 +1,32 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
$sLangName = 'English';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = include __DIR__."/../../en/tinymce_translations.php";
// @codeCoverageIgnoreEnd

View File

@ -0,0 +1,32 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
$sLangName = 'English';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = include __DIR__."/../../en/tinymce_translations.php";
// @codeCoverageIgnoreEnd

View File

@ -0,0 +1,32 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
$sLangName = 'English';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = include __DIR__."/../../en/tinymce_translations.php";
// @codeCoverageIgnoreEnd

View File

@ -0,0 +1,32 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
$sLangName = 'English';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = include __DIR__."/../../en/tinymce_translations.php";
// @codeCoverageIgnoreEnd

View File

@ -19,8 +19,10 @@
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3) * @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/ */
$sLangName = 'Deutsch'; // @codeCoverageIgnoreStart
$aLang = [ declare(strict_types=1);
return [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'TINYMCE_TOGGLE' => 'Editor zeigen/verstecken', 'TINYMCE_TOGGLE' => 'Editor zeigen/verstecken',
'TINYMCE_PLAINCMS' => '<b class="errorbox">Der Editor wurde für diese Seite deaktiviert, weil sie keine HTML Formatierung enthalten darf </b>', 'TINYMCE_PLAINCMS' => '<b class="errorbox">Der Editor wurde für diese Seite deaktiviert, weil sie keine HTML Formatierung enthalten darf </b>',
@ -31,3 +33,4 @@ $aLang = [
'HELP_SHOP_MODULE_aTinyMCE_classes' => 'für die Benutzung von TinyMCE in eigenen Admin Views muss hier die entsprechende Controllerklasse eingetragen werden, dann wird für jedes Textarea je ein Editor erzeugt', 'HELP_SHOP_MODULE_aTinyMCE_classes' => 'für die Benutzung von TinyMCE in eigenen Admin Views muss hier die entsprechende Controllerklasse eingetragen werden, dann wird für jedes Textarea je ein Editor erzeugt',
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen &amp; Plugins', 'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen &amp; Plugins',
]; ];
// @codeCoverageIgnoreStart

View File

@ -19,8 +19,10 @@
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3) * @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/ */
$sLangName = 'English'; // @codeCoverageIgnoreStart
$aLang = [ declare(strict_types=1);
return [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'TINYMCE_TOGGLE' => 'toggle editor', 'TINYMCE_TOGGLE' => 'toggle editor',
'TINYMCE_PLAINCMS' => '<b class="errorbox">The editor was disabled for this page because it may not contain HTML code</b>', 'TINYMCE_PLAINCMS' => '<b class="errorbox">The editor was disabled for this page because it may not contain HTML code</b>',
@ -31,3 +33,4 @@ $aLang = [
'HELP_SHOP_MODULE_aTinyMCE_classes' => 'if you want to use TinyMCE for your custom controllers, you need to enter their class names here.', 'HELP_SHOP_MODULE_aTinyMCE_classes' => 'if you want to use TinyMCE for your custom controllers, you need to enter their class names here.',
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Settings &amp; Plugins', 'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Settings &amp; Plugins',
]; ];
// @codeCoverageIgnoreEnd

View File

@ -22,14 +22,15 @@
declare(strict_types=1); declare(strict_types=1);
use O3\TinyMCE\Application\Core\Setup\Events; use O3\TinyMCE\Application\Core\Setup\Events;
use O3\TinyMCE\Application\Model\Constants;
$sMetadataVersion = '2.1'; $sMetadataVersion = '2.1';
$aModule = [ $aModule = [
'id' => 'o3-tinymce-editor', 'id' => Constants::OXID_MODULE_ID,
'title' => 'TinyMCE Editor', 'title' => 'TinyMCE Editor',
'description' => 'TinyMCE 6 integration for O3-Shop, ported to OXID eShop', 'description' => 'TinyMCE 6 integration for O3-Shop, ported to OXID eShop',
'thumbnail' => 'logo.png', 'thumbnail' => 'logo.png',
'version' => '1.1.0', 'version' => '2.0.0',
'author' => 'D3 Data Development, O3-Shop, Marat Bedoev', 'author' => 'D3 Data Development, O3-Shop, Marat Bedoev',
'url' => 'https://www.o3-shop.com/', 'url' => 'https://www.o3-shop.com/',
'extend' => [ 'extend' => [
@ -39,14 +40,14 @@ $aModule = [
'tinyfilemanager' => O3\TinyMCE\Application\Controller\Admin\TinyFileManager::class, 'tinyfilemanager' => O3\TinyMCE\Application\Controller\Admin\TinyFileManager::class,
], ],
'templates' => [ 'templates' => [
'TinyFilemanager.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/filemanager.tpl', '@' . Constants::OXID_MODULE_ID.'/admin/TinyFilemanager.tpl' => 'views/smarty/admin/tpl/filemanager.tpl',
'EditorSwitch.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/editorswitch.tpl', '@' . Constants::OXID_MODULE_ID.'/admin/EditorSwitch.tpl' => 'views/smarty/admin/tpl/editorswitch.tpl',
], ],
'blocks' => [ 'blocks' => [
[ [
'template' => 'bottomnaviitem.tpl', 'template' => 'bottomnaviitem.tpl',
'block' => 'admin_bottomnaviitem', 'block' => 'admin_bottomnaviitem',
'file' => 'Application/views/blocks/admin/bottomnaviitem_admin_bottomnaviitem.tpl', 'file' => 'views/smarty/blocks/admin/bottomnaviitem_admin_bottomnaviitem.tpl',
], ],
], ],
'settings' => [ 'settings' => [