Commit b539c0ce authored by RobLoach's avatar RobLoach
Browse files

#315100: Attempt to use the centralized plugin repository.

parent 04d7193d
......@@ -4,6 +4,10 @@ jQuery UI x.x-x.x, xxxx-xx-xx
jQuery UI 7.x-1.x, xxxx-xx-xx
jQuery UI 6.x-1.x, xxxx-xx-xx
#362509 by Rob Loach, Deciphered, sun and adrinux: New release system with jQuery UI 1.6.
......@@ -29,37 +29,19 @@ on its own.
1. Copy the jquery_ui module directory to your sites/all/modules directory.
1. Apply the patch from .
2. Download the latest jQuery 1.6 development package from:
2. Copy the jquery_ui module directory to your sites/all/modules directory.
3. Extract it as a sub-directory called 'jquery.ui' in the jquery_ui folder:
4. Enable the module at Administer >> Site building >> Modules.
The jQuery UI module uses jQuery UI 1.6 because jQuery UI 1.7 requires at least
jQuery 1.3, which is not shipped with Drupal 6. If you absolutely need to move
to jQuery UI 1.7, you can get around this by doing the following:
1. Install the jQuery Update module appropriately from:
2. Download the latest jQuery UI 1.7 development package from:
3. Download the latest jQuery 1.7 development package from:
3. Replace the old jQuery UI folder with the 1.7 package at:
4. Extract it as a sub-directory called 'jquery-ui' in the jquery_ui folder:
5. Enable the module at Administer >> Site building >> Modules.
......@@ -77,16 +59,9 @@ the following changes:
2. In your module, call the following function:
For example:
jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable'));
jquery_ui_add('ui.sortable'); // For a single file
See the contents of the jquery.ui-X.X sub-directory for a list of available
files that may be included, and see for details on
how to use them. The required ui.core file is automatically included, as is
effects.core if you include any effects files.
; $Id$
name = jQuery UI
description = Provides the jQuery UI plug-in to other Drupal modules.
package = User interface
core = 6.x
core = 7.x
files[] = jquery_ui.module
// $Id$
* @file
* Installation file for jQuery UI module.
* Implementation of hook_requirements().
function jquery_ui_requirements($phase) {
$requirements = array();
$t = get_t();
$jquery_ui_version = 0;
if ($phase == 'install') {
// The jquery_ui_get_version() function is in the .module file, which isn't
// loaded yet.
include_once drupal_get_path('module', 'jquery_ui') . '/jquery_ui.module';
$requirements['jquery_ui']['title'] = $t('jQuery UI');
if ($jquery_ui_version = jquery_ui_get_version()) {
// Everything looks good; display the current jQuery UI version.
$requirements['jquery_ui']['value'] = $jquery_ui_version;
$requirements['jquery_ui']['severity'] = REQUIREMENT_OK;
else {
// Required library wasn't found. Abort installation.
$requirements['jquery_ui']['value'] = $t('Not found');
// Provide a download link to the jQuery UI development bundle. The provided
// link will list the latest 1.6.x build.
$requirements['jquery_ui']['description'] = $t('The <a href="@jqueryui">jQuery UI</a> plugin is missing. <a href="@download">Download</a> and extract it to your <em>jquery_ui</em> module directory. See <a href="@readme">README.txt</a> for more info.', array('@jqueryui' => '', '@download' => '', '@readme' => url(drupal_get_path('module', 'jquery_ui') .'/README.txt')));
$requirements['jquery_ui']['severity'] = REQUIREMENT_ERROR;
return $requirements;
* Implementation of hook_uninstall().
function jquery_ui_uninstall() {
......@@ -5,81 +5,124 @@
* @file
* Provides the jQuery UI plug-in to other Drupal modules.
* This module doesn't do too much, but it is a central location for any other
* modules that implement the JQuery UI library. It ensures that multiple
* modules will all include the same library script just once on any given page.
* Requires .
* Path to jQuery UI library.
* Implementation of hook_help().
define('JQUERY_UI_PATH', drupal_get_path('module', 'jquery_ui') . '/jquery.ui');
function jquery_ui_help($path, $arg) {
switch ($path) {
case 'admin/help#jquery_ui':
$output = '<p>' . t('jQuery UI provides abstractions for low-level interaction and animation, advanced effects and high-level, themeable widgets, built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.') . '</p>';
$output .= <<<EOT
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
<h3><a href="#">Section 2</a></h3>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
suscipit faucibus urna.
<h3><a href="#">Section 3</a></h3>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
<h3><a href="#">Section 4</a></h3>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
if (!isset($added)) {
drupal_add_js('jQuery(document).ready(function() { jQuery("#accordion").accordion(); });', 'inline');
$added = TRUE;
return $output;
* Add the specified jQuery UI library files to this page.
* The ui.core file is always included automatically, as well as the
* effects.core file if any of the effects libraries are used.
* @param $files
* An array of what additional files (other than UI core) should be loaded
* on the page, or a string with a single file name.
* Implementation of hook_js_plugin().
function jquery_ui_add($files = array()) {
static $loaded_files, $ui_core, $effects_core;
$jquery_ui_path = JQUERY_UI_PATH . '/ui';
$compression = variable_get('jquery_update_compression_type', 'mini');
// Convert file to an array if it's not one already, to compensate for
// lazy developers. ;)
if (!is_array($files)) {
$files = array($files);
// If core hasn't been added yet, add it.
if (!isset($ui_core)) {
$ui_core = TRUE;
// Loop through list of files to include and add them to the page.
foreach ($files as $file) {
// Any effects files require the effects core file.
if (!isset($effects_core) && strpos($file, 'effects.') === 0) {
$effects_core = TRUE;
// Load other files.
if (!isset($loaded_files[$file])) {
switch ($compression) {
case 'none':
$file_path = "$file.js";
case 'pack':
$file_path = "packed/$file.packed.js";
case 'mini':
$file_path = "minified/$file.min.js";
$js_path = $jquery_ui_path . '/' . $file_path;
$loaded_files[$file] = $js_path; // or TRUE...
function jquery_ui_js_plugin() {
$version = jquery_ui_get_version();
$path = drupal_get_path('module', 'jquery_ui').'/jquery-ui';
if (!empty($version)) {
$files = file_scan_directory($path .'/ui', '/.js/', array('recurse' => FALSE));
foreach ($files as $file) {
$plugins[$file->name] = array(
'title' => $file->name,
'project_page' => '',
'version' => $version,
'download' => '',
'js' => array(
'plugin' => array(
$plugins['ui.core'] = array(
'title' => 'jQuery UI',
'project_page' => '',
'version' => $version,
'download' => '',
'js' => array(
// Items that are just strings are interpreted as stright files.
$path . '/ui/ui.core.js' => array('weight' => -100),
'css' => array(
$path . '/themes/base/ui.all.css',
return $plugins;
* Return the version of jQuery UI installed.
* Gets the current jQuery UI version.
function jquery_ui_get_version() {
$version = 0;
if (file_exists(JQUERY_UI_PATH . '/version.txt')) {
$version = file_get_contents(JQUERY_UI_PATH . '/version.txt');
static $version = NULL;
if (!isset($version)) {
$path = drupal_get_path('module', 'jquery_ui') .'/jquery-ui/version.txt';
if (file_exists($path)) {
$version = file_get_contents($path);
return $version;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment