? out
Index: updown-active.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/updown/Attic/updown-active.tpl.php,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 updown-active.tpl.php
--- updown-active.tpl.php	23 Aug 2008 00:08:59 -0000	1.1.2.3
+++ updown-active.tpl.php	8 Sep 2008 23:11:52 -0000
@@ -1,4 +1,4 @@
-<div class="updown-widget updown-widget-<?php print $vote_class; ?>" id="updown-widget-<?php print $node->nid; ?>">
+<div class="updown-widget updown-widget-<?php print $vote_class; ?>" id="updown-widget-<?php print $object_type . '-' . $object_id; ?>">
   <div class="updown-score"><span class="updown-current-score"><?php print $current_score; ?></span> score</div>
   <div class="updown-vote">
     <div class="updown-voteup"><a href="<?php print $vote_up_uri; ?>">+</a></div>
Index: updown.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/updown/Attic/updown.module,v
retrieving revision 1.2.2.6
diff -u -p -r1.2.2.6 updown.module
--- updown.module	23 Aug 2008 00:08:30 -0000	1.2.2.6
+++ updown.module	8 Sep 2008 23:11:53 -0000
@@ -17,6 +17,7 @@ function updown_nodeapi(&$node, $op, $te
       if (variable_get('updown_'. $node->type, FALSE)) {
         $display_mode = variable_get('updown_display_'. $node->type, 'full');
         if ($display_mode == 'both' || ($display_mode == 'teaser' && $teaser) || ($display_mode == 'full' && $page)) {
+          $node->updown_type = 'node';
           if (user_access('vote')) {
             $node->content['widget']['#value'] = theme('updown_active_widget', $node);
           }
@@ -104,6 +105,7 @@ function updown_vote_node($node, $vote, 
   // otherwise, return the new score.
   if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
     $token = _updown_generate_token($node->nid, 'node');
+    $node->updown_type = 'node';
     $js = array(
       'score' => _updown_get_current_score($node),
       'vote_full' => url('node/'. $node->nid .'/vote/'. UPDOWN_VALUE_HIGH .'/'. $token),
@@ -138,11 +140,11 @@ function updown_cron() {
 /**
  * Get the current score for a node.
  */
-function _updown_get_current_score($node) {
+function _updown_get_current_score($object) {
   $current_score = 0;
   $criteria = array(
-    'content_type' => 'node',
-    'content_id' => $node->nid,
+    'content_type' => $object->updown_type == 'node' ? 'node' : 'comment',
+    'content_id' => $object->updown_type == 'node' ? $object->nid : $object->cid,
   );
   $votes = votingapi_select_votes($criteria);
   foreach ($votes as $vote) {
@@ -151,12 +153,12 @@ function _updown_get_current_score($node
   return $current_score;
 }
 
-function _updown_user_voted($node) {
+function _updown_user_voted($object) {
   global $user;
   
   $criteria = array(
-    'content_type' => 'node',
-    'content_id' => $node->nid,
+    'content_type' => $object->updown_type == 'node' ? 'node' : 'comment',
+    'content_id' => $object->updown_type == 'node' ? $object->nid : $object->cid,
     'uid' => $user->uid,
   );
   
@@ -166,27 +168,30 @@ function _updown_user_voted($node) {
 function updown_theme($existing, $type, $theme, $path) {
   return array(
     'updown_inactive_widget' => array(
-      'arguments' => array('node' => NULL),
+      'arguments' => array('object' => NULL),
       'template' => 'updown-inactive',
     ),
     'updown_active_widget' => array(
-      'arguments' => array('node' => NULL),
+      'arguments' => array('object' => NULL),
       'template' => 'updown-active',
     ),
   );
 }
 
 function template_preprocess_updown_inactive_widget(&$vars) {
-  $vars['current_score'] = _updown_get_current_score($vars['node']);
+  $vars['current_score'] = _updown_get_current_score($vars['object']);
 }
 
 function template_preprocess_updown_active_widget(&$vars) {
-  $token = $vars['token'] = _updown_generate_token($vars['node']->nid, 'node');
-  $vars['current_score']  = _updown_get_current_score($vars['node']);
-  $vars['vote_up_uri']    = url('node/'. $vars['node']->nid .'/vote/'. UPDOWN_VALUE_HIGH .'/'. $token);
-  $vars['vote_down_uri']  = url('node/'. $vars['node']->nid .'/vote/'. UPDOWN_VALUE_LOW .'/'. $token);
-  $vars['vote_undo_uri']  = url('node/'. $vars['node']->nid .'/vote/'. UPDOWN_VALUE_UNVOTE .'/'. $token);
-  $vars['vote_class']     = _updown_user_voted($vars['node']) ? 'voted' : 'voting';
+  $id = $vars['object']->updown_type == 'node' ? $vars['object']->nid : $vars['object']->cid;
+  $token = $vars['token'] = _updown_generate_token($id, $vars['object']->updown_type);
+  $vars['current_score']  = _updown_get_current_score($vars['object']);
+  $vars['object_id']      = $id;
+  $vars['object_type']    = $vars['object']->updown_type;
+  $vars['vote_up_uri']    = url('node/'. $id .'/vote/'. UPDOWN_VALUE_HIGH .'/'. $token);
+  $vars['vote_down_uri']  = url('node/'. $id .'/vote/'. UPDOWN_VALUE_LOW .'/'. $token);
+  $vars['vote_undo_uri']  = url('node/'. $id .'/vote/'. UPDOWN_VALUE_UNVOTE .'/'. $token);
+  $vars['vote_class']     = _updown_user_voted($vars['object']) ? 'voted' : 'voting';
   drupal_add_js(drupal_get_path('module', 'updown') .'/updown.js');
   drupal_add_css(drupal_get_path('module', 'updown') .'/updown.css');
 }
