From: tjhunt Date: Tue, 23 Sep 2008 07:00:59 +0000 (+0000) Subject: MDL-16583 - Clean up some fo the places we link to javascript files, to use require_js X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7264519e3f988fc4b66b067534eee0c9340076b8;p=moodle.git MDL-16583 - Clean up some fo the places we link to javascript files, to use require_js --- diff --git a/admin/xmldb/javascript.php b/admin/xmldb/javascript.php index ac1a8029c6..d7b986faa1 100644 --- a/admin/xmldb/javascript.php +++ b/admin/xmldb/javascript.php @@ -42,14 +42,14 @@ $file = $CFG->dirroot . '/'.$CFG->admin.'/xmldb/actions/' . $action . '/' . $action . '.js'; $wwwfile = $CFG->wwwroot . '/'.$CFG->admin.'/xmldb/actions/' . $action . '/' . $action . '.js'; if (file_exists($file) && is_readable($file)) { - echo '' . "\n"; + require_js($wwwfile); } else { /// Try to load the postaction javascript if exists if ($postaction) { $file = $CFG->dirroot . '/'.$CFG->admin.'/xmldb/actions/' . $postaction . '/' . $postaction . '.js'; $wwwfile = $CFG->wwwroot . '/'.$CFG->admin.'/xmldb/actions/' . $postaction . '/' . $postaction . '.js'; if (file_exists($file) && is_readable($file)) { - echo '' . "\n"; + require_js($wwwfile); } } } diff --git a/calendar/lib.php b/calendar/lib.php index 0381fb5b54..b9ddbb1787 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -1197,8 +1197,8 @@ function calendar_session_vars($course=null) { } function calendar_overlib_html() { - return '' - .''; + require_js(CALENDAR_URL . 'overlib.cfg.php'); + return ''; } function calendar_set_referring_course($courseid) { diff --git a/course/report/progress/index.php b/course/report/progress/index.php index 616247aa57..d1d572763e 100644 --- a/course/report/progress/index.php +++ b/course/report/progress/index.php @@ -86,7 +86,7 @@ if($csv) { } print_header($strcompletion,$course->fullname,build_navigation($navlinks)); if($svgcleverness) { - print ''; + require_js('textrotate.js'); } // Handle groups (if enabled) diff --git a/course/view.php b/course/view.php index 56ad16ca38..ddf087c6aa 100644 --- a/course/view.php +++ b/course/view.php @@ -200,13 +200,14 @@ require_js(array('yui_yahoo','yui_event','yui_connection','yui_dom')); // Need to do this after the header because it requires the YUI stuff // to be loaded already - print ''. - ''; + require_js($CFG->wwwroot . '/course/completion.js'); + print_js_config(array( + 'completion_strsaved' => get_string('saved','completion'), + 'completion_strtitley' => get_string('completion-title-manual-y','completion'), + 'completion_strtitlen' => get_string('completion-title-manual-n','completion'), + 'completion_stralty' => get_string('completion-alt-manual-y','completion'), + 'completion_straltn' => get_string('completion-alt-manual-n','completion'), + )); } // Course wrapper start. @@ -247,8 +248,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. - echo '\n"; + require_js($CFG->wwwroot . '/lib/ajax/ajaxcourse.js'); $COURSE->javascriptportal->print_javascript($course->id); } diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index c2bb6f028c..af96fae079 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -191,9 +191,9 @@ if (!empty($studentsperpage)) { print_paging_bar($numusers, $report->page, $studentsperpage, $report->pbarurl); } -$reporthtml = ''; +require_js('functions.js'); -$reporthtml .= '
' . "\n"; +$reporthtml = '
' . "\n"; $reporthtml .= ''; $reporthtml .= ''; $reporthtml .= $report->get_headerhtml(); diff --git a/tag/coursetagslib.php b/tag/coursetagslib.php index 685e96077f..df7c3dd122 100644 --- a/tag/coursetagslib.php +++ b/tag/coursetagslib.php @@ -289,8 +289,9 @@ EOT; '.$coursetagscript.' '.$inputscript.' //]]> - - '; + '; + + require_js($CFG->wwwroot . '/blocks/tags/coursetags.js'); return $str; }