Added hooks to qtype import/export
[moodle-linuxchix.git] / lib / javascript.php
blobbbf26ef6d5f4ba52c12bfddb99279a885c9e4148
1 <?php /// $Id$
2 /// Load up any required Javascript libraries
4 if (!defined('MOODLE_INTERNAL')) {
5 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
8 if (!empty($CFG->aspellpath)) { // Enable global access to spelling feature.
9 echo '<script type="text/javascript" src="'.$CFG->httpswwwroot.'/lib/speller/spellChecker.js"></script>'."\n";
12 if (!empty($CFG->editorsrc) ) {
13 foreach ( $CFG->editorsrc as $scriptsource ) {
14 echo '<script type="text/javascript" src="'. $scriptsource .'"></script>'."\n";
19 <!--<style type="text/css">/*<![CDATA[*/ body{behavior:url(<?php echo $CFG->httpswwwroot ?>/lib/csshover.htc);} /*]]>*/</style>-->
21 <script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/javascript-static.js"></script>
22 <script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/javascript-mod.php"></script>
23 <script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/overlib/overlib.js"></script>
24 <script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/overlib/overlib_cssstyle.js"></script>
25 <script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/cookies.js"></script>
26 <script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/ufo.js"></script>
28 <script type="text/javascript" defer="defer">
30 //<![CDATA[
32 setTimeout('fix_column_widths()', 20);
34 function openpopup(url,name,options,fullscreen) {
35 fullurl = "<?php echo $CFG->httpswwwroot ?>" + url;
36 windowobj = window.open(fullurl,name,options);
37 if (fullscreen) {
38 windowobj.moveTo(0,0);
39 windowobj.resizeTo(screen.availWidth,screen.availHeight);
41 windowobj.focus();
42 return false;
45 function uncheckall() {
46 void(d=document);
47 void(el=d.getElementsByTagName('INPUT'));
48 for(i=0;i<el.length;i++) {
49 void(el[i].checked=0);
53 function checkall() {
54 void(d=document);
55 void(el=d.getElementsByTagName('INPUT'));
56 for(i=0;i<el.length;i++) {
57 void(el[i].checked=1);
61 function inserttext(text) {
62 <?php
63 if (!empty($SESSION->inserttextform)) {
64 $insertfield = "opener.document.forms['$SESSION->inserttextform'].$SESSION->inserttextfield";
65 } else {
66 $insertfield = "opener.document.forms['theform'].message";
68 echo " text = ' ' + text + ' ';\n";
69 echo " if ( $insertfield.createTextRange && $insertfield.caretPos) {\n";
70 echo " var caretPos = $insertfield.caretPos;\n";
71 echo " caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;\n";
72 echo " } else {\n";
73 echo " $insertfield.value += text;\n";
74 echo " }\n";
75 echo " $insertfield.focus();\n";
78 <?php if (!empty($focus)) {
79 if(($pos = strpos($focus, '.')) !== false) {
80 //old style focus using form name - no allowed inXHTML Strict
81 $topelement = substr($focus, 0, $pos);
82 echo "addonload(function() { if(document.$topelement) document.$focus.focus(); });\n";
83 } else {
84 //focus element with given id
85 echo "addonload(function() { if(el = document.getElementById('$focus')) el.focus(); });\n";
87 $focus=false; // Prevent themes from adding it to body tag which breaks addonload(), MDL-10249
88 } ?>
90 //]]>
91 </script>