Project

General

Profile

Feature #17714 » rtehtmlarea_feature_6579_fe.patch

Administrator Admin, 2007-11-10 23:07

View differences:

typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (working copy)
* TOOLBAR CONFIGURATION
* =======================================
*/
// Traverse registered plugins
if (is_array($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['plugins'])) {
foreach($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['plugins'] as $pluginId => $pluginObjectConfiguration) {
$plugin = &t3lib_div::getUserObj($pluginObjectConfiguration['objectReference']);
if (is_object($plugin)) {
if ($plugin->main($this)) {
$this->registeredPlugins[$pluginId] = $plugin;
// Override buttons from previously registered plugins
$pluginButtons = t3lib_div::trimExplode(',', $plugin->getPluginButtons(), 1);
foreach ($this->pluginButton as $previousPluginId => $buttonList) {
$this->pluginButton[$previousPluginId] = implode(',',array_diff(t3lib_div::trimExplode(',', $this->pluginButton[$previousPluginId], 1), $pluginButtons));
}
$this->pluginButton[$pluginId] = $plugin->getPluginButtons();
$pluginLabels = t3lib_div::trimExplode(',', $plugin->getPluginLabels(), 1);
foreach ($this->pluginLabel as $previousPluginId => $labelList) {
$this->pluginLabel[$previousPluginId] = implode(',',array_diff(t3lib_div::trimExplode(',', $this->pluginLabel[$previousPluginId], 1), $pluginLabels));
}
$this->pluginLabel[$pluginId] = $plugin->getPluginLabels();
$this->pluginList .= ','.$pluginId;
}
}
}
}
// Process overrides
$hidePlugins = array();
foreach ($this->registeredPlugins as $pluginId => $plugin) {
if (!$this->pluginButton[$pluginId]) {
$hidePlugins[] = $pluginId;
}
}
// htmlArea plugins list
$this->pluginEnabledArray = t3lib_div::trimExplode(',', $this->pluginList, 1);
$this->enableRegisteredPlugins();
$hidePlugins = array();
if(!t3lib_extMgm::isLoaded('static_info_tables') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
if ($this->client['BROWSER'] == 'msie') $hidePlugins[] = 'Acronym';
if ($this->client['BROWSER'] == 'opera') {
......
// Return form item:
return $item;
}
/**
* Add registered plugins to the array of enabled plugins
*
*/
function enableRegisteredPlugins() {
global $TYPO3_CONF_VARS;
// Traverse registered plugins
if (is_array($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['plugins'])) {
foreach($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['plugins'] as $pluginId => $pluginObjectConfiguration) {
$plugin = &t3lib_div::getUserObj($pluginObjectConfiguration['objectReference']);
if (is_object($plugin)) {
if ($plugin->main($this)) {
$this->registeredPlugins[$pluginId] = $plugin;
// Override buttons from previously registered plugins
$pluginButtons = t3lib_div::trimExplode(',', $plugin->getPluginButtons(), 1);
foreach ($this->pluginButton as $previousPluginId => $buttonList) {
$this->pluginButton[$previousPluginId] = implode(',',array_diff(t3lib_div::trimExplode(',', $this->pluginButton[$previousPluginId], 1), $pluginButtons));
}
$this->pluginButton[$pluginId] = $plugin->getPluginButtons();
$pluginLabels = t3lib_div::trimExplode(',', $plugin->getPluginLabels(), 1);
foreach ($this->pluginLabel as $previousPluginId => $labelList) {
$this->pluginLabel[$previousPluginId] = implode(',',array_diff(t3lib_div::trimExplode(',', $this->pluginLabel[$previousPluginId], 1), $pluginLabels));
}
$this->pluginLabel[$pluginId] = $plugin->getPluginLabels();
$this->pluginEnabledArray[] = $pluginId;
}
}
}
}
// Process overrides
$hidePlugins = array();
foreach ($this->registeredPlugins as $pluginId => $plugin) {
if (!$this->pluginButton[$pluginId]) {
$hidePlugins[] = $pluginId;
}
}
$this->pluginEnabledArray = array_diff($this->pluginEnabledArray, $hidePlugins);
}
/**
* Set the toolbar config (only in this PHP-Object, not in JS):
*
*/
......
// Setting the plugin flags
$configureRTEInJavascriptString .= '
RTEarea['.$RTEcounter.']["plugin"] = new Object();';
$pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1);
foreach ($pluginArray as $pluginId) {
if ($this->isPluginEnabled($pluginId)) {
$configureRTEInJavascriptString .= '
foreach ($this->pluginEnabledArray as $pluginId) {
$configureRTEInJavascriptString .= '
RTEarea['.$RTEcounter.']["plugin"]["'.$pluginId.'"] = true;';
}
}
// Setting the buttons configuration
typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php (working copy)
* TOOLBAR CONFIGURATION
* =======================================
*/
// Traverse registered plugins
if (is_array($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['plugins'])) {
foreach($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['plugins'] as $pluginId => $pluginObjectConfiguration) {
$plugin = &t3lib_div::getUserObj($pluginObjectConfiguration['objectReference']);
if (is_object($plugin)) {
if ($plugin->main($this)) {
$this->registeredPlugins[$pluginId] = $plugin;
$this->pluginButton[$pluginId] = $plugin->getPluginButtons();
$this->pluginList .= ','.$pluginId;
$this->convertToolbarForHtmlAreaArray = array_unique(array_merge($this->convertToolbarForHtmlAreaArray, $plugin->getConvertToolbarForHtmlAreaArray()));
}
}
}
}
// htmlArea plugins list
$this->pluginEnabledArray = t3lib_div::trimExplode(',', $this->pluginList, 1);
$this->enableRegisteredPlugins();
$hidePlugins = array('TYPO3Browsers', 'UserElements', 'Acronym', 'TYPO3HtmlParser');
if ($this->client['BROWSER'] == 'opera') {
$hidePlugins[] = 'ContextMenu';
......
// Merge the list of enabled plugins with the lists from the previous RTE editing areas on the same form
$this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] = $this->pluginEnabledArray;
if ($this->TCEform->RTEcounter > 1) $this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] = array_unique(array_values(array_merge($this->pluginEnabledArray,$this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1])));
if ($this->TCEform->RTEcounter > 1 && isset($this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1]) && is_array($this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1])) {
$this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] = array_unique(array_values(array_merge($this->pluginEnabledArray,$this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1])));
}
/* =======================================
* PLUGIN-SPECIFIC CONFIGURATION
(4-4/6)