? .DS_Store
? jquery.ui
? jquery_ui-choose-theme-266692-6.patch
? jquery_ui-choose-theme-266692-8.patch
Index: jquery_ui.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/jquery_ui/jquery_ui.module,v
retrieving revision 1.3
diff -u -p -r1.3 jquery_ui.module
--- jquery_ui.module	15 Jun 2008 05:15:11 -0000	1.3
+++ jquery_ui.module	15 Jun 2008 07:45:12 -0000
@@ -101,6 +101,54 @@ function jquery_ui_admin_settings() {
 }
 
 /**
+ * Implementation of hook_form_form_id_alter().
+ */
+function jquery_ui_form_system_theme_settings_alter(&$form, $form_state) {
+  // Determine which Drupal theme's settings page we're looking at.
+  $key = $form['var']['#value'];
+  $themes = jquery_ui_get_themes();
+  $settings = variable_get($key, array());
+  $default_theme = isset($settings['jquery_ui_theme']) ? $settings['jquery_ui_theme'] : 'flora';
+
+  $form['jquery_ui'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('jQuery UI'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#weight' => -10,
+  );
+  $form['jquery_ui']['jquery_ui_theme'] = array(
+    '#type' => 'select',
+    '#title' => t('jQuery UI theme'),
+    '#options' => $themes,
+    '#default_value' => $default_theme,
+    '#description' => t('The theme used by jQuery UI for its widgets.'),
+  );
+}
+
+/**
+ * Retrieve list of themes that can be selected.
+ */
+function jquery_ui_get_themes() {
+  $themes_path = JQUERY_UI_PATH . '/themes';
+  $themes = array();
+
+  // Find all files in the themes folder, without recursing. Loop through and
+  // check for directories with dirname.css files within them.
+  $files = file_scan_directory($themes_path, '.*', array('.', '..', 'CVS'), 0, FALSE);
+  foreach ($files as $file) {
+    if (is_dir($file->filename)) {
+      $css_path = $themes_path . "/$file->basename/$file->basename.css";
+      if (file_exists($css_path)) {
+        $themes[$file->basename] = $file->basename;
+      }
+    }
+  }
+
+  return $themes;
+}
+
+/**
  * Return the version of jQuery UI installed.
  */
 function jquery_ui_get_version() {
