/[drupal]/contributions/modules/fivestar/fivestar_color.inc
ViewVC logotype

Diff of /contributions/modules/fivestar/fivestar_color.inc

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

revision 1.1.2.8, Fri Apr 10 18:20:59 2009 UTC revision 1.1.2.9, Wed Jul 1 01:12:35 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: fivestar_color.inc,v 1.1.2.7 2008/10/05 21:08:57 quicksketch Exp $  // $Id: fivestar_color.inc,v 1.1.2.8 2009/04/10 18:20:59 quicksketch Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 21  function fivestar_color_form() { Line 21  function fivestar_color_form() {
21      '#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.'),
22    );    );
23    
24      $disabled = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE;
25      if ($disabled) {
26        $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')));
27      }
28    
29    // Create the list of available schemes.    // Create the list of available schemes.
30    $options = array(    $options = array(
31      '#fff633,#f5d000,#d2e7f9,#027AC6,#cccccc,#dfdfdf' => t('Blue Lagoon (default)'),      '#fff633,#f5d000,#d2e7f9,#027AC6,#cccccc,#dfdfdf' => t('Blue Lagoon (default)'),
# Line 49  function fivestar_color_form() { Line 54  function fivestar_color_form() {
54      '#title' => t('Color display'),      '#title' => t('Color display'),
55      '#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')),
56      '#default_value' => variable_get('fivestar_color_type', 'solid'),      '#default_value' => variable_get('fivestar_color_type', 'solid'),
57        '#access' => !$disabled,
58    );    );
59    
60    // Add scheme selector.    // Add scheme selector.
# Line 57  function fivestar_color_form() { Line 63  function fivestar_color_form() {
63      '#title' => t('Color set'),      '#title' => t('Color set'),
64      '#options' => $options,      '#options' => $options,
65      '#default_value' => isset($options[$scheme_default]) ? $scheme_default : '',      '#default_value' => isset($options[$scheme_default]) ? $scheme_default : '',
66        '#access' => !$disabled,
67    );    );
68    
69    // Add palette fields.    // Add palette fields.
# Line 70  function fivestar_color_form() { Line 77  function fivestar_color_form() {
77      'matte' => t('Matte color'),      'matte' => t('Matte color'),
78    );    );
79    
80    $form['fivestar_colors']['#tree'] = TRUE;    $form['fivestar_colors'] = array(
81    $form['fivestar_colors']['#theme'] = 'fivestar_color_palette';      '#tree' => TRUE,
82        '#access' => !$disabled,
83      );
84    foreach ($names as $key => $name) {    foreach ($names as $key => $name) {
85      $form['fivestar_colors'][$key] = array(      $form['fivestar_colors'][$key] = array(
86        '#type' => 'textfield',        '#type' => 'textfield',
# Line 81  function fivestar_color_form() { Line 90  function fivestar_color_form() {
90      );      );
91    }    }
92    
93      if ($disabled) {
94        $form['fivestar_color_type']['#value'] = 'default';
95      }
96    
97    return $form;    return $form;
98  }  }
99    
# Line 88  function fivestar_color_form() { Line 101  function fivestar_color_form() {
101   * Theme color form.   * Theme color form.
102   */   */
103  function theme_fivestar_color_form($form) {  function theme_fivestar_color_form($form) {
104      if ($form['#access'] == FALSE) {
105        return '';
106      }
107    
108    // Add Farbtastic color picker.    // Add Farbtastic color picker.
109    drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);    drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
110    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.2.8  
changed lines
  Added in v.1.1.2.9

  ViewVC Help
Powered by ViewVC 1.1.2