diff -upN nodereview/nodereview.admin.inc nodereview_new/nodereview.admin.inc
--- nodereview/nodereview.admin.inc	1970-01-01 05:30:00.000000000 +0530
+++ nodereview_new/nodereview.admin.inc	2008-11-28 12:17:26.000000000 +0530
@@ -0,0 +1,222 @@
+<?php
+// $Id$
+
+
+/**
+ * @file
+ * Administration page callbacks for the nodereview module.
+ */
+
+
+/**
+ * Form builder. Configure nodereview node types.
+ *
+ * @ingroup forms
+ *
+ */
+
+function nodereview_configure_axes(&$form_state, $type, $name) {
+
+  drupal_set_title(t('Reviews for %type nodes', array('%type' => check_plain($name))));
+
+  $form['use'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('reviews'),
+      '#collapsible' => TRUE,
+      '#collapsed' => FALSE,
+  );
+
+  $form['use']['node_type'] = array('#type' => 'hidden', '#value' => $type);
+  $form['use']['guide'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Usage Guide to the User'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('nodereview_guide_'. $type, ''),
+    '#description' => t('Instructions to users for how to use this review.  These will be shown on the "Add Review" page. Note that if you have help text defined on admin/settings/content-types/nodereview, this value will override it.'),
+  );
+
+  $form['axes'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('review axes'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+    '#tree' => TRUE,
+  );
+
+  // We'll store field information in its own table
+  $result = db_query("SELECT aid, tag, description, weight FROM {nodereview_axes} WHERE node_type='%s' ORDER BY weight", $type);
+
+  $axes = array();
+
+  while ($record = db_fetch_object($result)) {
+    $axes[] = _nodereview_configure_axis($record);
+  }
+
+  $record = new stdClass();
+  $record->aid = 0;
+  $record->node_type = $type;
+
+  $axes[] = _nodereview_configure_axis($record);
+
+  $form['axes'] += $axes;
+
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
+
+  return $form;
+
+}
+
+
+/**
+ * Handle submission of the nodereview node type axes
+ * form and saving of the data to the database.
+ *
+ */
+
+function nodereview_configure_axes_submit($form, $form_state) {
+  $form_values = $form_state['values'];
+  // Save whether or not we're reviewing this node type
+  // variable_set('nodereview_use_' . $form_values['node_type'], $form_values['use']);
+  variable_set('nodereview_guide_'. $form_values['node_type'], $form_values['guide']);
+
+  // Regardless, save the user's data, just in case they may want it later
+  foreach ($form_values['axes'] as $axis) {
+    if ($axis['aid'] && $axis['use']) {
+      // Update an existing axis
+      $axis['description'] = check_plain($axis['description']);
+      db_query("UPDATE {nodereview_axes} SET tag='%s', description='%s', weight=%d WHERE aid=%d", $axis['tag'], $axis['description'], $axis['weight'], $axis['aid']);
+    }
+    elseif ($axis['aid'] && ! $axis['use']) {
+      // Delete an existing axis
+      db_query("DELETE FROM {nodereview_axes} WHERE aid=%d", $axis['aid']);
+    }
+    elseif ($axis['use'] && ! $axis['aid']) {
+      // Create a new axis
+      $axis['description'] = check_plain($axis['description']);
+      db_query("INSERT INTO {nodereview_axes} (node_type, tag, description, weight) VALUES ('%s', '%s', '%s', %d)", $form_values['node_type'], $axis['tag'], $axis['description'], $axis['weight']);
+    }
+    else {
+      // Doesn't exist and don't use, so just ignore
+    }
+  }
+}
+
+
+/**
+ * Form builder. To build additional axes on submit.
+ *
+ * @ingroup forms
+ *
+ */
+function _nodereview_configure_axis($record) {
+  $form['aid'] = array(
+    '#type' => 'hidden',
+    '#value' => $record->aid,
+  );
+  $form['use'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use axis'),
+    '#return_value' => 1,
+    '#default_value' => (boolean)($record->aid),
+    '#description' => t(''),
+  );
+  $form['tag'] = array(
+    '#type' => 'textfield',
+    '#title' => t('name'),
+    '#return_value' => 1,
+    '#default_value' => $record->tag,
+    '#size' => 30,
+  );
+  $form['description'] = array(
+    '#type' => 'textarea',
+    '#title' => t('description'),
+    '#return_value' => 1,
+    '#default_value' => $record->description,
+    '#rows' => 2,
+  );
+  $form['weight'] = array(
+    '#type' => 'weight',
+    '#title' => t('weight'),
+    '#delta' => 10,
+    '#default_value' => $record->weight,
+    '#description' => t(''),
+  );
+
+  return $form;
+}
+
+
+/**
+ * We use this function in place of hook_settings(), because hook_settings()
+ * isn't fancy enough to support what we need to do.
+ *
+ */
+function nodereview_configure() {
+
+  $form = array();
+  $default = array();
+  foreach(node_get_types() as $type => $info) {
+    $options[$type] = $info->name;
+    if (variable_get('nodereview_use_'. $type, 0)) {
+      $default[] = $type;
+    }
+  }
+
+  $form['nodereview'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Review types'),
+    '#collapsible' => FALSE,
+    '#collapsed' => FALSE,
+  );
+  $form['nodereview']['types'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Reviewable content types'),
+    '#default_value' => $default,
+    '#options' => $options,
+    '#description' => t('Specify which content types can be reviewed.'),
+  );
+
+  if (module_exists('fivestar')) {
+    $form['fivestar'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Fivestar options'),
+      '#collapsible' => FALSE,
+      '#collapsed' => FALSE,
+      '#tree' => TRUE,
+    );
+    $form['fivestar']['enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use Fivestar for reviews'),
+      '#default_value' => variable_get('nodereview_fivestar_enable', 0),
+      '#description' => t('Enabling Fivestar for reviews will replace select list options with a JavaScript star display.'),
+    );
+    $form['fivestar']['stars'] = array(
+      '#type' => 'select',
+      '#title' => t('Number of stars'),
+      '#options' => drupal_map_assoc(range(1, 10)),
+      '#default_value' => variable_get('nodereview_fivestar_stars', 5),
+    );
+  }
+
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save'),
+  );
+
+  return $form;
+}
+
+
+function nodereview_configure_submit($form, $form_state) {
+  $form_values = $form_state['values'];
+  foreach ($form_values['types'] as $type => $checked) {
+    variable_set('nodereview_use_'. $type, (bool)$checked);
+  }
+  foreach ($form_values['fivestar'] as $option => $value) {
+    variable_set('nodereview_fivestar_'. $option, $value);
+  }
+  cache_clear_all();
+  menu_rebuild();
+
+}
+
diff -upN nodereview/nodereview.info nodereview_new/nodereview.info
--- nodereview/nodereview.info	2008-05-16 05:41:16.000000000 +0530
+++ nodereview_new/nodereview.info	2008-11-28 12:17:26.000000000 +0530
@@ -1,10 +1,7 @@
-; $Id: nodereview.info,v 1.1.2.2 2007/06/18 23:06:54 dww Exp $
+;$Id$
 name = Node Review
 description = "Add reviews to arbitrary node types."
-dependencies = views votingapi
-
-; Information added by drupal.org packaging script on 2008-05-16
-version = "5.x-1.x-dev"
-project = "nodereview"
-datestamp = "1210896676"
+core = "6.x"
+dependencies[] = views
+dependencies[] = votingapi
 
diff -upN nodereview/nodereview.install nodereview_new/nodereview.install
--- nodereview/nodereview.install	2008-05-15 22:57:14.000000000 +0530
+++ nodereview_new/nodereview.install	2008-11-28 12:17:26.000000000 +0530
@@ -1,79 +1,143 @@
 <?php
-// $Id: nodereview.install,v 1.3.2.4 2008/05/15 17:27:14 johnforsythe Exp $
+// $Id$
+
+
+/**
+ * Implementation of hook_install().
+ */
 
 function nodereview_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {nodereview} (
-        nid int unsigned NOT NULL default '0',
-        reviewed_nid int unsigned NOT NULL default '0',
-        PRIMARY KEY  (nid),
-        KEY (reviewed_nid)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      db_query("CREATE TABLE {nodereview_axes} (
-        aid int(11) NOT NULL auto_increment,
-        tag varchar(255) NOT NULL default '',
-        node_type varchar(255) NOT NULL default '',
-        weight int(11) NOT NULL default 0,
-        description text NOT NULL default '',
-        PRIMARY KEY  (aid)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      db_query("CREATE TABLE {nodereview_reviews} (
-        nid int(11) NOT NULL default 0,
-        aid int(11) NOT NULL default 0,
-        review text NOT NULL,
-        KEY (nid)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-    
-    // this syntax seems to be incorrect, a patch by someone familiar with pgsql would be appreciated.
-    case 'pgsql':
-      db_query("CREATE TABLE {nodereview} (
-        nid int unsigned NOT NULL default '0',
-        reviewed_nid int unsigned NOT NULL default '0',
-        PRIMARY KEY  (nid),
-        KEY (reviewed_nid)
-      );");
-      db_query("CREATE TABLE {nodereview_axes} (
-        aid int(11) NOT NULL auto_increment,
-        tag varchar(255) NOT NULL default '',
-        node_type varchar(255) NOT NULL default '',
-        weight int(11) NOT NULL default 0,
-        description text NOT NULL default '',
-        PRIMARY KEY  (aid)
-      );");
-      db_query("CREATE TABLE {nodereview_reviews} (
-        nid int(11) NOT NULL default 0,
-        aid int(11) NOT NULL default 0,
-        review text NOT NULL,
-        KEY (nid)
-      );");
-      break;
-  }
-}
 
-function nodereview_update_1() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {nodereview_axes} ADD COLUMN description text NOT NULL default ''");
-      break;
-    case 'pgsql':
-      db_add_column($ret, 'nodereview_axes', 'description', 'text', array('default' => '', 'not null' => TRUE));
-      break;
-  }
-  return $ret;
+  // Use schema API to create database table.
+  drupal_install_schema('nodereview');
 }
 
+/**
+ * Implementation of hook_uninstall().
+ */
 function nodereview_uninstall() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("DROP TABLE {nodereview}}");
-      db_query("DROP TABLE {nodereview_axes}}");
-      db_query("DROP TABLE {nodereview_reviews}");
-      db_query("DELETE FROM {node_type} WHERE type='nodereview'");
+  // Use schema API to delete database table.
+  drupal_uninstall_schema('nodereview');
+
+  //Delete all the node type entry from nodetype table
+  db_query("DELETE FROM {node_type} WHERE type='nodereview'");
+
+  //Delete nodereview fivestar variables
+  variable_del('nodereview_fivestar_enable');
+  variable_del('nodereview_fivestar_stars');
+
+  //Delete nodereview node types & its help info
+  foreach(node_get_types() as $type => $info) {
+    variable_del('nodereview_use_' . $type);
+    variable_del('nodereview_guide_' . $info->name);
   }
 }
+
+
+/**
+ * Implementation of hook_schema().
+ */
+function nodereview_schema() {
+
+  $schema['nodereview'] = array(
+    'description' => t('Stores reviewed node and the review node mapping.'),
+    'fields' => array(
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+        'description' => t('The {node}.nid of the review.'),
+      ),
+
+      'reviewed_nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+        'description' => t('The {node}.nid to which is reviewed.'),
+      ),
+
+    ),
+    'primary key' => array('nid'),
+  );
+
+
+  $schema['nodereview_axes'] = array(
+    'description' => t('Stores axes labels for particular node types.'),
+    'fields' => array(
+      'aid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'description' => t('The {node}.nid of the review.'),
+      ),
+
+      'tag' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+        'description' => t('The tag for the axes.'),
+      ),
+
+      'node_type' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+        'description' => t('The node type to which the axes belong.'),
+      ),
+
+      'weight' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'length'   => 11,
+        'default'  => 0,
+        'description' => t('The axes weight.'),
+      ),
+
+      'description' => array(
+        'type' => 'text',
+        'not null' => TRUE,
+        'default' => '',
+        'description' => t('The decsription about the axes.'),
+      ),
+    ),
+    'primary key' => array('aid'),
+  );
+
+
+
+  $schema['nodereview_reviews'] = array(
+    'description' => t('Stores reviews.'),
+    'fields' => array(
+      'nid' => array(
+        'type' => 'int',
+        'length'   => 11,
+        'not null' => TRUE,
+        'default' => 0,
+        'description' => t('The {node}.nid of the review.'),
+      ),
+
+      'aid' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'length'   => 11,
+        'default'  => 0,
+        'description' => t('The {axes}.nid of the review.'),
+      ),
+
+      'review' => array(
+        'type' => 'text',
+        'not null' => TRUE,
+        'description' => t('The review.'),
+      ),
+
+    ),
+    'key' => array('nid'),
+  );
+  return $schema;
+}
+
+
diff -upN nodereview/nodereview.module nodereview_new/nodereview.module
--- nodereview/nodereview.module	2008-05-15 22:57:14.000000000 +0530
+++ nodereview_new/nodereview.module	2008-11-28 12:17:26.000000000 +0530
@@ -1,17 +1,18 @@
 <?php
-// $Id: nodereview.module,v 1.5.2.6 2008/05/15 17:27:14 johnforsythe Exp $
+// $Id$
 
 define('NODEREVIEW_FIVESTAR_ENABLE', module_exists('fivestar') && variable_get('nodereview_fivestar_enable', 0));
 
-require_once(
-  drupal_get_path('module', 'nodereview') . '/nodereview_node_nodereview.inc'
-);
 
-if (module_exists('views')) {
-  require_once(drupal_get_path('module', 'nodereview') . '/nodereview_views.inc');
-}
+if(!function_exists("node_object_prepare")) {
+  include_once(drupal_get_path('module', 'node') . '/node.pages.inc');
+ }
+
+ require_once(drupal_get_path('module', 'nodereview') . '/nodereview_node_nodereview.inc');
+
 
-/** 
+
+/**
  * @file
  * This module adds user reviews to specified node types, on multiple axes and with
  * voting via the Voting API module (required).  It uses the Views module
@@ -19,15 +20,14 @@ if (module_exists('views')) {
  *
  */
 
-/* ----- System hooks ----- */
 
 /**
  * Implementation of hook_help().
- * 
+ *
  */
-function nodereview_help($section) {
+function nodereview_help($path, $arg) {
 
-  // We want to show custom help text on both the add and edit pages, which 
+  // We want to show custom help text on both the add and edit pages, which
   // have very different path structures
   if ('node' == arg(0)) {
     if ('addreview' == arg(2)) {
@@ -38,8 +38,8 @@ function nodereview_help($section) {
     }
     elseif ('edit' == arg(2)) {
       // Get the type of the node we're reviewing, which is not the nid in the path
-      $type = db_result(db_query("SELECT n.type 
-        FROM {node} n 
+      $type = db_result(db_query("SELECT n.type
+        FROM {node} n
           INNER JOIN {nodereview} nr ON n.nid=nr.reviewed_nid
         WHERE nr.nid=%d", arg(1)));
 
@@ -51,13 +51,13 @@ function nodereview_help($section) {
 
 /**
  * Implementation of hook_node_info().
- * 
+ *
  */
 
 function nodereview_node_info() {
   return array(
     'nodereview' => array(
-      'name' => t('Review'), 
+      'name' => t('Review'),
       'module' => 'nodereview',
       'description' => 'A review is a user-supplied critique of another node.',
       'has_title' => TRUE,
@@ -73,7 +73,12 @@ function nodereview_node_info() {
  *
  */
 function nodereview_perm() {
-  return array('administer reviews', 'read reviews', 'submit reviews', 'edit own reviews');
+  return array(
+    'administer reviews',
+    'read reviews',
+    'submit reviews',
+    'edit own reviews'
+  );
 }
 
 /**
@@ -84,8 +89,8 @@ function nodereview_link($type, $node = 
   $links = array();
   global $user;
 
-  if ('node' == $type && 'nodereview' == $node->type) {
-  
+  if ($type == 'node' && $node->type == 'nodereview') {
+
     // Add a link back to the node being reviewed by this node
     $reviewed_type = node_get_types('type', db_result(db_query("SELECT type FROM {node} WHERE nid=%d", $node->reviewed_nid)));
     $reviewed_type = $reviewed_type->name;
@@ -104,116 +109,122 @@ function nodereview_link($type, $node = 
  * Implementation of hook_menu().
  *
  */
-function nodereview_menu($may_cache) {
+function nodereview_menu() {
   $items = array();
-
   global $user;
 
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/content/nodereview',
-      'title' => t('Review types'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => t('nodereview_configure'),
-      'access' => user_access('administer reviews'),
-    );
-    $items[] = array(
-      'path' => 'admin/content/nodereview/types',
-      'title' => t('List'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => t('nodereview_configure'),
-      'access' => user_access('administer reviews'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -1,
+  $items['admin/content/nodereview'] = array(
+    'title' => t('Review types'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('nodereview_configure'),
+    'file' => 'nodereview.admin.inc',
+    'file path' => drupal_get_path('module', 'nodereview'),
+    'access arguments' => array('administer reviews'),
+    'description' => t('Configure the axes for node type review'),
     );
-    // Hide the normal node-add page, since we never want users to see it
-    $items[] = array(
-      'path' => 'node/add/nodereview',
-      'access' => FALSE,
+
+  $items['admin/content/nodereview/types'] = array(
+    'title' => t('List'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('nodereview_configure'),
+    'file' => 'nodereview.admin.inc',
+    'file path' => drupal_get_path('module', 'nodereview'),
+    'access arguments' => array('administer reviews'),
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -1,
     );
-  }
-  else {
 
-    // Add a tab for each node type that we can review
-    // It's slow to put this here, as it should go in 
-    foreach(node_get_types() as $type => $info) {
-      if (variable_get('nodereview_use_'. $type, 0)) {
-        $items[] = array(
-          'path' => 'admin/content/nodereview/'. $type,
-          'type' => MENU_LOCAL_TASK,
-          'title' => t($info->name),
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('nodereview_configure_axes', $type),
-          'access' => user_access('administer reviews'),
-        );
-      }
-    }
 
-    // To avoid SQL overhead, check whether we are on a node page and whether the
-    // user is allowed to write reviews.
-    if (arg(0) == 'node' && is_numeric(arg(1))) {
-
-      // Only add review tabs if this is one of the nodes we want to review.
-      $type = db_result(db_query("SELECT n.type FROM {node} n WHERE n.nid = %d", arg(1)));
-
-      // Only add menu items for reviews if we're supposed to on this node type, *and* there is at least one axis defined.
-      if (variable_get('nodereview_use_' . $type, 0) && db_result(db_query("SELECT COUNT(*) FROM {nodereview_axes} WHERE node_type='%s'", $type))) {
-        $items[] = array(
-          'path' => 'node/' . arg(1) . '/reviews',
-          'callback' => 'views_page',
-          'callback arguments' => array('review list', arg(1)),
-          'type' => MENU_LOCAL_TASK,
-          'title' => t('Reviews'),
-          'weight' => 2,
-          'access' => user_access('read reviews'),
-        );
-        // The permission check is redundant, but is to avoid the SQL hit if we don't need these menu items anyway
-        if (user_access('submit reviews')) {
-          $review_nid = db_result(db_query("SELECT n.nid FROM {node} n INNER JOIN {nodereview} nr ON n.nid=nr.nid WHERE uid=%d AND reviewed_nid=%d", $user->uid, arg(1)));
-          if ($review_nid) {
-            $review_node = node_load(array('nid'=>$review_nid));
-            $items[] = array(
-              'path' => 'node/'. arg(1) .'/editreview',
-              'title' => t('Edit your review'),
-              'callback' => 'node_page_edit',
-              'callback arguments' => array($review_node),
-              'access' => user_access('edit own reviews') || user_access('administer reviews'),
-              'type' => MENU_LOCAL_TASK,
-              'weight' => 3
-            );
-          }
-          else {
-            $items[] = array(
-              'path' => 'node/'. arg(1) .'/addreview',
-              'title' => t('Add review'),
-              'callback' => 'node_add',
-              'callback arguments' => array('nodereview'),
-              'access' => user_access('submit reviews'),
-              'type' => MENU_LOCAL_TASK,
-              'weight' => 3
-            );
-          }
-        }
-      }
+  // Add a tab for each node type that we can review
+  // It's slow to put this here, as it should go in
+
+  foreach(node_get_types() as $type => $info) {
+    if(variable_get('nodereview_use_'. $type, 0)) {
+      $items['admin/content/nodereview/' . $type] = array(
+        'title callback' => 'check_plain',
+        'title arguments' => array($info->name),
+        'page callback' => 'drupal_get_form',
+        'page arguments' => array('nodereview_configure_axes', $type, $info->name),
+        'file' => 'nodereview.admin.inc',
+        'file path' => drupal_get_path('module', 'nodereview'),
+        'access arguments' => array('administer reviews'),
+        'type' => MENU_LOCAL_TASK,
+      );
+
     }
+
   }
 
+   $items['node/%/reviews'] = array(
+     'title' => t('Reviews'),
+     'page callback' => 'views_page',
+     'page arguments' => array('review_list', 'page_1', 1),
+     'access callback' => 'read_reviews_access',
+     'access arguments' => array(1),
+     'file' => 'views.module',
+     'file path' => drupal_get_path('module', 'views'),
+     'type' => MENU_LOCAL_TASK,
+     'weight' => 2,
+   );
+
+  
+
+  $items['node/%node_add_review/addreview'] = array(
+    'title' => t('Add review'),
+    'page callback' => 'node_add',
+    'page arguments' => array('nodereview'),
+    'access callback' => 'addreview_access',
+    'access arguments' => array(1),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 3,
+  );
+
+  $items['node/%node_edit_review/editreview'] = array(
+    'title' => t('Edit your review'),
+    'page callback' => 'node_page_edit',
+    'page arguments' => array(1),
+    'access arguments' => array('edit own reviews'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 3,
+  );
+
   return $items;
 }
 
+
+
+/**
+ * Implementation of hook_menu_alter()
+ *
+ */
+function nodereview_menu_alter(&$callbacks) {
+  // Hide the normal node-add page, since we never want users to see it
+  unset($callbacks['node/add/nodereview']);
+
+
+}
+
+
+
 /**
  * Implementation of hook_form_alter()
+ *
  */
-function nodereview_form_alter($form_id, &$form) {
-//   dpm($form_id);
+function nodereview_form_alter(&$form, $form_state, $form_id) {
 
-  if ('node_type_form' == $form_id) {
+  if ($form_id == 'node_type_form') {
+
+    // variable_set('nodereview_node_types', array());
     $node_type = $form['old_type']['#value'];
-    if ($node_type == 'nodereview') { // We don't use the normal submission guidelines anyway, so hide the form field for them.
+
+    // We don't use the normal submission guidelines anyway, so hide the form field for them.
+    if ($node_type == 'nodereview') {
       $form['submission']['help']['#type'] = 'value';
       $form['submission']['help']['#value'] = '';
     }
-    $form['workflow']['nodereview_use'] = array(  // The node type form automatically appends the node type to the variable name when saving
+
+    // The node type form automatically appends the node type to the variable name when saving
+    $form['workflow']['nodereview_use'] = array(
       '#type' => 'radios',
       '#title' => t('Enable user reviews'),
       '#default_value' => variable_get('nodereview_use_' . $node_type, 0),
@@ -224,48 +235,38 @@ function nodereview_form_alter($form_id,
 }
 
 
-/* ----- Menu callbacks ----- */
-
-/*
-function nodereview_add_review($reviewed_nid) {
-  //return node_add('nodereview');
+/**
+  * Implementation of hook_theme().
+  * We declare  nodereview_configure_axes so
+  * Drupal will look for a function
+  * named theme_nodereview_configure_axes().
+  */
+function nodereview_theme() {
+   return array(
+      'nodereview_configure_axes' => array(
+         'arguments' => array('form'),
+         'file' => 'nodereview.theme.inc',
+         'path' => drupal_get_path('module', 'nodereview'),
+      ),
+      'nodereview_review_body' => array(
+         'arguments' => array('review' => NULL, 'node' => NULL),
+         'file' => 'nodereview.theme.inc',
+         'path' => drupal_get_path('module', 'nodereview'),
+      ),
+      'nodereview_review_preview' => array(
+         'arguments' => array('review' => NULL, 'node' => NULL),
+         'file' => 'nodereview.theme.inc',
+         'path' => drupal_get_path('module', 'nodereview'),
+      ),
+      'nodereview_teaser' => array(
+         'arguments' => array('node' => NULL),
+         'file' => 'nodereview.theme.inc',
+         'path' => drupal_get_path('module', 'nodereview'),
+      ),
 
-  // Borrowed from node_add(), and modified as needed
-  global $user;
-  $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => 'nodereview');
- 
-  $output = node_form($node);
-  drupal_set_title(t('Submit %name', array('%name' => node_get_name($node))));
-  
-  return $output;
+   );
 }
-*/
 
-/*
-function nodereview_edit_review() {
-
-  global $user;
-
-  // We'll want the title from the real node
-  $node = node_load(arg(1));
-
-  // This code ripped straight from node_page() and tweaked
-  if (is_numeric(arg(1))) {
-    $review_nid = db_result(db_query("SELECT n.nid FROM {node} n INNER JOIN {nodereview} nr ON n.nid=nr.nid WHERE uid=%d AND reviewed_nid=%d", $user->uid, arg(1)));
-    $review_node = node_load(array('nid'=>$review_nid));
-    if ($review_node->nid) {
-      drupal_set_title(check_plain($node->title));
-      return node_form($review_node);
-    }
-    else if (db_result(db_query('SELECT nid FROM {node} WHERE nid = %d', arg(1)))) {
-      drupal_access_denied();
-    }
-    else {
-      drupal_not_found();
-    }
-  }
-}
-*/
 
 function nodereview_view_reviews($nid) {
 
@@ -277,249 +278,96 @@ function nodereview_view_reviews($nid) {
 }
 
 
-/**
- * We use this function in place of hook_settings(), because hook_settings()
- * isn't fancy enough to support what we need to do.
- * 
- */
-function nodereview_configure($type = NULL) {
-
-  $form = array();
+function nodereview_list_axes($node_type) {
+  static $axes = array();
 
-  foreach(node_get_types() as $type => $info) {
-    $options[$type] = $info->name;
-    if (variable_get('nodereview_use_'. $type, 0)) {
-      $default[] = $type;
+  if (! isset($axes[$node_type])) {
+    $result = db_query("SELECT na.aid, na.tag FROM {nodereview_axes} na WHERE na.node_type='%s'", $node_type);
+    while ($record = db_fetch_object($result)) {
+      $axes[$node_type][$record->aid] = $record->tag;
     }
   }
-
-  $form['nodereview'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Review types'),
-    '#collapsible' => FALSE,
-    '#collapsed' => FALSE,
-  );
-  $form['nodereview']['types'] = array(
-    '#type' => 'checkboxes',
-    '#title' => t('Reviewable content types'),
-    '#default_value' => $default,
-    '#options' => $options,
-    '#description' => t('Specify which content types can be reviewed.'),
-  );
-
-  if (module_exists('fivestar')) {
-    $form['fivestar'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Fivestar options'),
-      '#collapsible' => FALSE,
-      '#collapsed' => FALSE,
-      '#tree' => TRUE,
-    );
-    $form['fivestar']['enable'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Use Fivestar for reviews'),
-      '#default_value' => variable_get('nodereview_fivestar_enable', 0),
-      '#description' => t('Enabling Fivestar for reviews will replace select list options with a JavaScript star display.'),
-    );
-    $form['fivestar']['stars'] = array(
-      '#type' => 'select',
-      '#title' => t('Number of stars'),
-      '#options' => drupal_map_assoc(range(1, 10)),
-      '#default_value' => variable_get('nodereview_fivestar_stars', 5),
-    );
-  }
-
-  $form['submit'] = array(
-    '#type' => 'submit', 
-    '#value' => t('Save'),
-  );
-
-  return $form;
-
-
-
+  return $axes[$node_type];
 }
 
 
-function nodereview_configure_submit($form_id, $form_values) {
-  foreach ($form_values['types'] as $type => $checked) {
-    variable_set('nodereview_use_'. $type, (bool)$checked);
-  }
-  foreach ($form_values['fivestar'] as $option => $value) {
-    variable_set('nodereview_fivestar_'. $option, $value);
-  }
+/**
+ * Implementation of hook_node_type()
+ *
+ * To clear the cache when a content type
+ * is modified and the changes to reflect
+ * in nodereview settings page
+ *
+ */
+function nodereview_node_type($op, $info) {
+  cache_clear_all();
+  menu_rebuild();
 }
 
 
-function nodereview_configure_axes($type) {
-
-  //drupal_set_title("review for '{$type}' nodes");
-  drupal_set_title(t('Reviews for %type nodes', array('%type' => check_plain($type))));
-
-  $form['use'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('reviews'),
-      '#collapsible' => TRUE,
-      '#collapsed' => FALSE,
-  );
-  /*
-  $form['use']['use'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable reviews for this content type'),
-    '#return_value' => 1,
-    '#default_value' => variable_get('nodereview_use_'. $type, 0),
-    '#description' => t('Enable the reviewing of content of this type.  (If unchecked, the information below is ignored.)'),
-  );
-  */
-  $form['use']['node_type'] = array('#type' => 'hidden', '#value' => $type);
-  $form['use']['guide'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Usage Guide to the User'),
-    '#return_value' => 1,
-    '#default_value' => variable_get('nodereview_guide_'. $type, ''),
-    '#description' => t('Instructions to users for how to use this review.  These will be shown on the "Add Review" page. Note that if you have help text defined on admin/settings/content-types/nodereview, this value will override it.'),
-  );
+/**
+ * Implementation of hook_views_api()
+ *
+ */
+function nodereview_views_api() {
 
-  $form['axes'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('review axes'),
-    '#collapsible' => TRUE,
-    '#collapsed' => FALSE,
-    '#tree' => TRUE,
+  return array(
+    'api' => '2.0',
+    'path' =>drupal_get_path('module', 'nodereview'),
   );
-
-  // We'll store field information in its own table
-  $result = db_query("SELECT aid, tag, description, weight FROM {nodereview_axes} WHERE node_type='%s' ORDER BY weight", $type);
-  //$result = db_query("SELECT aid, tag, weight FROM {nodereview_axes} ORDER BY weight");
-
-  $axes = array();
-
-  while ($record = db_fetch_object($result)) {
-    $axes[] = _nodereview_configure_axis($record);
-  }
-
-  $record = new stdClass();
-  $record->aid = 0;
-  $record->node_type = $type;
-
-  $axes[] = _nodereview_configure_axis($record);
-
-  $form['axes'] += $axes;
-
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
-
-  return $form;
-
 }
 
-function nodereview_configure_axes_submit($form_id, $form_values) {
 
-  // Save whether or not we're reviewing this node type
-//   variable_set('nodereview_use_' . $form_values['node_type'], $form_values['use']);
-  variable_set('nodereview_guide_'. $form_values['node_type'], $form_values['guide']);
-
-  // Regardless, save the user's data, just in case they may want it later
-  foreach ($form_values['axes'] as $axis) {
-    if ($axis['aid'] && $axis['use']) {
-      // Update an existing axis
-      $axis['description'] = check_plain($axis['description']);
-      db_query("UPDATE {nodereview_axes} SET tag='%s', description='%s', weight=%d WHERE aid=%d", $axis['tag'], $axis['description'], $axis['weight'], $axis['aid']);
-    }
-    elseif ($axis['aid'] && ! $axis['use']) {
-      // Delete an existing axis
-      db_query("DELETE FROM {nodereview_axes} WHERE aid=%d", $axis['aid']);
-    }
-    elseif ($axis['use'] && ! $axis['aid']) {
-      // Create a new axis
-      $axis['description'] = check_plain($axis['description']);
-      db_query("INSERT INTO {nodereview_axes} (node_type, tag, description, weight) VALUES ('%s', '%s', '%s', %d)", $form_values['node_type'], $axis['tag'], $axis['description'], $axis['weight']);
-    }
-    else {
-      // Doesn't exist and don't use, so just ignore
-    }
+/**
+ * Menu callback
+ * Returns TRUE if no review for the current node from current user
+ * Returns FALSE if review review for the current node from current user
+ */
+function node_add_review_load($arg) {
+  global $user;
+  $add_review = FALSE;
+  $current_node = node_load($arg);
+  $type =$current_node->type;
+  $axes_count = db_result(db_query("SELECT COUNT(*) FROM {nodereview_axes} WHERE node_type='%s'", $type));
+  if (variable_get('nodereview_use_' . $type, 0) && $axes_count) {
+    $add_review = db_result(db_query("SELECT n.nid FROM {node} n INNER JOIN {nodereview} nr ON n.nid=nr.nid WHERE uid=%d AND reviewed_nid=%d", $user->uid, $arg));
   }
+  return $add_review ? FALSE : $arg;
 }
 
 
-function _nodereview_configure_axis($record) {
-
-  $form['aid'] = array(
-    '#type' => 'hidden',
-    '#value' => $record->aid,
-  );
-  $form['use'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Use axis'),
-    '#return_value' => 1,
-    '#default_value' => (boolean)($record->aid),
-    '#description' => t(''),
-  );
-  $form['tag'] = array(
-    '#type' => 'textfield',
-    '#title' => t('name'),
-    '#return_value' => 1,
-    '#default_value' => $record->tag,
-    '#size' => 30,
-  );
-  $form['description'] = array(
-    '#type' => 'textarea',
-    '#title' => t('description'),
-    '#return_value' => 1,
-    '#default_value' => $record->description,
-    '#rows' => 2,
-  );
-  $form['weight'] = array(
-    '#type' => 'weight',
-    '#title' => t('weight'),
-    '#delta' => 10,
-    '#default_value' => $record->weight,
-    '#description' => t(''),
-  );
-
-  return $form;
-}
-
-
-function nodereview_list_axes($node_type) {
-  static $axes = array();
-
-  if (! isset($axes[$node_type])) {
-    $result = db_query("SELECT na.aid, na.tag FROM {nodereview_axes} na WHERE na.node_type='%s'", $node_type);
-    while ($record = db_fetch_object($result)) {
-      $axes[$node_type][$record->aid] = $record->tag;
-    }
+/**
+ * Menu callback
+ * Returns FALSE if no review for the current node from current user
+ * Returns review node object if review for the current node exists to alter the review
+ */
+function node_edit_review_load($arg) {
+  global $user;
+  $edit_review = FALSE;
+  $current_node = node_load($arg);
+  $type =$current_node->type;
+  $axes_count = db_result(db_query("SELECT COUNT(*) FROM {nodereview_axes} WHERE node_type='%s'", $type));
+  if (variable_get('nodereview_use_' . $type, 0) && $axes_count) {
+    $edit_review = db_result(db_query("SELECT n.nid FROM {node} n INNER JOIN {nodereview} nr ON n.nid=nr.nid WHERE uid=%d AND reviewed_nid=%d", $user->uid, $arg));
   }
-  return $axes[$node_type];
+  return $edit_review ? node_load($edit_review) : FALSE;
 }
 
-
-function theme_nodereview_configure_axes($form) {
-  
-  $rows = array();
-  $output = '';
-  
-//   $output .= form_render($form['use']);
-  
-  foreach (element_children($form['axes']) as $key) {
-    $row = array();
-    // Strip out the labels on each form element, since they're redundant with the header
-    $form['axes'][$key]['use']['#title'] = '';
-    $form['axes'][$key]['tag']['#title'] = '';
-    $form['axes'][$key]['description']['#title'] = '';
-    $form['axes'][$key]['weight']['#title'] = '';
-
-    $row[] = drupal_render($form['axes'][$key]['aid']) . drupal_render($form['axes'][$key]['use']);
-    $row[] = drupal_render($form['axes'][$key]['tag']);
-    $row[] = drupal_render($form['axes'][$key]['description']);
-    $row[] = drupal_render($form['axes'][$key]['weight']);
-    $rows[] = $row;
-  }
- 
-  $header = array('use', 'name', 'description', 'weight');
-  // This is how we get the table to be "inside" the fieldset
-  $form['axes']['#children'] = theme('table', $header, $rows);
-  $output .= drupal_render($form);
-  return $output;
- 
+/**
+ * Custom access menucallback for add review
+ */
+function addreview_access($arg) {
+  $current_node = node_load($arg);
+  $type =$current_node->type;
+  $axes_count = db_result(db_query("SELECT COUNT(*) FROM {nodereview_axes} WHERE node_type='%s'", $type));
+  return variable_get('nodereview_use_' . $type, 0) && $axes_count && user_access('submit reviews');
 }
 
+/**
+ * Custom access menucallback for read review
+ */
+function read_reviews_access($arg) {
+  $current_node = node_load($arg);
+  $type =$current_node->type;
+  return variable_get('nodereview_use_' . $type, 0) && user_access('read reviews');
+}
diff -upN nodereview/nodereview_node_nodereview.inc nodereview_new/nodereview_node_nodereview.inc
--- nodereview/nodereview_node_nodereview.inc	2008-05-15 22:57:14.000000000 +0530
+++ nodereview_new/nodereview_node_nodereview.inc	2008-11-28 12:17:26.000000000 +0530
@@ -1,7 +1,12 @@
 <?php
-// $Id: nodereview_node_nodereview.inc,v 1.6.2.3 2008/05/15 17:27:14 johnforsythe Exp $
+// $Id$
+
+/**
+ * @file
+ * Used to build the nodereview content type form
+ *
+ */
 
-/* ----- Node hooks ----- */
 
 /**
  * Implementation of hook_access().
@@ -37,8 +42,9 @@ function nodereview_access($op, $node) {
 function nodereview_form(&$node) {
 
   // This is for the LOCAL_TASK version, node/nid/addreview
-  if (! $node->reviewed_nid) $node->reviewed_nid = arg(1);
-
+  if (!$node->reviewed_nid) {
+    $node->reviewed_nid = arg(1);
+  }
   $node_info = node_get_types('type', 'nodereview');
 
   $form['reviewed_nid'] = array(
@@ -55,19 +61,13 @@ function nodereview_form(&$node) {
 
   $reviewed_node = node_load(array('nid'=>$node->reviewed_nid));
 
-  $votes = array();
-  $votes_obj = votingapi_get_user_votes('node', $node->reviewed_nid, $node->uid);
-  foreach ($votes_obj as $vote) {
-    $votes[$vote->tag] = $vote->value;
-  }
-
   $form['reviews']['#tree'] = TRUE;
   $form['reviews']['#weight'] = 0;
 
   $result = db_query("SELECT * FROM {nodereview_axes} WHERE node_type ='%s' ORDER BY weight, tag", $reviewed_node->type);
 
   while ($record = db_fetch_object($result)) {
-    _nodereview_form_review($form, $record, $node->reviews, $votes);
+    _nodereview_form_review($form, $record, $node);
   }
 
   // We'll use a single filter format for all textareas on the page
@@ -78,7 +78,7 @@ function nodereview_form(&$node) {
 
 /**
  * Add the review axis to the node edit form
- * 
+ *
  * @param $form
  *  The form object for the node edit form
  * @param $axis
@@ -88,8 +88,8 @@ function nodereview_form(&$node) {
  * @param $votes
  *  An array of votes (scores) for this review, keyed by axis name
  */
-function _nodereview_form_review(&$form, $axis, $reviews, $votes) {
-  
+//function _nodereview_form_review(&$form, $axis, $reviews, $votes) {
+function _nodereview_form_review(&$form, $axis, $node) {
   static $options;
   if (!isset($options)) {
     $options = array(
@@ -99,7 +99,7 @@ function _nodereview_form_review(&$form,
       40 => 4,
       50 => 5,
       60 => 6,
-      70 => 7, 
+      70 => 7,
       80 => 8,
       90 => 9,
       100 => 10,
@@ -110,12 +110,13 @@ function _nodereview_form_review(&$form,
     '#title' => $axis->tag,
     '#collapsible' => TRUE,
     '#collapsed' => FALSE,
-  ); 
+  );
+
   $form['reviews'][$axis->aid]['score'] = array(
     '#type' => 'select',
     '#title' => t('Score'),
     '#options' => $options,
-    '#default_value' => $votes[$axis->tag] ? $votes[$axis->tag] : 50,
+    '#default_value' => $node->reviews[$axis->aid]['score'] ? $node->reviews[$axis->aid]['score'] : 50,
     '#description' => $axis->description,
     '#required' => TRUE,
   );
@@ -128,10 +129,9 @@ function _nodereview_form_review(&$form,
   $form['reviews'][$axis->aid]['review'] = array(
     '#type' => 'textarea',
     '#title' => t('Review'),
-    '#default_value' => $reviews[$axis->aid]->review,
+    '#default_value' => $node->reviews[$axis->aid]['review'],
     '#required' => TRUE,
   );
- 
 }
 
 
@@ -140,7 +140,6 @@ function _nodereview_form_review(&$form,
  *
  */
 function nodereview_validate(&$node) {
-
   if (! $node->reviewed_nid || ! db_result(db_query("SELECT Count(*) FROM {node} WHERE nid=%d", $node->reviewed_nid))) {
     // There is no such node, so error
     form_set_error('reviewed_nid', t('The node you are trying to review does not exist.'));
@@ -160,27 +159,34 @@ function nodereview_validate(&$node) {
  *
  */
 function nodereview_load($node) {
-
   // Get the basic information from the nodereview node table
   $additions = db_fetch_object(db_query('SELECT reviewed_nid FROM {nodereview} WHERE nid = %d', $node->nid));
-
   // And now get the actual review info.  The numeric scores are stored with voteapi,
   // while textual reviews are in our own auxiliary table.  We need to merge them properly
 
-  $votes_obj = votingapi_get_user_votes('node', $additions->reviewed_nid, $node->uid);
+  $criteria = array(
+    'content_type' => 'node',
+    'content_id' => $additions->reviewed_nid,
+    'uid' => $node->uid,
+  );
+
+  $votes_obj = votingapi_select_votes($criteria);
+
+
+  //  $votes_obj = votingapi_get_user_votes('node', $additions->reviewed_nid, $node->uid);
   $votes = array();
   foreach ($votes_obj as $vote) {
-    $votes[$vote->tag] = $vote;
+    $votes[$vote['tag']] = $vote;
   }
 
+
   $additions->reviews = array();
   $result = db_query('SELECT nr.aid, tag, review FROM {nodereview_reviews} nr INNER JOIN {nodereview_axes} na ON nr.aid=na.aid WHERE nid = %d ORDER BY na.weight, na.tag', $node->nid);
   while ($record = db_fetch_object($result)) {
     // Add in the numeric scores
-    $record->score = $votes[$record->tag]->value;
-    $additions->reviews[$record->aid] = $record;
+    $record->score = $votes[$record->tag]['value'];
+    $additions->reviews[$record->aid] = (array)$record;
   }
-
   return $additions;
 }
 
@@ -190,9 +196,7 @@ function nodereview_load($node) {
  *
  */
 function nodereview_insert($node) {
-
   db_query("INSERT INTO {nodereview} (nid, reviewed_nid) VALUES (%d, %d)", $node->nid, $node->reviewed_nid);
-
   nodereview_save_reviews($node);
 }
 
@@ -213,27 +217,17 @@ function nodereview_save_reviews($node) 
 
   $votes = array();
 
-  /*
-  $result = db_query("SELECT na.aid, na.tag
-                        FROM {nodereview_axes} na
-                          INNER JOIN {node} n ON na.node_type=n.type
-                        WHERE n.nid=%d", $node->reviewed_nid);
-  while ($record = db_fetch_object($result)) {
-    $axes[$record->aid] = $record->tag;
-  }
-  */
-
   $axes = nodereview_list_axes(db_result(db_query("SELECT type FROM {node} WHERE nid=%d", $node->reviewed_nid)));
-
   foreach ($node->reviews as $aid => $review) {
     // Save the text review
     db_query("INSERT INTO {nodereview_reviews} (nid, aid, review) VALUES (%d, %d, '%s')", $node->nid, $aid, $review['review']);
 
     // And use the votingapi to save the score
-    $votes[] = (object)array('value'=>$review['score'], 'tag'=>$axes[$aid]);
-  }
+    $votes[] = array('value'=>$review['score'], 'tag'=>$axes[$aid], 'content_type' => 'node', 'content_id' => $node->reviewed_nid);
 
-  votingapi_set_vote('node', $node->reviewed_nid, $votes, $node->uid);
+  }
+  //  votingapi_set_vote('node', $node->reviewed_nid, $votes, $node->uid);
+  votingapi_set_votes($votes);
 }
 
 /**
@@ -244,8 +238,16 @@ function nodereview_delete($node) {
   db_query('DELETE FROM {nodereview} WHERE nid = %d', $node->nid);
   db_query('DELETE FROM {nodereview_reviews} WHERE nid=%d', $node->nid);
 
+
+ $criteria = array(
+    'content_type' => 'node',
+    'content_id' => $node->reviewed_nid,
+    'uid' => $node->uid,
+  );
+
+  $vote_obj = votingapi_select_votes($criteria);
   // Delete the votes in the votingapi associated with this node
-  votingapi_delete_votes(votingapi_get_user_votes('node', $node->reviewed_nid, $node->uid));
+  votingapi_delete_votes($vote_obj);
   votingapi_recalculate_results('node', $node->reviewed_nid);
 }
 
@@ -256,19 +258,17 @@ function nodereview_delete($node) {
  */
 function nodereview_view($node, $teaser = FALSE, $page = FALSE) {
   //$node = node_prepare($node, $teaser);
-
   $aids = array_keys($node->reviews);
   $num_aids = sizeof($aids);
-
   // Previews are just plain ugly, because the $node object is not really a node
   // but a mutated $_POST.  It has to be handled completely differently.
-  if ($node->in_preview) {
 
+  if ($node->op == 'Preview') {
     // We have to load in our axis data, which the $_POST doesn't have but we need
-    $result = db_query("SELECT tag, aid 
-      FROM {nodereview_axes} na 
-        INNER JOIN {node} n ON na.node_type=n.type
-      WHERE n.nid=%d", $node->reviewed_nid);
+    $result = db_query("SELECT tag, aid
+                        FROM {nodereview_axes} na
+                        INNER JOIN {node} n ON na.node_type=n.type
+                        WHERE n.nid=%d", $node->reviewed_nid);
     while ($record = db_fetch_array($result)) {
       $node->reviews[$record['aid']]['tag'] = $record['tag'];
     }
@@ -285,82 +285,22 @@ function nodereview_view($node, $teaser 
 
     // Do a markup check on the fields
     for ($i=0; $i < $num_aids; $i++) {
-      $node->reviews[$aids[$i]]->review = check_markup($node->reviews[$aids[$i]]->review);
+      $node->reviews[$aids[$i]]['review'] = check_markup($node->reviews[$aids[$i]]['review']);
     }
-
     if ($teaser) {
       $node->content['reviews'] = array(
           '#value' => theme('nodereview_teaser', $node),
         );
     }
-
     if ($page) {
       foreach ($node->reviews as $review) {
-        $node->content['reviews'][$review->tag] = array(
+        $node->content['reviews'][$review['tag']] = array(
           '#value' => theme('nodereview_review_body', $review, $node),
         );
       }
     }
 
-    return $node;
-  }
-}
-
-/* ----- Theme functions ----- */
-
-function theme_nodereview_review_body($review, $node) {
-  $output = '';
-
-  $title = $review->tag;
-  if (NODEREVIEW_FIVESTAR_ENABLE) {
-    $output = theme('fivestar_static', $review->score, variable_get('nodereview_fivestar_stars', 5));
-  }
-  else {
-    $title .= ': ' . $review->score/10 . '/10';
-  }
-  $output = theme('box', $title, $output . $review->review);
 
-  return $output;
-}
-
-function theme_nodereview_review_preview($review, $node) {
-  $output = '';
-
-  $title = $review['tag'];
-  if (NODEREVIEW_FIVESTAR_ENABLE) {
-    $output = theme('fivestar_static', $review['score']);
-  }
-  else {
-    $title .= ': ' . $review['score']/10 . '/10';
-  }
-  $output = theme('box', $title, $output . check_markup($review['review'], $node->format));
-
-  return $output;
-}
-
-function theme_nodereview_teaser($node) {
-  $output = '';
-  static $header;
-
-  // Presumably teaser will be called multiple times on different nodes
-  // on the same page, so static cache the static strings
-  if (!isset($header)) {
-    $header = array(t('axis'), t('score'), t('review'));
-  }
-
-  foreach ($node->reviews as $review) {
-    $row = array();
-    $row[] = $review->tag;
-    if (NODEREVIEW_FIVESTAR_ENABLE) {
-      $row[] = theme('fivestar_static', $review->score, variable_get('nodereview_fivestar_stars', 5));
-    }
-    else {
-      $row[] = $review->score/10 . '/10';
-    }
-    $row[] = truncate_utf8($review->review, 50, TRUE, TRUE);
-    $rows[] = $row;
+    return $node;
   }
-
-  $output = theme('table', $header, $rows, array('class'=>'review-teaser'));
-  return $output;
 }
diff -upN nodereview/nodereview.theme.inc nodereview_new/nodereview.theme.inc
--- nodereview/nodereview.theme.inc	1970-01-01 05:30:00.000000000 +0530
+++ nodereview_new/nodereview.theme.inc	2008-11-28 12:17:26.000000000 +0530
@@ -0,0 +1,116 @@
+<?php
+  //$Id$
+
+/**
+ * Implementation of theme_nodereview_configure_axes()
+ * We declare this function to theme the axes in table
+ * format
+ */
+function theme_nodereview_configure_axes($form) {
+
+  $rows = array();
+  $output = '';
+  foreach (element_children($form['axes']) as $key) {
+    $row = array();
+    // Strip out the labels on each form element, since they're redundant with the header
+    $form['axes'][$key]['use']['#title'] = '';
+    $form['axes'][$key]['tag']['#title'] = '';
+    $form['axes'][$key]['description']['#title'] = '';
+    $form['axes'][$key]['weight']['#title'] = '';
+
+    $row[] = drupal_render($form['axes'][$key]['aid']) . drupal_render($form['axes'][$key]['use']);
+    $row[] = drupal_render($form['axes'][$key]['tag']);
+    $row[] = drupal_render($form['axes'][$key]['description']);
+    $row[] = drupal_render($form['axes'][$key]['weight']);
+    $rows[] = $row;
+  }
+
+  $header = array('use', 'name', 'description', 'weight');
+
+  // This is how we get the table to be "inside" the fieldset
+  $form['axes']['#children'] = theme('table', $header, $rows);
+
+  $output .= drupal_render($form);
+  return $output;
+}
+
+/**
+ * Implementation of  theme_nodereview_review_body
+ * We declare this function to theme the full node
+ * view
+ *
+ */
+
+function theme_nodereview_review_body($review, $node) {
+  //Logger::debug_var('review', $review);
+
+  $output = '';
+
+  $title = $review['tag'];
+  if (NODEREVIEW_FIVESTAR_ENABLE) {
+    $output = theme('fivestar_static', $review['score'], variable_get('nodereview_fivestar_stars', 5));
+  }
+  else {
+    $title .= ': ' . $review['score']/10 . '/10';
+  }
+  $output = theme('box', $title, $output . $review['review']);
+
+  return $output;
+}
+
+
+/**
+ * Implementation of  theme_nodereview_review_preview
+ * We declare this function to theme the node preview
+ *
+ */
+
+function theme_nodereview_review_preview($review, $node) {
+  $output = '';
+
+  $title = $review['tag'];
+  if (NODEREVIEW_FIVESTAR_ENABLE) {
+    $output = theme('fivestar_static', $review['score']);
+  }
+  else {
+    $title .= ': ' . $review['score']/10 . '/10';
+  }
+  $output = theme('box', $title, $output . check_markup($review['review'], $node->format));
+
+  return $output;
+}
+
+
+/**
+ * Implementation of  theme_nodereview_teaser
+ * We declare this function to theme the node teaser
+ * view
+ *
+ */
+
+function theme_nodereview_teaser($node) {
+  $output = '';
+  static $header;
+
+  // Presumably teaser will be called multiple times on different nodes
+  // on the same page, so static cache the static strings
+  if (!isset($header)) {
+    $header = array(t('axis'), t('score'), t('review'));
+  }
+
+  foreach ($node->reviews as $review) {
+    $row = array();
+    $row[] = $review['tag'];
+    if (NODEREVIEW_FIVESTAR_ENABLE) {
+      $row[] = theme('fivestar_static', $review['score'], variable_get('nodereview_fivestar_stars', 5));
+    }
+    else {
+      $row[] = $review['score']/10 . '/10';
+    }
+    $row[] = truncate_utf8($review['review'], 50, TRUE, TRUE);
+    $rows[] = $row;
+  }
+
+  $output = theme('table', $header, $rows, array('class'=>'review-teaser'));
+  return $output;
+}
diff -upN nodereview/nodereview.views_default.inc nodereview_new/nodereview.views_default.inc
--- nodereview/nodereview.views_default.inc	1970-01-01 05:30:00.000000000 +0530
+++ nodereview_new/nodereview.views_default.inc	2008-11-28 12:17:26.000000000 +0530
@@ -0,0 +1,148 @@
+<?php
+
+  //$Id$
+
+/**
+ * Implementation of hook_views_default_views().
+ */
+function nodereview_views_default_views() {
+
+$view = new view;
+$view->name = 'review_list';
+$view->description = 'A list of teasers for reviews of a given node';
+$view->tag = 'nodereview';
+$view->view_php = '';
+$view->base_table = 'node';
+$view->is_cacheable = FALSE;
+$view->api_version = 2;
+$view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */
+$handler = $view->new_display('default', 'Defaults', 'default');
+$handler->override_option('fields', array(
+  'title' => array(
+    'label' => 'Title',
+    'link_to_node' => 1,
+    'exclude' => 0,
+    'id' => 'title',
+    'table' => 'node',
+    'field' => 'title',
+    'override' => array(
+      'button' => 'Override',
+    ),
+    'relationship' => 'none',
+  ),
+  'changed' => array(
+    'label' => 'Updated',
+    'date_format' => 'small',
+    'custom_date_format' => '',
+    'exclude' => 0,
+    'id' => 'changed',
+    'table' => 'node',
+    'field' => 'changed',
+    'override' => array(
+      'button' => 'Override',
+    ),
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('sorts', array(
+  'changed' => array(
+    'order' => 'DESC',
+    'granularity' => 'second',
+    'id' => 'changed',
+    'table' => 'node',
+    'field' => 'changed',
+    'override' => array(
+      'button' => 'Override',
+    ),
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('arguments', array(
+  'reviewed_nid' => array(
+    'default_action' => 'not found',
+    'style_plugin' => 'default_summary',
+    'style_options' => array(),
+    'wildcard' => '',
+    'wildcard_substitution' => '',
+    'title' => '',
+    'default_argument_type' => 'fixed',
+    'default_argument' => '',
+    'validate_type' => 'none',
+    'validate_fail' => 'not found',
+    'break_phrase' => 0,
+    'not' => 0,
+    'id' => 'reviewed_nid',
+    'table' => 'nodereview',
+    'field' => 'reviewed_nid',
+    'relationship' => 'none',
+    'default_options_div_prefix' => '',
+    'default_argument_user' => 0,
+    'default_argument_fixed' => '',
+    'default_argument_php' => '',
+    'validate_argument_node_type' => array(
+      'nodereview' => 0,
+      'page' => 0,
+      'story' => 0,
+    ),
+    'validate_argument_node_access' => 0,
+    'validate_argument_nid_type' => 'nid',
+    'validate_argument_vocabulary' => array(),
+    'validate_argument_type' => 'tid',
+    'validate_argument_php' => '',
+  ),
+));
+$handler->override_option('filters', array(
+  'type' => array(
+    'operator' => 'in',
+    'value' => array(
+      'nodereview' => 'nodereview',
+    ),
+    'group' => '0',
+    'exposed' => FALSE,
+    'expose' => array(
+      'operator' => FALSE,
+      'label' => '',
+    ),
+    'id' => 'type',
+    'table' => 'node',
+    'field' => 'type',
+    'override' => array(
+      'button' => 'Override',
+    ),
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('access', array(
+  'type' => 'none',
+));
+$handler->override_option('title', 'Reviews');
+$handler->override_option('empty', 'No reviews have been submitted.  Maybe you should be the first?');
+$handler->override_option('empty_format', '1');
+$handler->override_option('use_pager', '1');
+$handler->override_option('distinct', 0);
+$handler->override_option('style_options', NULL);
+$handler->override_option('row_plugin', 'node');
+$handler->override_option('row_options', array(
+  'teaser' => 1,
+  'links' => 1,
+  'comments' => 0,
+));
+$handler = $view->new_display('page', 'Reviews', 'page_1');
+$handler->override_option('path', 'node/%/reviews');
+$handler->override_option('menu', array(
+  'type' => 'none',
+  'title' => '',
+  'weight' => 0,
+  'name' => 'navigation',
+));
+$handler->override_option('tab_options', array(
+  'type' => 'none',
+  'title' => '',
+  'weight' => 0,
+));
+
+ $views[$view->name] = $view;
+  return $views;
+}
+
+
diff -upN nodereview/nodereview_views.inc nodereview_new/nodereview_views.inc
--- nodereview/nodereview_views.inc	2007-02-25 08:20:10.000000000 +0530
+++ nodereview_new/nodereview_views.inc	1970-01-01 05:30:00.000000000 +0530
@@ -1,153 +0,0 @@
-<?php
-// $Id: nodereview_views.inc,v 1.5 2007/02/25 02:50:10 crell Exp $
-
-/* ----- Views API ----- */
-
-function nodereview_views_tables() {
- 
-  $tables['nodereview'] = array(
-    'name' => 'nodereview',
-    'provider' => 'nodereview',
-    'join' => array(
-      'left' => array(
-        'table' => 'node',
-        'field' => 'nid',
-      ),
-      'right' => array(
-        'field' => 'nid'
-      ),
-    ),
-    'filters' => array(
-      'reviewed_nid' => array(
-         'name' => t('Review: Reviewed Node'),
-         'list' => 'nodereview_views_handler_filter_reviewed_node',
-         'operator' => 'views_handler_operator_andor',
-         'help' => t('This allows you to filter reviews based on the reviewed node.'),
-      ),
-    ),
-  );
-  
-  return $tables;
-}
-
-function nodereview_views_arguments() {
-  $arguments = array(
-    'reviewed_node' => array(
-      'name' => t("Review: Reviewed Node ID"), 
-      'handler' => "nodereview_views_handler_arg_reviewed_node",
-    ),
-  );
-  return $arguments;
-}
-
-function nodereview_views_handler_arg_reviewed_node($op, & $query, $argtype, $arg = '') {
-  switch ($op) {
-    case 'summary' :
-      $query->ensure_table("nodereview");
-      $query->add_field("reviewed_nid");
-      $fieldinfo['field'] = "nodereview.reviewed_nid";
-      return $fieldinfo;
-    case 'sort':
-      //$query->add_orderby('book', 'weight', $argtype);
-      //$query->add_orderby('book_parent_node', 'title', $argtype);
-      break;
-    case 'filter' :
-      $query->ensure_table("nodereview");
-      $query->add_where("reviewed_nid = '$arg'");
-      $query->add_where("nodereview.nid = node.nid");
-      break;
-    case 'link' :
-      return l($query->title, "$arg/$query->nid");
-    case 'title' :
-      if ($query) {
-        $term = db_fetch_object(db_query("SELECT title FROM {node} WHERE nid = '%d'", $query));
-        return $term->title;
-      }
-  }
-}
-
-function nodereview_views_handler_filter_reviewed_node() {
-  $reviewed_nids = array();
-
-  $result = db_query("SELECT DISTINCT reviewed_nid FROM {nodereview} ORDER BY reviewed_nid");
-  while ($obj = db_fetch_object($result)) {
-    $reviewed_nids[$obj->reviewed_nid] = "$obj->reviewed_nid";
-  }
-  return $reviewed_nids;
-}
-
-
-function nodereview_views_default_views() {
-  $view = new stdClass();
-  $view->name = 'review_list';
-  $view->description = 'A list of teasers for reviews of a given node';
-  $view->access = array (
-    0 => '1',
-    1 => '2',
-  );
-  $view->view_args_php = '';
-  $view->page = TRUE;
-  $view->page_title = '%1';
-  $view->page_header = '';
-  $view->page_header_format = '1';
-  $view->page_footer = '';
-  $view->page_footer_format = '1';
-  $view->page_empty = 'No reviews have been submitted.  Maybe you should be the first?';
-  $view->page_empty_format = '1';
-  $view->page_type = 'teaser';
-  $view->url = 'node/$arg/reviews';
-  $view->use_pager = TRUE;
-  $view->nodes_per_page = '10';
-  $view->sort = array (
-    array (
-      'tablename' => 'node',
-      'field' => 'changed',
-      'sortorder' => 'DESC',
-      'options' => '',
-    ),
-  );
-  $view->argument = array (
-    array (
-      'type' => 'reviewed_node',
-      'argdefault' => '1',
-      'title' => '',
-      'options' => '',
-      'wildcard' => '',
-      'wildcard_substitution' => '',
-    ),
-  );
-  $view->field = array (
-    array (
-      'tablename' => 'node',
-      'field' => 'changed',
-      'label' => 'updated',
-      'handler' => 'views_handler_field_date_small',
-      'defaultsort' => 'DESC',
-    ),
-    array (
-      'tablename' => 'node',
-      'field' => 'title',
-      'label' => 'title',
-      'handler' => 'views_handler_field_nodelink_with_mark',
-      'options' => 'link',
-    ),
-  );
-  $view->filter = array (
-    array (
-      'tablename' => 'node',
-      'field' => 'type',
-      'operator' => 'OR',
-      'options' => '',
-      'value' => array (
-        0 => 'nodereview',
-      ),
-    ),
-  );
-  $view->exposed_filter = array (
-  );
-  $view->requires = array(node);
-  $views[$view->name] = $view;
-
-  
-  return $views;
-}
diff -upN nodereview/nodereview.views.inc nodereview_new/nodereview.views.inc
--- nodereview/nodereview.views.inc	1970-01-01 05:30:00.000000000 +0530
+++ nodereview_new/nodereview.views.inc	2008-11-28 12:17:26.000000000 +0530
@@ -0,0 +1,26 @@
+<?php
+
+//$Id$
+
+function nodereview_views_data() {
+  $data['nodereview']['table']['group']  =t('Node Review');
+  $data['nodereview']['table']['join']['node'] = array(
+    'left_field' => 'nid',
+    'field' => 'nid',
+  );
+
+  $data['nodereview']['reviewed_nid'] = array(
+    'title' => t('Reviewed Node'),
+    'help' => t('The node which is reviewed.'),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+      'numeric' => TRUE,
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_numeric',
+      'numeric' => TRUE,
+    ),
+
+  );
+  return $data;
+}
