]> git.mjollnir.org Git - moodle.git/commitdiff
themes: MDL-19077 fix install regression
authortjhunt <tjhunt>
Fri, 26 Jun 2009 09:38:14 +0000 (09:38 +0000)
committertjhunt <tjhunt>
Fri, 26 Jun 2009 09:38:14 +0000 (09:38 +0000)
admin/index.php
admin/report/unittest/test_tables.php
lib/deprecatedlib.php
lib/javascript-static.js
lib/scroll_to_page_end.js [deleted file]
lib/upgradelib.php

index e833f1842b3ee56d9a58c05e64966ef6b97591ad..22e60a51d231591b748693e97901a61df42ab960 100644 (file)
@@ -153,7 +153,8 @@ if (!core_tables_exist()) {
 
     $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, '&nbsp;', '&nbsp;');
+    upgrade_get_javascript();
+    print_header($strinstallation.' - Moodle '.$CFG->target_release, $strinstallation, $navigation, '', '', false, '&nbsp;', '&nbsp;');
 
     if (!$DB->setup_is_unicodedb()) {
         if (!$DB->change_db_encoding()) {
index 730a70871b2100cd1afdef6e948ea241368e9328..71c5b32f34e4a0b6dff9a59ceb5561fbe2144787 100644 (file)
@@ -54,9 +54,6 @@ die;die;die;
             }
     }
 
-    echo upgrade_get_javascript();
-
-
 /// return to original debugging level
 
     $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
index 27cef30285a227718fd66519ee73fbb64ce94224..6bb12ca5dc5197cba45b5658d921a8a2c86d01eb 100644 (file)
@@ -2072,7 +2072,7 @@ function print_header($title='', $heading='', $navigation='', $focus='',
 
     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.');
index 27afefac73c6dd0da0bdc0790ffa51534ad95654..e87779d09deee84fbbfb69e0be4783d45ccd8fe7 100644 (file)
@@ -1040,4 +1040,20 @@ function focuscontrol(controlid) {
     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;
+    }
+}
diff --git a/lib/scroll_to_page_end.js b/lib/scroll_to_page_end.js
deleted file mode 100644 (file)
index ebe831c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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);
-    }
-
-})();
index d14477d6dc7599279bfecb7b84d5529cd8320f2a..6cf80286de02b32c382d5d2b915eeba835a09199 100644 (file)
@@ -751,9 +751,10 @@ function upgrade_started($preinstall=false) {
         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, '&nbsp;', '&nbsp;');
+                '', false, '&nbsp;', '&nbsp;');
         }
 
         ignore_user_abort(true);
@@ -895,8 +896,10 @@ function print_upgrade_part_end($plugin, $installation, $verbose) {
  * @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);
 }