/[drupal]/contributions/modules/fivestar/fivestar.module
ViewVC logotype

Diff of /contributions/modules/fivestar/fivestar.module

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

revision 1.13.2.63, Wed Jul 1 02:17:46 2009 UTC revision 1.13.2.64, Wed Jul 1 02:43:31 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: fivestar.module,v 1.13.2.62 2009/07/01 00:33:49 quicksketch Exp $  // $Id: fivestar.module,v 1.13.2.63 2009/07/01 02:17:46 quicksketch Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 1160  function fivestar_custom_widget(&$form_s Line 1160  function fivestar_custom_widget(&$form_s
1160      $form['content_type'] = array(      $form['content_type'] = array(
1161        '#type' => 'hidden',        '#type' => 'hidden',
1162        '#value' => $settings['content_type'],        '#value' => $settings['content_type'],
       '#id' => $settings['content_id'] ? 'edit-content-type-'. $settings['content_id'] : NULL,  
1163      );      );
1164    }    }
1165    
# Line 1168  function fivestar_custom_widget(&$form_s Line 1167  function fivestar_custom_widget(&$form_s
1167      $form['content_id'] = array(      $form['content_id'] = array(
1168        '#type' => 'hidden',        '#type' => 'hidden',
1169        '#value' => $settings['content_id'],        '#value' => $settings['content_id'],
       '#id' => $settings['content_id'] ? 'edit-content-id-'. $settings['content_id'] : NULL,  
1170      );      );
1171    }    }
1172    
# Line 1191  function fivestar_custom_widget(&$form_s Line 1189  function fivestar_custom_widget(&$form_s
1189    $form['destination'] = array(    $form['destination'] = array(
1190      '#type' => 'hidden',      '#type' => 'hidden',
1191      '#value' => $_GET['q'],      '#value' => $_GET['q'],
     '#id' => isset($settings['content_id']) ? 'edit-destination-'. $settings['content_id'] : NULL,  
1192    );    );
1193    
1194    $form['fivestar_submit'] = array(    $form['fivestar_submit'] = array(
1195      '#type' => 'submit',      '#type' => 'submit',
1196      '#value' => t('Rate'),      '#value' => t('Rate'),
1197      '#attributes' => array('class' => 'fivestar-submit'),      '#attributes' => array('class' => 'fivestar-submit'),
     '#id' => isset($settings['content_id']) ? 'edit-fivestar-submit-'. $settings['content_id'] : NULL,  
1198    );    );
1199    
1200    $form['vote']['#attributes']['class'] = isset($form['vote']['#attributes']['class']) ? $form['vote']['#attributes']['class'] : '';    $form['vote']['#attributes']['class'] = isset($form['vote']['#attributes']['class']) ? $form['vote']['#attributes']['class'] : '';
# Line 1532  function fivestar_get_inline_css() { Line 1528  function fivestar_get_inline_css() {
1528   * Process callback for fivestar_element -- see fivestar_element()   * Process callback for fivestar_element -- see fivestar_element()
1529   */   */
1530  function fivestar_expand($element) {  function fivestar_expand($element) {
   static $fivestar_id = 0;  
1531    
1532    if (isset($element['#vote_count'])) {    if (isset($element['#vote_count'])) {
1533      $element['vote_count'] =  array(      $element['vote_count'] =  array(
1534        '#type' => 'hidden',        '#type' => 'hidden',
1535        '#value' => $element['#vote_count'],        '#value' => $element['#vote_count'],
       '#id' => 'edit-vote-count-'. $fivestar_id,  
1536      );      );
1537    }    }
1538    
# Line 1546  function fivestar_expand($element) { Line 1540  function fivestar_expand($element) {
1540      $element['vote_average'] =  array(      $element['vote_average'] =  array(
1541        '#type' => 'hidden',        '#type' => 'hidden',
1542        '#value' => $element['#vote_average'],        '#value' => $element['#vote_average'],
       '#id' => 'edit-vote-average-'. $fivestar_id,  
1543      );      );
1544    }    }
1545    
# Line 1555  function fivestar_expand($element) { Line 1548  function fivestar_expand($element) {
1548        '#type' => 'hidden',        '#type' => 'hidden',
1549        '#value' => url($element['#auto_submit_path']),        '#value' => url($element['#auto_submit_path']),
1550        '#attributes' => array('class' => 'fivestar-path'),        '#attributes' => array('class' => 'fivestar-path'),
       '#id' => 'edit-auto-submit-path-'. $fivestar_id,  
1551      );      );
1552      $element['auto_submit_token'] = array(      $element['auto_submit_token'] = array(
1553        '#type' => 'hidden',        '#type' => 'hidden',
1554        '#value' => fivestar_get_token($element['#auto_submit_path']),        '#value' => fivestar_get_token($element['#auto_submit_path']),
1555        '#attributes' => array('class' => 'fivestar-token'),        '#attributes' => array('class' => 'fivestar-token'),
       '#id' => 'edit-auto-submit-token-'. $fivestar_id,  
1556      );      );
1557    }    }
1558    
# Line 1600  function fivestar_expand($element) { Line 1591  function fivestar_expand($element) {
1591      '#required' => $element['#required'],      '#required' => $element['#required'],
1592      '#default_value' => $default_value,      '#default_value' => $default_value,
1593      '#parents' => $element['#parents'],      '#parents' => $element['#parents'],
     '#id' => 'edit-vote-'. $fivestar_id,  
1594      '#theme' => 'fivestar_select',      '#theme' => 'fivestar_select',
1595      '#weight' => $element['#weight'],      '#weight' => $element['#weight'],
1596    );    );
# Line 1613  function fivestar_expand($element) { Line 1603  function fivestar_expand($element) {
1603    // Set a class for the display of label text on hover.    // Set a class for the display of label text on hover.
1604    $label_class = $element['#labels_enable'] ? ' fivestar-labels-hover' : '';    $label_class = $element['#labels_enable'] ? ' fivestar-labels-hover' : '';
1605    
   $element['#id'] = 'edit-vote-'. $fivestar_id;  
1606    $element['#prefix'] = '<div class="fivestar-form-item '. (isset($element['#attributes']['class']) ? $element['#attributes']['class'] : '') . $label_class .'">';    $element['#prefix'] = '<div class="fivestar-form-item '. (isset($element['#attributes']['class']) ? $element['#attributes']['class'] : '') . $label_class .'">';
1607    $element['#suffix'] = '</div>';    $element['#suffix'] = '</div>';
1608    
1609    // Add validation function that considers a 0 value as empty.    // Add validation function that considers a 0 value as empty.
1610    $element['#element_validate'] = array('fivestar_validate');    $element['#element_validate'] = array('fivestar_validate');
1611    
   $fivestar_id++;  
1612    return $element;    return $element;
1613  }  }
1614    

Legend:
Removed from v.1.13.2.63  
changed lines
  Added in v.1.13.2.64

  ViewVC Help
Powered by ViewVC 1.1.2