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
>
27 <script type
="text/javascript" src
="<?php echo $CFG->httpswwwroot ?>/lib/dropdown.js"></script
>
29 <script type
="text/javascript" defer
="defer">
31 setTimeout('fix_column_widths()', 20);
34 <script type
="text/javascript">
36 function openpopup(url
, name
, options
, fullscreen
) {
37 var fullurl
= "<?php echo $CFG->httpswwwroot ?>" + url
;
39 //code to add session id to url params if necessary for cookieless sessions
40 if (!empty($CFG->usesid
) && !isset($_COOKIE[session_name()])){
41 $sessionparams = session_name() .'='. session_id();
43 if (-1 == fullurl.indexOf('?')){
44 fullurl = fullurl+'?$sessionparams';
46 fullurl = fullurl+'&$sessionparams';
51 var windowobj
= window
.open(fullurl
, name
, options
);
56 windowobj
.moveTo(0, 0);
57 windowobj
.resizeTo(screen
.availWidth
, screen
.availHeight
);
63 function uncheckall() {
64 var inputs
= document
.getElementsByTagName('input');
65 for(var i
= 0; i
< inputs
.length
; i++
) {
66 inputs
[i
].checked
= false;
71 var inputs
= document
.getElementsByTagName('input');
72 for(var i
= 0; i
< inputs
.length
; i++
) {
73 inputs
[i
].checked
= true;
77 function inserttext(text
) {
79 if (!empty($SESSION->inserttextform
)) {
80 $insertfield = "opener.document.forms['$SESSION->inserttextform'].$SESSION->inserttextfield";
82 $insertfield = "opener.document.forms['theform'].message";
84 echo " text = ' ' + text + ' ';\n";
85 echo " if ( $insertfield.createTextRange && $insertfield.caretPos) {\n";
86 echo " var caretPos = $insertfield.caretPos;\n";
87 echo " caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;\n";
89 echo " $insertfield.value += text;\n";
91 echo " $insertfield.focus();\n";
94 <?php
if (!empty($focus)) {
95 if(($pos = strpos($focus, '.')) !== false) {
96 //old style focus using form name - no allowed inXHTML Strict
97 $topelement = substr($focus, 0, $pos);
98 echo "addonload(function() { if(document.$topelement) document.$focus.focus(); });\n";
100 //focus element with given id
101 echo "addonload(function() { if(el = document.getElementById('$focus')) el.focus(); });\n";
103 $focus=false; // Prevent themes from adding it to body tag which breaks addonload(), MDL-10249
106 function getElementsByClassName(oElm
, strTagName
, oClassNames
){
107 var arrElements
= (strTagName
== "*" && oElm
.all
)? oElm
.all
: oElm
.getElementsByTagName(strTagName
);
108 var arrReturnElements
= new Array();
109 var arrRegExpClassNames
= new Array();
110 if(typeof oClassNames
== "object"){
111 for(var i
=0; i
<oClassNames
.length
; i++
){
112 arrRegExpClassNames
.push(new RegExp("(^|\\s)" + oClassNames
[i
].replace(/\
-/g
, "\\-") +
"(\\s|$)"));
116 arrRegExpClassNames
.push(new RegExp("(^|\\s)" + oClassNames
.replace(/\
-/g
, "\\-") +
"(\\s|$)"));
120 for(var j
=0; j
<arrElements
.length
; j++
){
121 oElement
= arrElements
[j
];
123 for(var k
=0; k
<arrRegExpClassNames
.length
; k++
){
124 if(!arrRegExpClassNames
[k
].test(oElement
.className
)){
130 arrReturnElements
.push(oElement
);
133 return (arrReturnElements
)