Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodevote/README.txt,v
retrieving revision 1.5
diff -U3 -r1.5 README.txt
--- README.txt	8 Nov 2005 04:17:54 -0000	1.5
+++ README.txt	14 Dec 2005 16:22:26 -0000
@@ -1,4 +1,4 @@
-$Id: README.txt,v 1.5 2005-11-08 04:17:54 kbahey Exp $
+$Id: README.txt,v 1.5 2005/11/08 04:17:54 kbahey Exp $
 
 Copyright 2005 http://2bits.com
 
Index: nodevote.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodevote/nodevote.module,v
retrieving revision 1.13
diff -U3 -r1.13 nodevote.module
--- nodevote.module	30 Oct 2005 03:09:47 -0000	1.13
+++ nodevote.module	14 Dec 2005 16:22:26 -0000
@@ -1,6 +1,6 @@
 <?php
 
-//$Id: nodevote.module,v 1.13 2005-10-30 03:09:47 kbahey Exp $
+//$Id: nodevote.module,v 1.13 2005/10/30 03:09:47 kbahey Exp $
 
 // Copyright 2005 Khalid Baheyeldin http://2bits.com
 
@@ -22,7 +22,7 @@
 
   return $output;
 }
-  
+
 function nodevote_menu($may_cache) {
   $nid = (int)arg(1);
 
@@ -50,27 +50,52 @@
 }
 
 function nodevote_settings() {
-  
-  $output = '';
-  foreach(node_list() as $type) {
-    $output .= form_checkbox (node_invoke($type, 'node_name'), NODEVOTE_TYPE . $type, 1,
-
-  // 4.7 changes. Uncomment these two lines and delete the two preceding ones
-  //foreach(node_get_types() as $type => $name) {
-  // $output .= form_checkbox ($name, NODEVOTE_TYPE . $type, 1,
-      variable_get(NODEVOTE_TYPE . $type, '0'));
-  }
-  $form_types = form_group(t('Enable voting for these node types'), $output);
 
-  $output = form_textfield ('vote', VOTE_DESC, variable_get(VOTE_DESC, 'Score'), 25, 25);
-  $form_desc = form_group(t('Vote description'), $output);
+  $form['types'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Enable voting for these node types'),
+  );
 
-  $output = form_checkbox (t('Show vote results only if user has voted on node'),
-    'nodevote_result_voted', 1, variable_get('nodevote_result_voted', 0));
-  $form_show = form_group(t('Show vote results'), $output);
+  $output = '';
+  foreach(node_get_types() as $type => $name) {
+    $form['types'][NODEVOTE_TYPE . $type] = array(
+      '#type' => 'checkbox',
+      '#title' => $name,
+      '#return_value' => 1,
+      '#default_value' => variable_get(NODEVOTE_TYPE . $type, '0'),
+    );
+  }
+
+  $form['description'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Vote description'),
+  );
+
+
+  $form['description'][VOTE_DESC] = array(
+    '#type' => 'textfield',
+    '#title' => t('vote'),
+    '#description' => t('The word used to describe the votes when displayed'),
+    '#default_value' => variable_get(VOTE_DESC, 'Score'),
+    '#size' => 25,
+    '#maxlength' => 25,
+  );
+
+
+  $form['results'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Show vote results'),
+  );
+
+  $form['results']['nodevote_result_voted'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show vote results only if user has voted on node'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('nodevote_result_voted', 0),
+  );
 
-  return $form_types . $form_desc . $form_show;
-}  
+  return $form;
+}
 
 function nodevote_user($op) {
   switch($op) {
@@ -130,22 +155,20 @@
 
 function nodevote_page() {
   global $user;
-  $edit = $_POST['edit'];
+  $vote = $_POST['edit']['vote'];
 
   $nid = (int)arg(1);
   $op  = arg(2);
 
   switch($op) {
     case 'add':
-      $vote = $edit['vote'];
-
       if (_nodevote_validate_vote($vote)) {
         $result = db_query("INSERT INTO {nodevote} VALUES (%d, %d, %d)",
           $user->uid, $nid, $vote);
         if(module_exist('userpoints')) {
           userpoints_nodevote($nid);
         }
-	      drupal_goto("node/" . $nid);
+	drupal_goto("node/view/" . $nid);
       }
       else {
         drupal_set_message(t('You must select a valid vote score.'), 'error');
@@ -155,7 +178,7 @@
 
     case 'view':
     default:
-      if (_nodevote_vote_is_visible($node)) {
+      if (_nodevote_vote_is_visible($node->nid)) {
         $o = theme('nodevote_display_vote',$node->nid);
       }
       break;
@@ -177,11 +200,11 @@
         }
       }
       return $extra;
-    case 'view':
-      if ($page) {
-        if (variable_get(NODEVOTE_TYPE . $node->type, '0')) { 
-          if ($node->nodevote->vote_display) {
-            $node->body .= theme('nodevote_display_vote',$node->nid);
+     case 'view':
+       if ($page) {
+         if (variable_get(NODEVOTE_TYPE . $node->type, '0')) {
+           if ($node->nodevote->vote_display) {
+           $node->body .= theme('nodevote_display_vote',$node->nid);
           }
 
           if ($node->nodevote->vote_do) {
@@ -257,22 +280,27 @@
 }
 
 function theme_nodevote_do_vote($node) {
-  
+
   $score = array();
   $score[] = 'Select';
   for($j=MIN_SCORE; $j<MAX_SCORE+1; $j++) {
     $score[] = $j;
   }
+  $form['#action'] = url("nodevote/$node->nid/add");
+  $form['vote'] = array(
+    '#type' => select,
+    '#default_value' => VOTE_DEFAULT,
+    '#options' => $score,
+    '#prefix' => '',
+    '#suffix' => '',
+  );
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Rate it').'WOOT', '#prefix' => '', '#suffix' => '');
 
-  $o = '<div id="nodevote vote">'.t('Please rate this node. 1 = worst score, 10 = best score').'<br />';
-  $vote_desc = variable_get(VOTE_DESC, 'Score');
-  $o .= form_select($vote_desc, 'vote', VOTE_DEFAULT, $score);
-  $o .= form_button(t('Vote'));
+  $o = '<div id="nodevote vote">';
+  $o .= drupal_get_form('theme_nodevote_do_vote', $form);
   $o .= '</div>';
 
-  $frm .= form($o, 'post', url('nodevote/' . $node->nid . '/add'), array('class' => 'nodevote-form'));
-
-  return $frm;
+  return $o;
 }
 
 
Index: nodevote.mysql
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodevote/nodevote.mysql,v
retrieving revision 1.1
diff -U3 -r1.1 nodevote.mysql
--- nodevote.mysql	21 Jun 2005 02:20:28 -0000	1.1
+++ nodevote.mysql	14 Dec 2005 16:22:26 -0000
@@ -1,6 +1,6 @@
 --
 -- Table structure for table 'nodevote'
--- $Id: nodevote.mysql,v 1.1 2005-06-21 02:20:28 kbahey Exp $
+-- $Id: nodevote.mysql,v 1.1 2005/06/21 02:20:28 kbahey Exp $
 --
 
 CREATE TABLE nodevote (
