--- jquery_ui.module.orig 2008-06-22 21:09:58.000000000 +0100 +++ jquery_ui.module 2009-04-27 18:21:13.000000000 +0100 @@ -25,11 +25,15 @@ define('JQUERY_UI_PATH', drupal_get_path * An array of what additional files (other than UI core) should be loaded * on the page, or a string with a single file name. */ -function jquery_ui_add($files = array()) { +function jquery_ui_add($files = array(), $theme = NULL) { static $loaded_files, $ui_core, $effects_core; $jquery_ui_path = JQUERY_UI_PATH . '/ui'; $compression = variable_get('jquery_update_compression_type', 'mini'); + // Set the theme. + $theme_name = $theme ? $theme : variable_get('jquery_ui_theme', 'flora'); + $theme_path = JQUERY_UI_PATH . '/themes/' . $theme_name; + // Convert file to an array if it's not one already, to compensate for // lazy developers. ;) if (!is_array($files)) { @@ -40,6 +44,7 @@ function jquery_ui_add($files = array()) if (!isset($ui_core)) { $ui_core = TRUE; jquery_ui_add(array('ui.core')); + drupal_add_css($theme_path . '/ui.all.css'); } // Loop through list of files to include and add them to the page. @@ -83,3 +88,36 @@ function jquery_ui_get_version() { return $version; } + +/** + * Implementation of hook_menu() + */ +function jquery_ui_menu() { + $items['admin/settings/jquery_ui'] = array( + 'title' => 'jQuery UI', + 'description' => 'Configure settings for jQuery UI module.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('jquery_ui_settings'), + 'access arguments' => array('administer site configuration'), + ); + return $items; +} + +function jquery_ui_settings() { + $theme_path = JQUERY_UI_PATH . '/themes'; + $files = file_scan_directory($theme_path, '.*', array('.', '..', 'CVS', '.DS_Store'), 0, FALSE, 'basename'); + + $options = array(); + foreach ($files as $name => $file) { + $options[$name] = $name; + } + + $form['jquery_ui_theme'] = array( + '#type' => 'radios', + '#title' => t('Choose jQuery UI theme'), + '#default_value' => variable_get('jquery_ui_theme', 'flora'), + '#options' => $options, + ); + + return system_settings_form($form); +}