3 ///////////////////////////////////////////////////////////////////////////
5 // NOTICE OF COPYRIGHT //
7 // Moodle - Modular Object-Oriented Dynamic Learning Environment //
8 // http://moodle.com //
10 // Copyright (C) 2001-3001 Martin Dougiamas http://dougiamas.com //
11 // (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
13 // This program is free software; you can redistribute it and/or modify //
14 // it under the terms of the GNU General Public License as published by //
15 // the Free Software Foundation; either version 2 of the License, or //
16 // (at your option) any later version. //
18 // This program is distributed in the hope that it will be useful, //
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21 // GNU General Public License for more details: //
23 // http://www.gnu.org/copyleft/gpl.html //
25 ///////////////////////////////////////////////////////////////////////////
27 /// Load XMLDB required Javascript libraries, adding them
28 /// before the standard one ($standard_javascript)
30 if (!defined('MOODLE_INTERNAL')) {
31 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
34 /// We use this globals to be able to generate the proper JavaScripts
35 global $standard_javascript;
37 /// Load XMLDB javascript needed to handle some forms
38 $action = optional_param('action', '', PARAM_ALPHAEXT
);
39 $postaction = optional_param('postaction', '', PARAM_ALPHAEXT
);
40 /// If the js exists, load it
42 $file = $CFG->dirroot
. '/'.$CFG->admin
.'/xmldb/actions/' . $action . '/' . $action . '.js';
43 $wwwfile = $CFG->wwwroot
. '/'.$CFG->admin
.'/xmldb/actions/' . $action . '/' . $action . '.js';
44 if (file_exists($file) && is_readable($file)) {
45 echo '<script type="text/javascript" src="' . $wwwfile . '"></script>' . "\n";
47 /// Try to load the postaction javascript if exists
49 $file = $CFG->dirroot
. '/'.$CFG->admin
.'/xmldb/actions/' . $postaction . '/' . $postaction . '.js';
50 $wwwfile = $CFG->wwwroot
. '/'.$CFG->admin
.'/xmldb/actions/' . $postaction . '/' . $postaction . '.js';
51 if (file_exists($file) && is_readable($file)) {
52 echo '<script type="text/javascript" src="' . $wwwfile . '"></script>' . "\n";
58 /// Load standard JavaScript
59 include($standard_javascript);