MDL-15688: Modified version of TinyMCE that uses Moodle translation system. Includes a new compressed version of TinyMCE (this one compressed using YUI

compressor)
This commit is contained in:
scyrma
2008-08-01 09:08:48 +00:00
parent 2e4a8e0caa
commit 66d68c083d
6 changed files with 56 additions and 59 deletions
+3 -3
View File
@@ -42,10 +42,10 @@ class htmlEditor {
switch ($editor) {
case 'tinymce':
$editorlanguage = substr(current_language(), 0, 2);
$direction = get_string('thisdirection');
$editorlanguage = current_language();
$configuration[] = $CFG->httpswwwroot ."/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce.js";
$configuration[] = $CFG->httpswwwroot ."/lib/editor/tinymce.js.php?course=$courseid&editorlanguage=$editorlanguage&direction=$direction";
//$configuration[] = $CFG->httpswwwroot ."/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_src.js";
$configuration[] = $CFG->httpswwwroot ."/lib/editor/tinymce.js.php?course=$courseid&editorlanguage=$editorlanguage";
$configured['tinymce'] = true;
break;
+34 -43
View File
@@ -5,8 +5,11 @@ define('NO_MOODLE_COOKIES', true);
require_once('../../config.php');
$courseid = optional_param('course', 0, PARAM_INT);
$editorlanguage = optional_param('editorlanguage', 'en', PARAM_ALPHA);
$directionality = optional_param('direction', get_string('thisdirection'), PARAM_ALPHA);
$editorlanguage = optional_param('editorlanguage', 'en_utf8', PARAM_ALPHANUMEXT);
$SESSION->lang = $editorlanguage;
//$editorlanguage = substr($editorlanguage, 0, strrpos($editorlanguage, '_'));;
$directionality = get_string('thisdirection');
/*
* This section configures the TinyMCE toolbar buttons on and off
@@ -105,51 +108,36 @@ $temp = explode('/', $temp);
$root = $temp[1];
$configuration = <<<EOF
tinyMCE.init({
mode : "exact",
elements : id,
theme : "advanced",
function createHTMLArea(id) {
plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,",
spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv",
random = Math.ceil(1000*Math.random());
editor = 'editor'+random;
editorsubmit = 'editorsubmit'+random;
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
tinyMCE.init({
mode : "exact",
elements : id,
theme : "advanced",
content_css : "/$root/lib/editor/tinymce/examples/css/content.css",
plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,",
spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "top",
theme_advanced_statusbar_location : "bottom",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
theme_advanced_resize_horizontal : true,
theme_advanced_resizing : true,
apply_source_formatting : true,
content_css : "/$root/lib/editor/tinymce/examples/css/content.css",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "top",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resize_horizontal : true,
theme_advanced_resizing : true,
apply_source_formatting : true,
$editorhidebuttons
$editoraddbuttons3
$editoraddbuttons4
});
document.getElementById('ed').form.editorsubmit_43 = document.getElementById('ed').form.onsubmit;
document.getElementById('ed').form.onsubmit = function() {
tinyMCE.triggerSave();
document.getElementById('ed').form.editorsubmit_43();
document.getElementById('ed').form.editorsubmit_43 = null;
}
}
$editorhidebuttons
$editoraddbuttons3
$editoraddbuttons4
});
EOF;
$strtime = get_string('strftimetime');
$strdate = get_string('strftimedaydate');
echo <<<EOF
tinyMCE.init({
@@ -157,6 +145,7 @@ echo <<<EOF
relative_urls: false,
editor_selector: "form-textarea-simple",
document_base_url: "$CFG->httpswwwroot",
content_css: "$CFG->httpswwwroot/lib/editor/tinymce/examples/css/content.css",
theme: "simple",
skin: "o2k7",
skin_variant: "silver",
@@ -180,15 +169,17 @@ echo <<<EOF
entity_encoding: "raw",
language: "$editorlanguage",
directionality: "$directionality",
plugins: "safari,spellchecker,table,style,layer,advhr,advimage,advlink,emoticons,inlinepopups,media,searchreplace,paste,standardmenu,directionality,fullscreen,moodlelink,moodlenolink,dragmath,nonbreaking,contextmenu",
plugins: "safari,spellchecker,table,style,layer,advhr,advimage,advlink,emoticons,inlinepopups,media,searchreplace,paste,standardmenu,directionality,fullscreen,moodlenolink,dragmath,nonbreaking,contextmenu,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak",
plugin_insertdate_dateFormat : "$strdate",
plugin_insertdate_timeFormat : "$strtime",
theme_advanced_layout_manager: "SimpleLayout",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons1: "fontselect,fontsizeselect,formatselect,styleselect",
theme_advanced_buttons1_add: "|,undo,redo,|,search,spellchecker",
theme_advanced_buttons2: "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull",
theme_advanced_buttons1_add: "|,undo,redo,|,search,replace,spellchecker,|,fullscreen",
theme_advanced_buttons2: "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull,|,cite,abbr,acronym",
theme_advanced_buttons2_add: "|,selectall,cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl",
theme_advanced_buttons3: "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,anchor,|,emoticons,image,media,dragmath,advhr,nonbreaking,charmap",
theme_advanced_buttons3_add: "|,table,insertlayer,styleprops,|,code,fullscreen",
theme_advanced_buttons3: "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,anchor,|,insertdate,inserttime,|,emoticons,image,media,dragmath,advhr,nonbreaking,charmap",
theme_advanced_buttons3_add: "|,table,insertlayer,styleprops,visualchars,|,code,preview",
theme_advanced_fonts: "Trebuchet=Trebuchet MS,Verdana,Arial,Helvetica,sans-serif;Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;Wingdings=wingdings",
moodleimage_course_id: $courseid,
theme_advanced_resize_horizontal: true,
File diff suppressed because one or more lines are too long
+4 -2
View File
@@ -95,10 +95,12 @@ tinyMCEPopup = {
},
requireLangPack : function() {
var u = this.getWindowArg('plugin_url') || this.getWindowArg('theme_url');
var u = tinyMCE.settings['document_base_url'];
var p = this.getWindowArg('plugin_url') || this.getWindowArg('theme_url');
if (u && this.editor.settings.language) {
u += '/langs/' + this.editor.settings.language + '_dlg.js';
l = tinyMCE.settings['language'];
u += '/lib/editor/tinymce/strings.php?lang='+l+'&dlg=1&context=' + p;
if (!tinymce.ScriptLoader.isDone(u)) {
document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
+11 -6
View File
@@ -6028,7 +6028,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
var u, s;
if (tinymce.EditorManager.settings) {
u = this.urls[n] + '/langs/' + tinymce.EditorManager.settings.language + '.js';
l = tinyMCE.settings['language'];
u = tinyMCE.settings['document_base_url'] + '/lib/editor/tinymce/strings.php?lang='+l+'&dlg=0&context=' + this.urls[n];
s = tinymce.EditorManager.settings;
if (s) {
@@ -6133,8 +6134,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
// If page not loaded and strict mode isn't enabled then load them
if (!Event.domLoaded && !s.strict_loading_mode) {
// Load language
if (s.language)
sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
if (s.language) {
l = tinyMCE.settings['language'];
sl.add(tinyMCE.settings['document_base_url'] + '/lib/editor/tinymce/strings.php?lang='+l+'&dlg=0');
}
// Load theme
if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
@@ -6640,8 +6643,10 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// Load scripts
function loadScripts() {
if (s.language)
sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
if (s.language) {
l = tinyMCE.settings['language'];
sl.add(tinyMCE.settings['document_base_url'] + '/lib/editor/tinymce/strings.php?lang='+l+'&dlg=0');
}
if (s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
@@ -10602,4 +10607,4 @@ tinymce.create('tinymce.UndoManager', {
}
});
}());
}());
+3 -4
View File
@@ -1,13 +1,13 @@
<?php
define('NO_MOODLE_COOKIES', true);
require_once('../../../config.php');
$contexturl = optional_param('context', null, PARAM_URL);
$isdialog = optional_param('dlg', false, PARAM_BOOL);
$lang = optional_param('lang', 'en_utf8', PARAM_ALPHANUMEXT);
$SESSION->lang = $lang;
error_log($contexturl, 0);
$lang = substr(current_language(), 0, 2);
$output = '';
// get the keys from the reference english translations
@@ -57,7 +57,6 @@ if (!is_null($contexturl)) {
}
$output .= "}}});";
}
$lifetime = '86400';
@header('Content-type: text/javascript; charset=utf-8');
@header('Content-length: '.strlen($output));