mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
javascript: MDL-19475 replace require_js calls with $PAGE->requires->js.
Also, some related JavaScript cleanup. More to follow.
This commit is contained in:
parent
424362f3b5
commit
c28bf5c9f8
@ -86,12 +86,10 @@ if($csv) {
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => $strreports, 'link' => "../../report.php?id=$course->id", 'type' => 'misc');
|
||||
$navlinks[] = array('name' => $strcompletion, 'link' => null, 'type' => 'misc');
|
||||
if($svgcleverness) {
|
||||
require_js(array('yui_yahoo','yui_event','yui_dom'));
|
||||
}
|
||||
print_header($strcompletion,$course->fullname,build_navigation($navlinks));
|
||||
if($svgcleverness) {
|
||||
require_js('course/report/progress/textrotate.js');
|
||||
$PAGE->requires->yui_lib('event');
|
||||
$PAGE->requires->js('course/report/progress/textrotate.js');
|
||||
}
|
||||
|
||||
// Handle groups (if enabled)
|
||||
|
@ -249,7 +249,7 @@
|
||||
// At the bottom because we want to process sections and activities
|
||||
// after the relevant html has been generated. We're forced to do this
|
||||
// because of the way in which lib/ajax/ajaxcourse.js is written.
|
||||
require_js('lib/ajax/ajaxcourse.js');
|
||||
$PAGE->requires->js('lib/ajax/ajaxcourse.js');
|
||||
|
||||
$COURSE->javascriptportal->print_javascript($course->id);
|
||||
}
|
||||
|
@ -28,8 +28,14 @@ require_once $CFG->dirroot.'/grade/lib.php';
|
||||
require_once $CFG->dirroot.'/grade/report/lib.php'; // for preferences
|
||||
require_once $CFG->dirroot.'/grade/edit/tree/lib.php';
|
||||
|
||||
require_js(array('yui_yahoo', 'yui_dom', 'yui_event', 'yui_json', 'yui_connection', 'yui_dragdrop', 'yui_treeview', 'yui_element', 'yui_container','yui_animation',
|
||||
$CFG->wwwroot.'/grade/edit/tree/functions.js'));
|
||||
$PAGE->requires->yui_lib('event');
|
||||
$PAGE->requires->yui_lib('json');
|
||||
$PAGE->requires->yui_lib('connection');
|
||||
$PAGE->requires->yui_lib('dragdrop');
|
||||
$PAGE->requires->yui_lib('element');
|
||||
$PAGE->requires->yui_lib('container');
|
||||
$PAGE->requires->yui_lib('animation');
|
||||
$PAGE->requires->js('grade/edit/tree/functions.js');
|
||||
|
||||
$courseid = required_param('id', PARAM_INT);
|
||||
$action = optional_param('action', 0, PARAM_ALPHA);
|
||||
|
@ -13,8 +13,8 @@ require_once('lib.php');
|
||||
|
||||
ini_set('include_path', $CFG->libdir.'/pear'.PATH_SEPARATOR.ini_get('include_path'));
|
||||
|
||||
require_js(array('yui_yahoo', 'yui_dom', 'yui_utilities', 'yui_connection'));
|
||||
require_js('group/clientlib.js');
|
||||
$PAGE->requires->yui_lib('connection');
|
||||
$PAGE->requires->js('group/clientlib.js');
|
||||
|
||||
$courseid = required_param('id', PARAM_INT);
|
||||
$groupid = optional_param('group', false, PARAM_INT);
|
||||
@ -24,14 +24,7 @@ $action = groups_param_action();
|
||||
if ($groupid) {
|
||||
$groupids=array($groupid);
|
||||
} else {
|
||||
$groupids=array();
|
||||
if (isset($_REQUEST['groups'])) {
|
||||
foreach ($_REQUEST['groups'] as $groupid) {
|
||||
if ($groupid = clean_param($groupid, PARAM_INT)) {
|
||||
$groupids[]=$groupid;
|
||||
}
|
||||
}
|
||||
}
|
||||
$groupids = optional_param('groups', array(), PARAM_INT);
|
||||
}
|
||||
$singlegroup=count($groupids) == 1;
|
||||
|
||||
@ -259,12 +252,10 @@ echo '</div>'."\n";
|
||||
echo '</form>'."\n";
|
||||
|
||||
if (ajaxenabled()) {
|
||||
echo '<script type="text/javascript">'."\n";
|
||||
echo '//<![CDATA['."\n";
|
||||
echo 'var groupsCombo = new UpdatableGroupsCombo("'.$CFG->wwwroot.'", '.$course->id.');'."\n";
|
||||
echo 'var membersCombo = new UpdatableMembersCombo("'.$CFG->wwwroot.'", '.$course->id.');'."\n";
|
||||
echo '//]]>'."\n";
|
||||
echo '</script>'."\n";
|
||||
$PAGE->requires->js_function_call('var groupsCombo = new UpdatableGroupsCombo',
|
||||
array($CFG->httpswwwroot, $course->id));
|
||||
$PAGE->requires->js_function_call('var membersCombo = new UpdatableMembersCombo',
|
||||
array($CFG->httpswwwroot, $course->id));
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
|
@ -154,7 +154,6 @@ function mce_saveOnSubmit(id) {
|
||||
|
||||
function mce_moodlefilemanager(field_name, url, type, win) {
|
||||
var client_id = id2clientid[tinyMCE.selectedInstance.editorId];
|
||||
document.body.className += ' yui-skin-sam';
|
||||
var picker = document.createElement('DIV');
|
||||
picker.className = "file-picker";
|
||||
picker.id = 'file-picker-'+client_id;
|
||||
|
@ -206,7 +206,6 @@ function fp_callback(obj) {
|
||||
list.innerHTML += html;
|
||||
}
|
||||
function callpicker(el_id, client_id, itemid) {
|
||||
document.body.className += ' yui-skin-sam';
|
||||
var picker = document.createElement('DIV');
|
||||
picker.id = 'file-picker-'+client_id;
|
||||
picker.className = 'file-picker';
|
||||
|
@ -97,7 +97,6 @@ function updatefile(client_id, obj) {
|
||||
document.getElementById('repo_info_'+client_id).innerHTML = obj['file'];
|
||||
}
|
||||
function callpicker(client_id, id) {
|
||||
document.body.className += ' yui-skin-sam';
|
||||
var picker = document.createElement('DIV');
|
||||
picker.id = 'file-picker-'+client_id;
|
||||
picker.className = 'file-picker';
|
||||
|
@ -2111,7 +2111,8 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function renderHeader(&$header) {
|
||||
function renderHeader(&$header) {
|
||||
global $PAGE;
|
||||
$name = $header->getName();
|
||||
|
||||
$id = empty($name) ? '' : ' id="' . $name . '"';
|
||||
@ -2137,7 +2138,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
|
||||
}
|
||||
|
||||
if (isset($this->_advancedElements[$name])){
|
||||
require_js(array('yui_yahoo', 'yui_event'));
|
||||
$PAGE->requires->yui_lib('event');
|
||||
// this is tricky - the first submit button on form is "clicked" if user presses enter
|
||||
// we do not want to "submit" using advanced button if javascript active
|
||||
$button_nojs = '<input name="'.$elementName.'" value="'.$buttonlabel.'" type="submit" />';
|
||||
|
@ -410,7 +410,6 @@ function unmaskPassword(id) {
|
||||
* elements, and add date_selector_calendar instance to each.
|
||||
*/
|
||||
function init_date_selectors(firstdayofweek) {
|
||||
YAHOO.util.Dom.addClass(document.body, 'yui-skin-sam');
|
||||
var els = YAHOO.util.Dom.getElementsByClassName('fdate_time_selector', 'fieldset');
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
new date_selector_calendar(els[i], firstdayofweek);
|
||||
|
@ -1210,10 +1210,10 @@ function get_user_preferences($name=NULL, $default=NULL, $otheruserid=NULL) {
|
||||
* submitted values before set_user_preference is called.
|
||||
*/
|
||||
function user_preference_allow_ajax_update($name, $paramtype) {
|
||||
global $USER;
|
||||
global $USER, $PAGE;
|
||||
|
||||
// Make sure that the required JavaScript libraries are loaded.
|
||||
require_js(array('yui_yahoo', 'yui_connection'));
|
||||
$PAGE->requires->yui_lib('connection');
|
||||
|
||||
// Record in the session that this user_preference is allowed to updated remotely.
|
||||
$USER->ajax_updatable_user_prefs[$name] = $paramtype;
|
||||
|
@ -2126,11 +2126,11 @@ function question_init_qenginejs_script() {
|
||||
* @return string some HTML code that can go inside the head tag.
|
||||
*/
|
||||
function get_html_head_contributions($questionlist, &$questions, &$states) {
|
||||
global $CFG, $QTYPES;
|
||||
global $CFG, $PAGE, $QTYPES;
|
||||
|
||||
// The question engine's own JavaScript.
|
||||
require_js(array('yui_yahoo','yui_event', 'yui_connection'));
|
||||
require_js('question/qengine.js');
|
||||
$PAGE->requires->yui_lib('connection');
|
||||
$PAGE->requires->js('question/qengine.js');
|
||||
|
||||
// An inline script to record various lang strings, etc. that qengine.js needs.
|
||||
$contributions = array(question_init_qenginejs_script());
|
||||
|
@ -31,8 +31,10 @@
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
/// Add ajax-related libs
|
||||
require_js(array('yui_yahoo', 'yui_event', 'yui_dom', 'yui_connection', 'yui_json'));
|
||||
require_js('mod/forum/rate_ajax.js');
|
||||
$PAGE->requires->yui_lib('event');
|
||||
$PAGE->requires->yui_lib('connection');
|
||||
$PAGE->requires->yui_lib('json');
|
||||
$PAGE->requires->js('mod/forum/rate_ajax.js');
|
||||
|
||||
// move this down fix for MDL-6926
|
||||
require_once('lib.php');
|
||||
|
File diff suppressed because one or more lines are too long
@ -45,7 +45,6 @@ var repository_client = (function(){
|
||||
onclick: {fn: repository_client.view_as_list, obj:client_id}};
|
||||
var btn_icons = {label: fp_lang.thumbview, value: 't',
|
||||
onclick: {fn: repository_client.view_as_icons, obj:client_id}};
|
||||
document.body.className += ' yui-skin-sam';
|
||||
var el = document.createElement('DIV');
|
||||
el.id = 'file-picker-'+client_id;
|
||||
el.className = 'file-picker';
|
||||
|
Loading…
x
Reference in New Issue
Block a user