[TYPO3-dev] tinymce_rte is now beta

Tapio Markula tapio.markula at xetpoint.fi
Thu Nov 6 12:05:49 CET 2008


Steffen Kamper kirjoitti:
> Tapio Markula schrieb:
>> Dmitry Dulepov
>>> Firsts, it exists and mantained by the core team. So if something
>>> changes, this code is updated. You have one less huge code piece to
>>> manage.
>>
>> that is not so simple because tinyMCE needs some additional JS code.
>>
>> At least needed XCLASS, which has
>> a)
>> function init()    {
>>         global $BE_USER,$BACK_PATH;
>> parent::init()
>> # Extra JS for tinymce_rte
>> $this->doc->JScode .=...
>> }
>>
>> or
>>
>> b)
>> function init()    {
>>         global $BE_USER,$BACK_PATH;
>> # Extra JS for tinymce_rte
>> $this->doc->JScode .=...
>> parent::init()
>> }
>>
>> Both should work because parent function doesn't have
>> $this->doc->JScode =... and no return statement on the end of parent 
>> function
>>
>> BTW. That was *not* possible for the init function of 
>> tinymce_rte/mod2/browse_links.php
>>
>> because $this->doc->JScode = '... and return statement on the end of 
>> the function => $this->doc->JScode .= '... was both in a) and b) ignored
>>
>> It should *always* set as
>> $this->doc->JScode .=...
>>
>> in order to dynamic add new JS
> 
> look to RTE how he does. There is imho no need for XCLASS or hook.

I propose include
class.browse_links.php and

class SC_browse_links extends browse_links {

and reset just necessary the init() and other functions, for example


	function init() {
		global $BE_USER,$BACK_PATH;		
		parent::init();		
		if(TYPO3_branch<4.2) {
				// init hook objects:
			$this->hookObjects = array();
			if 
(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'])) 
{
			 
foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'] 
as $classData) {
					$processObject = &t3lib_div::getUserObj($classData);
	
					$parameters = array();
					$processObject->init($this, $parameters);
					$this->hookObjects[] = $processObject;
				}
			}
		}
			// BEGIN accumulation of header JavaScript:
		$JScode='';
		$JScode.= 'var bm=tinyMCEPopup.editor.selection.getBookmark();
		';
...
			// Finally, add the accumulated JavaScript to the template object:
		$this->doc->JScode .= '<script language="javascript" 
type="text/javascript" src="../res/tiny_mce/tiny_mce_popup.js"></script>';
		$this->doc->JScode .= $this->doc->wrapScriptTags($JScode);
	}




More information about the TYPO3-dev mailing list