? asd.diff
? fivestar-latest.patcgh
? fivestar-settings-text_display.patch
? fivestar-value-type-points-a.patch
? fivestar-value-type-points-b.patch
? fivestar-value-type-points-c.patch
? fivestar-value-type-points.patch
? fivestar-value-type.patch
? fivestar-widget-settings-786224-f.patch
? fivestar-widget-settings-786224-g.patch
? fivestar-widget-settings-786224-h.patch
? fivestar-widget-settings-786224-i.patch
? fivestar-widget-settings-786224-j.patch
? fivestar-widget-settings-786224-k.diff
? rock.diff
? uuuh.diff
Index: fivestar.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fivestar/fivestar.module,v
retrieving revision 1.32.2.2
diff -u -p -r1.32.2.2 fivestar.module
--- fivestar.module	7 Feb 2011 21:20:01 -0000	1.32.2.2
+++ fivestar.module	7 Feb 2011 21:57:03 -0000
@@ -311,7 +311,7 @@ function _fivestar_cast_vote($type, $cid
     }
 
     // Get the user's current vote.
-    $criteria = array('content_type' => $type, 'content_id' => $cid, 'tag' => $tag, 'uid' => $uid);
+    $criteria = array('content_type' => $type, 'content_id' => $cid, 'tag' => $tag, 'uid' => $uid, 'value_type' => variable_get('fivestar_value_type', 'percent'));
     // Get the unique identifier for the user (IP Address if anonymous).
     $user_criteria = votingapi_current_user_identifier();
     $user_votes = votingapi_select_votes($criteria + $user_criteria);
@@ -358,7 +358,7 @@ function fivestar_get_votes($type, $cid,
   $criteria = array(
     'content_type' => $type,
     'content_id' => $cid,
-    'value_type' => 'percent',
+    'value_type' => variable_get('fivestar_value_type', 'percent'),
     'tag' => $tag,
   );
 
@@ -718,7 +718,7 @@ function fivestar_static($content_type, 
   $criteria = array(
     'content_type' => $content_type,
     'content_id' => $content_id,
-    'value_type' => 'percent',
+    'value_type' => variable_get('fivestar_value_type', 'percent'),
     'tag' => 'vote',
   );
 
@@ -854,7 +854,6 @@ function fivestar_custom_widget(&$form_s
       '#value' => $settings['tag'],
     );
   }
-
   $form['vote'] = array(
     '#type' => 'fivestar',
     '#stars' => $settings['stars'],
@@ -1121,8 +1120,14 @@ function theme_fivestar_summary($user_ra
   $div_class = '';
   if (isset($user_rating)) {
     $div_class = isset($votes) ? 'user-count' : 'user';
-    $user_stars = round(($user_rating * $stars) / 100, 1);
+    if (variable_get('fivestar_value_type', 'percent') == 'percent') {
+      $user_stars = round(($user_rating * $stars) / 100, 1);
+    }
+    else {
+      $user_stars = $user_rating;
+    }
     $output .= '<span class="user-rating">'. t('Your rating: <span>!stars</span>', array('!stars' => $user_rating ? $user_stars : t('None'))) .'</span>';
+
   }
   if (isset($user_rating) && isset($average_rating)) {
     $output .= ' ';
@@ -1274,8 +1279,14 @@ function fivestar_expand($element) {
   $options = array('-' => t('Select rating'));
   $default_value = $element['#default_value'];
   for ($i = 0; $i <= $element['#stars']; $i++) {
-    $this_value = ceil($i * 100/$element['#stars']);
-    $next_value = ceil(($i+1) * 100/$element['#stars']);
+    if (variable_get('fivestar_value_type', 'percent') == 'percent') {
+      $this_value = ceil($i * 100/$element['#stars']);
+      $next_value = ceil(($i+1) * 100/$element['#stars']);  
+    }
+    else {
+      $this_value = $i;
+      $next_value = $i+1;
+    }
 
     // Display clear button only if enabled.
     if ($element['#allow_clear'] == TRUE && $i == 0) {
@@ -1313,7 +1324,10 @@ function fivestar_expand($element) {
 
   // Set a class for the display of label text on hover.
   $label_class = $element['#labels_enable'] ? ' fivestar-labels-hover' : '';
-
+  if (variable_get('fivestar_value_type', 'percent') == 'points') {
+    $label_class .= ' fivestar-points';
+  }
+  $value_type_class = 
   $element['#prefix'] = '<div class="fivestar-form-item '. (isset($element['#attributes']['class']) ? $element['#attributes']['class'] : '') . $label_class .'">';
   $element['#suffix'] = '</div>';
 
@@ -1402,7 +1416,10 @@ function fivestar_views_value_text_handl
   $node_type = isset($columns->node_type) ? $columns->node_type : db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $columns->nid));
   $settings = fivestar_get_settings($node_type, $tag);
   $stars = $settings['stars'];
-
+  // If we're using points, simply return the point value.
+  if (variable_get('fivestar_value_type', 'percent') == 'points') {
+    return $value;
+  }
   // If displaying a user's vote, always display a whole value.
   if ($field->table == 'votingapi_vote') {
     return ceil(($value / 100) * $stars);
@@ -1485,9 +1502,7 @@ function fivestar_views_widget_handler($
       'autosubmit' => TRUE,
       'title' => FALSE,
     );
-    
     $settings += fivestar_get_settings($node_type, $tag);
-    
     return drupal_get_form('fivestar_custom_widget', $values, $settings);
   }
   else {
Index: includes/fivestar.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fivestar/includes/fivestar.admin.inc,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 fivestar.admin.inc
--- includes/fivestar.admin.inc	6 Feb 2011 03:34:29 -0000	1.2.2.1
+++ includes/fivestar.admin.inc	7 Feb 2011 21:57:03 -0000
@@ -58,21 +58,31 @@ function fivestar_settings() {
     '#attributes' => array('class' => 'fivestar-widgets'),
   );
 
-  $form['tags'] = array(
+  $form['votingapi_settings'] = array(
     '#tree' => FALSE,
     '#type' => 'fieldset',
-    '#title' => t('Voting tags'),
-    '#description' => t('Choose the voting tags that will be available for node rating. A tag is simply a category of vote. If you only need to rate one thing per node, leave this as the default "vote".'),
+    '#title' => t('VotingAPI settings'),
+    '#description' => t('Choose the VotingAPI value_type and tags that will be available for node rating. A tag is simply a category of vote. If you only need to rate one thing per node, leave this as the default "vote".'),
     '#weight' => 3,
    );
 
-  $form['tags']['tags'] = array(
+  $form['votingapi_settings']['tags'] = array(
     '#type' => 'textfield',
     '#title' => t('Tags'),
     '#default_value' => variable_get('fivestar_tags', 'vote'),
     '#required' => TRUE,
     '#description' => t('Separate multiple tags with commas.'),
    );
+   $form['votingapi_settings']['fivestar_value_type'] = array(
+     '#type' => 'radios',
+     '#title' => t('Value type'),
+     '#options' => array(
+       'percent' => t('Percent (Default value)'),
+       'points' => t('Points'),
+     ),
+     '#description' => t("The default value for this setting is 'percent'. Don't change this unless you understand what you're doing. Changing this value on a site with existing votes from Fivestar widgets can corrupt vote total data."),
+     '#default_value' => variable_get('fivestar_value_type', 'percent'),
+   );
 
   $form['color'] = fivestar_color_form();
   $form['#validate'][] = 'fivestar_color_form_validate';
@@ -92,7 +102,7 @@ function fivestar_settings_submit($form,
   // TODO We could delete all variables for removed tags
   variable_set('fivestar_tags', $form_state['values']['tags']);
   variable_set('fivestar_widget', $form_state['values']['fivestar_widget']);
-
+  variable_set('fivestar_value_type', $form_state['values']['fivestar_value_type']);
   // Rebuild the menu in case tags were changed
   menu_rebuild();
 }
@@ -203,7 +213,6 @@ function fivestar_node_type_tag_form(&$f
     '#default_value' => $settings['stars'],
     '#weight' => -4,
   );
-
   $form['labels'] = array(
     '#type' => 'fieldset',
     '#title' => t('Star Labels'),
Index: js/fivestar.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fivestar/js/fivestar.js,v
retrieving revision 1.2
diff -u -p -r1.2 fivestar.js
--- js/fivestar.js	11 May 2009 03:12:56 -0000	1.2
+++ js/fivestar.js	7 Feb 2011 21:57:03 -0000
@@ -37,7 +37,9 @@
             cancelTitle = $('label', $obj).html(),
             voteTitle = cancelTitle != Drupal.settings.fivestar.titleAverage ? cancelTitle : Drupal.settings.fivestar.titleUser,
             voteChanged = false;
-
+        if ($obj.is('.fivestar-points')) {
+          var fivestarPoints = true;
+        }
         // Record star display.
         if ($obj.is('.fivestar-user-stars')) {
           var starDisplay = 'user';
@@ -207,7 +209,12 @@
             },
             reset: function(){
               // Reset the stars to the default index.
-              var starValue = currentValue/100 * $stars.size();
+              if (!fivestarPoints) {
+                var starValue = currentValue/100 * $stars.size();  
+              }
+              else {
+                var starValue = currentValue;
+              }
               var percent = (starValue - Math.floor(starValue)) * 100;
               $stars.filter(':lt(' + Math.floor(starValue) + ')').addClass('on').end();
               if (percent > 0) {
@@ -352,7 +359,12 @@
         $('div.fivestar-form-'+voteResult.vote.id).each(function() {
           // Update stars.
           var $stars = $('.fivestar-widget-static .star span', this);
-          var average = voteResult.result.average/100 * $stars.size();
+          if (!fivestarPoints) {
+            var average = voteResult.result.average/100 * $stars.size();  
+          }
+          else {
+            var average = voteResult.result.average;
+          }
           var index = Math.floor(average);
           $stars.removeClass('on').addClass('off').css('width', 'auto');
           $stars.filter(':lt(' + (index + 1) + ')').removeClass('off').addClass('on');
