Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.828
diff -u -r1.828 system.module
--- modules/system/system.module	29 Oct 2009 06:58:56 -0000	1.828
+++ modules/system/system.module	3 Nov 2009 18:15:30 -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	3 Nov 2009 18:15:30 -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.1031
diff -u -r1.1031 common.inc
--- includes/common.inc	27 Oct 2009 19:29:12 -0000	1.1031
+++ includes/common.inc	3 Nov 2009 18:15:29 -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,103 @@
 }
 
 /**
+ * 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:
+ *   - 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".
+ *   - functions: (optional) An associative array of functions to declare during
+ *     the execution of this effect. The key is the name of the function, and
+ *     the value is the JavaScript code that will be executed. When processing
+ *     the effect, it will iterate through all "arguments", and replace all the
+ *     found function names with the actual function callback. This allows
+ *     function callbacks to be passed through as arguments.
+ *   - return: (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__, array());
+  if (empty($elements)) {
+    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.
+    unset($options['module'], $options['library'], $options['actions']);
+    // Use the explicit index to avoid conflicts when the settings are merged.
+    $index = count($elements[$action]);
+    $settings['ui'][$action][$index] = $options;
+    drupal_add_js($settings, '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	3 Nov 2009 18:15:29 -0000
@@ -160,7 +160,30 @@
       $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">' . filter_tips_long() . '</div>';
+      $form['format']['#attached']['ui'][] = array(
+        'library' => 'ui.dialog',
+        'selector' => '#filter-tips-modal-dialog',
+        'arguments' => array(
+          array(
+            'width' => 600,
+            'height' => 500,
+            '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-modal',
+            'arguments' => array('open'),
+          ),
+        ),
+      );
     }
     $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	3 Nov 2009 18:15:30 -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,40 @@
   );
   $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">',
+    '#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',
+    'arguments' => array(
+      array(
+        'width' => 600,
+        'height' => 500,
+        '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-modal',
+        'arguments' => array('open'),
+      ),
+    ),
+  );
 
   return $form;
 }
@@ -786,15 +813,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	3 Nov 2009 18:15:30 -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,89 @@
+// $Id$
+(function ($) {
+
+/**
+ * @file
+ * Provides the jQuery UI Drupal behaviors.
+ */
+
+/**
+   * The base UI namespace.
+   */
+Drupal.ui = {
+  // An array of functions that will be dynamically created.
+  functions: [],
+  processFunctions: function(elements) {
+    // Recurse through the items and associate any provided function names
+    // with the correct function callback.
+    jQuery.each(elements, function(index, value) {
+      // Make sure we only check for function names (aka strings).
+      if (typeof(value) == 'string') {
+        // See if the function exists and associate the callback.
+        if (Drupal.ui.functions[value] || false) {
+          elements[index] = Drupal.ui.functions[value];
+        }
+      }
+      else {
+        // Since it's not a string, we should recurse into it.
+        elements[index] = Drupal.ui.processFunctions(value);
+      }
+    });
+    return elements;
+  }
+};
+
+/**
+ * The jQuery UI Drupal behavior.
+ *
+ * This will go through all desired actions and apply them to the appropriate
+ * selectors with the given arguments. It also takes the binded events into
+ * consideration.
+ */
+Drupal.behaviors.ui = {
+  attach: function (context, settings) {
+    if (settings.ui || false) {
+      // Iterate through each desired jQuery UI effect and apply the tool to
+      // the elements.
+      jQuery.each(settings.ui, function(action, effects) {
+        jQuery.each(effects, function(index, effect) {
+          // Process the function declarations.
+          if (effect.functions || false) {
+            jQuery.each(effect.functions, function(name, code) {
+              // Create the function callback, wrapping the code in jQuery.
+              Drupal.ui.functions[name] = new Function(name, '(function ($) {' + code + '})(jQuery);');
+            });
+            effect.arguments = Drupal.ui.processFunctions(effect.arguments);
+          }
+
+          // 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('ui-' + 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('ui-' + 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 || false;
+            });
+          }
+        });
+      });
+    }
+  }
+};
+
+})(jQuery);
