Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.827
diff -u -r1.827 system.module
--- modules/system/system.module	27 Oct 2009 04:16:39 -0000	1.827
+++ modules/system/system.module	27 Oct 2009 16:54:58 -0000
@@ -1153,6 +1153,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.18
diff -u -r1.18 php.test
--- modules/php/php.test	11 Oct 2009 03:07:19 -0000	1.18
+++ modules/php/php.test	27 Oct 2009 16:54:58 -0000
@@ -60,7 +60,7 @@
 
     // Make sure that the PHP code shows up as text.
     $this->drupalGet('node/' . $node->nid);
-    $this->assertText('print', t('PHP code is displayed.'));
+    $this->assertText('print "SimpleTest PHP was executed!"', t('PHP code is displayed.'));
 
     // Change filter to PHP filter and see that PHP code is evaluated.
     $edit = array();
@@ -70,7 +70,7 @@
     $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), t('PHP code filter turned on.'));
 
     // Make sure that the PHP code shows up as text.
-    $this->assertNoText('print', 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.'));
   }
 }
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1030
diff -u -r1.1030 common.inc
--- includes/common.inc	24 Oct 2009 05:13:43 -0000	1.1030
+++ includes/common.inc	27 Oct 2009 16:54:58 -0000
@@ -3734,6 +3734,7 @@
     'library' => array(),
     'js' => array(),
     'css' => array(),
+    'ui' => array(),
   );
 
   // Add the libraries first.
@@ -3749,6 +3750,12 @@
   }
   unset($elements['#attached']['library']);
 
+  // Add any bound jQuery UI elements.
+  foreach ($elements['#attached']['ui'] as $ui) {
+    drupal_add_ui($ui);
+  }
+  unset($elements['#attached']['ui']);
+
   // Add both the JavaScript and the CSS.
   // The parameters for drupal_add_js() and drupal_add_css() require special
   // handling.
@@ -3882,6 +3889,75 @@
 }
 
 /**
+ * Adds a jQuery UI element to the page, and invokes its behaviors.
+ *
+ * @param $options
+ *   An associative array with the following keys defining the jQuery UI being
+ *   added:
+ *   - module
+ *       The name of the module that originally registered the desired library.
+ *       Defaults to "system".
+ *   - library
+ *       The name of the library to add. Some examples are "ui.dialog",
+ *       "effects.resizable", "ui.accordion", etc.
+ *   - selector
+ *       The jQuery selector for the element to apply the tool to.
+ *   - options
+ *       (optional) The options that are passed to the element during execution.
+ *   - 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.
+ * @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',
+    'selector' => NULL,
+    'options' => array(),
+    'event' => 'ready',
+    'bound_element' => NULL,
+  );
+
+  // Prepare the jQuery UI Drupal behaviors.
+  $elements = &drupal_static(__FUNCTION__, array());
+  if (empty($elements)) {
+    drupal_add_js('misc/ui.js');
+  }
+
+  // Retrieve the desired base (ui or effects) and tool (dialog, draggable, etc).
+  $library = $options['library'];
+  list($base, $tool) = explode('.', $library, 2);
+  // Add the jQuery UI tool if it hasn't been added yet.
+  if (!isset($elements[$library])) {
+    $elements[$library] = array();
+    drupal_add_library($options['module'], $library);
+  }
+  // Add the settings so that the behaviors are attached to the elements.
+  $selector = $options['selector'];
+  $event = $options['event'];
+  if (isset($selector) && !isset($elements[$library][$selector][$event])) {
+    $elements[$library][$selector][$event] = $options;
+    drupal_add_js(array('ui' => array(
+      $tool => array(
+        $selector => array(
+          $event => array(
+            'options' => $options['options'],
+            'item' => $options['bound_element'],
+          ),
+        ),
+      ),
+    )), 'setting');
+  }
+  return $elements;
+}
+
+/**
  * Retrieves information for a JavaScript/CSS library.
  *
  * Library information is statically cached. Libraries are keyed by module for
Index: modules/filter/filter.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v
retrieving revision 1.49
diff -u -r1.49 filter.admin.inc
--- modules/filter/filter.admin.inc	13 Oct 2009 15:39:41 -0000	1.49
+++ modules/filter/filter.admin.inc	27 Oct 2009 16:54:58 -0000
@@ -160,7 +160,27 @@
       $tiplist = '<p>' . t('No guidelines available.') . '</p>';
     }
     else {
-      $tiplist .= theme('filter_tips_more_info');
+      $tiplist .= '<p>' . l(t('More information about text formats'), 'filter/tips', array('attributes' => array('class' => array('filter-tips-modal')))) . '</p>';
+
+      // Create a dialog box for the filter tips.
+      $tiplist .= '<div id="filter-tips-modal-dialog" class="ui-helper-hidden" title="' . t('Filter tips') . '">' . filter_tips_long() . '</div>';
+      drupal_add_ui(array(
+        'library' => 'ui.dialog',
+        'selector' => '#filter-tips-modal-dialog',
+        'options' => array(
+          'width' => 600,
+          'height' => 500,
+          'dialogClass' => 'filter-tips',
+          'autoOpen' => FALSE,
+        ),
+      ));
+      drupal_add_ui(array(
+        'library' => 'ui.dialog',
+        'selector' => '#filter-tips-modal-dialog',
+        'options' => 'open',
+        'event' => 'click',
+        'bound_element' => '.filter-tips-modal',
+      ));
     }
     $group = '<p>' . t('These are the guidelines that users will see for posting in this text format. They are automatically generated from the filter settings.') . '</p>';
     $group .= $tiplist;
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.300
diff -u -r1.300 filter.module
--- modules/filter/filter.module	23 Oct 2009 22:24:14 -0000	1.300
+++ modules/filter/filter.module	27 Oct 2009 16:54:58 -0000
@@ -49,9 +49,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),
     ),
@@ -674,10 +671,38 @@
   );
   $form['format_help'] = array(
     '#prefix' => '<div id="' . $element_id . '-help" class="filter-help">',
-    '#markup' => theme('filter_tips_more_info'),
     '#suffix' => '</div>',
     '#weight' => 1,
   );
+  // Present the more information about text formats link.
+  $form['format_help']['more'] = array(
+    '#markup' => l(t('More information about text formats'), 'filter/tips', array('attributes' => array('class' => array('filter-tips-modal')))),
+  );
+  $form['format_help']['long'] = array(
+    '#prefix' => '<div id="filter-tips-modal-dialog" class="ui-helper-hidden" title="' . t('Filter tips') . '">',
+    '#markup' => filter_tips_long(),
+    '#suffix' => '</div>',
+  );
+
+  // Create a dialog box for the filter tips.
+  $form['#attached']['ui'][] = array(
+    'library' => 'ui.dialog',
+    'selector' => '#filter-tips-modal-dialog',
+    'options' => array(
+      'width' => 600,
+      'height' => 500,
+      'dialogClass' => 'filter-tips',
+      'autoOpen' => FALSE,
+    ),
+  );
+  // When the user clicks on the more information link, present the dialog box.
+  $form['#attached']['ui'][] = array(
+    'library' => 'ui.dialog',
+    'selector' => '#filter-tips-modal-dialog',
+    'options' => 'open',
+    'event' => 'click',
+    'bound_element' => '.filter-tips-modal'
+  );
 
   return $form;
 }
@@ -786,15 +811,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/filter/filter.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.pages.inc,v
retrieving revision 1.9
diff -u -r1.9 filter.pages.inc
--- modules/filter/filter.pages.inc	13 Oct 2009 15:39:41 -0000	1.9
+++ modules/filter/filter.pages.inc	27 Oct 2009 16:54:58 -0000
@@ -11,17 +11,9 @@
  * Menu callback; show a page with long filter tips.
  */
 function filter_tips_long() {
-  $format_id = arg(2);
-  if ($format_id) {
-    $output = theme('filter_tips', array('tips' => _filter_tips($format_id, TRUE), 'long' => TRUE));
-  }
-  else {
-    $output = theme('filter_tips', array('tips' => _filter_tips(-1, TRUE), 'long' => TRUE));
-  }
-  return $output;
+  return theme('filter_tips', array('tips' => _filter_tips(-1, TRUE), 'long' => TRUE));
 }
 
-
 /**
  * Render HTML for a set of filter tips.
  *
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,45 @@
+// $Id$
+(function ($) {
+
+/**
+ * @file
+ * Provides the jQuery UI Drupal behaviors.
+ */
+
+/**
+ * The jQuery UI Drupal behavior.
+ *
+ * This will go through all widgets and apply them to the given selectors with
+ * the appropriate arguments. It also takes binded events into consideration.
+ */
+Drupal.behaviors.ui = {
+  attach: function(context, settings) {
+    if (settings.ui || false) {
+      // Iterate through each widget and apply the tool to the elements.
+      jQuery.each(settings.ui, function(tool, selectors) {
+        // Iterate through each selector to bind the events.
+        jQuery.each(selectors, function(selector, events) {
+          // Iterate through each event to bind the elements to their properties.
+          jQuery.each(events, function(event, options) {
+            // See if we are to bind the tool to an event, or just apply it when
+            // the element itself is ready.
+            if (event == 'ready') {
+              // Apply the jQuery UI's effect.
+              $(selector, context).once('ui-' + tool + '-ready')[tool](options.options);
+            }
+            else {
+              // Apply the jQuery UI's effect on a binded event.
+              $(options.item, context).once('ui-' + tool + '-' + event).bind(event, function(e) {
+                $(selector, context)[tool](options.options);
+                // Remove the default effect as we're using jQuery UI now.
+                return false;
+              });
+            }
+          });
+        });
+      });
+    }
+  }
+};
+
+})(jQuery);
