Index: date_popup/date_popup.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/date_popup/date_popup.module,v retrieving revision 1.42.2.1.2.65 diff -u -r1.42.2.1.2.65 date_popup.module --- date_popup/date_popup.module 20 Nov 2010 11:33:30 -0000 1.42.2.1.2.65 +++ date_popup/date_popup.module 10 Mar 2011 23:49:06 -0000 @@ -58,17 +58,23 @@ return $paths; } $version = jquery_ui_get_version(); - $jquery_ui_path = drupal_get_path('module', 'jquery_ui'); - switch ($version) { + list($major, $minor) = explode('.', $version); + $paths = array('' => t('No CSS')); + switch ("$major.$minor") { case '1.6': $paths[drupal_get_path('module', 'date_popup') .'/themes/datepicker.css'] = t('Date Popup default'); - $paths[$jquery_ui_path .'/jquery.ui/themes/default/ui.datepicker.css'] = t('jQuery UI default'); break; default: $paths[drupal_get_path('module', 'date_popup') .'/themes/datepicker.1.7.css'] = t('Date Popup default'); - $paths[$jquery_ui_path .'/jquery.ui/themes/base/ui.datepicker.css'] = t('jQuery UI default'); break; } + $files = file_scan_directory(JQUERY_UI_PATH.'/themes', '.+', array('.', '..', 'CVS'), 0, FALSE); + foreach ($files as $file) { + if (is_dir($file->filename) && file_exists($file->filename.'/ui.datepicker.css')) { + $name = $file->basename == 'base' ? t('jQuery UI Default (base)') : check_plain($file->basename); + $paths[$file->filename.'/ui.datepicker.css'] = $name; + } + } return $paths; } @@ -82,9 +88,17 @@ return; } - drupal_add_css(variable_get('date_popup_css_file', date_popup_css_default())); + $css = variable_get('date_popup_css_file', date_popup_css_default()); - if (variable_get('date_popup_timepicker', 'default') == 'default') { + if ($css) { + drupal_add_css($css); + + // Add theme CSS as well when we're using a jQuery UI theme. + if (stristr($css, 'ui.datepicker.css')) { + drupal_add_css(str_replace('ui.datepicker.css', 'ui.theme.css', $css)); + } + } + if (variable_get('date_popup_timepicker', 'default') == 'default') { drupal_add_css(drupal_get_path('module', 'date_popup') .'/themes/jquery.timeentry.css'); } }