Index: modules/color/color.module =================================================================== RCS file: /cvs/drupal/drupal/modules/color/color.module,v retrieving revision 1.3 diff -u -r1.3 color.module --- modules/color/color.module 29 Oct 2006 15:13:01 -0000 1.3 +++ modules/color/color.module 3 Nov 2006 08:25:37 -0000 @@ -66,6 +66,40 @@ } /** + * Menu hook implementation for color module + */ +function color_menu($may_cache) { + if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) { + $items[] = array('path' => 'admin/settings/color', + 'title' => t('Color picker settings'), + 'description' => t('If drupal is using private file system you can set public dir for custom themes.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('color_admin_settings'), + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM); + return $items; + } +} + +/** + * Menu callback for the coor settings form. + */ +function color_admin_settings() { + + $form['color_directory_path'] = array( + '#type' => 'textfield', + '#title' => t('Custom theme directory'), + '#default_value' => variable_get('color_directory_path', ""), + '#size' => 30, + '#maxlength' => 50, + '#description' => t('Where do you want to put custom themes.'), + '#after_build' => array('system_check_directory'), + ); + + return system_settings_form($form); +} + +/** * Helper function to retrieve the color palette for a particular theme. */ function color_get_palette($theme, $default = false) { @@ -210,7 +244,12 @@ // Prepare target locations for generated files $id = $theme .'-'. substr(md5(serialize($palette) . microtime()), 0, 8); - $paths['color'] = variable_get('file_directory_path', 'files') .'/color'; + if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) { + $paths['color'] = variable_get('color_directory_path', 'files') ; + } + else { + $paths['color'] = variable_get('file_directory_path', 'files') .'/color'; + } $paths['target'] = $paths['color'] .'/'. $id .'/'; foreach ($paths as $path) { if (!is_dir($path)) {