From 3ad23e789cee121af4643209fc6dd6de42214bae Mon Sep 17 00:00:00 2001 From: Marat Date: Wed, 10 Aug 2016 22:42:23 +0200 Subject: [PATCH] cleanup + vendormetadata --- .../extend/blatinymceoxviewconfig.php | 243 ------------------ copy_this/modules/bla/vendormetadata.php | 5 + 2 files changed, 5 insertions(+), 243 deletions(-) delete mode 100644 copy_this/modules/bla/bla-tinymce/extend/blatinymceoxviewconfig.php create mode 100644 copy_this/modules/bla/vendormetadata.php diff --git a/copy_this/modules/bla/bla-tinymce/extend/blatinymceoxviewconfig.php b/copy_this/modules/bla/bla-tinymce/extend/blatinymceoxviewconfig.php deleted file mode 100644 index a4dd0fd..0000000 --- a/copy_this/modules/bla/bla-tinymce/extend/blatinymceoxviewconfig.php +++ /dev/null @@ -1,243 +0,0 @@ - - * - * Marat Bedoev - */ - -class blaTinyMceOxViewConfig extends blaTinyMceOxViewConfig_parent -{ - public function loadTinyMce() - { - $cfg = oxRegistry::getConfig(); - $blEnabled = in_array($this->getActiveClassName(), $cfg->getConfigParam("aTinyMCE_classes")); - $blPlainCms = in_array($cfg->getActiveView()->getViewDataElement("edit")->oxcontents__oxloadid->value, - $cfg->getConfigParam("aTinyMCE_plaincms")); - - if (!$blEnabled) - { - return; - } - if ($blPlainCms) - { - return oxRegistry::getLang()->translateString("hdi_tinymce_plaincms"); - } - - // processind editor config & other stuff - $sLang = oxRegistry::getLang()->getLanguageAbbr(oxRegistry::getLang()->getTplLanguage()); - // array to assign shops lang abbreviations to lang file names of tinymce: shopLangAbbreviation => fileName (without .js ) - $aLang = array( - "cs" => "cs", - "da" => "da", - "de" => "de", - "fr" => "fr_FR", - "it" => "it", - "nl" => "nl", - "ru" => "ru" - ); - - - // default config - $aDefaultConfig = array( - 'selector' => '"textarea:not(.mceNoEditor)"', - 'language' => '"' . (in_array($sLang, $aLang) ? $aLang[$sLang] : 'en') . '"', - //'spellchecker_language' => '"' . (in_array($sLang, $aLang) ? $aLang[$sLang] : 'en') . '"', - 'nowrap' => 'true', - 'entity_encoding' => '"raw"', - // http://www.tinymce.com/wiki.php/Configuration:entity_encoding - 'height' => 300, - 'menubar' => 'false', - 'document_base_url' => '"' . $this->getBaseDir() . '"', - // http://www.tinymce.com/wiki.php/Configuration:document_base_url - 'relative_urls' => 'false', - // http://www.tinymce.com/wiki.php/Configuration:relative_urls - - 'plugin_preview_width' => 'window.innerWidth', - 'plugin_preview_height' => 'window.innerHeight-90', - 'code_dialog_width' => 'window.innerWidth-50', - 'code_dialog_height' => 'window.innerHeight-130', - 'image_advtab' => 'true', - 'imagetools_toolbar' => '"rotateleft rotateright | flipv fliph | editimage imageoptions"', - 'moxiemanager_fullscreen' => 'true', - 'insertdatetime_formats' => '[ "%d.%m.%Y", "%H:%M" ]', - 'nonbreaking_force_tab' => 'true', - // http://www.tinymce.com/wiki.php/Plugin:nonbreaking - 'autoresize_max_height' => '400' - ); - //merging with custom config - $aConfig = ($aCustomCfg = $this->_getTinyCustConfig()) ? array_merge($aDefaultConfig, - $aCustomCfg) : $aDefaultConfig; - - - // default plugins and their buttons - $aPluginsControls = array( - 'advlist' => false, - 'anchor' => 'anchor', - 'autolink' => false, - 'autoresize' => false, - 'charmap' => 'charmap', - 'code' => 'code', - 'colorpicker' => false, - //'emoticons' => 'emoticons', - 'fullscreen' => 'fullscreen', - 'hr' => 'hr', - 'image' => 'image', - 'imagetools' => false, - 'insertdatetime' => 'insertdatetime', - 'link' => 'link unlink', - 'lists' => false, - 'media' => 'media', - 'nonbreaking' => false, - 'pagebreak' => 'pagebreak', - 'paste' => 'pastetext', - 'preview' => 'preview', - 'searchreplace' => 'searchreplace', - //'spellchecker' => 'spellchecker', - 'table' => 'table', - 'textcolor' => 'forecolor backcolor', - 'visualblocks' => false, - //'visualchars' => 'visualchars', - 'wordcount' => false - ); - - $aPlugins = $cfg->getConfigParam("aTinyMCE_plugins"); - if (empty($aPlugins) || !is_array($aPlugins)) $aPlugins = array_keys($aPluginsControls); - if ($this->getActiveClassName() == "newsletter_main") - { - $aPlugins["legacyoutput"] = false; - $aPlugins["fullpage"] = "fullpage"; - } - - $aConfig['plugins'] = '"' . implode(' ', $aPlugins) . '"'; - - // external plugins - if ($aExtPlugins = $this->_getTinyExtPlugins()) - { - $aConfig['external_plugins'] = '{ '; - foreach ($aExtPlugins AS $plugin => $file) - { - $aConfig['external_plugins'] .= '"' . $plugin . '": "' . $file . '", '; - } - $aConfig['external_plugins'] .= ' }'; - } - - // default tollbar buttons - $aDefaultButtons = array( - "undo redo", - "bold italic underline strikethrough", - "alignleft aligncenter alignright alignjustify", - "bullist numlist", - "outdent indent", - "blockquote", - "removeformat", - "subscript", - "superscript", - "formatselect", - "fontselect", - "fontsizeselect", - "subscript superscript" - ); - $aButtons = $this->_getTinyToolbarControls(); - if (!is_array($aButtons) || empty($aButtons)) $aButtons = $aDefaultButtons; - - // buttons for plugins, enable only if plugin is active - $aPluginButtons = array_values(array_intersect_key($aPluginsControls, array_flip($aPlugins))); - - $aButtons = array_merge($aButtons, $aPluginButtons); - - $aConfig['toolbar'] = '"' . implode(" | ", $aButtons) . '"'; - - - // compile the whole config stuff - $sConfig = ''; - foreach ($aConfig AS $param => $value) - { - $sConfig .= "$param: $value, "; - } - - // add init script - $sInit = 'tinymce.init({ ' . $sConfig . ' });'; - - $sCopyLongDescFromTinyMCE = 'function copyLongDescFromTinyMCE(sIdent) -{ - var editor = tinymce.get("editor_"+sIdent); - if (editor && editor.isHidden() !== true) - { - console.log("copy content from tinymce"); - var content = editor.getContent().replace(/\[{([^\]]*?)}\]/g, function(m) { return m.replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&") }); - document.getElementsByName("editval[" + sIdent + "]").item(0).value = content; - return true; - } - return false; -} - -var origCopyLongDesc = copyLongDesc; -copyLongDesc = function(sIdent) -{ - if ( copyLongDescFromTinyMCE( sIdent ) ) return; - console.log("tinymce disabled, copy content from regular textarea"); - origCopyLongDesc( sIdent ); -}'; - - // adding scripts to template - $smarty = oxRegistry::get("oxUtilsView")->getSmarty(); - $sSufix = ($smarty->_tpl_vars["__oxid_include_dynamic"]) ? '_dynamic' : ''; - - $aScript = (array)$cfg->getGlobalParameter('scripts' . $sSufix); - $aScript[] = $sCopyLongDescFromTinyMCE; - $aScript[] = $sInit; - $cfg->setGlobalParameter('scripts' . $sSufix, $aScript); - - $aInclude = (array)$cfg->getGlobalParameter('includes' . $sSufix); - $aInclude[3][] = $this->getModuleUrl('bla-tinymce', 'tinymce/tinymce.min.js'); - $cfg->setGlobalParameter('includes' . $sSufix, $aInclude); - - return '
  • - -
  • '; - // javascript:tinymce.execCommand(\'mceToggleEditor\',false,\'editor1\'); - } - - protected function _getTinyToolbarControls() - { - $aControls = oxRegistry::getConfig()->getConfigParam("aTinyMCE_buttons"); - if (method_exists(get_parent_class(__CLASS__), __FUNCTION__)) - { - $aControls = array_merge($aControls, parent::_getTinyToolbarControls()); - } - return $aControls; - } - - protected function _getTinyExtPlugins() - { - $aPlugins = oxRegistry::getConfig()->getConfigParam("aTinyMCE_external_plugins"); - if (method_exists(get_parent_class(__CLASS__), __FUNCTION__)) - { - $aPlugins = array_merge(parent::_getTinyExtPlugins(), $aPlugins); - } - return $aPlugins; - } - - protected function _getTinyCustConfig() - { - $aConfig = oxRegistry::getConfig()->getConfigParam("aTinyMCE_config_override"); - if (method_exists(get_parent_class(__CLASS__), __FUNCTION__)) - { - $aConfig = array_merge(parent::_getTinyCustConfig(), $aConfig); - } - return $aConfig; - } -} diff --git a/copy_this/modules/bla/vendormetadata.php b/copy_this/modules/bla/vendormetadata.php new file mode 100644 index 0000000..f04e82d --- /dev/null +++ b/copy_this/modules/bla/vendormetadata.php @@ -0,0 +1,5 @@ +