### Eclipse Workspace Patch 1.0
#P drupal-cvs
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.700
diff -u -r1.700 common.inc
--- includes/common.inc	12 Oct 2007 14:10:17 -0000	1.700
+++ includes/common.inc	13 Oct 2007 14:03:10 -0000
@@ -1752,6 +1752,9 @@
  *   'theme' so that files, that are added later, can override previously added
  *   files with ease.
  *
+ * - Add an external file ('external'):
+ *   Adds a reference to an external JavaScript file to the page.
+ *
  * - Add inline JavaScript code ('inline'):
  *   Executes a piece of JavaScript code on the current page by placing the code
  *   directly in the page. This can, for example, be useful to tell the user that
@@ -1765,6 +1768,7 @@
  * @param $data
  *   (optional) If given, the value depends on the $type parameter:
  *   - 'core', 'module' or 'theme': Path to the file relative to base_path().
+ *   - 'external': The absolute URL of a JavaScript resource.
  *   - 'inline': The JavaScript code that should be placed in the given scope.
  *   - 'setting': An array with configuration options as associative array. The
  *       array is directly placed in Drupal.settings. You might want to wrap your
@@ -1772,7 +1776,7 @@
  *       of the Drupal.settings namespace.
  * @param $type
  *   (optional) The type of JavaScript that should be added to the page. Allowed
- *   values are 'core', 'module', 'theme', 'inline' and 'setting'. You
+ *   values are 'core', 'module', 'theme', 'inline', 'external' and 'setting'. You
  *   can, however, specify any value. It is treated as a reference to a JavaScript
  *   file. Defaults to 'module'.
  * @param $scope
@@ -1804,11 +1808,11 @@
         'misc/jquery.js' => array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE),
         'misc/drupal.js' => array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE),
       ),
-      'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array(),
+      'module' => array(), 'theme' => array(), 'external' => array(), 'setting' => array(), 'inline' => array(),
     );
   }
   if (isset($scope) && !isset($javascript[$scope])) {
-    $javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array());
+    $javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'external' => array(), 'setting' => array(), 'inline' => array());
   }
 
   if (isset($type) && isset($scope) && !isset($javascript[$scope][$type])) {
@@ -1877,9 +1881,16 @@
 
   foreach ($javascript as $type => $data) {
 
-    if (!$data) continue;
+    if (!$data) {
+      continue;
+    }
 
     switch ($type) {
+      case 'external':
+        foreach ($data as $path => $info) {
+          $output .= '<script type="text/javascript"'. ($info['defer'] ? ' defer="defer"' : '') .' src="'. check_url($path) . ($info['cache'] ? '' : '?'. time()) ."\"></script>\n";
+        }
+        break;
       case 'setting':
         $output .= '<script type="text/javascript">jQuery.extend(Drupal.settings, '. drupal_to_js(call_user_func_array('array_merge_recursive', $data)) .");</script>\n";
         break;
