From e6278a71e90112ffd2e06763cb766b5bc6654730 Mon Sep 17 00:00:00 2001 From: O3-Shop Date: Wed, 5 Apr 2023 08:53:11 +0200 Subject: [PATCH] refactoring --- Application/Core/TinyMCE/Configuration.php | 52 ++++++++-------- Application/Core/TinyMCE/Loader.php | 4 +- .../Core/TinyMCE/Options/AbstractOption.php | 10 ++++ Application/Core/TinyMCE/Options/BaseUrl.php | 2 +- .../Core/TinyMCE/Options/CacheSuffix.php | 2 +- .../Core/TinyMCE/Options/ContentCss.php | 8 +-- .../Core/TinyMCE/Options/ContextMenu.php | 2 +- .../Core/TinyMCE/Options/DocumentBaseUrl.php | 2 +- .../Core/TinyMCE/Options/EntityEncoding.php | 2 +- .../Core/TinyMCE/Options/ExternalPlugins.php | 2 +- .../TinyMCE/Options/FilePickerCallback.php | 43 ++++++++++++++ .../Core/TinyMCE/Options/FilemanagerUrl.php | 4 +- .../Core/TinyMCE/Options/ImageAdvtab.php | 2 +- Application/Core/TinyMCE/Options/Language.php | 2 +- .../Core/TinyMCE/Options/MaxHeight.php | 2 +- Application/Core/TinyMCE/Options/MaxWidth.php | 2 +- Application/Core/TinyMCE/Options/Menubar.php | 2 +- .../Core/TinyMCE/Options/MinHeight.php | 10 +++- .../Core/TinyMCE/Options/OptionInterface.php | 2 + Application/Core/TinyMCE/Options/Plugins.php | 2 +- Application/Core/TinyMCE/Options/Protect.php | 2 +- .../Options/QuickbarsInsertToolbar.php | 3 +- .../Core/TinyMCE/Options/RelativeUrls.php | 2 +- Application/Core/TinyMCE/Options/Selector.php | 2 +- Application/Core/TinyMCE/Options/Toolbar.php | 59 ++++++++++++++++++- .../Core/TinyMCE/Options/ToolbarMode.php | 39 ++++++++++++ .../Core/TinyMCE/Options/ToolbarSticky.php | 2 +- Application/Core/TinyMCE/Toolbar/Font.php | 3 + Application/Core/TinyMCE/ToolbarList.php | 34 ----------- Application/Core/ViewConfig.php | 10 +--- Application/fileman/js/main.min.js | 2 +- Application/views/admin/de/module_options.php | 4 +- Application/views/admin/editorswitch.tpl | 2 +- Application/views/admin/en/module_options.php | 4 +- 34 files changed, 225 insertions(+), 100 deletions(-) create mode 100644 Application/Core/TinyMCE/Options/FilePickerCallback.php create mode 100644 Application/Core/TinyMCE/Options/ToolbarMode.php diff --git a/Application/Core/TinyMCE/Configuration.php b/Application/Core/TinyMCE/Configuration.php index 37e2e33..50aecde 100644 --- a/Application/Core/TinyMCE/Configuration.php +++ b/Application/Core/TinyMCE/Configuration.php @@ -30,6 +30,7 @@ use O3\TinyMCE\Application\Core\TinyMCE\Options\ContextMenu; use O3\TinyMCE\Application\Core\TinyMCE\Options\DocumentBaseUrl; use O3\TinyMCE\Application\Core\TinyMCE\Options\EntityEncoding; use O3\TinyMCE\Application\Core\TinyMCE\Options\ExternalPlugins; +use O3\TinyMCE\Application\Core\TinyMCE\Options\FilePickerCallback; use O3\TinyMCE\Application\Core\TinyMCE\Options\FilemanagerUrl; use O3\TinyMCE\Application\Core\TinyMCE\Options\ImageAdvtab; use O3\TinyMCE\Application\Core\TinyMCE\Options\Language; @@ -44,6 +45,7 @@ use O3\TinyMCE\Application\Core\TinyMCE\Options\QuickbarsInsertToolbar; use O3\TinyMCE\Application\Core\TinyMCE\Options\RelativeUrls; use O3\TinyMCE\Application\Core\TinyMCE\Options\Selector; use O3\TinyMCE\Application\Core\TinyMCE\Options\Toolbar; +use O3\TinyMCE\Application\Core\TinyMCE\Options\ToolbarMode; use O3\TinyMCE\Application\Core\TinyMCE\Options\ToolbarSticky; class Configuration @@ -68,7 +70,7 @@ class Configuration $this->addToolbar(); } - protected function addOption($key, OptionInterface $optionInstance): void + protected function addOption(OptionInterface $optionInstance): void { if (!$optionInstance->requireRegistration()) return; @@ -78,7 +80,7 @@ class Configuration $option = (oxNew(Utils::class))->quote($option); } - $this->options[$key] = $option; + $this->options[$optionInstance->getKey()] = $option; } public function getConfig() @@ -113,54 +115,56 @@ class Configuration */ protected function addIntegrateOptions(): void { - $this->addOption( BaseUrl::KEY, oxNew( BaseUrl::class, $this->loader)); - $this->addOption( CacheSuffix::KEY, oxNew( CacheSuffix::class, $this->loader)); - $this->addOption( Selector::KEY, oxNew( Selector::class, $this->loader)); + $this->addOption(oxNew( BaseUrl::class, $this->loader)); + $this->addOption(oxNew( CacheSuffix::class, $this->loader)); + $this->addOption(oxNew( Selector::class, $this->loader)); } protected function addGuiOptions(): void { - $this->addOption(ContextMenu::KEY, oxNew(ContextMenu::class, $this->loader)); - $this->addOption(MinHeight::KEY, oxNew(MinHeight::class, $this->loader)); - $this->addOption(MaxHeight::KEY, oxNew(MaxHeight::class, $this->loader)); - $this->addOption(MaxWidth::KEY, oxNew(MaxWidth::class, $this->loader)); - $this->addOption(Menubar::KEY, oxNew(Menubar::class, $this->loader)); - $this->addOption(ToolbarSticky::KEY, oxNew(ToolbarSticky::class, $this->loader)); + $this->addOption(oxNew(ContextMenu::class, $this->loader)); + $this->addOption(oxNew(MinHeight::class, $this->loader)); + $this->addOption(oxNew(MaxHeight::class, $this->loader)); + $this->addOption(oxNew(MaxWidth::class, $this->loader)); + $this->addOption(oxNew(Menubar::class, $this->loader)); + $this->addOption(oxNew(ToolbarSticky::class, $this->loader)); + $this->addOption(oxNew(ToolbarMode::class, $this->loader)); } protected function addContentAppearance(): void { - $this->addOption(ContentCss::KEY, oxNew(ContentCss::class,$this->loader)); + $this->addOption(oxNew(ContentCss::class,$this->loader)); } protected function addContentFiltering(): void { - $this->addOption(EntityEncoding::KEY, oxNew(EntityEncoding::class,$this->loader)); - $this->addOption(Protect::KEY, oxNew(Protect::class,$this->loader)); + $this->addOption(oxNew(EntityEncoding::class,$this->loader)); + $this->addOption(oxNew(Protect::class,$this->loader)); } protected function addLocalizationOptions(): void { - $this->addOption( Language::KEY, oxNew( Language::class, $this->loader)); + $this->addOption(oxNew( Language::class, $this->loader)); } protected function addUrlHandling(): void { - $this->addOption( DocumentBaseUrl::KEY, oxNew( DocumentBaseUrl::class, $this->loader)); - $this->addOption( RelativeUrls::KEY, oxNew( RelativeUrls::class, $this->loader)); + $this->addOption(oxNew( DocumentBaseUrl::class, $this->loader)); + $this->addOption(oxNew( RelativeUrls::class, $this->loader)); } protected function addPlugins(): void { - $this->addOption( ImageAdvtab::KEY, oxNew( ImageAdvtab::class, $this->loader)); - $this->addOption( Plugins::KEY, oxNew( Plugins::class, $this->loader)); - $this->addOption( ExternalPlugins::KEY, oxNew( ExternalPlugins::class, $this->loader)); - $this->addOption( FilemanagerUrl::KEY, oxNew( FilemanagerUrl::class, $this->loader)); - $this->addOption(QuickbarsInsertToolbar::KEY, oxNew(QuickbarsInsertToolbar::class, $this->loader)); + $this->addOption(oxNew( ImageAdvtab::class, $this->loader)); + $this->addOption(oxNew( Plugins::class, $this->loader)); + $this->addOption(oxNew( ExternalPlugins::class, $this->loader)); + $this->addOption(oxNew( FilemanagerUrl::class, $this->loader)); + $this->addOption(oxNew( FilePickerCallback::class, $this->loader)); + $this->addOption(oxNew(QuickbarsInsertToolbar::class, $this->loader)); } protected function addToolbar(): void { - $this->addOption( Toolbar::KEY, oxNew( Toolbar::class, $this->loader)); + $this->addOption(oxNew( Toolbar::class, $this->loader)); } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Loader.php b/Application/Core/TinyMCE/Loader.php index 4109333..d2986b7 100644 --- a/Application/Core/TinyMCE/Loader.php +++ b/Application/Core/TinyMCE/Loader.php @@ -43,11 +43,11 @@ class Loader /** * @return string */ - public function getEditorSwitch(): string + public function getEditorCode(): string { if (!$this->isEnabledForCurrentController()) return ''; - if ($this->contentIsPlain()) return $this->language->translateString('BLA_TINYMCE_PLAINCMS'); + if ($this->contentIsPlain()) return $this->language->translateString('TINYMCE_PLAINCMS'); $configuration = oxNew(Configuration::class, $this); $configuration->build(); diff --git a/Application/Core/TinyMCE/Options/AbstractOption.php b/Application/Core/TinyMCE/Options/AbstractOption.php index 8d71849..63fba85 100644 --- a/Application/Core/TinyMCE/Options/AbstractOption.php +++ b/Application/Core/TinyMCE/Options/AbstractOption.php @@ -27,6 +27,8 @@ use O3\TinyMCE\Application\Core\TinyMCE\Loader; abstract class AbstractOption implements OptionInterface { + protected string $key = 'undefinedKey'; + protected Loader $loader; public function __construct(Loader $loader) @@ -34,6 +36,14 @@ abstract class AbstractOption implements OptionInterface $this->loader = $loader; } + /** + * @return string + */ + public function getKey(): string + { + return $this->key; + } + abstract public function get(): string; public function mustQuote(): bool diff --git a/Application/Core/TinyMCE/Options/BaseUrl.php b/Application/Core/TinyMCE/Options/BaseUrl.php index 18eff8c..c4a615d 100644 --- a/Application/Core/TinyMCE/Options/BaseUrl.php +++ b/Application/Core/TinyMCE/Options/BaseUrl.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class BaseUrl extends AbstractOption { - public const KEY = 'base_url'; + protected string $key = 'base_url'; /** * @return string diff --git a/Application/Core/TinyMCE/Options/CacheSuffix.php b/Application/Core/TinyMCE/Options/CacheSuffix.php index 21e5c32..8a4dfca 100644 --- a/Application/Core/TinyMCE/Options/CacheSuffix.php +++ b/Application/Core/TinyMCE/Options/CacheSuffix.php @@ -27,7 +27,7 @@ use O3\TinyMCE\Application\Core\TinyMCE\Loader; class CacheSuffix extends AbstractOption { - public const KEY = 'cache_suffix'; + protected string $key = 'cache_suffix'; protected Loader $loader; diff --git a/Application/Core/TinyMCE/Options/ContentCss.php b/Application/Core/TinyMCE/Options/ContentCss.php index 2975372..c44211d 100644 --- a/Application/Core/TinyMCE/Options/ContentCss.php +++ b/Application/Core/TinyMCE/Options/ContentCss.php @@ -24,21 +24,21 @@ declare(strict_types=1); namespace O3\TinyMCE\Application\Core\TinyMCE\Options; use O3\TinyMCE\Application\Core\TinyMCE\Loader; +use OxidEsales\Eshop\Core\Registry; class ContentCss extends AbstractOption { - public const KEY = 'content_css'; + protected string $key = 'content_css'; protected Loader $loader; public function get(): string { - // ToDo: use current theme - return '/out/wave/src/css/styles.min.css'; + return '/out/'.strtolower(Registry::getConfig()->getConfigParam('sTheme')).'/src/css/styles.min.css'; } public function mustQuote(): bool { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/ContextMenu.php b/Application/Core/TinyMCE/Options/ContextMenu.php index c9db5e0..7784af9 100644 --- a/Application/Core/TinyMCE/Options/ContextMenu.php +++ b/Application/Core/TinyMCE/Options/ContextMenu.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class ContextMenu extends AbstractOption { - public const KEY = 'contextmenu'; + protected string $key = 'contextmenu'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/DocumentBaseUrl.php b/Application/Core/TinyMCE/Options/DocumentBaseUrl.php index 08ee1fa..c926ab6 100644 --- a/Application/Core/TinyMCE/Options/DocumentBaseUrl.php +++ b/Application/Core/TinyMCE/Options/DocumentBaseUrl.php @@ -27,7 +27,7 @@ use OxidEsales\Eshop\Core\Registry; class DocumentBaseUrl extends AbstractOption { - public const KEY = 'document_base_url'; + protected string $key = 'document_base_url'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/EntityEncoding.php b/Application/Core/TinyMCE/Options/EntityEncoding.php index 73e1c96..4212f2c 100644 --- a/Application/Core/TinyMCE/Options/EntityEncoding.php +++ b/Application/Core/TinyMCE/Options/EntityEncoding.php @@ -27,7 +27,7 @@ use O3\TinyMCE\Application\Core\TinyMCE\Loader; class EntityEncoding extends AbstractOption { - public const KEY = 'entity_encoding'; + protected string $key = 'entity_encoding'; protected Loader $loader; diff --git a/Application/Core/TinyMCE/Options/ExternalPlugins.php b/Application/Core/TinyMCE/Options/ExternalPlugins.php index c9da48d..c5386aa 100644 --- a/Application/Core/TinyMCE/Options/ExternalPlugins.php +++ b/Application/Core/TinyMCE/Options/ExternalPlugins.php @@ -29,7 +29,7 @@ use O3\TinyMCE\Application\Core\TinyMCE\Utils; class ExternalPlugins extends AbstractOption { - public const KEY = 'external_plugins'; + protected string $key = 'external_plugins'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/FilePickerCallback.php b/Application/Core/TinyMCE/Options/FilePickerCallback.php new file mode 100644 index 0000000..922a778 --- /dev/null +++ b/Application/Core/TinyMCE/Options/FilePickerCallback.php @@ -0,0 +1,43 @@ + + * + * @copyright Copyright (c) 2022 OXID 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\Core\TinyMCE\Options; + +use O3\TinyMCE\Application\Core\TinyMCE\Loader; + +class FilePickerCallback extends AbstractOption +{ + protected string $key = 'file_picker_callback'; + + protected Loader $loader; + + public function get(): string + { + return 'RoxyFileBrowser'; + } + + public function requireRegistration(): bool + { + return (bool) $this->loader->getShopConfig()->getConfigParam("blTinyMCE_filemanager"); + } +} \ No newline at end of file diff --git a/Application/Core/TinyMCE/Options/FilemanagerUrl.php b/Application/Core/TinyMCE/Options/FilemanagerUrl.php index 482b87b..31b33a4 100644 --- a/Application/Core/TinyMCE/Options/FilemanagerUrl.php +++ b/Application/Core/TinyMCE/Options/FilemanagerUrl.php @@ -29,7 +29,7 @@ use OxidEsales\Eshop\Core\UtilsServer; class FilemanagerUrl extends AbstractOption { - public const KEY = 'filemanager_url'; + protected string $key = 'filemanager_url'; protected Loader $loader; @@ -41,7 +41,7 @@ class FilemanagerUrl extends AbstractOption return str_replace( '&', '&', - Registry::getConfig()->getActiveView()->getViewConfig()->getSslSelfLink()."cl=tinyfilemanager" + Registry::getConfig()->getActiveView()->getViewConfig()->getSslSelfLink()."cl=tinyfilemanager&input=form-field_3980235013121680647721848" ); } diff --git a/Application/Core/TinyMCE/Options/ImageAdvtab.php b/Application/Core/TinyMCE/Options/ImageAdvtab.php index bdbbcf5..296a01d 100644 --- a/Application/Core/TinyMCE/Options/ImageAdvtab.php +++ b/Application/Core/TinyMCE/Options/ImageAdvtab.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class ImageAdvtab extends AbstractOption { - public const KEY = 'image_advtab'; + protected string $key = 'image_advtab'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/Language.php b/Application/Core/TinyMCE/Options/Language.php index 6f2d3e9..ef4ad51 100644 --- a/Application/Core/TinyMCE/Options/Language.php +++ b/Application/Core/TinyMCE/Options/Language.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class Language extends AbstractOption { - public const KEY = 'language'; + protected string $key = 'language'; /** * @return string diff --git a/Application/Core/TinyMCE/Options/MaxHeight.php b/Application/Core/TinyMCE/Options/MaxHeight.php index bf9e172..72e51bf 100644 --- a/Application/Core/TinyMCE/Options/MaxHeight.php +++ b/Application/Core/TinyMCE/Options/MaxHeight.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class MaxHeight extends AbstractOption { - public const KEY = 'max_height'; + protected string $key = 'max_height'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/MaxWidth.php b/Application/Core/TinyMCE/Options/MaxWidth.php index 9c564e0..345851e 100644 --- a/Application/Core/TinyMCE/Options/MaxWidth.php +++ b/Application/Core/TinyMCE/Options/MaxWidth.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class MaxWidth extends AbstractOption { - public const KEY = 'max_width'; + protected string $key = 'max_width'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/Menubar.php b/Application/Core/TinyMCE/Options/Menubar.php index 1993bb0..f5202fe 100644 --- a/Application/Core/TinyMCE/Options/Menubar.php +++ b/Application/Core/TinyMCE/Options/Menubar.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class Menubar extends AbstractOption { - public const KEY = 'menubar'; + protected string $key = 'menubar'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/MinHeight.php b/Application/Core/TinyMCE/Options/MinHeight.php index f6ca46d..a54ba7e 100644 --- a/Application/Core/TinyMCE/Options/MinHeight.php +++ b/Application/Core/TinyMCE/Options/MinHeight.php @@ -23,12 +23,20 @@ declare(strict_types=1); namespace O3\TinyMCE\Application\Core\TinyMCE\Options; +use OxidEsales\Eshop\Core\Registry; + class MinHeight extends AbstractOption { - public const KEY = 'min_height'; + protected string $key = 'min_height'; public function get(): string { + $profile = Registry::getSession()->getVariable('profile'); + + if (isset($profile) && $profile[1]) { + return (string) (max($profile[1] * 20, 350)); + } + return '350'; } } \ No newline at end of file diff --git a/Application/Core/TinyMCE/Options/OptionInterface.php b/Application/Core/TinyMCE/Options/OptionInterface.php index 9a2e81a..a1aae92 100644 --- a/Application/Core/TinyMCE/Options/OptionInterface.php +++ b/Application/Core/TinyMCE/Options/OptionInterface.php @@ -29,6 +29,8 @@ interface OptionInterface { public function __construct(Loader $loader); + public function getKey(): string; + public function get(): string; public function mustQuote(): bool; diff --git a/Application/Core/TinyMCE/Options/Plugins.php b/Application/Core/TinyMCE/Options/Plugins.php index dac2665..8823182 100644 --- a/Application/Core/TinyMCE/Options/Plugins.php +++ b/Application/Core/TinyMCE/Options/Plugins.php @@ -28,7 +28,7 @@ use O3\TinyMCE\Application\Core\TinyMCE\Plugins\PluginInterface; class Plugins extends AbstractOption { - public const KEY = 'plugins'; + protected string $key = 'plugins'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/Protect.php b/Application/Core/TinyMCE/Options/Protect.php index 29ca7d2..d53c3cf 100644 --- a/Application/Core/TinyMCE/Options/Protect.php +++ b/Application/Core/TinyMCE/Options/Protect.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class Protect extends AbstractOption { - public const KEY = 'protect'; + protected string $key = 'protect'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/QuickbarsInsertToolbar.php b/Application/Core/TinyMCE/Options/QuickbarsInsertToolbar.php index 5048924..25ef92a 100644 --- a/Application/Core/TinyMCE/Options/QuickbarsInsertToolbar.php +++ b/Application/Core/TinyMCE/Options/QuickbarsInsertToolbar.php @@ -30,13 +30,14 @@ use O3\TinyMCE\Application\Core\TinyMCE\Utils; class QuickbarsInsertToolbar extends AbstractOption { - public const KEY = 'quickbars_insert_toolbar'; + protected string $key = 'quickbars_insert_toolbar'; public function get(): string { return implode( ' | ', [ + // 'quickimage', // disabled, as images are only inserted inline. This is too much for a typical database field length. 'quicktable', 'hr', 'pagebreak' diff --git a/Application/Core/TinyMCE/Options/RelativeUrls.php b/Application/Core/TinyMCE/Options/RelativeUrls.php index 8679a15..f5f80ad 100644 --- a/Application/Core/TinyMCE/Options/RelativeUrls.php +++ b/Application/Core/TinyMCE/Options/RelativeUrls.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class RelativeUrls extends AbstractOption { - public const KEY = 'relative_urls'; + protected string $key = 'relative_urls'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/Selector.php b/Application/Core/TinyMCE/Options/Selector.php index 41b4483..1aa57b1 100644 --- a/Application/Core/TinyMCE/Options/Selector.php +++ b/Application/Core/TinyMCE/Options/Selector.php @@ -27,7 +27,7 @@ use O3\TinyMCE\Application\Core\TinyMCE\Loader; class Selector extends AbstractOption { - public const KEY = 'selector'; + protected string $key = 'selector'; public function get(): string { diff --git a/Application/Core/TinyMCE/Options/Toolbar.php b/Application/Core/TinyMCE/Options/Toolbar.php index d3f5484..9fb02b8 100644 --- a/Application/Core/TinyMCE/Options/Toolbar.php +++ b/Application/Core/TinyMCE/Options/Toolbar.php @@ -30,7 +30,9 @@ use O3\TinyMCE\Application\Core\TinyMCE\ToolbarList; class Toolbar extends AbstractOption { - public const KEY = 'toolbar'; + protected string $key = 'toolbar'; + + protected bool $forceSingleLineToolbar = true; public function __construct( Loader $loader ) { @@ -40,6 +42,56 @@ class Toolbar extends AbstractOption public function get(): string { $toolbarList = oxNew(ToolbarList::class); + + return $this->forceSingleLineToolbar ? + $this->getSingleLineToolbar($toolbarList) : + $this->getMultiLineToolbar($toolbarList); + } + + protected function getSingleLineToolbar($toolbarList) + { + $all = []; + + foreach ($toolbarList->get() as $toolbar) { + $all = array_merge($all, $toolbar); + } + + $toolbarElements = implode( + ' | ', + array_filter( + array_map( + function ($toolbarElement) { + return implode( + ' ', + $toolbarElement->getButtons() + ); + }, + $all + ) + ) + ); + + $pluginList = oxNew(PluginList::class); + $pluginToolbarElements = implode( + ' | ', + array_filter( + array_map( + function (PluginInterface $plugin) { + return count($plugin->getToolbarElements()) ? implode( + ' ', + $plugin->getToolbarElements() + ) : null; + }, + $pluginList->get() + ) + ) + ); + + return $toolbarElements . ' | ' . $pluginToolbarElements; + } + + protected function getMultiLineToolbar($toolbarList) + { $list = []; foreach ($toolbarList->get() as $toolbar) { @@ -77,4 +129,9 @@ class Toolbar extends AbstractOption return '["'.implode('", "', $list).'"]'; } + + public function mustQuote(): bool + { + return true; + } } \ No newline at end of file diff --git a/Application/Core/TinyMCE/Options/ToolbarMode.php b/Application/Core/TinyMCE/Options/ToolbarMode.php new file mode 100644 index 0000000..ae46cbf --- /dev/null +++ b/Application/Core/TinyMCE/Options/ToolbarMode.php @@ -0,0 +1,39 @@ + + * + * @copyright Copyright (c) 2022 OXID 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\Core\TinyMCE\Options; + +class ToolbarMode extends AbstractOption +{ + protected string $key = 'toolbar_mode'; + + public function get(): string + { + return 'sliding'; + } + + public function mustQuote(): bool + { + return true; + } +} \ No newline at end of file diff --git a/Application/Core/TinyMCE/Options/ToolbarSticky.php b/Application/Core/TinyMCE/Options/ToolbarSticky.php index 26c3506..0d2d926 100644 --- a/Application/Core/TinyMCE/Options/ToolbarSticky.php +++ b/Application/Core/TinyMCE/Options/ToolbarSticky.php @@ -25,7 +25,7 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Options; class ToolbarSticky extends AbstractOption { - public const KEY = 'toolbar_sticky'; + protected string $key = 'toolbar_sticky'; public function get(): string { diff --git a/Application/Core/TinyMCE/Toolbar/Font.php b/Application/Core/TinyMCE/Toolbar/Font.php index 64a6509..324bfc1 100644 --- a/Application/Core/TinyMCE/Toolbar/Font.php +++ b/Application/Core/TinyMCE/Toolbar/Font.php @@ -28,6 +28,9 @@ class Font extends AbstractToolbar public function getButtons(): array { return [ + // 'fontselect', + //'fontsizeselect', + // '|', 'bold', 'italic', 'underline', diff --git a/Application/Core/TinyMCE/ToolbarList.php b/Application/Core/TinyMCE/ToolbarList.php index 1337b67..eaee8cd 100644 --- a/Application/Core/TinyMCE/ToolbarList.php +++ b/Application/Core/TinyMCE/ToolbarList.php @@ -58,39 +58,5 @@ class ToolbarList 'removeformat' => oxNew(RemoveFormat::class), ] ]; - - $all = $this->getAll(); - - if ($count && isset($all[$count])) { - return $all[$count]; - } elseif (!$count) { - $allList = []; - foreach ($all as $toolbars) { - $allList = array_merge($allList, $toolbars); - } - return $allList; - } - } - - protected function getAll(): array - { - return [ - 1 => [ - 'formatselect' => oxNew(Formatselect::class), - 'font' => oxNew(Font::class), - 'color' => oxNew(Color::class), - 'align' => oxNew(Align::class), - 'subscript' => oxNew(Subscript::class), - 'superscript' => oxNew(Superscript::class), - ], - 2 => [ - 'undo' => oxNew(Undo::class), - 'copypaste' => oxNew(CopyPaste::class), - 'lists' => oxNew(Lists::class), - 'indent' => oxNew(Indent::class), - 'blockquote' => oxNew(Blockquote::class), - 'removeformat' => oxNew(RemoveFormat::class), - ] - ]; } } \ No newline at end of file diff --git a/Application/Core/ViewConfig.php b/Application/Core/ViewConfig.php index 5300ca1..e6f9a50 100755 --- a/Application/Core/ViewConfig.php +++ b/Application/Core/ViewConfig.php @@ -38,14 +38,6 @@ class ViewConfig extends ViewConfig_parent $loader = oxNew(Loader::class, $config, $language); - return $loader->getEditorSwitch(); + return $loader->getEditorCode(); } } - - -// ToDo: - -// https://www.tiny.cloud/docs/tinymce/6/toolbar-configuration-options/ -// flexible MinHeight je nach Logineinstellung -// flexibles CSS basierend auf Wave -// MediaSelect Bug diff --git a/Application/fileman/js/main.min.js b/Application/fileman/js/main.min.js index d057f7b..c467592 100755 --- a/Application/fileman/js/main.min.js +++ b/Application/fileman/js/main.min.js @@ -1 +1 @@ -var fileTypeIcons=new Object();fileTypeIcons["3gp"]="file_extension_3gp.png";fileTypeIcons["7z"]="file_extension_7z.png";fileTypeIcons.ace="file_extension_ace.png";fileTypeIcons.ai="file_extension_ai.png";fileTypeIcons.aif="file_extension_aif.png";fileTypeIcons.aiff="file_extension_aiff.png";fileTypeIcons.amr="file_extension_amr.png";fileTypeIcons.asf="file_extension_asf.png";fileTypeIcons.asx="file_extension_asx.png";fileTypeIcons.avi="file_extension_avi.png";fileTypeIcons.bat="file_extension_bat.png";fileTypeIcons.bin="file_extension_bin.png";fileTypeIcons.bmp="file_extension_bmp.png";fileTypeIcons.bup="file_extension_bup.png";fileTypeIcons.cab="file_extension_cab.png";fileTypeIcons.cbr="file_extension_cbr.png";fileTypeIcons.cda="file_extension_cda.png";fileTypeIcons.cdl="file_extension_cdl.png";fileTypeIcons.cdr="file_extension_cdr.png";fileTypeIcons.chm="file_extension_chm.png";fileTypeIcons.dat="file_extension_dat.png";fileTypeIcons.divx="file_extension_divx.png";fileTypeIcons.dll="file_extension_dll.png";fileTypeIcons.dmg="file_extension_dmg.png";fileTypeIcons.doc="file_extension_doc.png";fileTypeIcons.dss="file_extension_dss.png";fileTypeIcons.dvf="file_extension_dvf.png";fileTypeIcons.dwg="file_extension_dwg.png";fileTypeIcons.eml="file_extension_eml.png";fileTypeIcons.eps="file_extension_eps.png";fileTypeIcons.exe="file_extension_exe.png";fileTypeIcons.fla="file_extension_fla.png";fileTypeIcons.flv="file_extension_flv.png";fileTypeIcons.gif="file_extension_gif.png";fileTypeIcons.gz="file_extension_gz.png";fileTypeIcons.hqx="file_extension_hqx.png";fileTypeIcons.htm="file_extension_htm.png";fileTypeIcons.html="file_extension_html.png";fileTypeIcons.ifo="file_extension_ifo.png";fileTypeIcons.indd="file_extension_indd.png";fileTypeIcons.iso="file_extension_iso.png";fileTypeIcons.jar="file_extension_jar.png";fileTypeIcons.jpeg="file_extension_jpeg.png";fileTypeIcons.jpg="file_extension_jpg.png";fileTypeIcons.lnk="file_extension_lnk.png";fileTypeIcons.log="file_extension_log.png";fileTypeIcons.m4a="file_extension_m4a.png";fileTypeIcons.m4b="file_extension_m4b.png";fileTypeIcons.m4p="file_extension_m4p.png";fileTypeIcons.m4v="file_extension_m4v.png";fileTypeIcons.mcd="file_extension_mcd.png";fileTypeIcons.mdb="file_extension_mdb.png";fileTypeIcons.mid="file_extension_mid.png";fileTypeIcons.mkv="file_extension_mkv.png";fileTypeIcons.mov="file_extension_mov.png";fileTypeIcons.mp2="file_extension_mp2.png";fileTypeIcons.mp3="file_extension_mp3.png";fileTypeIcons.mp4="file_extension_mp4.png";fileTypeIcons.mpeg="file_extension_mpeg.png";fileTypeIcons.mpg="file_extension_mpg.png";fileTypeIcons.msi="file_extension_msi.png";fileTypeIcons.mswmm="file_extension_mswmm.png";fileTypeIcons.ogg="file_extension_ogg.png";fileTypeIcons.pdf="file_extension_pdf.png";fileTypeIcons.png="file_extension_png.png";fileTypeIcons.pps="file_extension_pps.png";fileTypeIcons.ps="file_extension_ps.png";fileTypeIcons.psd="file_extension_psd.png";fileTypeIcons.pst="file_extension_pst.png";fileTypeIcons.ptb="file_extension_ptb.png";fileTypeIcons.pub="file_extension_pub.png";fileTypeIcons.qbb="file_extension_qbb.png";fileTypeIcons.qbw="file_extension_qbw.png";fileTypeIcons.qxd="file_extension_qxd.png";fileTypeIcons.ram="file_extension_ram.png";fileTypeIcons.rar="file_extension_rar.png";fileTypeIcons.rm="file_extension_rm.png";fileTypeIcons.rmvb="file_extension_rmvb.png";fileTypeIcons.rtf="file_extension_rtf.png";fileTypeIcons.sea="file_extension_sea.png";fileTypeIcons.ses="file_extension_ses.png";fileTypeIcons.sit="file_extension_sit.png";fileTypeIcons.sitx="file_extension_sitx.png";fileTypeIcons.ss="file_extension_ss.png";fileTypeIcons.swf="file_extension_swf.png";fileTypeIcons.tgz="file_extension_tgz.png";fileTypeIcons.thm="file_extension_thm.png";fileTypeIcons.tif="file_extension_tif.png";fileTypeIcons.tmp="file_extension_tmp.png";fileTypeIcons.torrent="file_extension_torrent.png";fileTypeIcons.ttf="file_extension_ttf.png";fileTypeIcons.txt="file_extension_txt.png";fileTypeIcons.vcd="file_extension_vcd.png";fileTypeIcons.vob="file_extension_vob.png";fileTypeIcons.wav="file_extension_wav.png";fileTypeIcons.wma="file_extension_wma.png";fileTypeIcons.wmv="file_extension_wmv.png";fileTypeIcons.wps="file_extension_wps.png";fileTypeIcons.xls="file_extension_xls.png";fileTypeIcons.xpi="file_extension_xpi.png";fileTypeIcons.zip="file_extension_zip.png";var FileTypes=new Array();FileTypes.image=new Array("jpg","jpeg","png","gif");FileTypes.media=new Array("avi","flv","swf","wmv","mp3","wma","mpg","mpeg");FileTypes.document=new Array("doc","docx","txt","rtf","pdf","xls","mdb","html","htm","db");function RoxyUtils(){}RoxyUtils.FixPath=function(b){if(!b){return""}var a=b.replace(/\\/g,"");a=a.replace(/\/\//g,"/");a=a.replace(":/","://");return a};RoxyUtils.FormatDate=function(b){var a="";try{a=$.format.date(b,RoxyFilemanConf.DATEFORMAT)}catch(c){a=b.toString();a=a.substr(0,a.indexOf("UTC"))}return a};RoxyUtils.GetPath=function(b){var a="";b=RoxyUtils.FixPath(b);if(b.indexOf("/")>-1){a=b.substring(0,b.lastIndexOf("/"))}return a};RoxyUtils.GetUrlParam=function(d,b){var a="";if(!b){b=self.location.href}if(b.indexOf("?")>-1){b=b.substr(b.indexOf("?")+1);b=b.split("&");for(i=0;i-1){a=b.substring(b.lastIndexOf("/")+1)}return a};RoxyUtils.MakePath=function(){ret="";if(arguments&&arguments.length>0){for(var a=0;a-1){a=b.substring(b.lastIndexOf(".")+1)}return a};RoxyUtils.FileExists=function(b){var a=false;$.ajax({url:b,type:"HEAD",async:false,dataType:"text",success:function(){a=true}});return a};RoxyUtils.GetFileIcon=function(a){ret="images/filetypes/unknown.png";if(fileTypeIcons[RoxyUtils.GetFileExt(a).toLowerCase()]){ret="images/filetypes/"+fileTypeIcons[RoxyUtils.GetFileExt(a).toLowerCase()]}return ret};RoxyUtils.GetFileSize=function(b){var a=0;$.ajax({url:b,type:"HEAD",async:false,success:function(f,c,e){a=e.getResponseHeader("Content-Length")}});if(!a){a=0}return a};RoxyUtils.GetFileType=function(b){var a=RoxyUtils.GetFileExt(b).toLowerCase();if(a=="png"||a=="jpg"||a=="gif"||a=="jpeg"){a="image"}return a};RoxyUtils.IsImage=function(b){var a=false;if(RoxyUtils.GetFileType(b)=="image"){a=true}return a};RoxyUtils.FormatFileSize=function(a){var b="B";if(!a){a=0}if(a>1024){a=a/1024;b="KB"}if(a>1024){a=a/1024;b="MB"}a=new Number(a);return a.toFixed(2)+" "+b};RoxyUtils.AddParam=function(b,c,a){b+=(b.indexOf("?")>-1?"&":"?")+c+"="+encodeURIComponent(a);return b};RoxyUtils.SelectText=function(d,f,b){try{var e=document.getElementById(d);if(e.createTextRange){var a=e.createTextRange();a.collapse(true);a.moveStart("character",f);a.moveEnd("character",b-f);a.select()}else{if(e.setSelectionRange){e.setSelectionRange(f,b)}else{if(e.selectionStart){e.selectionStart=f;e.selectionEnd=b}}}e.focus()}catch(c){}};function RoxyFilemanConf(){}RoxyUtils.LoadConfig=function(){$.ajax({url:"conf.json",dataType:"json",async:false,success:function(a){RoxyFilemanConf=a},error:function(a){alert(t("E_LoadingConf"))}})};function RoxyLang(){}RoxyUtils.LoadLang=function(){var a="";if(RoxyFilemanConf.LANG&&RoxyFilemanConf.LANG.toLowerCase()=="auto"){if(RoxyUtils.GetUrlParam("langCode")){a="lang/"+RoxyUtils.GetUrlParam("langCode").substr(0,2).toLowerCase()+".json"}else{var b=window.navigator.userLanguage||window.navigator.language;a="lang/"+b.substr(0,2)+".json"}if(!RoxyUtils.FileExists(a)){a=""}}else{if(RoxyFilemanConf.LANG){a="lang/"+RoxyFilemanConf.LANG.substr(0,2).toLowerCase()+".json";if(!RoxyUtils.FileExists(a)){a=""}}}if(!a){a="lang/en.json"}$.ajax({url:a,dataType:"json",async:false,success:function(c){RoxyLang=c},error:function(c){alert("Error loading language file")}})};RoxyUtils.Translate=function(){RoxyUtils.LoadLang();$("[data-lang-t]").each(function(){var a=$(this).attr("data-lang-t");$(this).prop("title",t(a))});$("[data-lang-v]").each(function(){var a=$(this).attr("data-lang-v");$(this).prop("value",t(a))});$("[data-lang]").each(function(){var a=$(this).attr("data-lang");$(this).html(t(a))})};RoxyUtils.GetCookies=function(){var a=new Object();var b=document.cookie.replace(" ","");b=b.split(";");for(i in b){var c=b[i].split("=");if(c.length>1){a[$.trim(c[0].toString())]=decodeURIComponent($.trim(c[1].toString()))||""}}return a};RoxyUtils.GetCookie=function(b){var a=RoxyUtils.GetCookies();return a[b]||""};RoxyUtils.SetCookie=function(c,e,b,d){var a=new Date();if(b){a.setTime(a.getTime()+(b*3600*1000))}if(!d){d="/"}document.cookie=c+"="+encodeURIComponent(e)+"; path="+d+(b?"; expires="+a.toGMTString():"")};RoxyUtils.ToBool=function(b){var a=false;b=b.toString().toLowerCase();if(b=="true"||b=="on"||b=="yes"||b=="1"){a=true}return a};RoxyUtils.UnsetCookie=function(a){document.cookie=a+"=; expires=Thu, 01 Jan 1972 00:00:00 UTC"};function t(a){var b=a;if(RoxyLang&&RoxyLang[a]){b=RoxyLang[a]}return b}function File(d,a,c,b,e){this.fullPath=d;this.type=RoxyUtils.GetFileType(d);this.name=RoxyUtils.GetFilename(d);this.ext=RoxyUtils.GetFileExt(d);this.path=RoxyUtils.GetPath(d);this.icon=RoxyUtils.GetFileIcon(d);this.bigIcon=this.icon.replace("filetypes","filetypes/big");this.image=d;this.size=(a?a:RoxyUtils.GetFileSize(d));this.time=c;this.width=(b?b:0);this.height=(e?e:0);this.Show=function(){html='
  • ';html+='';html+=''+RoxyUtils.FormatDate(new Date(this.time*1000))+"";html+=''+this.name+"";html+=''+RoxyUtils.FormatFileSize(this.size)+"";html+="
  • ";$("#pnlFileList").append(html);var f=$("#pnlFileList li:last");if(RoxyFilemanConf.MOVEFILE){f.draggable({helper:makeDragFile,start:startDragFile,cursorAt:{left:10,top:10},delay:200})}f.click(function(g){selectFile(this)});f.dblclick(function(g){selectFile(this);setFile()});f.tooltip({show:{delay:700},track:true,content:tooltipContent});f.bind("contextmenu",function(h){h.stopPropagation();h.preventDefault();closeMenus("dir");selectFile(this);$(this).tooltip("close");var g=h.pageY-$("#menuFile").height();if(g<0){g=0}$("#menuFile").css({top:g+"px",left:h.pageX+"px"}).show();return false})};this.GetElement=function(){return $('li[data-path="'+this.fullPath+'"]')};this.IsImage=function(){var f=false;if(this.type=="image"){f=true}return f};this.Delete=function(){if(!RoxyFilemanConf.DELETEFILE){alert(t("E_ActionDisabled"));return}var g=RoxyUtils.AddParam(RoxyFilemanConf.DELETEFILE,"f",this.fullPath);var f=this;$.ajax({url:g,type:"POST",data:{f:this.fullPath},dataType:"json",async:false,success:function(h){if(h.res.toLowerCase()=="ok"){$('li[data-path="'+f.fullPath+'"]').remove();var j=Directory.Parse(f.path);if(j){j.files--;j.Update();j.SetStatusBar()}}else{alert(h.msg)}},error:function(h){alert(t("E_LoadingAjax")+" "+g)}})};this.Rename=function(f){if(!RoxyFilemanConf.RENAMEFILE){alert(t("E_ActionDisabled"));return false}if(!f){return false}var h=RoxyUtils.AddParam(RoxyFilemanConf.RENAMEFILE,"f",this.fullPath);h=RoxyUtils.AddParam(h,"n",f);var j=this;var g=false;$.ajax({url:h,type:"POST",data:{f:this.fullPath,n:f},dataType:"json",async:false,success:function(l){if(l.res.toLowerCase()=="ok"){var k=RoxyUtils.MakePath(this.path,f);$('li[data-path="'+j.fullPath+'"] .icon').attr("src",RoxyUtils.GetFileIcon(f));$('li[data-path="'+j.fullPath+'"] .name').text(f);$('li[data-path="'+k+'"]').attr("data-path",k);g=true}if(l.msg){alert(l.msg)}},error:function(k){alert(t("E_LoadingAjax")+" "+h)}});return g};this.Copy=function(j){if(!RoxyFilemanConf.COPYFILE){alert(t("E_ActionDisabled"));return}var g=RoxyUtils.AddParam(RoxyFilemanConf.COPYFILE,"f",this.fullPath);g=RoxyUtils.AddParam(g,"n",j);var h=this;var f=false;$.ajax({url:g,type:"POST",data:{f:this.fullPath,n:j},dataType:"json",async:false,success:function(k){if(k.res.toLowerCase()=="ok"){var l=Directory.Parse(j);if(l){l.files++;l.Update();l.SetStatusBar();l.ListFiles(true)}f=true}if(k.msg){alert(k.msg)}},error:function(k){alert(t("E_LoadingAjax")+" "+g)}});return f};this.Move=function(j){if(!RoxyFilemanConf.MOVEFILE){alert(t("E_ActionDisabled"));return}newFullPath=RoxyUtils.MakePath(j,this.name);var g=RoxyUtils.AddParam(RoxyFilemanConf.MOVEFILE,"f",this.fullPath);g=RoxyUtils.AddParam(g,"n",newFullPath);var h=this;var f=false;$.ajax({url:g,type:"POST",data:{f:this.fullPath,n:newFullPath},dataType:"json",async:false,success:function(k){if(k.res.toLowerCase()=="ok"){$('li[data-path="'+h.fullPath+'"]').remove();var l=Directory.Parse(h.path);if(l){l.files--;l.Update();l.SetStatusBar();l=Directory.Parse(j);l.files++;l.Update()}f=true}if(k.msg){alert(k.msg)}},error:function(k){alert(t("E_LoadingAjax")+" "+g)}});return f}}File.Parse=function(c){var b=false;var a=$("#pnlFileList").find('li[data-path="'+c+'"]');if(a.length>0){b=new File(a.attr("data-path"),a.attr("data-size"),a.attr("data-time"),a.attr("data-w"),a.attr("data-h"))}return b};function Directory(a,c,b){if(!a){a=""}this.fullPath=a;this.name=RoxyUtils.GetFilename(a);if(!this.name){this.name="My files"}this.path=RoxyUtils.GetPath(a);this.dirs=(c?c:0);this.files=(b?b:0);this.filesList=new Array();this.Show=function(){var d=this.GetHtml();var e=null;e=$('li[data-path="'+this.path+'"]');if(e.length==0){e=$("#pnlDirList")}else{if(e.children("ul").length==0){e.append("
      ")}e=e.children("ul")}if(e){e.append(d);this.SetEvents()}};this.SetEvents=function(){var d=this.GetElement();if(RoxyFilemanConf.MOVEDIR){d.draggable({helper:makeDragDir,start:startDragDir,cursorAt:{left:10,top:10},delay:200})}d=d.children("div");d.click(function(f){selectDir(this)});d.bind("contextmenu",function(g){g.stopPropagation();g.preventDefault();closeMenus("file");selectDir(this);var f=g.pageY-$("#menuDir").height();if(f<0){f=0}$("#menuDir").css({top:f+"px",left:g.pageX+"px"}).show();return false});d.droppable({drop:moveObject,over:dragFileOver,out:dragFileOut});d=d.children(".dirPlus");d.click(function(f){f.stopPropagation();var g=Directory.Parse($(this).closest("li").attr("data-path"));g.Expand()})};this.GetHtml=function(){var d='
    • ';d+='
      ';d+=''+this.name+" ("+this.files+")
      ";d+="
    • ";return d};this.SetStatusBar=function(){$("#pnlStatus").html(this.files+" "+(this.files==1?t("file"):t("files")))};this.SetSelectedFile=function(e){if(e){var d=File.Parse(e);if(d){selectFile(d.GetElement())}}};this.Select=function(e){var d=this.GetElement();d.children("div").addClass("selected");$('#pnlDirList li[data-path!="'+this.fullPath+'"] > div').removeClass("selected");d.children("img.dir").prop("src","images/folder.png");this.SetStatusBar();var f=this.GetParent();while(f){f.Expand(true);f=f.GetParent()}this.Expand(true);this.ListFiles(true,e);setLastDir(this.fullPath)};this.GetElement=function(){return $('li[data-path="'+this.fullPath+'"]')};this.IsExpanded=function(){var d=this.GetElement().children("ul");return(d&&d.is(":visible"))};this.IsListed=function(){if($("#hdDir").val()==this.fullPath){return true}return false};this.GetExpanded=function(e){var d=new Array();if(!e){e=$("#pnlDirList")}e.children("li").each(function(){var f=$(this).attr("data-path");var g=new Directory(f);if(g){if(g.IsExpanded()&&f){d.push(f)}d=d.concat(g.GetExpanded(g.GetElement().children("ul")))}});return d};this.RestoreExpanded=function(e){for(i=0;ig){return -1+f}else{if(hg){return -1+f}else{if(hg){return -1+f}else{if(h0){b=new Directory(a.attr("data-path"),a.attr("data-dirs"),a.attr("data-files"))}return b};$.ajaxSetup({cache:false});function selectFile(b){$("#pnlFileList li").removeClass("selected");$(b).prop("class","selected");var a=RoxyUtils.GetFilename($(b).attr("data-path"));a+=" ("+t("Size")+": "+RoxyUtils.FormatFileSize($(b).attr("data-size"));if($(b).attr("data-w")>0){a+=", "+t("Dimensions")+":"+$(b).attr("data-w")+"x"+$(b).attr("data-h")}a+=")";$("#pnlStatus").html(a)}function getLastDir(){return RoxyUtils.GetCookie("roxyld")}function setLastDir(a){RoxyUtils.SetCookie("roxyld",a,10)}function selectDir(a){var b=Directory.Parse($(a).parent("li").attr("data-path"));if(b){b.Select()}}function startDragDir(){}function startDragFile(){selectFile(this)}function dragFileOver(){$(this).children("img.dir").attr("src","images/folder-green.png")}function dragFileOut(){$("#pnlDirList").find("img.dir").attr("src","images/folder.png")}function makeDragFile(b){var a=new File($(b.target).closest("li").attr("data-path"));return'
       '+a.name+"
      "}function makeDragDir(b){var a=new Directory($(b.target).attr("data-path")?$(b.target).attr("data-path"):$(b.target).closest("li").attr("data-path"));return'
       '+a.name+"
      "}function moveDir(f,b,d){var a=Directory.Parse(b.draggable.attr("data-path"));var c=Directory.Parse($(d).parent("li").attr("data-path"));if(c.fullPath!=a.path){a.Move(c.fullPath)}}function moveFile(g,b,c){var a=new File(b.draggable.attr("data-path"));var j=Directory.Parse($(c).parent("li").attr("data-path"));var h=Directory.Parse(a.path);if(a.path!=j.fullPath){a.Move(j.fullPath)}}function moveObject(b,a){b.stopPropagation();if(a.draggable.hasClass("directory")){moveDir(b,a,this)}else{moveFile(b,a,this)}dragFileOut()}function clickFirstOnEnter(a){$("#"+a).unbind("keypress");$(".actions input").each(function(){this.blur()});$("#"+a).keypress(function(b){if(b.keyCode==$.ui.keyCode.ENTER){b.stopPropagation();$(this).parent().find(".ui-dialog-buttonset button").eq(0).trigger("click")}})}function addDir(){var b=getSelectedDir();if(!b){return}clickFirstOnEnter("pnlDirName");$("#txtDirName").val("");var a={};a[t("CreateDir")]=function(){var c=$.trim($("#txtDirName").val());if(!c){alert(t("E_MissingDirName"))}if(b.Create(c)){$("#pnlDirName").dialog("close")}};a[t("Cancel")]=function(){$("#pnlDirName").dialog("close")};$("#pnlDirName").dialog({title:t("T_CreateDir"),modal:true,buttons:a})}var uploadFileList=new Array();function showUploadList(b){var a=$("#uploadFilesList");a.html("");clearFileField();for(i=0;i
      '+b[i].name+" ("+RoxyUtils.FormatFileSize(b[i].size)+')
      ')}if(b.length>0){$("#btnUpload").button("enable")}else{$("#btnUpload").button("disable")}}function listUploadFiles(a){if(!window.FileList){$("#btnUpload").button("enable")}else{if(a.length>0){uploadFileList=new Array();addUploadFiles(a)}}}function addUploadFiles(a){for(i=0;i99){c=99}b.find(".uploadProgress").css("width",c+"%");b.find(".progressPercent").html(" - "+c+"%")}function uploadComplete(b,a){uploadFinished(b,a,"ok")}function uploadError(b,a){setUploadError(a);uploadFinished(b,a,"error")}function setUploadError(a){var b=findUploadElement(a);b.find(".uploadProgress").css("width","100%").addClass("uploadError").removeClass("uploadComplete");b.find(".progressPercent").html(' - '+t("E_UploadingFile")+"")}function setUploadSuccess(a){var b=findUploadElement(a);b.find(".uploadProgress").css("width","100%").removeClass("uploadError").addClass("uploadComplete");b.find(".progressPercent").html(" - 100%")}function uploadCanceled(b,a){uploadFinished(b,a,"error")}function uploadFinished(g,d,c){var f=findUploadElement(d);var a=null;try{a=JSON.parse(g.target.responseText)}catch(b){}if((a&&a.res=="error")||c!="ok"){c="error";setUploadError(d)}else{c="ok";setUploadSuccess(d)}f.attr("data-ulpoad",c);checkUploadResult()}function checkUploadResult(){var b=$("#uploadFilesList .fileUpload").length;var a=$("#uploadFilesList .fileUpload[data-ulpoad]").length;var e=$('#uploadFilesList .fileUpload[data-ulpoad="ok"]').length;if(a==b){uploadFileList=new Array();var c=Directory.Parse($("#hdDir").val());c.ListFiles(true);$("#btnUpload").button("disable")}}function fileUpload(e,c){var b=new XMLHttpRequest();var a=new FormData();var d=findUploadElement(c);d.find(".removeUpload").remove();a.append("action","upload");a.append("method","ajax");a.append("d",$("#hdDir").attr("value"));a.append("files[]",e);b.upload.addEventListener("progress",function(f){updateUploadProgress(f,c)},false);b.addEventListener("load",function(f){uploadComplete(f,c)},false);b.addEventListener("error",function(f){uploadError(f,c)},false);b.addEventListener("abort",function(f){uploadCanceled(f,c)},false);b.open("POST",RoxyFilemanConf.UPLOAD,true);b.setRequestHeader("Accept","*/*");b.send(a)}function dropFiles(b,a){if(b&&b.dataTransfer&&b.dataTransfer.files){addFile();if(a){addUploadFiles(b.dataTransfer.files)}else{listUploadFiles(b.dataTransfer.files)}}else{addFile()}}function clearFileField(a){if(!a){a="#fileUploads"}try{$(a).val("");$(a).val(null)}catch(b){}}function addFileClick(){$("#uploadResult").html("");showUploadList(new Array());addFile()}function addFile(){clickFirstOnEnter("dlgAddFile");$("#uploadResult").html("");clearFileField();var a={};a[t("Upload")]={id:"btnUpload",text:t("Upload"),disabled:true,click:function(){if(!$("#fileUploads").val()&&(!uploadFileList||uploadFileList.length==0)){alert(t("E_SelectFiles"))}else{if(!RoxyFilemanConf.UPLOAD){alert(t("E_ActionDisabled"))}else{if(window.FormData&&window.XMLHttpRequest&&window.FileList&&uploadFileList&&uploadFileList.length>0){for(i=0;i0){RoxyUtils.SelectText("txtFileName",0,b.name.lastIndexOf("."))}}function getSelectedFile(){var a=null;if($("#pnlFileList .selected").length>0){a=new File($("#pnlFileList .selected").attr("data-path"))}return a}function getSelectedDir(){var a=null;if($("#pnlDirList .selected")){a=Directory.Parse($("#pnlDirList .selected").closest("li").attr("data-path"))}return a}function deleteDir(a){var b=null;if(a){b=Directory.Parse(a)}else{b=getSelectedDir()}if(b&&confirm(t("Q_DeleteFolder"))){b.Delete()}}function deleteFile(){var a=getSelectedFile();if(a&&confirm(t("Q_DeleteFile"))){a.Delete()}}function previewFile(){var a=getSelectedFile();if(a){window.open(a.fullPath)}}function downloadFile(){var b=getSelectedFile();if(b&&RoxyFilemanConf.DOWNLOAD){var a=RoxyUtils.AddParam(RoxyFilemanConf.DOWNLOAD,"f",b.fullPath);window.frames.frmUploadFile.location.href=a}else{if(!RoxyFilemanConf.DOWNLOAD){alert(t("E_ActionDisabled"))}}}function downloadDir(){var b=getSelectedDir();if(b&&RoxyFilemanConf.DOWNLOADDIR){var a=RoxyUtils.AddParam(RoxyFilemanConf.DOWNLOADDIR,"d",b.fullPath);window.frames.frmUploadFile.location.href=a}else{if(!RoxyFilemanConf.DOWNLOAD){alert(t("E_ActionDisabled"))}}}function closeMenus(a){if(!a||a=="dir"){$("#menuDir").fadeOut()}if(!a||a=="file"){$("#menuFile").fadeOut()}}function selectFirst(){var a=$("#pnlDirList li:first").children("div").first();if(a.length>0){selectDir(a)}else{window.setTimeout("selectFirst()",300)}}function tooltipContent(){if($("#menuFile").is(":visible")){return""}var a="";var b=File.Parse($(this).attr("data-path"));if($("#hdViewType").val()=="thumb"&&b.IsImage()){a=b.fullPath+'
      '+t("Size")+": "+RoxyUtils.FormatFileSize(b.size)+" "+t("Dimensions")+": "+b.width+"x"+b.height+""}else{if(b.IsImage()){if(RoxyFilemanConf.GENERATETHUMB){imgUrl=RoxyUtils.AddParam(RoxyFilemanConf.GENERATETHUMB,"f",b.fullPath);imgUrl=RoxyUtils.AddParam(imgUrl,"width",RoxyFilemanConf.PREVIEW_THUMB_WIDTH);imgUrl=RoxyUtils.AddParam(imgUrl,"height",RoxyFilemanConf.PREVIEW_THUMB_HEIGHT)}else{imgUrl=b.fullPath}a='
      '+b.name+'
      '+t("Size")+": "+RoxyUtils.FormatFileSize(b.size)+" "+t("Dimensions")+": "+b.width+"x"+b.height+""}else{a=b.fullPath+' '+t("Size")+": "+RoxyUtils.FormatFileSize(b.size)+""}}return a}function filterFiles(){var b=$("#txtSearch").val();$("#pnlSearchNoFiles").hide();if($("#pnlFileList li").length==0){return}if(!b){$("#pnlFileList li").show();return}var a=0;$("#pnlFileList li").each(function(){var c=$(this).children(".name").text();if(c.toLowerCase().indexOf(b.toLowerCase())>-1){a++;$(this).show()}else{$(this).removeClass("selected");$(this).hide()}});if(a==0){$("#pnlSearchNoFiles").show()}}function sortFiles(){var a=getSelectedDir();if(!a){return}a.ListFiles();filterFiles();switchView($("#hdViewType").val())}function switchView(a){if(a==$("#hdViewType").val()){return}if(!a){a=$("#hdViewType").val()}$(".btnView").removeClass("selected");if(a=="thumb"){$("#pnlFileList .icon").attr("src","images/blank.gif");$("#pnlFileList").addClass("thumbView");if($("#dynStyle").length==0){$("head").append('Moduleinstellungen', 'SHOP_MODULE_blTinyMCE_filemanager' => 'Dateimanager aktivieren', 'HELP_SHOP_MODULE_blTinyMCE_filemanager' => 'Ist diese Option aktiv, können Bilder hochgeladen werden. Der Speicherort ist: out/pictures/wysiwigpro/', diff --git a/Application/views/admin/editorswitch.tpl b/Application/views/admin/editorswitch.tpl index f45e9ee..f160899 100644 --- a/Application/views/admin/editorswitch.tpl +++ b/Application/views/admin/editorswitch.tpl @@ -2,7 +2,7 @@ \ No newline at end of file diff --git a/Application/views/admin/en/module_options.php b/Application/views/admin/en/module_options.php index 502c9db..478dfea 100644 --- a/Application/views/admin/en/module_options.php +++ b/Application/views/admin/en/module_options.php @@ -19,8 +19,8 @@ $sLangName = 'English'; $aLang = array( 'charset' => 'UTF-8', - 'BLA_TINYMCE_TOGGLE' => 'toggle TinyMCE', - 'BLA_TINYMCE_PLAINCMS' => 'TinyMCE was disabled for this page because it may not contain HTML code', + 'TINYMCE_TOGGLE' => 'toggle editor', + 'TINYMCE_PLAINCMS' => 'TinyMCE was disabled for this page because it may not contain HTML code', 'SHOP_MODULE_GROUP_tinyMceMain' => 'module settings', 'SHOP_MODULE_blTinyMCE_filemanager' => 'enable filemanager', 'HELP_SHOP_MODULE_blTinyMCE_filemanager' => 'When enabled, you can upload pictures into this directory: out/pictures/wysiwigpro/',