ENHANCEMENT Using currently used content languages for options in the TinyMCE spellchecker (see http://open.silverstripe.com/ticket/2498#comment:2)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65513 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-11-10 01:47:13 +00:00
parent 024bf71ccf
commit df7092163f
2 changed files with 13 additions and 2 deletions

View File

@ -81,13 +81,24 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
public function init() {
parent::init();
// collect languages for TinyMCE spellchecker plugin
if(Translatable::is_enabled()) {
$spellcheckLangs = i18n::get_existing_content_languages();
} else {
$defaultLang = Translatable::get_default_lang();
$spellcheckLangs = array($defaultLang => i18n::get_language_name($defaultLang));
}
$spellcheckSpec = array();
foreach($spellcheckLangs as $lang => $title) $spellcheckSpec[] = "{$title}={$lang}";
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
if(!Director::is_ajax()) {
Requirements::javascriptTemplate(CMS_DIR . "/javascript/tinymce.template.js", array(
"ContentCSS" => (SSViewer::current_theme() ? THEMES_DIR . "/" . SSViewer::current_theme() : project()) . "/css/editor.css",
"BaseURL" => Director::absoluteBaseURL(),
"Lang" => i18n::get_tinymce_lang()
"Lang" => i18n::get_tinymce_lang(),
'SpellcheckLangs' => '+' . implode(',', $spellcheckSpec)
));
}

View File

@ -30,7 +30,7 @@ if((typeof tinyMCE != 'undefined')) {
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,separator,bullist,numlist,outdent,indent,hr,charmap",
theme_advanced_buttons2 : "undo,redo,separator,cut,copy,paste,pastetext,pasteword,spellchecker,separator,ssimage,ssflash,sslink,unlink,anchor,separator,template,code,separator,search,replace,selectall,visualaid,separator,tablecontrols",
theme_advanced_buttons3 : "",
spellchecker_languages : "+English=en",
spellchecker_languages : "$SpellcheckLangs",
template_templates : [
{ title : "Three column", src : "assets/snippet.html", description : "A simple 3 column layout"},