8fae2ca861fbdb0f3e4241e62e75a23a4d82cf06
[moodle.git] / lib / editor / tinymce / plugins / dragmath / dragmath.php
1 <?php
3 define('NO_MOODLE_COOKIES', true);
5 require("../../../../../config.php");
7 $lang = required_param('elanguage', PARAM_SAFEDIR);
9 if (file_exists("$CFG->dataroot/lang/$lang") or file_exists("$CFG->dirroot/lang/$lang")) {
10     $SESSION->lang = $lang;
11 } else if (file_exists("$CFG->dataroot/lang/{$lang}") or file_exists("$CFG->dirroot/lang/{$lang}")) {
12     $SESSION->lang = $lang;
13 }
15 $langmapping = array('cs'=>'cz', 'pt_br'=>'pt-br');
17 // fix non-standard lang names
18 if (array_key_exists($lang, $langmapping)) {
19     $lang = $langmapping[$lang];
20 }
22 if (!file_exists("$CFG->dirroot/lib/dragmath/applet/lang/$lang.xml")) {
23     $lang = 'en';
24 }
26 @header('Content-Type: text/html; charset=utf-8');
27 ?>
28 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
29     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
30 <html>
31 <head>
32 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
33 <title><?php print_string('dragmath:dragmath_title', 'editor_tinymce')?></title>
34 <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
35 <script type="text/javascript" src="js/dragmath.js"></script>
36 </head>
37 <body>
39 <applet 
40         name="dragmath" 
41         codebase="<?php echo $CFG->httpswwwroot.'/lib/dragmath/applet' ?>" 
42         code="Display/MainApplet.class" 
43         archive="DragMath.jar,lib/AbsoluteLayout.jar,lib/swing-layout-1.0.jar,lib/jdom.jar,lib/jep.jar" 
44         width="540" height="300"
45 >
46         <param name="language" value="<?php echo $lang; ?>" />
47         <param name="outputFormat" value="MoodleTex" />
48     <?php print_string('dragmath:dragmath_javaneeded', 'editor_tinymce', '<a href="http://www.java.com">Java.com</a>')?>
49 </applet>
50 <form name="form" action="">
51         <div>
52         <button type="button" onclick="return DragMathDialog.insert();"><?php print_string('common:insert', 'editor_tinymce'); ?></button>
53         <button type="button" onclick="return tinyMCEPopup.close();"><?php print_string('cancel'); ?></button>
54         </div>
55 </form>
57 </body>
58 </html>