Index: jquery_ui.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/jquery_ui/jquery_ui.module,v retrieving revision 1.6.2.2 diff -u -p -r1.6.2.2 jquery_ui.module --- jquery_ui.module 21 Jun 2009 03:43:03 -0000 1.6.2.2 +++ jquery_ui.module 19 Jul 2010 18:42:01 -0000 @@ -39,6 +39,10 @@ function jquery_ui_add($files = array()) $jquery_ui_path = JQUERY_UI_PATH . '/ui'; $compression = variable_get('jquery_update_compression_type', 'mini'); + // Select theme to use. + $theme = variable_get('jquery_ui_theme', 'base'); + $theme_path = JQUERY_UI_PATH . '/themes/' . $theme; + // Convert file to an array if it's not one already, to compensate for // lazy developers. ;) if (!is_array($files)) { @@ -49,6 +53,15 @@ function jquery_ui_add($files = array()) if (!isset($ui_core)) { $ui_core = TRUE; jquery_ui_add(array('ui.core')); + + // Add minimal CSS when using base theme, otherwise add full themeroller + // style. + if ($theme == 'base') { + drupal_add_css($theme_path . '/ui.theme.css'); + } + else { + drupal_add_css($theme_path . '/ui.all.css'); + } } // Loop through list of files to include and add them to the page. @@ -77,6 +90,11 @@ function jquery_ui_add($files = array()) } $js_path = $jquery_ui_path . '/' . $file_path; drupal_add_js($js_path); + + // Add modular CSS files when using base theme. + if ($theme == 'base') { + drupal_add_css($theme_path . '/' . $file . '.css'); + } $loaded_files[$file] = $js_path; } } @@ -95,3 +113,38 @@ 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; +} + +/** + * Menu callback to display settings form. + */ +function jquery_ui_settings() { + $theme_path = JQUERY_UI_PATH . '/themes'; + $options = array('base' => '<' . t('default') . '>'); + + $files = file_scan_directory($theme_path, '.*', array('.', '..', 'CVS', 'base'), 0, FALSE, 'basename'); + foreach ($files as $name => $file) { + $options[$name] = $name; + } + + $form['jquery_ui_theme'] = array( + '#type' => 'radios', + '#title' => t('Select jQuery UI theme'), + '#default_value' => variable_get('jquery_ui_theme', 'base'), + '#options' => $options, + ); + + return system_settings_form($form); +}