Browse Source

Removed old hook_views_data and hook_views_alter from all modules as the views integration now handles integrating all of the tables. Those were older functions used before views integration was completed. Also, fixed the joins of linker tables with nodes to be recipricol with base tables. If you used node as the base table you couldn't join on the corresponding chado table. That's fixed

spficklin 11 years ago
parent
commit
fdd548a327

+ 0 - 116
tripal_analysis/tripal_analysis.views.inc

@@ -15,122 +15,6 @@
  * @ingroup views
  */
 
-/**
- * Implements hook_views_data()
- *
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_analysis_views
- */
-function tripal_analysis_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    // Base Table: Analysis
-    $tablename = 'analysis';
-    // get the setup with the lightest priority. That's the table
-    // that currently integrated with views.
-    $priority = 9;
-
-    // check to see if the table is integrated. If it is then integrate it's
-    // corresponding 'chado_[table]' table.
-    if (!tripal_views_is_integrated($tablename, $priority)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-      // Make table-specific modifications
-      $table_integration_array['fields']['program']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-      $table_integration_array['fields']['algorithm']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-
-      // Add in node relationships if chado is in the same db as drupal
-      if (tripal_core_chado_schema_exists()) {
-        $integrations = tripal_views_add_node_relationship_to_chado_table_integration($table_integration_array);
-        foreach ($integrations as $integration) {
-          tripal_views_integration_add_entry($integration);
-        }
-      }
-      else {
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-
-    $tables = array(
-      'analysisfeature',
-      'analysisprop'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-  }
-
-  return $data;
-}
-
-/**
- * Implements hook_views_handlers()
- *
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return
- *   An array of handler definitions
- *
- * @ingroup tripal_analysis_views
- */
-function tripal_analysis_views_views_handlers() {
-  return array(
-    'info' => array(
-      'path' => drupal_get_path('module', 'tripal_analysis') . '/views/handlers',
-    ),
-    'handlers' => array(
-      'views_handler_field_computed_analysis_nid' => array(
-        'parent' => 'views_handler_field_numeric',
-      ),
-      'views_handler_field_readable_date' => array(
-        'parent' => 'views_handler_field',
-      ),
-    ),
-  );
-}
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_analysis_views_data_alter(&$data) {
-
-  if (!(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['analysis_chado_nid'] = array(
-      'group' => 'Analysis',
-      'title' => 'Analysis Node',
-      'help' => 'Links Chado analysis Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_analysis',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
 /**
  * Implements hook_views_default_views().
  *

+ 0 - 69
tripal_contact/tripal_contact.views.inc

@@ -10,76 +10,7 @@
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
-/*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_contact
- */
-function tripal_contact_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-
-    // Base Table: contact
-    $tablename = 'contact';
-    $priority = 9;
-
-    // check to see if the table is integrated. If it is then integrate it's
-    // corresponding 'chado_[table]' table.
-    if (!tripal_views_is_integrated($tablename, $priority)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-      $status = tripal_views_integration_add_entry($table_integration_array);
-        if (!$status) {
-          drupal_set_message(t('Tripal Contact is unable to integrate %table', array('%table' => $tablename)), 'error');
-        }
-    }
-
-    // Additional tables
-    $tables = array(
-      'contact_relationship',
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        $status = tripal_views_integration_add_entry($table_integration_array);
-        if (!$status) {
-          drupal_set_message(t('Tripal Contact is unable to integrate %table', array('%table' => $tablename)), 'error');
-        }
-      }
-    }
-  }
 
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return: An array of handler definitions
- *
- * @ingroup tripal_contact
- */
-function tripal_contact_views_handlers() {
-  return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_contact') . '/views/handlers',
-  ),
-   'handlers' => array(
-
-  ),
-  );
-}
 
 /**
  *

+ 1 - 1
tripal_core/api/tripal_core_chado.api.inc

@@ -3378,7 +3378,7 @@ function tripal_get_chado_custom_schema($table) {
 }
 
 /**
- * Check that the Chado schema exists
+ * Check that the Chado schema exists within the local database
  *
  * @return
  *   TRUE/FALSE depending upon whether it exists

+ 0 - 90
tripal_cv/tripal_cv.views.inc

@@ -15,96 +15,6 @@
  * @ingroup views
  */
 
-/**
- * Implements hook_views_data()
- *
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return
- *   a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_cv_views
- */
-function tripal_cv_views_data() {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    // Base Tables
-    $tables = array(
-      'cv',
-      'cvterm'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        // get default integration array
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // add specialty handlers
-        if ($tablename == 'cvterm') {
-          $table_integration_array['fields']['name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-        }
-        elseif ($tablename == 'cv') {
-          $table_integration_array['fields']['name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-        }
-
-        // add integration
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-    // Additional Tables
-    $tables = array(
-      'cvterm_dbxref',
-      'cvterm_relationship',
-      'cvtermpath',
-      'cvtermprop',
-      'cvtermsynonym'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-  }
-
-  return $data;
-}
-
-/**
- * Implements hook_views_handlers()
- *
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return: An array of handler definitions
- *
- * @ingroup tripal_cv_views
- */
-function tripal_cv_views_handlers() {
-  return array(
-    'info' => array(
-      'path' => drupal_get_path('module', 'tripal_cv') . '/views/handlers',
-    ),
-    'handlers' => array(
-      'views_handler_field_tf_boolean' => array(
-       'parent' => 'views_handler_field',
-      ),
-    ),
-  );
-}
-
 /**
  *
  * @ingroup tripal_cv_views

+ 0 - 53
tripal_db/tripal_db.views.inc

@@ -15,59 +15,6 @@
  * @ingroup views
  */
 
-/**
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_db_views
- */
-function tripal_db_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    // Base Tables
-    $tables = array(
-      'db',
-      'dbxref'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // add specialty handlers
-        if ($tablename == 'db') {
-          $table_integration_array['fields']['name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-        }
-
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-    // Additional Tables
-    $tables = array(
-      'dbxrefprop'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-
-}
 
 /**
  *

+ 3 - 107
tripal_feature/tripal_feature.views.inc

@@ -15,83 +15,6 @@
  * @ingroup views
  */
 
-/**
- * Implements hook_views_data()
- *
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_feature_views
- */
-function tripal_feature_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'feature',
-    );
-
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // Add in node relationships if chado is in the same db as drupal
-        if (tripal_core_chado_schema_exists()) {
-          $integrations = tripal_views_add_node_relationship_to_chado_table_integration($table_integration_array);
-          foreach ($integrations as $integration) {
-            tripal_views_integration_add_entry($integration);
-          }
-        }
-        else {
-          tripal_views_integration_add_entry($table_integration_array);
-        }
-
-      }
-    }
-
-    $tables = array(
-      'feature_cvterm',
-      'feature_cvterm_dbxref',
-      'feature_cvterm_pub',
-      'feature_cvtermprop',
-      'feature_dbxref',
-      'feature_pub',
-      'feature_pubprop',
-      'feature_relationship',
-      'feature_relationship_pub',
-      'feature_relationshipprop',
-      'feature_relationshipprop_pub',
-      'feature_synonym',
-      'featureloc',
-      'featureloc_pub',
-      'featureprop',
-      'featureprop_pub',
-      'featuremap',
-      'featuremap_pub',
-      'featurepos',
-      'featurerange'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-}
-
 /**
  * Implements hook_views_handlers()
  *
@@ -109,39 +32,12 @@ function tripal_feature_views_handlers() {
       'path' => drupal_get_path('module', 'tripal_feature') . '/views_handlers',
     ),
     'handlers' => array(
-    'views_handler_field_residues' => array(
-      'parent' => 'views_handler_field',
-    ),
+      'views_handler_field_residues' => array(
+        'parent' => 'views_handler_field',
+      ),
     ),
   );
 }
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_feature_views_data_alter(&$data) {
-
-  if ( !(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['feature_chado_nid'] = array(
-      'group' => 'Feature',
-      'title' => 'Feature Node',
-      'help' => 'Links Chado Feature Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_feature',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
 /**
  *
  * @ingroup tripal_feature_views

+ 0 - 110
tripal_featuremap/tripal_featuremap.views.inc

@@ -15,116 +15,6 @@
  * @ingroup views
  */
 
-/*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_featuremap_views
- */
-function tripal_featuremap_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'featuremap'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // Add custom handle to handle type_ids
-        $table_integration_array['fields']['unittype_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
-
-        // Add in node relationships if chado is in the same db as drupal
-        if (tripal_core_chado_schema_exists()) {
-          $integrations = tripal_views_add_node_relationship_to_chado_table_integration($table_integration_array);
-          foreach ($integrations as $integration) {
-            tripal_views_integration_add_entry($integration);
-          }
-        }
-        else {
-          tripal_views_integration_add_entry($table_integration_array);
-        }
-
-      }
-    }
-
-    $tables = array(
-      'map_cvterm',
-      'map_feature',
-      'map_pub',
-      'map_synonym',
-      'mapprop'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- * @return: An array of handler definitions
- *
- * @ingroup tripal_featuremap_views
- */
-function tripal_featuremap_views_handlers() {
-  return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_featuremap') . '/views/handlers',
-      ),
-   'handlers' => array(
-     'views_handler_field_computed_map_nid' => array(
-       'parent' => 'views_handler_field_numeric',
-      ),
-    ),
-  );
-}
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_featuremap_views_data_alter(&$data) {
-
-  if ( !(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['map_chado_nid'] = array(
-      'group' => 'Map',
-      'title' => 'Map Node',
-      'help' => 'Links Chado Map Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_map',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
 /**
  *
  *

+ 0 - 77
tripal_genetic/tripal_genetic.views.inc

@@ -15,83 +15,6 @@
  * @ingroup views
  */
 
-/*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_genetic
- */
-function tripal_genetic_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'environment',
-      'genotype',
-      'phenstatement'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-        $status = tripal_views_integration_add_entry($table_integration_array);
-        if (!$status) {
-          drupal_set_message(t('Tripal Genetic is unable to integrate %table', array('%table' => $tablename)), 'error');
-        }
-      }
-    }
-
-    $tables = array(
-      'environment_cvterm',
-      'feature_genotype',
-      'phendesc',
-      'phenotype_comparison'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        $status = tripal_views_integration_add_entry($table_integration_array);
-        if (!$status) {
-          drupal_set_message(t('Tripal Genetic is unable to integrate %table', array('%table' => $tablename)), 'error');
-        }
-      }
-    }
-  }
-
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return: An array of handler definitions
- *
- * @ingroup tripal_genetic
- */
-function tripal_genetic_views_handlers() {
-  return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_genetic') . '/views/handlers',
-  ),
-   'handlers' => array(
-
-  ),
-  );
-}
-
 /**
  * Implements hook_views_default_views().
  *

+ 0 - 107
tripal_library/tripal_library.views.inc

@@ -15,113 +15,6 @@
  * @ingroup views
  */
 
-/*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_library_views
- */
-function tripal_library_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'library'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // Add in node relationships if chado is in the same db as drupal
-        if (tripal_core_chado_schema_exists()) {
-          $integrations = tripal_views_add_node_relationship_to_chado_table_integration($table_integration_array);
-          foreach ($integrations as $integration) {
-            tripal_views_integration_add_entry($integration);
-          }
-        }
-        else {
-          tripal_views_integration_add_entry($table_integration_array);
-        }
-
-      }
-    }
-
-    $tables = array(
-      'library_cvterm',
-      'library_feature',
-      'library_pub',
-      'library_synonym',
-      'libraryprop'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- * @return: An array of handler definitions
- *
- * @ingroup tripal_library_views
- */
-function tripal_library_views_handlers() {
-  return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_library') . '/views/handlers',
-      ),
-   'handlers' => array(
-     'views_handler_field_computed_library_nid' => array(
-       'parent' => 'views_handler_field_numeric',
-      ),
-    ),
-  );
-}
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_library_views_data_alter(&$data) {
-
-  if ( !(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['library_chado_nid'] = array(
-      'group' => 'Library',
-      'title' => 'Library Node',
-      'help' => 'Links Chado Library Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_library',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
 /**
  *
  *

+ 0 - 100
tripal_natural_diversity/tripal_natural_diversity.views.inc

@@ -15,106 +15,6 @@
  */
 
 
-/**
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_natural_diversity_views
- */
-function tripal_natural_diversity_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'nd_experiment',
-      'nd_geolocation',
-      'nd_protocol',
-      'nd_reagent'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // Add specialty handlers
-        switch ($tablename) {
-          case 'nd_geolocation':
-            $table_integration_array['fields']['description']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-            $table_integration_array['fields']['geodetic_datum']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-            $table_integration_array['fields']['latitude']['handlers']['filter']['name'] = 'chado_views_handler_filter_float';
-            $table_integration_array['fields']['longitude']['handlers']['filter']['name'] = 'chado_views_handler_filter_float';
-            $table_integration_array['fields']['altitude']['handlers']['filter']['name'] = 'chado_views_handler_filter_float';
-            break;
-        }
-
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-    $tables = array(
-      'nd_experiment_contact',
-      'nd_experiment_dbxref',
-      'nd_experiment_genotype',
-      'nd_experiment_phenotype',
-      'nd_experiment_project',
-      'nd_experiment_protocol',
-      'nd_experiment_pub',
-      'nd_experiment_stock',
-      'nd_experiment_stock_dbxref',
-      'nd_experiment_stockprop',
-      'nd_experimentprop',
-      'nd_geolocationprop',
-      'nd_protocol_reagent',
-      'nd_protocolprop',
-      'nd_reagent_relationship',
-      'nd_reagentprop'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-}
-
-/**
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return: An array of handler definitions
- *
- * @ingroup tripal_natural_diversity_views
- */
-function tripal_natural_diversity_views_handlers() {
-  return array(
-    'info' => array(
-      'path' => drupal_get_path('module', 'tripal_natural_diversity') . '/views/handlers',
-    ),
-    'handlers' => array(
-      'views_handler_field_chado_relationship_all' => array(
-        'parent' => 'views_handler_field_prerender_list',
-      ),
-      'views_handler_field_chado_relationship_by_type' => array(
-       'parent' => 'views_handler_field_prerender_list',
-      ),
-    ),
-  );
-}
 
 /**
  * Created Default views related to the tables integrated by this module

+ 0 - 114
tripal_organism/tripal_organism.views.inc

@@ -15,120 +15,6 @@
  * @ingroup views
  */
 
-/**
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_organism_views
- */
-function tripal_organism_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    // Base Table
-    $tables = array(
-      'organism'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // Add specialty handlers
-        $table_integration_array['fields']['common_name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-        $table_integration_array['fields']['genus']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-        $table_integration_array['fields']['species']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-        $table_integration_array['fields']['abbreviation']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
-
-        // Add in node relationships if chado is in the same db as drupal
-        if (tripal_core_chado_schema_exists()) {
-          $integrations = tripal_views_add_node_relationship_to_chado_table_integration($table_integration_array);
-          foreach ($integrations as $integration) {
-            tripal_views_integration_add_entry($integration);
-          }
-        }
-        else {
-          tripal_views_integration_add_entry($table_integration_array);
-        }
-      }
-    }
-
-    // Additional Tables
-    $tables = array(
-      'organismprop',
-      'organism_dbxref'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-}
-
-/**
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- * @return: An array of handler definitions
- *
- * @ingroup tripal_organism_views
- */
-function tripal_organism_views_handlers() {
-  return array(
-    'info' => array(
-      'path' => drupal_get_path('module', 'tripal_organism') . '/views/handlers',
-    ),
-    'handlers' => array(
-      'views_handler_field_computed_organism_nid' => array(
-        'parent' => 'views_handler_field_numeric',
-      ),
-      'views_handler_filter_organism_common_name' => array(
-      'parent' => 'views_handler_filter_string',
-    ),
-    ),
-  );
-}
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_organism_views_data_alter(&$data) {
-
-  if ( !(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['organism_chado_nid'] = array(
-      'group' => 'Organism',
-      'title' => 'Organism Node',
-      'help' => 'Links Chado Organism Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_organism',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
 /**
  *
  * @ingroup tripal_organism_views

+ 0 - 78
tripal_phenotype/tripal_phenotype.views.inc

@@ -15,84 +15,6 @@
  * @ingroup views
  */
 
-/*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_phenotype_views
- */
-function tripal_phenotype_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'phenotype'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // Add specialty handlers
-        switch ($tablename) {
-          case 'phenotype':
-            $table_integration_array['fields']['attr_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
-            $table_integration_array['fields']['assay_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
-            $table_integration_array['fields']['cvalue_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
-            $table_integration_array['fields']['observable_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
-            break;
-        }
-
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-    $tables = array(
-      'feature_phenotype',
-      'phenotype_cvterm'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return: An array of handler definitions
- *
- * @ingroup tripal_phenotype_views
- */
-function tripal_phenotype_views_handlers() {
-  return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_phenotype') . '/views/handlers',
-  ),
-   'handlers' => array(
-
-  ),
-  );
-}
-
 /**
  *
  *

+ 0 - 75
tripal_project/tripal_project.views.inc

@@ -15,81 +15,6 @@
  * @ingroup views
  */
 
-/*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_project_views
- */
-function tripal_project_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'project'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-
-      // check to see if the table is integrated. If it is then integrate it's
-      // corresponding 'chado_[table]' table.
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-        // Add in node relationships if chado is in the same db as drupal
-        if (tripal_core_chado_schema_exists()) {
-          $integrations = tripal_views_add_node_relationship_to_chado_table_integration($table_integration_array);
-          foreach ($integrations as $integration) {
-            tripal_views_integration_add_entry($integration);
-          }
-        }
-        else {
-          tripal_views_integration_add_entry($table_integration_array);
-        }
-      }
-    }
-
-    $tables = array(
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return: An array of handler definitions
- *
- * @ingroup tripal_project_views
- */
-function tripal_project_views_handlers() {
-  return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_project') . '/views/handlers',
-  ),
-   'handlers' => array(
-
-  ),
-  );
-}
-
 /**
  *
  *

+ 0 - 59
tripal_pub/tripal_pub.views.inc

@@ -10,62 +10,3 @@
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
-/*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- */
-function tripal_pub_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'pub'
-      );
-      foreach ($tables as $tablename) {
-        if (!tripal_views_is_integrated($tablename, 10)) {
-          $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
-          tripal_views_integration_add_entry($table_integration_array);
-        }
-      }
-
-      $tables = array(
-      'pub_dbxref',
-      'pub_relationship',
-      'pubauthor',
-      'pubprop'
-      );
-      foreach ($tables as $tablename) {
-        if (!tripal_views_is_integrated($tablename, 10)) {
-          $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
-          tripal_views_integration_add_entry($table_integration_array);
-        }
-      }
-  }
-
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return: An array of handler definitions
- */
-function tripal_pub_views_handlers() {
-  return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_pub') . '/views/handlers',
-  ),
-   'handlers' => array(
-
-  ),
-  );
-}

+ 0 - 93
tripal_stock/tripal_stock.views.inc

@@ -15,99 +15,6 @@
  * @ingroup views
  */
 
-/**
- * Implements hook_views_data(): Describe chado/tripal tables & fields to views
- *
- * @return array
- *   A data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_stock_views
- */
-function tripal_stock_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-    $tablename = 'stock';
-    $priority = 9;
-
-    // check to see if the table is integrated. If it is then integrate it's
-    // corresponding 'chado_[table]' table.
-    if (!tripal_views_is_integrated($tablename, $priority)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-
-      // Add in node relationships if chado is in the same db as drupal
-      if (tripal_core_chado_schema_exists()) {
-        $integrations = tripal_views_add_node_relationship_to_chado_table_integration($table_integration_array);
-        foreach ($integrations as $integration) {
-          tripal_views_integration_add_entry($integration);
-        }
-      }
-      else {
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-    $tablename = 'stockcollection';
-    $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
-      tripal_views_integration_add_entry($table_integration_array);
-    }
-
-    $tables = array(
-      'stock_cvterm',
-      'stock_dbxref',
-      'stock_genotype',
-      'stock_pub',
-      'stock_relationship',
-      'stock_relationship_pub',
-      'stockcollection_stock',
-      'stockcollectionprop',
-      'stockprop',
-      'stockprop_pub'
-    );
-    foreach ($tables as $tablename) {
-      $priority = 9;
-      if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-
-  return $data;
-}
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_stock_views_data_alter(&$data) {
-
-  if ( !(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['stock_chado_nid'] = array(
-      'group' => 'Stock',
-      'title' => 'Stock Node',
-      'help' => 'Links Chado Stock Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_stock',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
 /**
  *
  * @ingroup tripal_stock_views

+ 1 - 1
tripal_views/api/tripal_views.api.inc

@@ -606,7 +606,7 @@ function tripal_views_get_integration_array_for_chado_table($table_name, $base_t
         'name' => 'chado_views_handler_relationship',
         'base' => $foreign_key_schema['table'],
         'base field' => $right_field,
-        'label' => $table_name . ' ' . $left_field . ' to ' . $foreign_key_schema['table'] . ' ' . $right_field
+        'label' => $table_name . ' ' . $left_field . ' => ' . $foreign_key_schema['table'] . ' ' . $right_field
       );
     }
   }

+ 181 - 47
tripal_views/tripal_views.views.inc

@@ -5,9 +5,6 @@ include('views/handlers/views_handler_join_chado_aggregator.inc');
 include('api/tripal_views.api.inc');
 
 
-// TEMPORARY
-include('views/chado_linking.TMP.inc');
-
 /**
  * @file
  * Tripal Views Integration
@@ -299,6 +296,13 @@ function tripal_views_views_data() {
       // if we are we want to add to a current integration
       // as compared to create a whole new one
       if ($base_table == 'node') {
+
+      	/* -- SPF Jun 13, 2013 -- not sure why the node table 
+      	 *    is included in the Chado integrated tables. I've commented
+      	 *    out.  I think it was here for integration of chado tables wiht 
+      	 *    nodes, but code to do this has been added below and it's not
+      	 *    necessary to have the node table in the list of integrated tables
+      	 *
         // Add any joins between the node table and other tables
         $sql = "SELECT * FROM {tripal_views_join} WHERE setup_id = %d";
         $joins = db_query($sql, $setup_id);
@@ -331,8 +335,9 @@ function tripal_views_views_data() {
             $data[$base_table][$handler->column_name][$handler->handler_type] = array_merge($data[$base_table][$handler->column_name][$handler->handler_type], unserialize($handler->arguments));
           }
         }
+        */
         continue;
-      }
+      } 
 
       // get the table description
       $table_desc = tripal_core_get_chado_table_schema($base_table);
@@ -357,47 +362,155 @@ function tripal_views_views_data() {
       }
     }
 
-      // Setup the base table info in the data array
-      $data[$base_table]['table']['group'] = t("$tvi_row->name");
+    // Setup the base table info in the data array
+    $data[$base_table]['table']['group'] = t("$tvi_row->name");
 
-      if ($is_base_table) {
-        $data[$base_table]['table']['base'] = array(
-          'group' => "$tvi_row->name",
-          'title' => "$tvi_row->name",
-          'help'  => $tvi_row->comment,
-        );
-      }
-      else {
-        $data[$base_table]['table'] = array(
-          'group' => "$tvi_row->name",
-          'title' => "$tvi_row->name",
-          'help'  => $tvi_row->comment,
-        );
-      }
+    if ($is_base_table) {
+      $data[$base_table]['table']['base'] = array(
+        'group' => "$tvi_row->name",
+        'title' => "$tvi_row->name",
+        'help'  => $tvi_row->comment,
+      );
+    }
+    else {
+      $data[$base_table]['table'] = array(
+        'group' => "$tvi_row->name",
+        'title' => "$tvi_row->name",
+        'help'  => $tvi_row->comment,
+      );
+    }
 
-      // first add the fields
-      foreach ($base_fields as $column_name => $base_field) {
-        $data[$base_table][$column_name] = array(
-          'title' => t($base_field['name']),
-          'help' => t($base_field['help']),
-          'field' => array(
-            'click sortable' => TRUE,
-          ),
-        );
+    // first add the fields
+    foreach ($base_fields as $column_name => $base_field) {
+      $data[$base_table][$column_name] = array(
+        'title' => t($base_field['name']),
+        'help' => t($base_field['help']),
+        'field' => array(
+          'click sortable' => TRUE,
+        ),
+      );
 
 
-        // now add the handlers
-        $sql = "SELECT * FROM {tripal_views_handlers} WHERE setup_id = %d AND column_name = '%s'";
-        $handlers = db_query($sql, $setup_id, $column_name);
-        while ($handler = db_fetch_object($handlers)) {
-          $data[$base_table][$column_name][$handler->handler_type]['handler'] = $handler->handler_name;
+      // now add the handlers
+      $sql = "SELECT * FROM {tripal_views_handlers} WHERE setup_id = %d AND column_name = '%s'";
+      $handlers = db_query($sql, $setup_id, $column_name);
+      while ($handler = db_fetch_object($handlers)) {
+        $data[$base_table][$column_name][$handler->handler_type]['handler'] = $handler->handler_name;
 
-          // Add in any additional arguments
-          // This should be a serialized array including (at a minimum) name => <handler name>
-          if ($handler->arguments) {
-            $data[$base_table][$column_name][$handler->handler_type] = array_merge($data[$base_table][$column_name][$handler->handler_type], unserialize($handler->arguments));
-          }
-        };
+        // Add in any additional arguments
+        // This should be a serialized array including (at a minimum) name => <handler name>
+        if ($handler->arguments) {
+          $data[$base_table][$column_name][$handler->handler_type] = array_merge($data[$base_table][$column_name][$handler->handler_type], unserialize($handler->arguments));
+        }
+      };
+      
+      // add in joins to the node tables if the Chado schema is local
+		  if (tripal_core_chado_schema_exists()) {
+		    
+		    $linker_table = 'chado_' . $base_table;
+		    $linker_name = ucwords(str_replace('_', ' ', $base_table));
+		    $schema = tripal_core_get_chado_table_schema($base_table);
+		    $pkey = $schema['primary key'][0];
+		    
+		    // if a node linking table exists then add in the joins
+		    if (db_table_exists($linker_table)) {		
+		    		    		      
+		    	// add the linker table to the data array
+			    $data[$linker_table] = array(
+			      // describe the table
+			      'table' => array(
+			        'title' => 'Chado ' . $linker_name,
+              'group' => 'Chado ' . $linker_name,
+			        // join to the base table and the node table
+			        'join' => array(
+				        $base_table => array(
+			            'left_field' => $pkey,
+			            'field' => $pkey,
+				        ),
+				        'node' => array(
+                  'left_field' => 'nid',
+                  'field' => 'nid',
+				        ),
+				      ),
+				    ),
+				    // add the nid field
+            'nid' => array(
+              'title' => t($linker_name . ' Node ID'),
+              'help' => t("The node ID for this $linker_name"),
+              'field' => array(
+                'handler' => 'views_handler_field_numeric',
+                'click sortable' => TRUE,
+              ),
+              'filter' => array(
+                'handler' => 'views_handler_filter_numeric',
+              ),
+              'sort' => array(
+                'handler' => 'views_handler_sort',
+              ),
+            ),
+            // add the primary key field
+            $pkey => array(
+              'title' => t($linker_name . ' ' . $pkey),
+              'help' => t("The $base_table primary key"),
+              'field' => array(
+                'handler' => 'views_handler_field_numeric',
+                'click sortable' => TRUE,
+              ),
+              'filter' => array(
+                'handler' => 'views_handler_filter_numeric',
+              ),
+              'sort' => array(
+                'handler' => 'views_handler_sort',
+              ),
+            ),            
+          );  
+
+          // add the join instructions for the base table
+          // (we'll add the recipricol joins for the node table in the hook_views_data_alter
+          $data[$base_table]['table']['join'][$linker_table] = array(
+            'left_field' => 'organism_id',
+            'field' => 'organism_id',
+          );
+          $data[$base_table]['table']['join']['node'] = array(
+            'left_table' => $linker_table,
+            'left_field' => 'organism_id',
+            'field' => 'organism_id',
+          );
+
+			
+			    // Add relationship between linker and base table
+			    $data[$linker_table][$base_table . '_nid'] = array(
+			      'group' => $linker_name,
+			      'title' => $linker_name . 'Node',
+			      'help' => "Links Chado $linker_name Fields/Data to the Nodes in the current View.",
+			      'real field' => $pkey,
+			      'relationship' => array(
+			        'handler' => 'views_handler_relationship',
+			        'title' => t("Chado => $linker_name"),
+			        'label' => t("Chado => $linker_name"),
+			        'real field' => $pkey,
+			        'base' => $base_table,
+			        'base field' => $pkey
+			      ),
+			    );
+			
+			    // Add node relationship to base table
+			    $data[$linker_table][$linker_table .'_nid'] = array(
+			      'group' => $linker_name,
+			      'title' => $linker_name . 'Node',
+			      'help' => "Links Chado $linker_name Fields/Data to the Nodes in the current View.",
+			      'real field' => 'nid',
+			      'relationship' => array(
+			        'handler' => 'views_handler_relationship',
+			        'title' => t('Chado => Node'),
+			        'label' => t('Chado => Node'),
+			        'real field' => 'nid',
+			        'base' => 'node',
+			        'base field' => 'nid'
+			      ),
+			    );
+		    } 
+		  }		  
     }
 
     // now add the joins
@@ -411,6 +524,12 @@ function tripal_views_views_data() {
       $left_field = $join->left_field;
       $base_field = $join->base_field;
       $handler = $join->handler;
+      
+      // if the 'node' table is in our integrated list then
+      // we want to skip it. It shouldn't be there.
+      if ($left_table == 'node') {
+      	continue;
+      }
 
       // add join entry
       $data[$base_table]['table']['join'][$left_table] = array(
@@ -422,10 +541,6 @@ function tripal_views_views_data() {
       }
     }
   }
-
-  // TEMPORARY: needed to join chado base tables to node linking tables
-  // currently done using old-style data arrays
-  //$data = tripal_views_TEMPORARY_chado_linking_data($data);
   return $data;
 }
 
@@ -442,6 +557,7 @@ function tripal_views_views_data_alter(&$data) {
       //ids we'll use for queries
       $mview_id = $tvi_row->mview_id;
       $setup_id = $tvi_row->setup_id;
+      
 
       // iterate through the columns and alter the existing data array for
       // joins to other tables
@@ -454,15 +570,33 @@ function tripal_views_views_data_alter(&$data) {
         $base_table = $join->base_table;
 
         // add the recipricol join entries for each column
-        if (array_key_exists($left_table, $data)) {
+        if (array_key_exists($left_table, $data) and $base_table != 'node') {
           $data[$left_table]['table']['join'][$base_table] = array(
             'left_field' => $base_field,
             'field' => $left_field,
           );
         }
       }
-    }
-
+      
+      // add in joins to the node tables if the Chado schema is local
+      if (tripal_core_chado_schema_exists()) {
+        $base_table = $tvi_row->table_name;
+        $linker_table = 'chado_' . $base_table;
+        // if a node linking table exists then add in the joins
+        if (db_table_exists($linker_table)) {         
+      
+          $data['node']['table']['join'][$linker_table] = array(
+            'left_field' => 'nid',
+            'field' => 'nid',
+          );
+          $data['node']['table']['join'][$base_table] = array(
+            'left_table' => $linker_table,
+            'left_field' => 'nid',
+            'field' => 'nid',
+          );
+        }
+      }
+    }     
     return $data;
 }