]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16583 - Clean up some fo the places we link to javascript files, to use require_js
authortjhunt <tjhunt>
Tue, 23 Sep 2008 07:00:59 +0000 (07:00 +0000)
committertjhunt <tjhunt>
Tue, 23 Sep 2008 07:00:59 +0000 (07:00 +0000)
admin/xmldb/javascript.php
calendar/lib.php
course/report/progress/index.php
course/view.php
grade/report/grader/index.php
tag/coursetagslib.php

index ac1a8029c69a1538ab7272e1dfe2aff33eb1b6a4..d7b986faa18f6df4ca755a7cac7c8eeb6b583be2 100644 (file)
         $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 '<script type="text/javascript" src="' . $wwwfile . '"></script>' . "\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 '<script type="text/javascript" src="' . $wwwfile . '"></script>' . "\n";
+                    require_js($wwwfile);
                 }
             }
         }
index 0381fb5b5469530eb714e5edb55fa3ac46f3e780..b9ddbb17872d1d4730a874790ea353be30185f09 100644 (file)
@@ -1197,8 +1197,8 @@ function calendar_session_vars($course=null) {
 }
 
 function calendar_overlib_html() {
-    return '<div id="overDiv" style="position: absolute; visibility: hidden; z-index:1000;"></div>'
-          .'<script type="text/javascript" src="'.CALENDAR_URL.'overlib.cfg.php"></script>';
+    require_js(CALENDAR_URL . 'overlib.cfg.php');
+    return '<div id="overDiv" style="position: absolute; visibility: hidden; z-index:1000;"></div>';
 }
 
 function calendar_set_referring_course($courseid) {
index 616247aa5791d589cf7ed1187b9b941f6390d6a4..d1d572763ec36f684f91d7f67c1220b1d38d1b1b 100644 (file)
@@ -86,7 +86,7 @@ if($csv) {
     }
     print_header($strcompletion,$course->fullname,build_navigation($navlinks));
     if($svgcleverness) {
-        print '<script type="text/javascript" src="textrotate.js"></script>';
+        require_js('textrotate.js');
     }
 
     // Handle groups (if enabled)
index 56ad16ca38097f22c2755c8f4e9b76d3c89de57c..ddf087c6aae01cd8bfb39f72fabfa666275db9cc 100644 (file)
         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 '<script type="text/javascript" src="completion.js"></script>'.
-            '<script type="text/javascript">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').
-            '"; </script>';
+        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.
         // 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 '<script type="text/javascript" ';
-        echo "src=\"{$CFG->wwwroot}/lib/ajax/ajaxcourse.js\"></script>\n";
+        require_js($CFG->wwwroot . '/lib/ajax/ajaxcourse.js');
 
         $COURSE->javascriptportal->print_javascript($course->id);
     }
index c2bb6f028c3cb1fe513428567bd8716f504a5681..af96fae079479136cbc4ffa4f9bae62092a56014 100644 (file)
@@ -191,9 +191,9 @@ if (!empty($studentsperpage)) {
     print_paging_bar($numusers, $report->page, $studentsperpage, $report->pbarurl);
 }
 
-$reporthtml = '<script src="functions.js" type="text/javascript"></script>';
+require_js('functions.js');
 
-$reporthtml .= '<div id="grader_report_message"></div>' . "\n";
+$reporthtml = '<div id="grader_report_message"></div>' . "\n";
 $reporthtml .= '<table id="user-grades" class="gradestable flexible boxaligncenter generaltable">';
 $reporthtml .= '<thead>';
 $reporthtml .= $report->get_headerhtml();
index 685e96077fcaf8b5601e7f2479aa644472f76171..df7c3dd122037ffec159f56a2c3e7da79c9f8ef0 100644 (file)
@@ -289,8 +289,9 @@ EOT;
             '.$coursetagscript.'
             '.$inputscript.'
         //]]>
-    </script>
-    <script src="'.$CFG->wwwroot.'/blocks/tags/coursetags.js" type="text/javascript"></script>';
+    </script>';
+
+    require_js($CFG->wwwroot . '/blocks/tags/coursetags.js');
 
     return $str;
 }