--- jquery_ui/jquery_ui.module 2009-03-16 19:20:47.000000000 +0530 +++ jquery_ui/jquery_ui_new.module 2009-03-16 19:20:23.000000000 +0530 @@ -25,12 +25,14 @@ 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(),$theme='base',$compression_type=False) { +function jquery_ui_add($files = array(),$theme=False,$compression_type=False) { static $loaded_files, $ui_core, $effects_core; $jquery_ui_path = JQUERY_UI_PATH . '/ui'; $compression = $compression_type ? $compression_type : variable_get('jquery_update_compression_type', 'mini'); - $jquery_ui_css_path = drupal_get_path('module','jquery_ui')."/jquery.ui/themes/$theme/"; + $theme_name = $theme ? $theme : variable_get('jquery_ui_default_theme','base'); + + $jquery_ui_css_path = drupal_get_path('module','jquery_ui')."/jquery.ui/themes/$theme_name/"; if(!is_array($ui_css_core)){ $ui_css_core = TRUE; @@ -93,3 +95,43 @@ function jquery_ui_get_version() { return $version; } + + +/** + * Implementation of hook_menu() + */ +function jquery_ui_menu(){ + $items['admin/settings/jquery_ui'] = array( + 'title' => t('Jquery Ui module settings'), + 'description' => t('Settings about theme'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('jquery_ui_admin'), + 'access arguments' => array('access administration pages'), + 'type' => MENU_NORMAL_ITEM, + ); + return $items; +} + +function jquery_ui_admin(){ + $jquery_ui_css_path = dirname(__FILE__) . "/jquery.ui/themes/"; + $form['jquery_ui_default_theme'] = array( + '#type' => 'radios', + '#title' => t('Default JqueryUi Theme'), + '#default_value' => variable_get('jquery_ui_default_theme','base'), + '#options' => get_directory_names($jquery_ui_css_path), + ); + return system_settings_form($form); +} + + +function get_directory_names($root){ + $dirs = array(); + $d = dir($root); + while($entry=$d->read()) { + if(is_dir("$root/$entry") && (!in_array($entry,array('.','..')))){ + $dirs[$entry]=$entry; + } + } + $d->close(); + return $dirs; +} \ No newline at end of file