]> git.mjollnir.org Git - moodle.git/commitdiff
javascript MDL-16706 Removed inline script call in mod choice and scorm
authorsamhemelryk <samhemelryk>
Tue, 23 Jun 2009 01:18:22 +0000 (01:18 +0000)
committersamhemelryk <samhemelryk>
Tue, 23 Jun 2009 01:18:22 +0000 (01:18 +0000)
lib/javascript-static.js
mod/choice/lib.php
mod/scorm/report.php

index 641ef08dcc2a3a2a058871cba2f57ea75f40615c..bd42ac72b08508da5aed0e57511deeaf28581305 100644 (file)
@@ -1020,3 +1020,13 @@ function close_window_reloading_opener() {
         // Intentionally, only try to close the window if there is some evidence we are in a popup.
     }
 }
+
+/**
+ * Used in a couple of modules to hide navigation areas when using AJAX
+ */
+function hide_item(itemid) {
+    var item = document.getElementById(itemid);
+    if (item) {
+        item.style.display = "none";
+    }
+}
\ No newline at end of file
index 73cf853e8e8a6dac711d4556b9a4464ae2c82654..e1de214bb9b6b89ae3e840f172022cc24d2f2cce 100644 (file)
@@ -399,6 +399,7 @@ function choice_show_reportlink($user, $cm) {
  * @global object
  * @global int
  * @global string
+ * @global object
  * @uses CONTEXT_MODULE
  * @uses CHOICE_PUBLISH_NAMES
  * @uses CHOICE_PUBLISH_ANONYMOUS
@@ -410,7 +411,7 @@ function choice_show_reportlink($user, $cm) {
  * @return void Output is echo'd
  */
 function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish='') {
-    global $CFG, $CHOICE_COLUMN_HEIGHT, $FULLSCRIPT;
+    global $CFG, $CHOICE_COLUMN_HEIGHT, $FULLSCRIPT, $PAGE;
 
     print_heading(get_string("responses", "choice"));
     if (empty($forcepublish)) { //alow the publish setting to be overridden
@@ -548,7 +549,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish
                 echo '<noscript id="noscriptmenuaction" style="display: inline;">';
                 echo '<div>';
                 echo '<input type="submit" value="'.get_string('go').'" /></div></noscript>';
-                echo '<script type="text/javascript">'."\n<!--\n".'document.getElementById("noscriptmenuaction").style.display = "none";'."\n-->\n".'</script>';
+                $PAGE->requires->js_function_call('hide_item', Array('noscriptmenuaction'));
                 echo '</td><td></td></tr>';
             }
 
index 7c5e74fdc3c51cb35291f4ba2e7d6df4c7e2026f..cb5ca372cdf5e1dbca7162d7d4ea721a9dc49729 100755 (executable)
                     echo '<noscript id="noscriptmenuaction" style="display: inline;">';
                     echo '<div>';
                     echo '<input type="submit" value="'.get_string('go').'" /></div></noscript>';
-                    echo '<script type="text/javascript">'."\n<!--\n".'document.getElementById("noscriptmenuaction").style.display = "none";'."\n-->\n".'</script>';
+                    $PAGE->requires->js_function_call('hide_item', Array('noscriptmenuaction'));
                     echo '</form>';
                 } else {
                     print_table($table);