[TYPO3-project-formidable] TINYMCE renderlet adjustments
Jerome Schneider
typo3dev at ameos.com
Tue Feb 24 17:56:27 CET 2009
Hi Hauke,
I'll implement your proposition :)
Regards,
Jerome
Hauke Hain a écrit :
> Hello,
>
> liked written in the other posts by me I made a few adjustments to the
> TINYMCE renderlet.
>
> You can choose the path to your tiny_mce integration.
> This is useful if you use one extension which provides this editor, so
> you have only one source to update for all implementations of TinyMCE.
>
> At the end of this post I added my new class.tx_rdttinymce.php. The
> changes I made yesterday are included and improved.
>
> Since I don't know hat to make a *.patch oder *.diff I cannot post it.
> Sorry. But you may tell me and I'll post it.
>
> In order to set the path to the mce use the following xml inside the
> tinymce renderlet:
> <tinymce>
> <path>typo3conf/ext/tx_tinymce/tiny_mce/</path>
> </tinymce>
> It is important that the path end with a slash.
>
>
>
> <?php
> /**
> * Plugin 'rdt_tinymce' for the 'ameos_formidable' extension.
> *
> * @author Jerome Schneider <typo3dev at ameos.com>
> */
>
> // FOR CONFIGURATON REFERENCE, SEE
> // http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
>
> class tx_rdttinymce extends formidable_mainrenderlet {
>
> function _render() {
>
> $sLabel = $this->oForm->_getLLLabel($this->aElement["label"]);
> $sValue = htmlspecialchars(
> $this->getValue()
> );
>
> if(is_array($aUserConfig = $this->_navConf("/config")) &&
> !empty($aUserConfig)) {
> $sInput = "<textarea name=\"" . $this->_getElementHtmlName() . "\"
> id=\"" . $this->_getElementHtmlId() . "\" rows='2' cols='20'
> style=\"width:".$aUserConfig[width]."px;height:".$aUserConfig[height]."px\">"
> . $sValue . "</textarea>";
> } else {
> $sInput = "<textarea name=\"" . $this->_getElementHtmlName() . "\"
> id=\"" . $this->_getElementHtmlId() . "\" rows='2' cols='20'>" . $sValue
> . "</textarea>";
> }
>
> $aHtmlBag = array(
> "__compiled" => $this->_displayLabel($sLabel) . $sInput,
> "input" => $sInput,
> );
>
> $sPath = $this->_navConf("/tinymce/path");
>
> if(empty($sPath)) {
> $sPath = $this->sExtWebPath ."res/tiny_mce/";
> }
>
> $this->oForm->additionalHeaderData(
> "<script type='text/javascript' src='" . $sPath .
> "tiny_mce.js'></script>",
> "ameosformidable_tx_rdttinymce"
> );
>
>
> $aConfig = array(
> "mode" => "exact",
> "elements" => $this->_getElementHtmlId(),
> );
>
> if(is_array($aUserConfig) && !empty($aUserConfig)) {
> $aConfig = t3lib_div::array_merge_recursive_overrule($aUserConfig,
> $aConfig);
> }
>
> if(!array_key_exists("theme", $aConfig)) {
> $aConfig["theme"] = "simple";
> }
>
> if(array_key_exists("content_css", $aConfig)) {
> $aConfig["content_css"] =
> $this->oForm->toWebPath($aConfig["content_css"]);
> }
>
> if(is_array($aAddConfig = $this->_navConf("/addconfig")) &&
> $this->oForm->isRunneable($aAddConfig)) {
> $aAddConfig = $this->callRunneable($aAddConfig);
> if(is_array($aAddConfig) && !empty($aAddConfig)) {
> $aConfig = t3lib_div::array_merge_recursive_overrule($aConfig,
> $aAddConfig);
> }
> }
>
> // FOR CONFIGURATON REFERENCE, SEE
> // http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
>
> $sJson = $this->oForm->array2json($aConfig);
>
> $this->oForm->attachInitTask(
> "tinyMCE.init(" . $sJson . ");",
> "TinyMCE " . $this->_getElementHtmlId() . " initialization",
> $this->_getElementHtmlId(),
> TRUE
> );
>
>
>
> return $aHtmlBag;
> }
> }
>
>
> if (defined("TYPO3_MODE") &&
> $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/ameos_formidable/api/base/rdt_tinymce/api/class.tx_rdttinymce.php"])
> {
> include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/ameos_formidable/api/base/rdt_tinymce/api/class.tx_rdttinymce.php"]);
>
> }
> ?>
More information about the TYPO3-project-formidable
mailing list