Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1023 diff -u -p -r1.1023 common.inc --- includes/common.inc 16 Oct 2009 19:20:33 -0000 1.1023 +++ includes/common.inc 16 Oct 2009 23:14:02 -0000 @@ -3862,6 +3862,58 @@ function drupal_add_library($module, $na } /** + * Adds a jQuery UI element to the page, and invokes its behaviors. + * + * @param $module + * The name of the module that registered the desired library. For most jQuery + * UI elements, this is usually "system". + * @param $library + * The name of the library to add. Some examples are "ui.dialog", + * "effects.resizable", "ui.accordion", etc. + * @param $selector + * (optional) The jQuery selector for the element to apply the tool to. + * @param $options + * (optional) The options that are passed to the element during execution. + * @param $event + * (optional) On what binded event the tool should be applied to the element. + * Defaults to once the element is ready, much like document.ready(). + * @param $binded_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($module, $library, $selector = NULL, $options = array(), $event = 'ready', $binded_element = NULL) { + $elements = &drupal_static(__FUNCTION__, array()); + // Add the jQuery UI Drupal behaviors. + if (empty($elements)) { + drupal_add_js('misc/ui.js'); + } + // Retrieve the desired base (ui or effects) and tool (dialog, draggable, etc). + 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($module, $library); + } + // Add the settings so that the behaviors are attached to the elements. + 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, + 'item' => $binded_element, + ), + ), + ), + )), 'setting'); + } + return $elements; +} + +/** * Retrieves information for a JavaScript/CSS library. * * Library information is statically cached. Libraries are keyed by module for 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 16 Oct 2009 23:14:02 -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); Index: modules/filter/filter.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v retrieving revision 1.49 diff -u -p -r1.49 filter.admin.inc --- modules/filter/filter.admin.inc 13 Oct 2009 15:39:41 -0000 1.49 +++ modules/filter/filter.admin.inc 16 Oct 2009 23:14:02 -0000 @@ -160,7 +160,7 @@ function filter_admin_format_form($form, $tiplist = '

' . t('No guidelines available.') . '

'; } else { - $tiplist .= theme('filter_tips_more_info'); + $tiplist .= '

' . l(t('More information about text formats'), 'filter/tips') . '

'; } $group = '

' . t('These are the guidelines that users will see for posting in this text format. They are automatically generated from the filter settings.') . '

'; $group .= $tiplist; Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.298 diff -u -p -r1.298 filter.module --- modules/filter/filter.module 16 Oct 2009 19:06:23 -0000 1.298 +++ modules/filter/filter.module 16 Oct 2009 23:14:02 -0000 @@ -49,9 +49,6 @@ function filter_theme() { 'arguments' => array('tips' => NULL, 'long' => FALSE), 'file' => 'filter.pages.inc', ), - 'filter_tips_more_info' => array( - 'arguments' => array(), - ), 'filter_guidelines' => array( 'arguments' => array('format' => NULL), ), @@ -670,10 +667,28 @@ function filter_form($selected_format = ); $form['format_help'] = array( '#prefix' => '
', - '#markup' => theme('filter_tips_more_info'), '#suffix' => '
', '#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' => '
', + '#markup' => filter_tips_long(), + '#suffix' => '
', + ); + + // Create a dialog box for the filter tips. + $form['#attached']['drupal_add_ui'][] = array('system', 'ui.dialog', '#filter-tips-modal-dialog', 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']['drupal_add_ui'][] = array('system', 'ui.dialog', '#filter-tips-modal-dialog', 'open', 'click', '.filter-tips-modal'); return $form; } @@ -782,15 +797,6 @@ function filter_dom_serialize($dom_docum } /** - * Format a link to the more extensive filter tips. - * - * @ingroup themeable - */ -function theme_filter_tips_more_info() { - return '

' . l(t('More information about text formats'), 'filter/tips') . '

'; -} - -/** * 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 -p -r1.9 filter.pages.inc --- modules/filter/filter.pages.inc 13 Oct 2009 15:39:41 -0000 1.9 +++ modules/filter/filter.pages.inc 16 Oct 2009 23:14:02 -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: modules/php/php.test =================================================================== RCS file: /cvs/drupal/drupal/modules/php/php.test,v retrieving revision 1.18 diff -u -p -r1.18 php.test --- modules/php/php.test 11 Oct 2009 03:07:19 -0000 1.18 +++ modules/php/php.test 16 Oct 2009 23:14:02 -0000 @@ -60,7 +60,7 @@ class PHPFilterTestCase extends PHPTestC // 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 @@ class PHPFilterTestCase extends PHPTestC $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: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.818 diff -u -p -r1.818 system.module --- modules/system/system.module 16 Oct 2009 19:20:34 -0000 1.818 +++ modules/system/system.module 16 Oct 2009 23:14:02 -0000 @@ -1138,6 +1138,8 @@ function system_library() { ), 'dependencies' => array( array('system', 'ui'), + array('system', 'ui.draggable'), + array('system', 'ui.resizable'), ), ); $libraries['ui.draggable'] = array(