/[drupal]/contributions/modules/fivestar/includes/fivestar.color.inc
ViewVC logotype

Diff of /contributions/modules/fivestar/includes/fivestar.color.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Mon May 11 04:25:09 2009 UTC revision 1.2, Wed Jul 1 01:16:09 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: fivestar_color.inc,v 1.3 2009/05/11 03:26:18 quicksketch Exp $  // $Id: fivestar.color.inc,v 1.1 2009/05/11 04:25:09 quicksketch Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 63  function fivestar_color_form() { Line 63  function fivestar_color_form() {
63      '#description' => t('A custom color widget must be selected to choose colors. Only the selected widget will be previewed.'),      '#description' => t('A custom color widget must be selected to choose colors. Only the selected widget will be previewed.'),
64    );    );
65    
66      $disabled = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE;
67      if ($disabled) {
68        $form['#description'] = t('Custom colors are only supported when the <a href="!url">download method</a> is set to public.', array('!url' => url('admin/settings/file-system')));
69      }
70    
71    // Create the list of available schemes.    // Create the list of available schemes.
72    $options = array(    $options = array(
73      '#fff633,#f5d000,#d2e7f9,#027AC6,#cccccc,#dfdfdf' => t('Blue Lagoon (default)'),      '#fff633,#f5d000,#d2e7f9,#027AC6,#cccccc,#dfdfdf' => t('Blue Lagoon (default)'),
# Line 91  function fivestar_color_form() { Line 96  function fivestar_color_form() {
96      '#title' => t('Color display'),      '#title' => t('Color display'),
97      '#options' => array('default' => t('Default display'), 'solid' => t('Solid color'), 'gradient' => t('Gradient')),      '#options' => array('default' => t('Default display'), 'solid' => t('Solid color'), 'gradient' => t('Gradient')),
98      '#default_value' => variable_get('fivestar_color_type', 'solid'),      '#default_value' => variable_get('fivestar_color_type', 'solid'),
99        '#access' => !$disabled,
100    );    );
101    
102    // Add scheme selector.    // Add scheme selector.
# Line 99  function fivestar_color_form() { Line 105  function fivestar_color_form() {
105      '#title' => t('Color set'),      '#title' => t('Color set'),
106      '#options' => $options,      '#options' => $options,
107      '#default_value' => isset($options[$scheme_default]) ? $scheme_default : '',      '#default_value' => isset($options[$scheme_default]) ? $scheme_default : '',
108        '#access' => !$disabled,
109    );    );
110    
111    // Add palette fields.    // Add palette fields.
# Line 112  function fivestar_color_form() { Line 119  function fivestar_color_form() {
119      'matte' => t('Matte color'),      'matte' => t('Matte color'),
120    );    );
121    
122    $form['fivestar_colors']['#tree'] = TRUE;    $form['fivestar_colors'] = array(
123    $form['fivestar_colors']['#theme'] = 'fivestar_color_palette';      '#tree' => TRUE,
124        '#access' => !$disabled,
125      );
126    foreach ($names as $key => $name) {    foreach ($names as $key => $name) {
127      $form['fivestar_colors'][$key] = array(      $form['fivestar_colors'][$key] = array(
128        '#type' => 'textfield',        '#type' => 'textfield',
# Line 123  function fivestar_color_form() { Line 132  function fivestar_color_form() {
132      );      );
133    }    }
134    
135      if ($disabled) {
136        $form['fivestar_color_type']['#value'] = 'default';
137      }
138    
139    return $form;    return $form;
140  }  }
141    
# Line 130  function fivestar_color_form() { Line 143  function fivestar_color_form() {
143   * Theme color form.   * Theme color form.
144   */   */
145  function theme_fivestar_color_form($form) {  function theme_fivestar_color_form($form) {
146      if ($form['#access'] == FALSE) {
147        return '';
148      }
149    
150    // Add Farbtastic color picker.    // Add Farbtastic color picker.
151    drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);    drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
152    drupal_add_js(drupal_get_path('module', 'fivestar') .'/js/fivestar-color.js');    drupal_add_js(drupal_get_path('module', 'fivestar') .'/js/fivestar-color.js');

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2