2012-12-20 00:20:31 +01:00
|
|
|
<?php
|
2013-07-25 23:50:43 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* HDI TinyMCE
|
|
|
|
* Copyright (C) 2012-2013 HEINER DIRECT GmbH & Co. KG
|
|
|
|
* info: oxid@heiner-direct.com
|
|
|
|
*
|
|
|
|
* 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;
|
|
|
|
* either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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 this program; if not, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
|
|
|
|
class tinyMCE extends tinyMCE_parent
|
|
|
|
{
|
|
|
|
|
|
|
|
protected function _generateTextEditor($iWidth, $iHeight, $oObject, $sField, $sStylesheet = NULL)
|
|
|
|
{
|
2013-09-04 12:53:14 +02:00
|
|
|
$myConfig = oxRegistry::getConfig();
|
|
|
|
$aClasses = $myConfig->getConfigParam("aTinyMCE_classes");
|
|
|
|
$aPlainCms = $myConfig->getConfigParam("aTinyMCE_plaincms");
|
2013-07-25 23:50:43 +02:00
|
|
|
|
2013-09-04 12:53:14 +02:00
|
|
|
if (in_array($this->getClassName(),$aClasses) && !in_array($oObject->oxcontents__oxloadid->value,$aPlainCms))
|
2013-07-25 23:50:43 +02:00
|
|
|
{
|
|
|
|
$oViewConf = $this->_aViewData["oViewConf"];
|
|
|
|
$smarty = oxRegistry::get("oxUtilsView")->getSmarty();
|
|
|
|
|
|
|
|
//$sEditor = $smarty->fetch($myConfig->getModulesDir()."hdi/hdi-tinymce/test.tpl");
|
|
|
|
|
|
|
|
if ($oObject)
|
|
|
|
{
|
|
|
|
$sInitialValue = '';
|
|
|
|
if ($oObject->$sField instanceof oxField)
|
|
|
|
{
|
|
|
|
$sInitialValue = $oObject->$sField->getRawValue();
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
$sInitialValue = $oObject->$sField->value;
|
|
|
|
}
|
2013-09-03 17:03:33 +02:00
|
|
|
$sLang = oxRegistry::getLang()->getLanguageAbbr(oxRegistry::getLang()->getTplLanguage ());
|
2013-11-28 16:01:12 +01:00
|
|
|
// 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");
|
|
|
|
$smarty->assign("sEditorLang",(in_array($sLang,$aLang) ? $aLang[$sLang] : "en"));
|
2013-09-03 17:03:33 +02:00
|
|
|
|
2013-07-25 23:50:43 +02:00
|
|
|
//$oObject->$sField = new oxField(str_replace('[{$shop->currenthomedir}]', $myConfig->getCurrentShopURL(), $sInitialValue), oxField::T_RAW);
|
|
|
|
$smarty->assign("sField", $sField);
|
|
|
|
$smarty->assign("iWidth", (strpos($iWidth, '%') === false) ? $iWidth . 'px' : $iWidth);
|
|
|
|
//$smarty->assign("iHeight", "80%");
|
|
|
|
$smarty->assign( "iHeight", (strpos($iHeight, '%') === false) ? $iHeight . 'px' : $iHeight);
|
|
|
|
$smarty->assign("sContent", $this->_getEditValue($oObject, $sField));
|
|
|
|
|
|
|
|
//external plugins & controls
|
|
|
|
$smarty->assign("extPlugins", $myConfig->getConfigParam("aTinyMCE_external_plugins"));
|
|
|
|
$smarty->assign("extControls", $myConfig->getConfigParam("sTinyMCE_external_controls"));
|
2013-11-14 10:10:41 +01:00
|
|
|
$smarty->assign("extConfig", implode($myConfig->getConfigParam("aTinyMCE_external_config"),"\n"));
|
2013-07-25 23:50:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
//var_dump($myConfig->getModulesDir()."hdi/hdi-tinymce/test.tpl");
|
|
|
|
$smarty->assign("cfg", $myConfig);
|
|
|
|
$smarty->assign("oViewConf", $this->_aViewData["oViewConf"]);
|
|
|
|
$sEditor = $smarty->fetch("tinymce.tpl");
|
2012-12-20 00:20:31 +01:00
|
|
|
}
|
2013-07-25 23:50:43 +02:00
|
|
|
|
|
|
|
return $sEditor;
|
2013-09-04 12:53:14 +02:00
|
|
|
}
|
|
|
|
else
|
2013-07-25 23:50:43 +02:00
|
|
|
{
|
|
|
|
//returning default textarea or whatever
|
2013-09-04 12:53:14 +02:00
|
|
|
$sEditor = parent::_generateTextEditor($iWidth, $iHeight, $oObject, $sField, $sStylesheet);
|
|
|
|
if(in_array($oObject->oxcontents__oxloadid->value,$aPlainCms))
|
|
|
|
{
|
|
|
|
$sEditor .= oxRegistry::getLang()->translateString("hdi_tinymce_plaincms");
|
|
|
|
}
|
|
|
|
return $sEditor;
|
2012-12-20 00:20:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-25 23:50:43 +02:00
|
|
|
}
|