Project

General

Profile

Feature #20070 ยป rtehtmlarea_feature_10513.patch

Administrator Admin, 2009-02-21 06:18

View differences:

typo3/sysext/rtehtmlarea/ext_conf_template.txt (copie de travail)
# cat=basic; type=string; label=Aspell path: The server path where Aspell is installed.
AspellDirectory = /usr/bin/aspell
# cat=basic; type=string; label=Default Aspell dictionary: The default dictionary to be used by the htmlArea SpellChecker plugin. This should be set to the default language of the site.
# cat=basic; type=string; label=Default Aspell dictionary: The default dictionary to be used by the htmlArea SpellChecker plugin. DEPRECATED. Use Page TSConfig properties defaultContentLanguage and buttons.spellcheck.dictionaries.[language-iso-code].defaultValue.
defaultDictionary = en
# cat=basic; type=string; label=List of Aspell dictionaries: The list of dictionaries available to the htmlArea SpellChecker plugin. This list is used only if safe_mode is enabled. If safe_mode is not enabled, the list is automatically obtained from Aspell.
# cat=basic; type=string; label=List of Aspell dictionaries: The list of dictionaries available to the htmlArea SpellChecker plugin. DEPRECATED. Use Page TSConfig properties buttons.spellcheck.dictionaries.items and restrictToItems.
dictionaryList = en
# cat=basic/enable/100; type=options[Minimal (Most features disabled. Administrator needs to enable them using TypoScript. For advanced administrators only.),Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.),Demo (Show-off configuration. Includes pre-configured styles. Not for production environments.)]; label=Default configuration settings
typo3/sysext/rtehtmlarea/ext_localconf.php (copie de travail)
// Spell checking configuration
$TYPO3_CONF_VARS['FE']['eID_include']['rtehtmlarea_spellchecker'] = 'EXT:'.$_EXTKEY.'/pi1/class.tx_rtehtmlarea_pi1.php';
$TYPO3_CONF_VARS['BE']['AJAX']['rtehtmlarea::spellchecker'] = 'EXT:'.$_EXTKEY.'/pi1/class.tx_rtehtmlarea_pi1.php:tx_rtehtmlarea_pi1->main';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['dictionaryList'] = $_EXTCONF['dictionaryList'] ? $_EXTCONF['dictionaryList'] : 'en';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['defaultDictionary'] = $_EXTCONF['defaultDictionary'] ? $_EXTCONF['defaultDictionary'] : 'en';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['AspellDirectory'] = $_EXTCONF['AspellDirectory'] ? $_EXTCONF['AspellDirectory'] : '/usr/bin/aspell';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['noSpellCheckLanguages'] = $_EXTCONF['noSpellCheckLanguages'] ? $_EXTCONF['noSpellCheckLanguages'] : 'ja,km,ko,lo,th,zh,b5,gb';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['forceCommandMode'] = $_EXTCONF['forceCommandMode'] ? $_EXTCONF['forceCommandMode'] : 0;
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker'] = array();
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/SpellChecker/class.tx_rtehtmlarea_spellchecker.php:&tx_rtehtmlarea_spellchecker';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker']['addIconsToSkin'] = 0;
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker']['disableInFE'] = 0;
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker']['AspellDirectory'] = $_EXTCONF['AspellDirectory'] ? $_EXTCONF['AspellDirectory'] : '/usr/bin/aspell';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker']['noSpellCheckLanguages'] = $_EXTCONF['noSpellCheckLanguages'] ? $_EXTCONF['noSpellCheckLanguages'] : 'ja,km,ko,lo,th,zh,b5,gb';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker']['forceCommandMode'] = $_EXTCONF['forceCommandMode'] ? $_EXTCONF['forceCommandMode'] : 0;
// The following two properties DEPRECATED as of TYPO3 4.3.0
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker']['dictionaryList'] = $_EXTCONF['dictionaryList'] ? $_EXTCONF['dictionaryList'] : 'en';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['SpellChecker']['defaultDictionary'] = $_EXTCONF['defaultDictionary'] ? $_EXTCONF['defaultDictionary'] : 'en';
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['FindReplace'] = array();
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['FindReplace']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/FindReplace/class.tx_rtehtmlarea_findreplace.php:&tx_rtehtmlarea_findreplace';
typo3/sysext/rtehtmlarea/extensions/SpellChecker/class.tx_rtehtmlarea_spellchecker.php (copie de travail)
/***************************************************************
* Copyright notice
*
* (c) 2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
* (c) 2008-2209 Stanislas Rolland <typo3(arobas)sjbr.ca>
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
......
protected $convertToolbarForHtmlAreaArray = array (
'spellcheck' => 'SpellCheck',
);
protected $spellCheckerModes = array( 'ultra', 'fast', 'normal', 'bad-spellers');
protected $spellCheckerModes = array('ultra', 'fast', 'normal', 'bad-spellers');
public function main($parentObject) {
global $TYPO3_CONF_VARS;
return parent::main($parentObject)
&& t3lib_extMgm::isLoaded('static_info_tables')
&& !in_array($this->htmlAreaRTE->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->htmlAreaRTE->ID]['noSpellCheckLanguages']))
&& !in_array($this->htmlAreaRTE->language, t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->htmlAreaRTE->ID]['plugins'][$pluginName]['noSpellCheckLanguages']))
&& ($this->htmlAreaRTE->contentCharset == 'iso-8859-1' || $this->htmlAreaRTE->contentCharset == 'utf-8');
}
......
* RTEarea['.$RTEcounter.']["buttons"]["button-id"]["property"] = "value";
*/
public function buildJavascriptConfiguration($RTEcounter) {
global $TSFE, $LANG, $TYPO3_CONF_VARS, $BE_USER;
$button = 'spellcheck';
// Set the SpellChecker mode
$spellCheckerMode = isset($BE_USER->userTS['options.']['HTMLAreaPspellMode']) ? trim($BE_USER->userTS['options.']['HTMLAreaPspellMode']) : 'normal';
$spellCheckerMode = isset($GLOBALS['BE_USER']->userTS['options.']['HTMLAreaPspellMode']) ? trim($GLOBALS['BE_USER']->userTS['options.']['HTMLAreaPspellMode']) : 'normal';
if (!in_array($spellCheckerMode, $this->spellCheckerModes)) {
$spellCheckerMode = 'normal';
}
// Set the use of personal dictionary
$enablePersonalDicts = $this->thisConfig['enablePersonalDicts'] ? ((isset($BE_USER->userTS['options.']['enablePersonalDicts']) && $BE_USER->userTS['options.']['enablePersonalDicts']) ? true : false) : false;
// $this->thisConfig['enablePersonalDicts'] is DEPRECATED as of 4.3.0
$enablePersonalDicts = ($this->thisConfig['buttons.'][$button.'.']['enablePersonalDictionaries'] || $this->thisConfig['enablePersonalDicts']) ? ((isset($GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts']) && $GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts']) ? true : false) : false;
if (ini_get('safe_mode') || $this->htmlAreaRTE->is_FE()) {
$enablePersonalDicts = false;
}
$registerRTEinJavascriptString = '';
$button = 'spellcheck';
if (in_array($button, $this->toolbar)) {
if (!is_array( $this->thisConfig['buttons.']) || !is_array( $this->thisConfig['buttons.'][$button.'.'])) {
$registerRTEinJavascriptString .= '
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/popups/spell-check-ui-iso-8859-1.html (copie de travail)
<input type="hidden" name="pspell_mode" id="f_pspell_mode" />
<input type="hidden" name="userUid" id="f_user_uid" />
<input type="hidden" name="enablePersonalDicts" id="f_personal_dicts" />
<input type="hidden" name="showDictionaries" id="f_show_dictionaries" />
<input type="hidden" name="restrictToDictionaries" id="f_restrict_to_dictionaries" />
<input type="hidden" name="init" id="f_init" value="1" />
</form>
<div class="title">Spell Checker</div>
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/popups/spell-check-ui.html (copie de travail)
<input type="hidden" name="pspell_mode" id="f_pspell_mode" />
<input type="hidden" name="userUid" id="f_user_uid" />
<input type="hidden" name="enablePersonalDicts" id="f_personal_dicts" />
<input type="hidden" name="showDictionaries" id="f_show_dictionaries" />
<input type="hidden" name="restrictToDictionaries" id="f_restrict_to_dictionaries" />
<input type="hidden" name="init" id="f_init" value="1" />
</form>
<div class="title">Spell Checker</div>
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-check-ui.js (copie de travail)
* Copyright notice
*
* (c) 2003 dynarch.com. Authored by Mihai Bazon, sponsored by www.americanbible.org.
* (c) 2004-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
* (c) 2004-2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
var field = document.getElementById("f_content");
field.value = HTMLArea.getHTML(editor._doc.body, false, editor);
document.getElementById("f_init").value = "0";
document.getElementById("f_dictionary").value = plugin.contentISOLanguage;
document.getElementById("f_dictionary").value = plugin.defaultDictionary ? plugin.defaultDictionary : plugin.contentISOLanguage;
document.getElementById("f_charset").value = plugin.contentCharset;
document.getElementById("f_pspell_mode").value = plugin.spellCheckerMode;
document.getElementById("f_user_uid").value = plugin.userUid;
document.getElementById("f_personal_dicts").value = plugin.enablePersonalDicts;
document.getElementById("f_show_dictionaries").value = plugin.showDictionaries;
document.getElementById("f_restrict_to_dictionaries").value = plugin.restrictToDictionaries;
field.form.submit();
// assign some global event handlers
var select = document.getElementById("v_suggestions");
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-checker.js (copie de travail)
* Copyright notice
*
* (c) 2003 dynarch.com. Authored by Mihai Bazon, sponsored by www.americanbible.org.
* (c) 2004-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
* (c) 2004-2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
this.spellCheckerMode = this.pageTSconfiguration.spellCheckerMode;
this.enablePersonalDicts = this.pageTSconfiguration.enablePersonalDicts;
this.userUid = this.editorConfiguration.userUid;
this.defaultDictionary = (this.pageTSconfiguration.dictionaries && this.pageTSconfiguration.dictionaries[this.contentISOLanguage] && this.pageTSconfiguration.dictionaries[this.contentISOLanguage].defaultValue) ? this.pageTSconfiguration.dictionaries[this.contentISOLanguage].defaultValue : "";
this.showDictionaries = (this.pageTSconfiguration.dictionaries && this.pageTSconfiguration.dictionaries.items) ? this.pageTSconfiguration.dictionaries.items : "";
this.restrictToDictionaries = (this.pageTSconfiguration.dictionaries && this.pageTSconfiguration.dictionaries.restrictToItems) ? this.pageTSconfiguration.dictionaries.restrictToItems : "";
/*
* Registering plugin "About" information
typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php (copie de travail)
/***************************************************************
* Copyright notice
*
* (c) 2003-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
* (c) 2003-2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
......
// Setting start time
$time_start = microtime(true);
$this->pspell_is_available = in_array('pspell', get_loaded_extensions());
$this->AspellDirectory = trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['AspellDirectory'])? trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['AspellDirectory']) : '/usr/bin/aspell';
$this->forceCommandMode = (trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['forceCommandMode']))? trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['forceCommandMode']) : 0;
$this->AspellDirectory = trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['AspellDirectory'])? trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['AspellDirectory']) : '/usr/bin/aspell';
$this->forceCommandMode = (trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['forceCommandMode']))? trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['forceCommandMode']) : 0;
$safe_mode_is_enabled = ini_get('safe_mode');
if($safe_mode_is_enabled && !$this->pspell_is_available ) echo('Configuration problem: Spell checking cannot be performed');
if($safe_mode_is_enabled && $this->forceCommandMode) echo('Configuration problem: Spell checking cannot be performed in command mode');
......
}
// Setting the list of dictionaries
if(!$safe_mode_is_enabled && (!$this->pspell_is_available || $this->forceCommandMode)) {
if (!$safe_mode_is_enabled && (!$this->pspell_is_available || $this->forceCommandMode)) {
$dictionaryList = shell_exec( $this->AspellDirectory.' dump dicts');
$dictionaryList = implode(',', t3lib_div::trimExplode(chr(10), $dictionaryList, 1));
}
if( empty($dictionaryList) ) {
$dictionaryList = trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['dictionaryList']);
if (empty($dictionaryList)) {
$dictionaryList = t3lib_div::_POST('showDictionaries');
// Applying EM variable DEPRECATED as of TYPO3 4.3.0
$dictionaryList = $dictionaryList ? $dictionaryList : trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['dictionaryList']);
}
if( empty($dictionaryList) ) {
$dictionaryList = 'en';
}
$dictionaryArray = t3lib_div::trimExplode(',', $dictionaryList, 1);
$defaultDictionary = trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['defaultDictionary']);
if(!$defaultDictionary || !in_array($defaultDictionary, $dictionaryArray)) {
$defaultDictionary = 'en';
$restrictToDictionaries = t3lib_div::_POST('restrictToDictionaries');
if ($restrictToDictionaries) {
$dictionaryArray = array_intersect($dictionaryArray, t3lib_div::trimExplode(',', $restrictToDictionaries, 1));
}
// Get the defined sys_language codes
$languageArray = array();
$tableA = 'sys_language';
$tableB = 'static_languages';
$selectFields = $tableA . '.uid,' . $tableB . '.lg_iso_2,' . $tableB . '.lg_country_iso_2';
$table = $tableA . ' LEFT JOIN ' . $tableB . ' ON ' . $tableA . '.static_lang_isocode=' . $tableB . '.uid';
$whereClause = '1=1 ';
$whereClause .= ' AND ' . $tableA . '.hidden != 1';
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $table, $whereClause);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$languageArray[] = strtolower($row['lg_iso_2']).($row['lg_country_iso_2']?'_'.$row['lg_country_iso_2']:'');
if (!count($dictionaryArray)) {
$dictionaryArray[] = 'en';
}
if(!in_array($defaultDictionary, $languageArray)) {
$languageArray[] = $defaultDictionary;
$this->dictionary = t3lib_div::_POST('dictionary');
// Applying EM variable DEPRECATED as of TYPO3 4.3.0
$defaultDictionary = $this->dictionary ? $this->dictionary : trim($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['defaultDictionary']);
if (!$defaultDictionary || !in_array($defaultDictionary, $dictionaryArray)) {
$defaultDictionary = 'en';
}
foreach ($dictionaryArray as $key => $dict) {
$lang = explode('-', $dict);
if( !in_array(substr($dict, 0, 2), $languageArray) || !empty($lang[1])) {
unset($dictionaryArray[$key]);
} else {
$dictionaryArray[$key] = $lang[0];
}
}
uasort($dictionaryArray, 'strcoll');
$dictionaryList = implode(',', $dictionaryArray);
// Setting the dictionary
$this->dictionary = t3lib_div::_POST('dictionary');
if( empty($this->dictionary) || !in_array($this->dictionary, $dictionaryArray)) {
$this->dictionary = $defaultDictionary;
if (empty($this->dictionary) || !in_array($this->dictionary, $dictionaryArray)) {
$this->dictionary = 'en';
}
$dictionaries = substr_replace($dictionaryList, '@'.$this->dictionary, strpos($dictionaryList, $this->dictionary), strlen($this->dictionary));
typo3/sysext/rtehtmlarea/res/demo/pageTSConfig.txt (copie de travail)
## Configuration specific to the spellcheck button or SpellCheck feature (htmlArea RTE only)
## Enable the use of personal dictionaries
enablePersonalDicts = 1
buttons.spellcheck.enablePersonalDictionaries = 1
}
## Use same processing as on entry to database to clean content pasted into the editor
    (1-1/1)