<?php
+define('NO_MOODLE_COOKIES', true);
+
require("../../../../../config.php");
-$id = optional_param('id', SITEID, PARAM_INT);
+$lang = required_param('elanguage', PARAM_SAFEDIR);
-require_course_login($id);
-@header('Content-Type: text/html; charset=utf-8');
+if (file_exists("$CFG->dataroot/lang/$lang") or file_exists("$CFG->dirroot/lang/$lang")) {
+ $SESSION->lang = $lang;
+} else if (file_exists("$CFG->dataroot/lang/{$lang}_utf8") or file_exists("$CFG->dirroot/lang/{$lang}_utf8")) {
+ $SESSION->lang = $lang.'_utf8';
+}
+
+$lang = str_replace('_utf8', '', $lang);
+
+$langmapping = array('cs'=>'cz', 'pt_br'=>'pt-br');
+// fix non-standard lang names
+if (array_key_exists($lang, $langmapping)) {
+ $lang = $langmapping[$lang];
+}
+
+if (!file_exists("$CFG->dirroot/lib/dragmath/applet/lang/$lang.xml")) {
+ $lang = 'en';
+}
+
+@header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
-<title>"DragMath Equation Editor</title>
+<title><?php print_string('dragmath:dragmath_title', 'editor_tinymce')?></title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/dragmath.js"></script>
</head>
archive="Project.jar,lib/AbsoluteLayout.jar,lib/swing-layout-1.0.jar,lib/jdom.jar,lib/jep.jar"
width="540" height="300"
>
- <param name="language" value="en" />
+ <param name="language" value="<?php echo $lang; ?>" />
<param name="outputFormat" value="Latex" />
<param name="showOutputToolBar" value="false" />
- To use this page you need a Java-enabled browser.
- Download the latest Java plug-in from
- <a href="http://www.java.com">Java.com</a>
+ <?php print_string('dragmath:dragmath_javaneeded', 'editor_tinymce', '<a href="http://www.java.com">Java.com</a>')?>
</applet>
<form name="form" action="">
<div>
- <button type="button" onclick="return DragMathDialog.insert();">Insert</button>
- <button type="button" onclick="return tinyMCEPopup.close();">Cancel</button>
+ <button type="button" onclick="return DragMathDialog.insert();"><?php print_string('common:insert', 'editor_tinymce'); ?></button>
+ <button type="button" onclick="return tinyMCEPopup.close();"><?php print_string('cancel'); ?></button>
</div>
</form>
-(function(){tinymce.create('tinymce.plugins.DragMathPlugin',{init:function(ed,url){course_id=tinyMCE.activeEditor.getParam('moodleimage_course_id');ed.addCommand('mceDragMath',function(){ed.windowManager.open({file:url+'/dragmath.php?id='+course_id,width:540,height:380,inline:1},{plugin_url:url,some_custom_arg:'custom arg'});});ed.addButton('dragmath',{title:'Insert Equation',cmd:'mceDragMath',image:url+'/img/dragmath.gif'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('dragmath',n.nodeName=='IMG');});},createControl:function(n,cm){return null;},getInfo:function(){return{longname:'Moodle Dragmath plugin',author:'Glen Davies',authorurl:'http://www.canterbury.ac.nz',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',version:"1.0"};}});tinymce.PluginManager.add('dragmath',tinymce.plugins.DragMathPlugin);})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.DragMathPlugin",{init:function(a,b){lang=tinyMCE.activeEditor.getParam("language");a.addCommand("mceDragMath",function(){a.windowManager.open({file:b+"/dragmath.php?elanguage="+lang,width:540,height:380,inline:1},{plugin_url:b,some_custom_arg:"custom arg"})});a.addButton("dragmath",{title:"Insert Equation",cmd:"mceDragMath",image:b+"/img/dragmath.gif"});a.onNodeChange.add(function(d,c,e){c.setActive("dragmath",e.nodeName=="IMG")})},createControl:function(b,a){return null},getInfo:function(){return{longname:"Moodle Dragmath plugin",author:"Glen Davies",authorurl:"http://www.canterbury.ac.nz",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example",version:"1.0"}}});tinymce.PluginManager.add("dragmath",tinymce.plugins.DragMathPlugin)})();
\ No newline at end of file
-(function() {\r
- // Load plugin specific language pack\r
- //tinymce.PluginManager.requireLangPack('example');\r
-\r
- tinymce.create('tinymce.plugins.DragMathPlugin', {\r
- /**\r
- * Initializes the plugin, this will be executed after the plugin has been created.\r
- * This call is done before the editor instance has finished it's initialization so use the onInit event\r
- * of the editor instance to intercept that event.\r
- *\r
- * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.\r
- * @param {string} url Absolute URL to where the plugin is located.\r
- */\r
- init : function(ed, url) {\r
- // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');\r
- course_id = tinyMCE.activeEditor.getParam('moodleimage_course_id');\r
- \r
- ed.addCommand('mceDragMath', function() {\r
- ed.windowManager.open({\r
- \r
- file : url + '/dragmath.php?id=' + course_id,\r
- width : 540,\r
- height : 380,\r
- inline : 1\r
- }, {\r
- plugin_url : url, // Plugin absolute URL\r
- some_custom_arg : 'custom arg' // Custom argument\r
- });\r
- });\r
-\r
- // Register example button\r
- ed.addButton('dragmath', {\r
- title : 'Insert Equation',\r
- cmd : 'mceDragMath',\r
- image : url + '/img/dragmath.gif'\r
- });\r
- \r
-\r
- // Add a node change handler, selects the button in the UI when a image is selected\r
- ed.onNodeChange.add(function(ed, cm, n) {\r
- cm.setActive('dragmath', n.nodeName == 'IMG');\r
- });\r
- },\r
-\r
- /**\r
- * Creates control instances based in the incomming name. This method is normally not\r
- * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons\r
- * but you sometimes need to create more complex controls like listboxes, split buttons etc then this\r
- * method can be used to create those.\r
- *\r
- * @param {String} n Name of the control to create.\r
- * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.\r
- * @return {tinymce.ui.Control} New control instance or null if no control was created.\r
- */\r
- createControl : function(n, cm) {\r
- return null;\r
- },\r
-\r
- /**\r
- * Returns information about the plugin as a name/value array.\r
- * The current keys are longname, author, authorurl, infourl and version.\r
- *\r
- * @return {Object} Name/value array containing information about the plugin.\r
- */\r
- getInfo : function() {\r
- return {\r
- longname : 'Moodle Dragmath plugin',\r
- author : 'Glen Davies',\r
- authorurl : 'http://www.canterbury.ac.nz',\r
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',\r
- version : "1.0"\r
- };\r
- }\r
- });\r
-\r
- // Register plugin\r
- tinymce.PluginManager.add('dragmath', tinymce.plugins.DragMathPlugin);\r
+(function() {
+ // Load plugin specific language pack
+ //tinymce.PluginManager.requireLangPack('example');
+
+ tinymce.create('tinymce.plugins.DragMathPlugin', {
+ /**
+ * Initializes the plugin, this will be executed after the plugin has been created.
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
+ * of the editor instance to intercept that event.
+ *
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+ * @param {string} url Absolute URL to where the plugin is located.
+ */
+ init : function(ed, url) {
+ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
+ lang = tinyMCE.activeEditor.getParam('language');
+
+ ed.addCommand('mceDragMath', function() {
+ ed.windowManager.open({
+
+ file : url + '/dragmath.php?elanguage=' + lang,
+ width : 540,
+ height : 380,
+ inline : 1
+ }, {
+ plugin_url : url, // Plugin absolute URL
+ some_custom_arg : 'custom arg' // Custom argument
+ });
+ });
+
+ // Register example button
+ ed.addButton('dragmath', {
+ title : 'dragmath.dragmath_desc',
+ cmd : 'mceDragMath',
+ image : url + '/img/dragmath.gif'
+ });
+
+
+ // Add a node change handler, selects the button in the UI when a image is selected
+ ed.onNodeChange.add(function(ed, cm, n) {
+ cm.setActive('dragmath', n.nodeName == 'IMG');
+ });
+ },
+
+ /**
+ * Creates control instances based in the incomming name. This method is normally not
+ * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
+ * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
+ * method can be used to create those.
+ *
+ * @param {String} n Name of the control to create.
+ * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
+ * @return {tinymce.ui.Control} New control instance or null if no control was created.
+ */
+ createControl : function(n, cm) {
+ return null;
+ },
+
+ /**
+ * Returns information about the plugin as a name/value array.
+ * The current keys are longname, author, authorurl, infourl and version.
+ *
+ * @return {Object} Name/value array containing information about the plugin.
+ */
+ getInfo : function() {
+ return {
+ longname : 'Moodle Dragmath plugin',
+ author : 'Glen Davies',
+ authorurl : 'http://www.canterbury.ac.nz',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
+ version : "1.0"
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('dragmath', tinymce.plugins.DragMathPlugin);
})();
\ No newline at end of file