Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / javascript.php
blob16de59881bee2cacda49c148ff3dc6a37063ec0d
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.js"></script>
24 <script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/cookies.js"></script>
25 <script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/ufo.js"></script>
27 <script type="text/javascript" defer="defer">
29 //<![CDATA[
31 setTimeout('fix_column_widths()', 20);
33 function openpopup(url,name,options,fullscreen) {
34 fullurl = "<?php echo $CFG->httpswwwroot ?>" + url;
35 windowobj = window.open(fullurl,name,options);
36 if (fullscreen) {
37 windowobj.moveTo(0,0);
38 windowobj.resizeTo(screen.availWidth,screen.availHeight);
40 windowobj.focus();
41 return false;
44 function uncheckall() {
45 void(d=document);
46 void(el=d.getElementsByTagName('INPUT'));
47 for(i=0;i<el.length;i++) {
48 void(el[i].checked=0);
52 function checkall() {
53 void(d=document);
54 void(el=d.getElementsByTagName('INPUT'));
55 for(i=0;i<el.length;i++) {
56 void(el[i].checked=1);
60 function inserttext(text) {
61 <?php
62 if (!empty($SESSION->inserttextform)) {
63 $insertfield = "opener.document.forms['$SESSION->inserttextform'].$SESSION->inserttextfield";
64 } else {
65 $insertfield = "opener.document.forms['theform'].message";
67 echo " text = ' ' + text + ' ';\n";
68 echo " if ( $insertfield.createTextRange && $insertfield.caretPos) {\n";
69 echo " var caretPos = $insertfield.caretPos;\n";
70 echo " caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;\n";
71 echo " } else {\n";
72 echo " $insertfield.value += text;\n";
73 echo " }\n";
74 echo " $insertfield.focus();\n";
77 <?php if (!empty($focus)) {
78 if(($pos = strpos($focus, '.')) !== false) {
79 //old style focus using form name - no allowed inXHTML Strict
80 $topelement = substr($focus, 0, $pos);
81 echo "addonload(function() { if(document.$topelement) document.$focus.focus(); });\n";
82 } else {
83 //focus element with given id
84 echo "addonload(function() { if(el = document.getElementById('$focus')) el.focus(); });\n";
86 $focus=false; // Prevent themes from adding it to body tag which breaks addonload(), MDL-10249
87 } ?>
89 //]]>
90 </script>