Added ability to specify destination category within GIFT file.
[moodle-linuxchix.git] / lib / javascript.php
blob3692b28b9a4d38c5300fb2aa2270c75e71e8170d
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 language="JavaScript" 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 language="javascript" 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 language="JavaScript" type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/javascript-static.js"></script>
22 <script language="JavaScript" type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/javascript-mod.php"></script>
23 <script language="JavaScript" type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/overlib.js"></script>
24 <script language="JavaScript" type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/cookies.js"></script>
26 <script language="JavaScript" type="text/javascript" defer="defer">
28 <!-- // Non-Static Javascript functions
30 setTimeout('fix_column_widths()', 20);
32 function openpopup(url,name,options,fullscreen) {
33 fullurl = "<?php echo $CFG->httpswwwroot ?>" + url;
34 windowobj = window.open(fullurl,name,options);
35 if (fullscreen) {
36 windowobj.moveTo(0,0);
37 windowobj.resizeTo(screen.availWidth,screen.availHeight);
39 windowobj.focus();
40 return false;
43 function uncheckall() {
44 void(d=document);
45 void(el=d.getElementsByTagName('INPUT'));
46 for(i=0;i<el.length;i++)
47 void(el[i].checked=0)
50 function checkall() {
51 void(d=document);
52 void(el=d.getElementsByTagName('INPUT'));
53 for(i=0;i<el.length;i++)
54 void(el[i].checked=1)
57 function inserttext(text) {
58 <?php
59 if (!empty($SESSION->inserttextform)) {
60 $insertfield = "opener.document.forms['$SESSION->inserttextform'].$SESSION->inserttextfield";
61 } else {
62 $insertfield = "opener.document.forms['theform'].message";
64 echo " text = ' ' + text + ' ';\n";
65 echo " if ( $insertfield.createTextRange && $insertfield.caretPos) {\n";
66 echo " var caretPos = $insertfield.caretPos;\n";
67 echo " caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;\n";
68 echo " } else {\n";
69 echo " $insertfield.value += text;\n";
70 echo " }\n";
71 echo " $insertfield.focus();\n";
75 <?php if (!empty($focus)) {
76 if(($pos = strpos($focus, '.')) !== false) {
77 $topelement = substr($focus, 0, $pos);
79 else {
80 $topelement = $focus;
82 echo "function setfocus() { if(document.$topelement) document.$focus.focus(); }\n"; } ?>
84 // done hiding -->
85 </script>