Project

General

Profile

Bug #19233 » rtehtmlarea_bugfix_9197_trunk.patch

Administrator Admin, 2008-08-20 04:08

View differences:

typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php (copie de travail)
* @return void
*/
function init() {
global $BACK_PATH,$LANG,$TYPO3_CONF_VARS;
global $BACK_PATH,$LANG;
$this->initVariables();
$this->initConfiguration();
......
// Creating backend template object:
$this->doc = t3lib_div::makeInstance('template');
$this->doc->bodyTagAdditions = 'onLoad="initDialog();"';
$this->doc->bodyTagAdditions = $this->getBodyTagAdditions();
$this->doc->backPath = $BACK_PATH;
// Load the Prototype library and browse_links.js
$this->doc->loadJavascriptLib('contrib/prototype/prototype.js');
$this->doc->loadJavascriptLib('js/browse_links.js');
$this->doc->getContextMenuCode();
}
/**
* Initialize class variables
*
* @return void
*/
public function initVariables() {
// Process bparams
$this->bparams = t3lib_div::_GP('bparams');
$pArr = explode('|', $this->bparams);
$pRteArr = explode(':', $pArr[1]);
$this->editorNo = $pRteArr[0];
$this->contentTypo3Language = $pRteArr[1];
$this->contentTypo3Charset = $pRteArr[2];
$this->RTEtsConfigParams = $pArr[2];
if (!$this->editorNo) {
$this->editorNo = t3lib_div::_GP('editorNo');
$this->contentTypo3Language = t3lib_div::_GP('contentTypo3Language');
$this->contentTypo3Charset = t3lib_div::_GP('contentTypo3Charset');
$this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
}
$this->pointer = t3lib_div::_GP('pointer');
$this->expandPage = t3lib_div::_GP('expandPage');
$this->expandFolder = t3lib_div::_GP('expandFolder');
$this->P = t3lib_div::_GP('P');
$this->PM = t3lib_div::_GP('PM');
$pArr[1] = implode(':', array($this->editorNo, $this->contentTypo3Language, $this->contentTypo3Charset));
$pArr[2] = $this->RTEtsConfigParams;
$this->bparams = implode('|', $pArr);
// Find "mode"
$this->mode = t3lib_div::_GP('mode');
if (!$this->mode) {
$this->mode = 'rte';
}
// Current site url
$this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
// the script to link to
$this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
}
/**
* Initializes the configuration variables
*
* @return void
*/
public function initConfiguration() {
$this->thisConfig = $this->getRTEConfig();
$this->buttonConfig = $this->getButtonConfig('link');
}
/**
* Get the RTE configuration from Page TSConfig
*
* @return array RTE configuration array
*/
protected function getRTEConfig() {
global $BE_USER;
$RTEtsConfigParts = explode(':', $this->RTEtsConfigParams);
$RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
$this->RTEProperties = $RTEsetup['properties'];
return t3lib_BEfunc::RTEsetup($this->RTEProperties, $RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
}
/**
* Get the configuration of the button
*
* @param string $buttonName: the name of the button
* @return array the configuration array of the image button
*/
protected function getButtonConfig($buttonName) {
return ((is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.'][$buttonName.'.'])) ? $this->thisConfig['buttons.'][$buttonName.'.'] : array());
}
/**
* Initialize hook objects implementing interface t3lib_browseLinksHook
* @param string $hookKey: the hook key
* @return void
*/
protected function initHookObjects($hookKey) {
global $TYPO3_CONF_VARS;
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'])) {
foreach ($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'] as $classData) {
$processObject = &t3lib_div::getUserObj($classData);
if(!($processObject instanceof t3lib_browseLinksHook)) {
throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195115652);
}
$parameters = array();
$processObject->init($this, $parameters);
$this->hookObjects[] = $processObject;
}
}
}
/**
* Provide the additional parameters to be included in the template body tag
*
* @return string the body tag additions
*/
public function getBodyTagAdditions() {
return 'onLoad="initDialog();"';
}
/**
* Generate JS code to be used on the link insert/modify dialogue
*
* @return string the generated JS code
*/
function getJSCode() {
global $BACK_PATH;
// BEGIN accumulation of header JavaScript:
$JScode = '';
$JScode.= '
......
}
}
';
// Finally, add the accumulated JavaScript to the template object:
$this->doc->JScode = $this->doc->wrapScriptTags($JScode);
return $JScode;
}
/**
* Initialize class variables
*
* @return void
*/
public function initVariables() {
// Process bparams
$this->bparams = t3lib_div::_GP('bparams');
$pArr = explode('|', $this->bparams);
$pRteArr = explode(':', $pArr[1]);
$this->editorNo = $pRteArr[0];
$this->contentTypo3Language = $pRteArr[1];
$this->contentTypo3Charset = $pRteArr[2];
$this->RTEtsConfigParams = $pArr[2];
if (!$this->editorNo) {
$this->editorNo = t3lib_div::_GP('editorNo');
$this->contentTypo3Language = t3lib_div::_GP('contentTypo3Language');
$this->contentTypo3Charset = t3lib_div::_GP('contentTypo3Charset');
$this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
}
$this->pointer = t3lib_div::_GP('pointer');
$this->expandPage = t3lib_div::_GP('expandPage');
$this->expandFolder = t3lib_div::_GP('expandFolder');
$this->P = t3lib_div::_GP('P');
$this->PM = t3lib_div::_GP('PM');
$pArr[1] = implode(':', array($this->editorNo, $this->contentTypo3Language, $this->contentTypo3Charset));
$pArr[2] = $this->RTEtsConfigParams;
$this->bparams = implode('|', $pArr);
// Find "mode"
$this->mode = t3lib_div::_GP('mode');
if (!$this->mode) {
$this->mode = 'rte';
}
// Current site url
$this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
// the script to link to
$this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
}
/**
* Initializes the configuration variables
*
* @return void
*/
public function initConfiguration() {
$this->thisConfig = $this->getRTEConfig();
$this->buttonConfig = $this->getButtonConfig('link');
}
/**
* Get the RTE configuration from Page TSConfig
*
* @return array RTE configuration array
*/
protected function getRTEConfig() {
global $BE_USER;
$RTEtsConfigParts = explode(':', $this->RTEtsConfigParams);
$RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
$this->RTEProperties = $RTEsetup['properties'];
return t3lib_BEfunc::RTEsetup($this->RTEProperties, $RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
}
/**
* Get the configuration of the button
*
* @param string $buttonName: the name of the button
* @return array the configuration array of the image button
*/
protected function getButtonConfig($buttonName) {
return ((is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.'][$buttonName.'.'])) ? $this->thisConfig['buttons.'][$buttonName.'.'] : array());
}
/**
* Initialize hook objects implementing interface t3lib_browseLinksHook
* @param string $hookKey: the hook key
* @return void
*/
protected function initHookObjects($hookKey) {
global $TYPO3_CONF_VARS;
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'])) {
foreach ($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'] as $classData) {
$processObject = &t3lib_div::getUserObj($classData);
if(!($processObject instanceof t3lib_browseLinksHook)) {
throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195115652);
}
$parameters = array();
$processObject->init($this, $parameters);
$this->hookObjects[] = $processObject;
}
}
}
/******************************************************************
*
* Main functions
......
// End page, return content:
$content.= $this->doc->endPage();
$this->doc->JScodeArray['rtehtmlarea'] = $this->getJSCode();
$content = $this->doc->insertStylesAndJS($content);
return $content;
}
(2-2/3)