$strdatabasesetup = get_string('databasesetup');
$navigation = build_navigation(array(array('name'=>$strdatabasesetup, 'link'=>null, 'type'=>'misc')));
- print_header($strinstallation.' - Moodle '.$CFG->target_release, $strinstallation, $navigation, '', upgrade_get_javascript(), false, ' ', ' ');
+ upgrade_get_javascript();
+ print_header($strinstallation.' - Moodle '.$CFG->target_release, $strinstallation, $navigation, '', '', false, ' ', ' ');
if (!$DB->setup_is_unicodedb()) {
if (!$DB->change_db_encoding()) {
}
}
- echo upgrade_get_javascript();
-
-
/// return to original debugging level
$DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
if ($meta) {
throw new coding_exception('The $meta parameter to print_header is no longer supported. '.
- 'You should be able to do weverything you want with $PAGE->requires and other such mechanisms.');
+ 'You should be able to do everything you want with $PAGE->requires and other such mechanisms.');
}
if ($usexml) {
throw new coding_exception('The $usexml parameter to print_header is no longer supported.');
if (control) {
control.focus();
}
-}
\ No newline at end of file
+}
+
+function scroll_to_end() {
+ window.scrollTo(0, 5000000);
+}
+
+var scrolltoendtimeout;
+function repeatedly_scroll_to_end() {
+ scrolltoendtimeout = setInterval(scroll_to_end, 50);
+}
+
+function cancel_scroll_to_end() {
+ if (scrolltoendtimeout) {
+ clearTimeout(scrolltoendtimeout);
+ scrolltoendtimeout = null;
+ }
+}
+++ /dev/null
-// keep the global scope clean
-(function() {
-
- function scroll_to_page_end() {
- window.scrollTo(0, 5000000);
- };
-
- // load should be a document event, but most browsers use window
- if (window.addEventListener) {
- window.addEventListener('load', scroll_to_page_end, false);
- } else if (document.addEventListener) {
- document.addEventListener('load', scroll_to_page_end, false);
- } else if (window.attachEvent) {
- window.attachEvent('onload', scroll_to_page_end);
- }
-
-})();
if (!CLI_SCRIPT and !$PAGE->headerprinted) {
$strupgrade = get_string('upgradingversion', 'admin');
+ upgrade_get_javascript();
print_header($strupgrade.' - Moodle '.$CFG->target_release, $strupgrade,
build_navigation(array(array('name' => $strupgrade, 'link' => null, 'type' => 'misc'))), '',
- upgrade_get_javascript(), false, ' ', ' ');
+ '', false, ' ', ' ');
}
ignore_user_abort(true);
* @global object
*/
function upgrade_get_javascript() {
- global $CFG;
- return '<script type="text/javascript" src="'.$CFG->wwwroot.'/lib/scroll_to_page_end.js"></script>';
+ global $PAGE;
+ $PAGE->requires->js('lib/javascript-static.js')->at_top_of_body();
+ $PAGE->requires->js_function_call('repeatedly_scroll_to_end')->at_top_of_body();
+ $PAGE->requires->js_function_call('cancel_scroll_to_end')->after_delay(1);
}