Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1086
diff -u -r1.1086 common.inc
--- includes/common.inc	13 Jan 2010 05:00:24 -0000	1.1086
+++ includes/common.inc	13 Jan 2010 07:22:07 -0000
@@ -3977,8 +3977,8 @@
  * );
  * @endcode
  *
- * 'js', 'css', and 'library' are types that get special handling.  For any
- * other kind of attached data, the array key must be the full name of the
+ * 'js', 'css', 'library' and 'ui' are types that get special handling.  For
+ * any other kind of attached data, the array key must be the full name of the
  * callback function and each value an array of arguments. For example:
  *
  * @code
@@ -4012,6 +4012,7 @@
     'library' => array(),
     'js' => array(),
     'css' => array(),
+    'ui' => array(),
   );
 
   // Add the libraries first.
@@ -4053,6 +4054,12 @@
     unset($elements['#attached'][$type]);
   }
 
+  // Add any jQuery actions.
+  foreach ($elements['#attached']['ui'] as $action) {
+    drupal_add_ui($action);
+  }
+  unset($elements['#attached']['ui']); 
+
   // Add additional types of attachments specified in the render() structure.
   // Libraries, Javascript and CSS have been added already, as they require
   // special handling.
@@ -4209,6 +4216,100 @@
 }
 
 /**
+ * Adds a jQuery call to the page.
+ *
+ * This is used to invoke any jQuery method on elements without having to write
+ * any associated JavaScript. Selected handlers can be bound by events (like
+ * click) or be executed on once the element is ready.
+ *
+ * @param $options
+ *   An associative array with the following keys defining the jQuery action
+ *   being added:
+ *   - selector: The jQuery selector for the element to apply the action to.
+ *   - action: (optional) The name of the jQuery function to be called. This
+ *     allows calling functions like "show", "hide", etc. If not provided,
+ *     will default to the name of the library in use, through "library".
+ *   - arguments: (optional) An array of arguments that are passed to the
+ *     element during execution.
+ *   - library: (optional) The name of the library to add, if desired. Some
+ *     examples are "ui.dialog", "effects.resizable", "ui.accordion", etc.
+ *   - module: (optional) When adding a library, this represents the name of the
+ *     module that originally registered the library. Defaults to "system".
+ *   - event: (optional) On what binded event the tool should be applied to the
+ *     element. Defaults to once the element is ready, much like the effects of
+ *     document.ready().
+ *   - bound_element: (optional) When binding on an event other than ready, will
+ *     be the element that the event is binded to. Defaults to what was passed
+ *     into the "selector" argument.
+ *   - is: (optional) Allows applying the effect only when the given condition
+ *     is met. To read more about "is", visit the jQuery documentation at:
+ *     http://docs.jquery.com/Traversing/is .
+ *   - is_selector: (optional) When acting on a conditioning attribute through
+ *     the "is" parameter, this argument represents a jQuery selector pointing
+ *     to the element that will be checked. Defaults to the "bound_element".
+ *   - return_value: (optional) The value which should be returned after the
+ *     action is taken on the bound element. Defaults to FALSE.
+ *   - actions: (optional) An array of different actions to take on the given
+ *     element. All parameters are inherited from the parent action, but can be
+ *     overriden by the chind action.
+ * @return
+ *   An array representing all elements added to the page so far.
+ */
+function drupal_add_ui(array $options = array()) {
+  // Merge in the defaults.
+  $options += array(
+    'module' => 'system',
+    'event' => 'ready',
+  );
+
+  // Prepare the jQuery UI Drupal behaviors.
+  $elements = &drupal_static(__FUNCTION__);
+  if (!isset($elements)) {
+    $elements = array();
+    drupal_add_js('misc/ui.js');
+  }
+
+  // Allow multiple actions to be invoked on the element.
+  if (isset($options['actions'])) {
+    foreach ($options['actions'] as $action) {
+      // The base elements are inherited from the parent action so that the
+      // items don't have to be defined twice.
+      $action = array_merge($options, $action);
+      // Remove items that should not be inherited, and invoke the action.
+      unset($action['actions']);
+      drupal_add_ui($action);
+    }
+  }
+
+  // Add the depending library, if needed.
+  if (isset($options['library'])) {
+    $library = $options['library'];
+    // Make sure to only add the library once.
+    if (!isset($elements[$library])) {
+      $elements[$library] = array();
+      drupal_add_library($options['module'], $library);
+    }
+
+    // The action defaults to the associated library if not explicitly provided.
+    if (!isset($options['action'])) {
+      // Remove the prefixing "ui." of jQuery UI widgets.
+      $options['action'] = str_replace('ui.', '', $library);
+    }
+  }
+
+  // Add the settings so that the behaviors are attached to the elements.
+  if (isset($options['selector'])) {
+    $action = $options['action'];
+    $elements[$action][] = $options;
+    // Remove items that the JavaScript doesn't need, and add it to the settings.
+    unset($options['module'], $options['library'], $options['actions']);
+    $settings['ui'][$action][] = $options;
+    drupal_add_js($settings, 'setting');
+  }
+  return $elements;
+}
+
+/**
  * Assist in adding the tableDrag JavaScript behavior to a themed table.
  *
  * Draggable tables should be used wherever an outline or list of sortable items
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.314
diff -u -r1.314 filter.module
--- modules/filter/filter.module	28 Dec 2009 21:52:13 -0000	1.314
+++ modules/filter/filter.module	13 Jan 2010 07:22:11 -0000
@@ -54,9 +54,6 @@
       'variables' => array('tips' => NULL, 'long' => FALSE),
       'file' => 'filter.pages.inc',
     ),
-    'filter_tips_more_info' => array(
-      'variables' => array(),
-    ),
     'filter_guidelines' => array(
       'variables' => array('format' => NULL),
     ),
@@ -711,11 +708,44 @@
     '#attributes' => array('class' => array('filter-list')),
   );
   $form['format_help'] = array(
-    '#prefix' => '<div id="' . $element_id . '-help" class="filter-help">',
-    '#markup' => theme('filter_tips_more_info'),
-    '#suffix' => '</div>',
+    '#type' => 'container',
+    '#attributes' => array('class' => array('filter-help')),
     '#weight' => 1,
   );
+  $form['format_help']['link'] = array(
+    '#type' => 'link',
+    '#title' => t('More information about text formats'),
+    '#href' => 'filter/tips',
+    '#options' => array(
+      'attributes' => array('class' => array('filter-tips-help-link')),
+    ),
+  );
+  // Create a dialog box for the filter tips.
+  $form['format_help']['dialog'] = array(
+    '#type' => 'container',
+    '#attributes' => array('class' => array('filter-tips-long-dialog', 'js-show')),
+    '#children' => theme('filter_tips', array('tips' => _filter_tips(-1, TRUE), 'long' => TRUE)),
+  );
+  $form['format_help']['dialog']['#attached']['ui'][] = array(
+    'library' => 'ui.dialog',
+    'selector' => '.filter-tips-long-dialog',
+    'arguments' => array(
+      array(
+        'width' => 600,
+        'height' => 400,
+        'autoOpen' => FALSE,
+        'title' => t('Filter tips'),
+      ),
+    ),
+    'actions' => array(
+      // When the more information link is clicked, open the dialog box.
+      array(
+        'event' => 'click',
+        'bound_element' => '.filter-tips-help-link',
+        'arguments' => array('open'),
+      ),
+    ),
+  );
 
   return $form;
 }
@@ -824,15 +854,6 @@
 }
 
 /**
- * Format a link to the more extensive filter tips.
- *
- * @ingroup themeable
- */
-function theme_filter_tips_more_info() {
-  return '<p>' . l(t('More information about text formats'), 'filter/tips') . '</p>';
-}
-
-/**
  * Format guidelines for a text format.
  *
  * @param $variables
Index: modules/system/system-behavior.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system-behavior.css,v
retrieving revision 1.2
diff -u -r1.2 system-behavior.css
--- modules/system/system-behavior.css	11 Jan 2010 16:47:54 -0000	1.2
+++ modules/system/system-behavior.css	13 Jan 2010 07:22:12 -0000
@@ -284,6 +284,16 @@
 }
 
 /**
+ * Show elements only when JavaScript is enabled.
+ */
+.js-show {
+  display: none;
+}
+html.js .js-show {
+  display: block;
+}
+
+/**
  * Hide elements from all users.
  *
  * Used for elements which should not be immediately displayed to any user. An
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.875
diff -u -r1.875 system.module
--- modules/system/system.module	13 Jan 2010 05:08:29 -0000	1.875
+++ modules/system/system.module	13 Jan 2010 07:22:22 -0000
@@ -1194,6 +1194,8 @@
     ),
     'dependencies' => array(
       array('system', 'ui'),
+      array('system', 'ui.draggable'),
+      array('system', 'ui.resizable'),
     ),
   );
   $libraries['ui.draggable'] = array(
Index: modules/php/php.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.test,v
retrieving revision 1.23
diff -u -r1.23 php.test
--- modules/php/php.test	10 Jan 2010 22:56:51 -0000	1.23
+++ modules/php/php.test	13 Jan 2010 07:22:11 -0000
@@ -82,7 +82,7 @@
     $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.'));
 
     // Make sure that the PHP code shows up as text.
-    $this->assertNoText('print "SimpleTest PHP was executed!"', t("PHP code isn't displayed."));
+    $this->assertNoText('print "SimpleTest PHP was executed!"', t('PHP code isn\'t displayed.'));
     $this->assertText('SimpleTest PHP was executed!', t('PHP code has been evaluated.'));
   }
 }
@@ -110,7 +110,7 @@
 
     // Make sure that the PHP code shows up as text.
     $this->drupalGet('node/' . $node->nid);
-    $this->assertText('print', t('PHP code was not evaluated.'));
+    $this->assertText('print "SimpleTest PHP was executed!"', t('PHP code is displayed.'));
 
     // Make sure that user doesn't have access to filter.
     $this->drupalGet('node/' . $node->nid . '/edit');
Index: misc/ui.js
===================================================================
RCS file: misc/ui.js
diff -N misc/ui.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/ui.js	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,52 @@
+// $Id$
+(function ($) {
+
+/**
+ * @file
+ * Provides the jQuery UI Drupal behavior.
+ */
+
+/**
+ * The jQuery UI Drupal behavior.
+ *
+ * This will go through all desired actions and apply them to the appropriate
+ * elements, taking the function arguments and bound events into
+ * consideration.
+ */
+Drupal.behaviors.ui = {
+  attach: function (context, settings) {
+    // Iterate through each desired jQuery UI effect and apply the tool to
+    // the elements.
+    $.each(settings.ui || {}, function (action, effects) {
+      $.each(effects, function (index, effect) {
+        // See if we are to bind the tool to an event, or just apply it when
+        // the element itself is ready.
+        if (effect.event == 'ready') {
+          // Apply the jQuery UI's effect.
+          $(effect.selector, context).once('action-' + action + '-' + index, function() {
+            // Since we are calling the function with a dynamic set of
+            // arguments, we have to use the JavaScript apply function.
+            $(this)[action].apply($(this), effect.arguments);
+          });
+        }
+        else {
+          // Apply the jQuery UI's effect on the binded event. If a bound
+          // element isn't provided, we will use the original selected item.
+          $(effect.bound_element || effect.selector, context).once('action-' + action + '-' + index).bind(effect.event, function() {
+            // Make sure the "is" argument is satisfied.
+            if (effect.is ? $(effect.is_selector ? effect.is_selector : this).is(effect.is) : true) {
+              // Apply the tool to the element using the arguments array.
+              var element = $(effect.selector);
+              element[action].apply(element, effect.arguments);
+            }
+            // Return the expected value, defaulting to false to override
+            // the default functionality of the action.
+            return effect.return_value || false;
+          });
+        }
+      });
+    });
+  }
+};
+
+})(jQuery);
