Index: fivestar_color.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/fivestar/Attic/fivestar_color.inc,v retrieving revision 1.1.4.8 diff -u -r1.1.4.8 fivestar_color.inc --- fivestar_color.inc 10 Apr 2009 18:21:03 -0000 1.1.4.8 +++ fivestar_color.inc 1 Jul 2009 01:11:12 -0000 @@ -21,6 +21,11 @@ '#description' => t('A custom color widget must be selected to choose colors. Only the selected widget will be previewed.'), ); + $disabled = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE; + if ($disabled) { + $form['#description'] = t('Custom colors are only supported when the download method is set to public.', array('!url' => url('admin/settings/file-system'))); + } + // Create the list of available schemes. $options = array( '#fff633,#f5d000,#d2e7f9,#027AC6,#cccccc,#dfdfdf' => t('Blue Lagoon (default)'), @@ -49,6 +54,7 @@ '#title' => t('Color display'), '#options' => array('default' => t('Default display'), 'solid' => t('Solid color'), 'gradient' => t('Gradient')), '#default_value' => variable_get('fivestar_color_type', 'solid'), + '#access' => !$disabled, ); // Add scheme selector. @@ -57,6 +63,7 @@ '#title' => t('Color set'), '#options' => $options, '#default_value' => isset($options[$scheme_default]) ? $scheme_default : '', + '#access' => !$disabled, ); // Add palette fields. @@ -70,8 +77,10 @@ 'matte' => t('Matte color'), ); - $form['fivestar_colors']['#tree'] = TRUE; - $form['fivestar_colors']['#theme'] = 'fivestar_color_palette'; + $form['fivestar_colors'] = array( + '#tree' => TRUE, + '#access' => !$disabled, + ); foreach ($names as $key => $name) { $form['fivestar_colors'][$key] = array( '#type' => 'textfield', @@ -81,6 +90,10 @@ ); } + if ($disabled) { + $form['fivestar_color_type']['#value'] = 'default'; + } + return $form; } @@ -88,6 +101,10 @@ * Theme color form. */ function theme_fivestar_color_form($form) { + if ($form['#access'] == FALSE) { + return ''; + } + // Add Farbtastic color picker. drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE); drupal_add_js(drupal_get_path('module', 'fivestar') .'/js/fivestar-color.js');