? asd.diff
? 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
? uuuh.diff
Index: fivestar.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fivestar/fivestar.module,v
retrieving revision 1.32.2.1
diff -u -p -r1.32.2.1 fivestar.module
--- fivestar.module	6 Feb 2011 03:34:29 -0000	1.32.2.1
+++ fivestar.module	7 Feb 2011 20:36:27 -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',
   );
 
@@ -1274,8 +1274,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) {
@@ -1402,7 +1408,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);
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 20:36:27 -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,7 @@ function fivestar_node_type_tag_form(&$f
     '#default_value' => $settings['stars'],
     '#weight' => -4,
   );
-
+ dpm($form['fivestar_stars']['#options'], 'options');
   $form['labels'] = array(
     '#type' => 'fieldset',
     '#title' => t('Star Labels'),
