Browse Source

Removed all Old-style views integration

Lacey Sanderson 12 years ago
parent
commit
93bee06bd0
94 changed files with 86 additions and 8628 deletions
  1. 8 18
      tripal_analysis/tripal_analysis.views.inc
  2. 0 45
      tripal_analysis/views/README
  3. 0 331
      tripal_analysis/views/analysis.views.inc
  4. 0 100
      tripal_analysis/views/chado_analysis.views.inc
  5. 0 23
      tripal_analysis/views/handlers/views_handler_field_computed_analysis_nid.inc
  6. 0 37
      tripal_analysis/views/misc_tables.views.inc
  7. 0 84
      tripal_analysis/views/template.node_join.views.inc
  8. 0 211
      tripal_analysis/views/template.table_defn.views.inc
  9. 0 45
      tripal_contact/views/README
  10. 0 84
      tripal_contact/views/template.node_join.views.inc
  11. 0 211
      tripal_contact/views/template.table_defn.views.inc
  12. 9 19
      tripal_cv/tripal_cv.views.inc
  13. 0 45
      tripal_cv/views/README
  14. 0 93
      tripal_cv/views/cv.views.inc
  15. 0 155
      tripal_cv/views/cvterm.views.inc
  16. 0 84
      tripal_cv/views/template.node_join.views.inc
  17. 0 211
      tripal_cv/views/template.table_defn.views.inc
  18. 6 11
      tripal_db/tripal_db.views.inc
  19. 0 45
      tripal_db/views/README
  20. 0 150
      tripal_db/views/db.views.inc
  21. 0 149
      tripal_db/views/dbxref.views.inc
  22. 0 84
      tripal_db/views/template.node_join.views.inc
  23. 0 211
      tripal_db/views/template.table_defn.views.inc
  24. 11 21
      tripal_feature/tripal_feature.views.inc
  25. 0 45
      tripal_feature/views/README
  26. 0 99
      tripal_feature/views/chado_feature.views.inc
  27. 0 294
      tripal_feature/views/feature.views.inc
  28. 0 23
      tripal_feature/views/handlers/views_handler_field_computed_feature_nid.inc
  29. 0 60
      tripal_feature/views/misc_tables.views.inc
  30. 0 84
      tripal_feature/views/template.node_join.views.inc
  31. 0 211
      tripal_feature/views/template.table_defn.views.inc
  32. 0 0
      tripal_feature/views_handlers/views_handler_field_residues.inc
  33. 5 8
      tripal_genetic/tripal_genetic.views.inc
  34. 0 45
      tripal_genetic/views/README
  35. 0 180
      tripal_genetic/views/genotype.views.inc
  36. 0 84
      tripal_genetic/views/template.node_join.views.inc
  37. 0 211
      tripal_genetic/views/template.table_defn.views.inc
  38. 9 16
      tripal_library/tripal_library.views.inc
  39. 0 45
      tripal_library/views/README
  40. 0 99
      tripal_library/views/chado_library.views.inc
  41. 0 17
      tripal_library/views/handlers/views_handler_field_computed_library_nid.inc
  42. 0 216
      tripal_library/views/library.views.inc
  43. 0 49
      tripal_library/views/misc_tables.views.inc
  44. 0 84
      tripal_library/views/template.node_join.views.inc
  45. 0 211
      tripal_library/views/template.table_defn.views.inc
  46. 6 24
      tripal_natural_diversity/tripal_natural_diversity.views.inc
  47. 0 45
      tripal_natural_diversity/views/README
  48. 0 182
      tripal_natural_diversity/views/nd_experiment.views.inc
  49. 0 127
      tripal_natural_diversity/views/nd_experimentprop.views.inc
  50. 0 161
      tripal_natural_diversity/views/nd_geolocation.views.inc
  51. 0 127
      tripal_natural_diversity/views/nd_geolocationprop.views.inc
  52. 0 121
      tripal_natural_diversity/views/nd_reagent.views.inc
  53. 0 125
      tripal_natural_diversity/views/nd_reagentprop.views.inc
  54. 0 84
      tripal_natural_diversity/views/template.node_join.views.inc
  55. 0 211
      tripal_natural_diversity/views/template.table_defn.views.inc
  56. 8 13
      tripal_organism/tripal_organism.views.inc
  57. 0 45
      tripal_organism/views/README
  58. 0 99
      tripal_organism/views/chado_organism.views.inc
  59. 0 17
      tripal_organism/views/handlers/views_handler_field_computed_organism_nid.inc
  60. 0 230
      tripal_organism/views/organism.views.inc
  61. 0 84
      tripal_organism/views/template.node_join.views.inc
  62. 0 211
      tripal_organism/views/template.table_defn.views.inc
  63. 0 45
      tripal_phenotype/views/README
  64. 0 84
      tripal_phenotype/views/template.node_join.views.inc
  65. 0 211
      tripal_phenotype/views/template.table_defn.views.inc
  66. 5 10
      tripal_project/tripal_project.views.inc
  67. 0 45
      tripal_project/views/README
  68. 0 98
      tripal_project/views/chado_project.views.inc
  69. 0 251
      tripal_project/views/project.views.inc
  70. 0 84
      tripal_project/views/template.node_join.views.inc
  71. 0 211
      tripal_project/views/template.table_defn.views.inc
  72. 0 45
      tripal_pub/views/README
  73. 0 84
      tripal_pub/views/template.node_join.views.inc
  74. 0 211
      tripal_pub/views/template.table_defn.views.inc
  75. 19 26
      tripal_stock/tripal_stock.views.inc
  76. 0 45
      tripal_stock/views/README
  77. 0 102
      tripal_stock/views/chado_stock.views.inc
  78. 0 37
      tripal_stock/views/misc_tables.views.inc
  79. 0 290
      tripal_stock/views/stock.views.inc
  80. 0 84
      tripal_stock/views/template.node_join.views.inc
  81. 0 211
      tripal_stock/views/template.table_defn.views.inc
  82. 0 0
      tripal_views/views/handlers/views_handler_argument_stockprop_id.inc
  83. 0 0
      tripal_views/views/handlers/views_handler_field_chado_relationship_all.inc
  84. 0 0
      tripal_views/views/handlers/views_handler_field_chado_relationship_by_type.inc
  85. 0 0
      tripal_views/views/handlers/views_handler_field_computed_stock_nid.inc
  86. 0 0
      tripal_views/views/handlers/views_handler_field_stock_dbxref_all.inc
  87. 0 0
      tripal_views/views/handlers/views_handler_field_stock_dbxref_by_type.inc
  88. 0 0
      tripal_views/views/handlers/views_handler_field_stockprop_all.inc
  89. 0 0
      tripal_views/views/handlers/views_handler_field_stockprop_by_type.inc
  90. 0 0
      tripal_views/views/handlers/views_handler_field_stockrel_all.inc
  91. 0 0
      tripal_views/views/handlers/views_handler_field_stockrel_by_type.inc
  92. 0 0
      tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc
  93. 0 0
      tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc
  94. 0 0
      tripal_views/views/handlers/views_handler_filter_stockprop_id.inc

+ 8 - 18
tripal_analysis/tripal_analysis.views.inc

@@ -6,7 +6,7 @@
  *  chado/tripal analysis tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
@@ -16,9 +16,6 @@
  * @ingroup tripal_analysis
  */
 
-require('views/analysis.views.inc');
-require('views/chado_analysis.views.inc');
-require('views/misc_tables.views.inc'); 
 /**
  * Implements hook_views_data()
  *
@@ -26,7 +23,7 @@ require('views/misc_tables.views.inc');
  *
  * @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 
+ *   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)
  *
@@ -42,7 +39,7 @@ function tripal_analysis_views_data()  {
 			$table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
 			tripal_views_integration_add_entry($table_integration_array);
 		}
-      
+
 
     $tables = array(
       'analysisfeature',
@@ -54,16 +51,9 @@ function tripal_analysis_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-  
-  // Old Style Views Integration
-  } else {
 
-  	$data = array_merge($data, retrieve_analysis_views_data());
-  	$data = array_merge($data, retrieve_chado_analysis_views_data());
-  	$data = array_merge($data, retrieve_analysis_misc_tables_views_data());
-    
   }
-  
+
   return $data;
 }
 
@@ -71,7 +61,7 @@ function tripal_analysis_views_data()  {
  * Implements hook_views_handlers()
  *
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   where a handler describes either "the type of field",
  *   "how a field should be filtered", "how a field should be sorted"
  *
  * @return
@@ -118,7 +108,7 @@ function tripal_analysis_views_data_alter(&$data) {
       ),
     );
   }
-  
+
 }
 
 /**
@@ -128,7 +118,7 @@ function tripal_analysis_views_data_alter(&$data) {
  */
 function tripal_analysis_views_default_views () {
   $views = array();
-  
+
   // Main default view
   // List all cvterms based on cv
   $view = new view;
@@ -566,6 +556,6 @@ function tripal_analysis_views_default_views () {
     'name' => 'navigation',
   ));
   $views[$view->name] = $view;
-  
+
   return $views;
 }

+ 0 - 45
tripal_analysis/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_analysis_views_data() in ../tripal_analysis.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_analysis.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_analysis.views.inc:tripal_analysis_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 331
tripal_analysis/views/analysis.views.inc

@@ -1,331 +0,0 @@
-<?php
-	/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the analysis table, it's fields and any joins between it and other tables
- * @see tripal_analysis_views_data() --in tripal_analysis.views.inc
- *
- * @todo Add support for analysisprop table
- * @todo Add support for multiple analysis' listed per feature
- * @todo Add join to node table within if <chado/drupal same db>; also addd if not around nid field
- *
- * BASE TABLE: analysis
- * @code
- *   create table analysis (
- *       analysis_id serial not null,
- *       primary key (analysis_id),
- *       name varchar(255),
- *       description text,
- *       program varchar(255) not null,
- *       programversion varchar(255) not null,
- *       algorithm varchar(255),
- *       sourcename varchar(255),
- *       sourceversion varchar(255),
- *       sourceuri text,
- *       timeexecuted timestamp not null default current_timestamp,
- *       constraint analysis_c1 unique (program,programversion,sourcename)
- *   );
- * @endcode
- *
- * @ingroup tripal_analysis_views
- */
-function retrieve_analysis_views_data() {
-	global $db_url;
-	$data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     $database = 'chado';
-  }
-	
-  // Basic table definition
-  $data['analysis']['table']['group'] = 'Chado Analysis';
- 	$data['analysis']['table']['base'] = array(
- 		'field' => 'analysis_id',
- 		'title' => t('Chado Analysis'),
- 		'help' => t("An analysis is a particular type of a computational analysis; it may be a blast of one sequence against another, or an all by all blast, or a different kind of analysis altogether. It is a single unit of computation."),
- 	);
-  if($database){
-     $data['analysis']['table']['base']['database'] = $database;
-  }
-
-  // Define relationships between this table and others
-  $data['analysis']['table']['join']['feature'] = array(
-    'linking' => array(
-      'table' => 'analysisfeature',
-      'left_field' => 'feature_id',
-      'field' => 'analysis_id',
-    ),
-    'left_field' => 'feature_id',
-    'field' => 'analysis_id',
-    'handler' => 'views_handler_join_chado_through_linking'
-  );
-
-  // Analysis properties?
- 	$data['analysisprop']['table'] = array(
-'group' => 'Chado analysis Properties',
- 		'field' => 'analysisprop_id',
- 		'title' => t('Chado analysis Properties'),
- 		'help' => '  ',
- 	);
- 	
- 	$data['analysisprop']['table']['join']['analysis'] = array(
-    'left_field' => 'analysis_id',
-    'field' => 'analysis_id',
-    'handler' => 'views_handler_join_chado_aggregator'
- 	);
- 	
- 	$data['analysisprop']['value'] = array(
-    'title' => t('Value'),
-    'help' => t(' '),
-    'field' => array(
-      'handler' => 'chado_views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'chado_views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
- 	);
- 	
- 	$data['analysisprop']['all'] = array(
-    'title' => t('All'),
-    'help' => t('An aggregate field that contains all fields for a row.'),
-    'field' => array(
-      'handler' => 'chado_views_handler_field_aggregate',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'chado_views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
- 	);
- 	
-	// Table Field Definitions----------------------
-	// Field: analysis_id (primary key)
-	$data['analysis']['analysis_id'] = array(
-	  'title' => 'analysis ID',
-	  'help' => 'The primary key of the analysis table.',
-	  'field' => array(
-	    'handler' => 'views_handler_field_numeric',
-	    'click sortable' => TRUE,
-	  ),
-	  'filter' => array(
-	    'handler' => 'views_handler_filter_numeric',
-	  ),
-	  'sort' => array(
-	    'handler' => 'chado_views_handler_sort',
-	  ),
-	);
-	
-  // Calculated Field: Node ID
-  //  use custom field handler to query drupal for the node ID
-  //  this is only needed if chado is in a separate database from drupal
-  if($database){
-		$data['analysis']['analysis_nid'] = array(
-	  	'title' => 'Node ID',
-	  	'help' => 'The node ID for the current analysis',
-	  	'field' => array(
-	    	'handler' => 'views_handler_field_computed_analysis_nid',
-	  	),
-		);
-  } else {
-    // Add relationship between chado_analysis and analysis
-    $data['analysis']['analysis_nid'] = array(
-      'group' => 'Analysis',
-      'title' => 'Analysis Node',
-      'help' => 'Links Chado Analysis Fields/Data to the Nodes in the current View.',
-      'real field' => 'analysis_id',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Analysis => Chado'),
-        'label' => t('Analysis => Chado'),
-        'real field' => 'analysis_id',
-        'base' => 'chado_analysis',
-        'base field' => 'analysis_id'
-      ),
-    );
-
-  }
-	
-	// Field: name (varchar 255)
- 	$data['analysis']['name'] = array(
-    'title' => t('Name'),
-    'help' => t(''),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_chado_select_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database) {
-    $data['analysis']['name']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-
-  // Field: description (text)
- 	$data['analysis']['description'] = array(
-    'title' => t('Description'),
-    'help' => t(''),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'chado_views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: program (varchar 255)
- 	$data['analysis']['program'] = array(
-    'title' => t('Program'),
-    'help' => t('Program name, e.g. blastx, blastp, sim4, genscan.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_chado_select_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: program version (varchar 255)
- 	$data['analysis']['programversion'] = array(
-    'title' => t('Program Version'),
-    'help' => t('Version description, e.g. TBLASTX 2.0MP-WashU [09-Nov-2000].'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_chado_select_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: algorithm (varchar 255)
- 	$data['analysis']['algorithm'] = array(
-    'title' => t('Algorithm'),
-    'help' => t('Algorithm name, e.g. blast.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_chado_select_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
- 	$data['analysis']['sourcename'] = array(
-    'title' => t('Source Name'),
-    'help' => t('Source name, e.g. cDNA, SwissProt.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'chado_views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: source version (varchar 255)
- 	$data['analysis']['sourceversion'] = array(
-    'title' => t('Source Version'),
-    'help' => t('The version of the source.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'chado_views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: source URI/URL (text)
- 	$data['analysis']['sourceuri'] = array(
-    'title' => t('Source URL'),
-    'help' => t('This is an optional, permanent URL or URI for the source of the analysis.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'chado_views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: time executed (datetime)
- 	$data['analysis']['timeexecuted'] = array(
-    'title' => 'Time Executed',
-    'help' => 'The date & time when this analysis was executed.',
-    'field' => array(
-      'handler' => 'views_handler_field_readable_date',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'chado_views_handler_sort_date',
-    ),
-  );
-
- 	return $data;
-}

+ 0 - 100
tripal_analysis/views/chado_analysis.views.inc

@@ -1,100 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_analysis drupal table, it's fields and any joins between it and other tables
- * @see tripal_analysis_views_data() --in tripal_analysis.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- *
- * @ingroup tripal_analysis_views
- */
-function retrieve_chado_analysis_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  // Basic table definition
-  $data['chado_analysis']['table'] = array(
-    'field' => 'nid',
-    'group' => 'Chado Analysis'
-  );
-
-  $data['chado_analysis']['nid'] = array(
-    'title' => t('Analysis Node ID'),
-    'help' => t('The node ID for this analysis'),
-    'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
-    ),
-    'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-     	'handler' => 'views_handler_sort',
-    ),
-  );
-  
-  // Note: No joins need to be made from $data['analysis']['table']
-  
-  // Join the chado analysis table to analysis
-  $data['chado_analysis']['table']['join']['analysis'] = array(
-  	'left_field' => 'analysis_id',
-  	'field' => 'analysis_id',
-  );
-  
-  // Join the node table to chado analysis
-  $data['node']['table']['join']['chado_analysis'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to analysis
-  $data['node']['table']['join']['analysis'] = array(
-  	'left_table' => 'chado_analysis',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-  // Add relationship between chado_analysis and analysis
-  $data['chado_analysis']['analysis_nid'] = array(
-    'group' => 'Analysis',
-    'title' => 'Analysis Node',
-    'help' => 'Links Chado Analysis Fields/Data to the Nodes in the current View.',
-    'real field' => 'analysis_id',
-    'relationship' => array(
-      'handler' => 'views_handler_relationship',
-      'title' => t('Chado => Analysis'),
-      'label' => t('Chado => Analysis'),
-      'real field' => 'analysis_id',
-      'base' => 'analysis',
-      'base field' => 'analysis_id'
-    ),
-  );
-
-  // Add node relationship to analysis
-  $data['chado_analysis']['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('Chado => Node'),
-      'label' => t('Chado => Node'),
-      'real field' => 'nid',
-      'base' => 'node',
-      'base field' => 'nid'
-    ),
-  );
-  
-	return $data;
-}

+ 0 - 23
tripal_analysis/views/handlers/views_handler_field_computed_analysis_nid.inc

@@ -1,23 +0,0 @@
-<?php
-
-/**
- *
- *
- * @ingroup tripal_analysis
- */
-class views_handler_field_computed_analysis_nid extends views_handler_field_numeric {
-	function construct() {
-		parent::construct();
-		drupal_set_message('Computed Analysis NID Handler loaded');
-		$this->additional_fields['analysis_id'] = array('table' => 'analysis', 'field' => 'analysis_id');
-	}
-
-	function query() { 
-		$this->ensure_my_table();
-		$this->add_additional_fields(); 
-	}
-
-	function render($values) { 
-		return $values->analysis_nid;
-	}
-} 

+ 0 - 37
tripal_analysis/views/misc_tables.views.inc

@@ -1,37 +0,0 @@
-<?php
-
-/**
- * Purpose: Allows the analysis module to add fields to other module views
- *
- *   For example, a field counting the number of analysis' associted with a given feature would be
- *   added to the feature view as follows:
- *   @code
-      $data['feature']['num_analysis''] = array(
-        'title' => "Number of analysis'",
-        'help' => "Provides a count of the number of analysis' associated with a given feature",
-        'field' => array(
-          'handler' => 'views_handler_field_chado_count',
-          'table_to_query' => 'analysis_feature',
-        ),
-      ); 
- *   @endcode
- *
- * @ingroup tripal_analysis_views
- */
-function retrieve_analysis_misc_tables_views_data() {
-  $data = array();
- 
-  // Table: Feature---------------------------------------------------------------------------------
-  // Calculated Field: Number of analysis' (Count -Int)
-  // Provides the number of analysis' for a given feature
-  $data['feature']['num_analysis'] = array(
-    'title' => "Number of analysis'",
-    'help' => "Provides a count of the number of analysis' associated with a given feature",
-    'field' => array(
-      'handler' => 'views_handler_field_chado_count',
-      'table_to_query' => 'analysisfeature',
-    ),
-  );  
-  
-  return $data;
-}

+ 0 - 84
tripal_analysis/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_analysis.views.inc in 
- *        tripal_analysis_views_data() by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_analysis.views.inc --in tripal_analysis_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_analysis_views_data() --in tripal_analysis.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_analysis/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_analysis.views.inc in 
- *        tripal_analysis_views_data() by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_analysis.views.inc --in tripal_analysis_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_analysis_views_data() --in tripal_analysis.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 0 - 45
tripal_contact/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_contact_views_data() in ../tripal_contact.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_contact.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_contact.views.inc:tripal_contact_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 84
tripal_contact/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_contact.views.inc:tripal_contact_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_contact.views.inc --in tripal_contact_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_contact_views_data() --in tripal_contact.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_contact/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_contact.views.inc:tripal_contact_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_contact.views.inc --in tripal_contact_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_contact_views_data() --in tripal_contact.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 9 - 19
tripal_cv/tripal_cv.views.inc

@@ -6,7 +6,7 @@
  *  chado/tripal db tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
@@ -16,8 +16,6 @@
  * @ingroup tripal_cv
  */
 
-require_once('views/cvterm.views.inc');
-require_once('views/cv.views.inc'); 
 /**
  * Implements hook_views_data()
  *
@@ -26,7 +24,7 @@ require_once('views/cv.views.inc');
  * @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 
+ *   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)
  *
@@ -34,15 +32,7 @@ require_once('views/cv.views.inc');
  */
 function tripal_cv_views_data() {
   $data = array();
-  
-  //Function is contained in includes/cvterm.views.inc
-  //Returns the data array for the chado cvterm table
-  //$data = array_merge($data, retrieve_cvterm_views_data());
-  
-  //Function is contained in includes/cv.views.inc
-  //Returns the data array for the chado cv table
-  //$data = array_merge($data, retrieve_cv_views_data());
-  
+
   if (module_exists('tripal_views')) {
     // Base Tables
     $tables = array(
@@ -55,7 +45,7 @@ function tripal_cv_views_data() {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-    
+
     // Additional Tables
     $tables = array(
       'cvterm_dbxref',
@@ -71,15 +61,15 @@ function tripal_cv_views_data() {
       }
     }
   }
-  
+
   return $data;
 }
- 
+
 /**
  * Implements hook_views_handlers()
  *
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   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
@@ -105,7 +95,7 @@ function tripal_cv_views_handlers() {
  */
 function tripal_cv_views_default_views () {
   $views = array();
-  
+
   // Main default view
   // List all cvterms based on cv
   $view = new view;
@@ -395,6 +385,6 @@ function tripal_cv_views_default_views () {
     'name' => 'navigation',
   ));
   $views[$view->name] = $view;
-  
+
   return $views;
 }

+ 0 - 45
tripal_cv/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_cv_views_data() in ../tripal_cv.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_cv.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_cv.views.inc:tripal_cv_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 93
tripal_cv/views/cv.views.inc

@@ -1,93 +0,0 @@
-<?php
-
-/**
- * Prupose: this function returns a portion of the data array 
- *   which describes the cv table, it's fields and any joins between it and other tables
- * @see tripal_cv_views_data() --in tripal_cv.views.inc
- *
- * TABLE: cv
- * @code
- *   create table cv (
- *       cv_id serial not null,
- *       primary key (cv_id),
- *       name varchar(255) not null,
- *       definition text,
- *       constraint cv_c1 unique (name)
- *   );
- * @endcode
- *
- * @ingroup tripal_cv_views
- */
-function retrieve_cv_views_data() {
-  $data = array();
-
-  // Basic table definition
-  $data['cv']['table'] = array(
-    'field' => 'cv_id',
-    'title' => 'Chado CV (Controlled Vocabulary)',
-    'group' => 'Chado CV',
-    'help' => 'Controlled vocabularies existing in the Chado Database',
-    'database' => 'chado'
-  );
-
-  // Define relationships between this table and others
-  $data['cv']['table']['join'] = array(
-     'cvterm' => array(
-       'left_field' => 'cv_id',
-       'field' => 'cv_id',
-     ),
-  );
-
-  // Table Field Definitions----------------------
-  // Field: cv_id (primary key)
-  $data['cv']['cv_id'] = array(
-    'title' => t('CV ID'),
-    'help' => t('The primary key of the controlled vocabulary.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-  ); 
-  
-  //Field: name (varchar -255)
-  $data['cv']['name'] = array(
-    'title' => 'Vocabulary Name',
-    'field' => array(
-       'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_chado_select_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-  );
-
-  //Field: definition (text)
-  $data['cv']['definition'] = array(
-    'title' => 'Vocabulary Definition',
-    'field' => array(
-       'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-  );
-
-  return $data;
-
-}

+ 0 - 155
tripal_cv/views/cvterm.views.inc

@@ -1,155 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the cv table, it's fields and any joins between it and other tables
- * @see tripal_cv_views_data() --in tripal_cv.views.inc
- *
- * BASE TABLE: cvterm
- * @code
- *   create table cvterm (
- *       cvterm_id serial not null,
- *       primary key (cvterm_id),
- *       cv_id int not null,
- *       foreign key (cv_id) references cv (cv_id) on delete cascade INITIALLY DEFERRED,
- *       name varchar(1024) not null,
- *       definition text,
- *       dbxref_id int not null,
- *       foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
- *       is_obsolete int not null default 0,
- *       is_relationshiptype int not null default 0,
- *       constraint cvterm_c1 unique (name,cv_id,is_obsolete),
- *       constraint cvterm_c2 unique (dbxref_id)
- *   );
- * @endcode
- *
- * @ingroup tripal_cv_views
- */
-function retrieve_cvterm_views_data() {
-
-  // Basic table definition
-  $data['cvterm']['table']['group'] = 'Chado CV Terms';
-  $data['cvterm']['table']['base'] = array(
-    'field' => 'cvterm_id',
-    'title' => 'Chado CV Terms (Controlled Vocabulary)',
-    'help' => 'Controlled Vocabularies (CVs) are the main way Chado controls content.',
-    'database' => 'chado'
-  );
-
-  // Define relationships between this table and others
-   $data['cvterm']['table']['join'] = array(
-     'feature' => array(
-       'left_field' => 'type_id',
-       'field' => 'cvterm_id',
-     ),
-     'library' => array(
-       'left_field' => 'type_id',
-       'field' => 'cvterm_id',
-     ),
-     'stock' => array(
-       'left_field' => 'type_id',
-       'field' => 'cvterm_id',
-     ),
-     'nd_reagent' => array(
-       'left_field' => 'type_id',
-       'field' => 'cvterm_id',
-     ),
-   );
-
- // Table Field Definitions----------------------
- // Field: cvterm_id (primary key)
- $data['cvterm']['cvterm_id'] = array(
-   'title' => t('CV Term ID'),
-   'help' => t('The primary kep of controlled vocabulary terms.'),
-   'field' => array(
-     'handler' => 'views_handler_field_numeric',
-     'click sortable' => TRUE,
-    ),
-   'filter' => array(
-     'handler' => 'views_handler_filter_numeric',
-   ),
-   'sort' => array(
-     'handler' => 'views_handler_sort',
-   ),
- );
- 
- //Field: cv_id (foreign key: cv)
- //  join between cv table and this one in cv.views.inc
- 
- // Field: Name (varchar 1024)
-  $data['cvterm']['name'] = array(
-     'title' => 'Name',
-     'help' => 'The term name',
-     'field' => array(
-     'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-   );
-
-   // Field: Definition (text)
-   $data['cvterm']['definition'] = array(
-     'title' => 'Definition',
-     'help' => 'A definition of this term',
-     'field' => array(
-       'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-   );
-
-   // Field: dbxref_id (foreign key: dbxref)
-   //  join between dbxref table and this one in tripal_db/views/dbxref.views.inc
-   
-   // Field: is_obsolete (integer: 1/0)
-   $data['cvterm']['is_obsolete'] = array(
-     'title' => 'Is Obsolete',
-     'help' => 'Whether this term is obsolete or not.',
-     'field' => array(
-       'handler' => 'views_handler_field_boolean',
-       'click sortable' => TRUE,
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-       'label' => t('Is Obsolete?'),
-       'type' => 'yes-no',
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-   );
-
-   // Field: is_relationshiptype (integer: 1/0)
-   $data['cvterm']['is_relationshiptype'] = array(
-     'title' => 'Is Relationship',
-     'help' => 'Whether this term describes a relationship or not.',
-     'field' => array(
-       'handler' => 'views_handler_field_boolean',
-       'click sortable' => TRUE,
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_chado_boolean',
-       'label' => t('Is Relationship Type?'),
-       'type' => 'yes-no',
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-    );
-  
-  return $data;
-
-}

+ 0 - 84
tripal_cv/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_cv.views.inc:tripal_cv_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_cv.views.inc --in tripal_cv_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_cv_views_data() --in tripal_cv.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_cv/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_cv.views.inc:tripal_cv_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_cv.views.inc --in tripal_cv_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_cv_views_data() --in tripal_cv.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 6 - 11
tripal_db/tripal_db.views.inc

@@ -6,7 +6,7 @@
  *  chado/tripal db tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
@@ -16,14 +16,12 @@
  * @ingroup tripal_db
  */
 
-require_once('views/dbxref.views.inc');
-require_once('views/db.views.inc'); 
 /**
  * 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 
+ *   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)
  *
@@ -31,10 +29,7 @@ require_once('views/db.views.inc');
  */
 function tripal_db_views_data()  {
   $data = array();
-   
-   //$data = array_merge($data, retrieve_dbxref_views_data());
-   //$data = array_merge($data, retrieve_db_views_data());
-   
+
   if (module_exists('tripal_views')) {
     // Base Tables
     $tables = array(
@@ -47,7 +42,7 @@ function tripal_db_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-        
+
     // Additional Tables
     $tables = array(
       'dbxrefprop'
@@ -70,7 +65,7 @@ function tripal_db_views_data()  {
  */
 function tripal_db_views_default_views () {
   $views = array();
-  
+
   // Main default view
   // List all cvterms based on cv
   $view = new view;
@@ -332,6 +327,6 @@ function tripal_db_views_default_views () {
     'name' => 'navigation',
   ));
   $views[$view->name] = $view;
-  
+
   return $views;
 }

+ 0 - 45
tripal_db/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_db_views_data() in ../tripal_db.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_db.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_db.views.inc:tripal_db_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 150
tripal_db/views/db.views.inc

@@ -1,150 +0,0 @@
-<?php
-
-  /**
- * Purpose: this function returns the portion of the data array 
- *   which describes the cv table, it's fields and any joins between it and other tables
- * @see tripal_cv_views_data() --in tripal_cv.views.inc
- *
- *  TABLE: db
- * @code
- * create table db (
- *    db_id serial not null,
- *    primary key (db_id),
- *    name varchar(255) not null,
- *    description varchar(255) null,
- *    urlprefix varchar(255) null,
- *    url varchar(255) null,
- *    constraint db_c1 unique (name)
- * );
- * @endcode
- *
- * @ingroup tripal_db_views
- */
-function retrieve_db_views_data() {
-  
-  // Basic table definition
-  $data['db']['table'] = array(
-    'field' => 'db_id',
-    'group' => 'Chado Database',
-    'title' => 'Chado Database',
-    'help' => 'Database Records existing in the Chado Database',
-    'database' => 'chado'
-  );
-  
-  // Define relationships between this table and others
-  $data['db']['table']['join'] = array(
-    'dbxref' => array(
-      'left_field' => 'db_id',
-      'field' => 'db_id',
-    ),
-    'stock' => array(
-    	'left_table' => 'dbxref',
-    	'left_field' => 'db_id',
-    	'field' => 'db_id',
-    ),
-    'cvterm' => array(
-    	'left_table' => 'dbxref',
-    	'left_field' => 'db_id',
-    	'field' => 'db_id',
-    ),
-    'feature' => array(
-    	'left_table' => 'dbxref',
-    	'left_field' => 'db_id',
-    	'field' => 'db_id',
-    ),
-  );
-  
-  // Table Field Definitions----------------------
-  // Field: db_id (primary key)
-  $data['db']['db_id'] = array(
-    'title' => t('Database ID'),
-    'help' => t('The primary key of the Database.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-  );
-  
-  // Field: name (varchar 255)
-  $data['db']['name'] = array(
-    'title' => 'Name',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_chado_select_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  
-  // Field: description (varchar 255)
-  $data['db']['description'] = array(
-    'title' => 'Description',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  
-  // Field: urlprefix (varchar 255)
-  $data['db']['urlprefix'] = array(
-    'title' => 'URL Prefix',
-    'help' => 'The url that when concatenated with the accession of a record in this db produces the url to the record in this database.',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  
-  // Field: url (varchar 255)
-  $data['db']['url'] = array(
-    'title' => 'URL',
-    'help' => 'The url to the main page of the database',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  
-  return $data;
-  
-}

+ 0 - 149
tripal_db/views/dbxref.views.inc

@@ -1,149 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the db table, it's fields and any joins between it and other tables
- * @see tripal_db_views_data() --in tripal_db.views.inc
- *
- * BASE TABLE: dbxref
- * @code
- * create table dbxref (
- *    dbxref_id serial not null,
- *    primary key (dbxref_id),
- *    db_id int not null,
- *    foreign key (db_id) references db (db_id) on delete cascade INITIALLY DEFERRED,
- *    accession varchar(255) not null,
- *    version varchar(255) not null default '',
- *    description text,
- *    constraint dbxref_c1 unique (db_id,accession,version)
- * );
- * @endcode
- *
- * @ingroup tripal_db_views
- */
-function retrieve_dbxref_views_data() {
-
-  // Basic table definition
-  $data['dbxref']['table']['group'] = 'Chado Database Reference';
-  $data['dbxref']['table']['base'] = array(
-    'field' => 'dbxref_id',
-    'title' => 'Chado Database Reference',
-    'help' => 'A Reference to another database. Allows easy linking between becords in one database to those in another.',
-    'database' => 'chado'
-  );
-
-  // Define relationships between this table and others
-  $data['dbxref']['table']['join'] = array(
-    'cvterm' => array(
-      'left_field' => 'dbxref_id',
-      'field' => 'dbxref_id',
-    ),
-    'feature' => array(
-      'left_field' => 'dbxref_id',
-      'field' => 'dbxref_id',
-    ),
-    'stock' => array(
-      'left_field' => 'dbxref_id',
-      'field' => 'dbxref_id',
-    ),  
-  );
-
-  // Table Field Definitions----------------------
-  // Field: dbxref_id (primary key)
-  $data['dbxref']['dbxref_id'] = array(
-    'title' => t('Database Reference ID'),
-    'help' => t('The primary key of Database References.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-  );
-   
-  //Field: cv_id (foreign key: cv)
-  //  join between cv table and this one in cv.views.inc
-
-  // Field: accession (varchar 255)
-  $data['dbxref']['accession'] = array(
-    'title' => 'Accession',
-    'help' => 'The accession from the database.',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: version (varchar 255)
-  $data['dbxref']['version'] = array(
-    'title' => 'Version',
-    'help' => 'The version of the database reference.',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: description (text)
-  $data['dbxref']['description'] = array(
-    'title' => 'Description',
-    'help' => 'a description of the database reference.',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Calculated Field: Accession Link
-  //  uses custom field handler to pull db urlprefix and concatenate with accession
-  //  solves the problem of not being able to add urlprefix to tables which only
-  //  join to dbxref table (not db)
-  $data['dbxref']['accession_link'] = array(
-    'title' => 'Accession Link',
-    'help' => 'Provides a link to the record in the external database.',
-    'field' => array(
-      'handler' => 'views_handler_field_dbxref_accession_link',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  return $data;
-
-}

+ 0 - 84
tripal_db/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_db.views.inc:tripal_db_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_db.views.inc --in tripal_db_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_db_views_data() --in tripal_db.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_db/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_db.views.inc:tripal_db_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_db.views.inc --in tripal_db_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_db_views_data() --in tripal_db.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 11 - 21
tripal_feature/tripal_feature.views.inc

@@ -6,7 +6,7 @@
  *  chado/tripal organism tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
@@ -15,7 +15,7 @@
  * @ingroup views
  * @ingroup tripal_feature
  */
- 
+
 /**
  * Implements hook_views_data()
  *
@@ -23,22 +23,15 @@
  *
  * @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 
+ *   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
  */
-require_once('views/feature.views.inc');
-require_once('views/chado_feature.views.inc');
-require_once('views/misc_tables.views.inc');
 function tripal_feature_views_data()  {
   $data = array();
-  
-  //$data = array_merge($data, retrieve_feature_views_data());
-  //$data = array_merge($data, retrieve_chado_feature_views_data());
-  //$data = array_merge($data, retrieve_feature_misc_tables_views_data());
-  
+
   if (module_exists('tripal_views')) {
     $tables = array(
       'feature',
@@ -49,7 +42,7 @@ function tripal_feature_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-        
+
     $tables = array(
       'feature_cvterm',
       'feature_cvterm_dbxref',
@@ -79,7 +72,7 @@ function tripal_feature_views_data()  {
       }
     }
   }
-  
+
   return $data;
 }
 
@@ -87,7 +80,7 @@ function tripal_feature_views_data()  {
  * Implements hook_views_handlers()
  *
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   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
@@ -97,12 +90,9 @@ function tripal_feature_views_data()  {
 function tripal_feature_views_handlers() {
  return array(
    'info' => array(
-     'path' => drupal_get_path('module', 'tripal_feature') . '/views/handlers',
+     'path' => drupal_get_path('module', 'tripal_feature') . '/views_handlers',
    ),
    'handlers' => array(
-     'views_handler_field_computed_feature_nid' => array(
-       'parent' => 'views_handler_field_numeric',
-     ),
      'views_handler_field_residues' => array(
        'parent' => 'views_handler_field',
      ),
@@ -133,7 +123,7 @@ function tripal_feature_views_data_alter(&$data) {
       ),
     );
   }
-  
+
 }
 
 /**
@@ -142,7 +132,7 @@ function tripal_feature_views_data_alter(&$data) {
  */
 function tripal_feature_views_default_views () {
   $views = array();
-  
+
   // Main default view
   // List all cvterms based on cv
   $view = new view;
@@ -472,6 +462,6 @@ function tripal_feature_views_default_views () {
     'name' => 'navigation',
   ));
   $views[$view->name] = $view;
-  
+
   return $views;
 }

+ 0 - 45
tripal_feature/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_feature_views_data() in ../tripal_feature.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_feature.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_feature.views.inc:tripal_feature_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 99
tripal_feature/views/chado_feature.views.inc

@@ -1,99 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_feature drupal table, it's fields and any joins between it and other tables
- * @see tripal_feature_views_data() --in tripal_feature.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- * @ingroup tripal_feature_views
- */
-function retrieve_chado_feature_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  // Basic table definition
-  $data['chado_feature']['table'] = array(
-    'field' => 'nid',
-    'group' => 'Chado Feature'
-  );
-  
-  $data['chado_feature']['nid'] = array(
-    'title' => t('Feature Node ID'),
-    'help' => t('The node ID for this feature'),
-    'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
-    ),
-    'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-     	'handler' => 'views_handler_sort',
-    ),
-  );
-
-  // Note: No joins need to be made from $data['feature']['table']
-  
-  // Join the chado feature table to feature
-  $data['chado_feature']['table']['join']['feature'] = array(
-  	'left_field' => 'feature_id',
-  	'field' => 'feature_id',
-  );
-  
-  // Join the node table to chado feature
-  $data['node']['table']['join']['chado_feature'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to feature
-  $data['node']['table']['join']['feature'] = array(
-  	'left_table' => 'chado_feature',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Add relationship between chado_feature and feature
-  $data['chado_feature']['feature_nid'] = array(
-    'group' => 'Feature',
-    'title' => 'Feature Node',
-    'help' => 'Links Chado Feature Fields/Data to the Nodes in the current View.',
-    'real field' => 'feature_id',
-    'relationship' => array(
-      'handler' => 'views_handler_relationship',
-      'title' => t('Chado => Feature'),
-      'label' => t('Chado => Feature'),
-      'real field' => 'feature_id',
-      'base' => 'feature',
-      'base field' => 'feature_id'
-    ),
-  );
-
-  // Add node relationship to feature
-  $data['chado_feature']['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('Chado => Node'),
-      'label' => t('Chado => Node'),
-      'real field' => 'nid',
-      'base' => 'node',
-      'base field' => 'nid'
-    ),
-  );
-
-	return $data;
-}

+ 0 - 294
tripal_feature/views/feature.views.inc

@@ -1,294 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the feature table, it's fields and any joins between it and other tables
- * @see tripal_feature_views_data() --in tripal_feature.views.inc
- *
- * @todo Add better handler for is_analysis, is_obsolete: something which changes the t/f to a true boolean
- * @todo Add support for the following tables: featureprop, featureloc, featurepos, feature_synonym, feature_relationship
- * @todo Add join to node table within if <chado/drupal same db>; also addd if not around nid field
- *
- * BASE TABLE: feature
- * @code
- *   create table feature (
- *        feature_id serial not null,
- *        primary key (feature_id),
- *        dbxref_id int,
- *        foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
- *        organism_id int not null,
- *        foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
- *        name varchar(255),
- *        uniquename text not null,
- *        residues text,
- *        seqlen int,
- *        md5checksum char(32),
- *        type_id int not null,
- *        foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
- *        is_analysis boolean not null default 'false',
- *        is_obsolete boolean not null default 'false',
- *        timeaccessioned timestamp not null default current_timestamp,
- *        timelastmodified timestamp not null default current_timestamp,
- *        constraint feature_c1 unique (organism_id,uniquename,type_id)
- *   );
- * @endcode
- *
- * @ingroup tripal_feature_views
- */
- function retrieve_feature_views_data() {
-	global $db_url;
-	$data = array();
-	
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     $database = 'chado';
-  }
-
-	
-   // Basic table definition
-   $data['feature']['table']['group'] = 'Chado Feature';
-   $data['feature']['table']['base'] = array(
-     'field' => 'feature_id',
-     'title' => 'Chado Features',
-     'help' => 'Features are Sequence Data Records in Chado.',
-   );
-
-	if($database){
-		$data['feature']['table']['base']['database'] = $database;
-	}
-	
-
-  //Relationship Definitions---------------------------------
-  //Join: feature => nd_reagent
-  $data['feature']['table']['join']['nd_reagent'] = array(
-    'left_field' => 'feature_id',
-    'field' => 'feature_id',
-  );  
-
-  // Table Field Definitions----------------------
-  // Field: feature_id (primary key)
-  $data['feature']['feature_id'] = array(
-    'title' => 'Feature ID',
-    'help' => 'The primary key of a feature',
-    'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
-    ),
-    'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-     	'handler' => 'views_handler_sort',
-    ),
-  );
-
-  // Calculated Field: Node ID
-  //  use custom field handler to query drupal for the node ID
-  //  this is only needed if chado is in a separate database from drupal
-  if($database){
-  	$data['feature']['feature_nid'] = array(
-    	'title' => 'Node ID',
-			'help' => 'This is the node ID of this feature. It can be used as a link to the node.',
-    	'field' => array(
-      	'handler' => 'views_handler_field_computed_feature_nid',
-      ),
-  	);
-  } else {
-    // Add relationship between chado_feature and feature
-    $data['feature']['feature_nid'] = array(
-      'group' => 'Feature',
-      'title' => 'Feature Node',
-      'help' => 'Links Chado Feature Fields/Data to the Nodes in the current View.',
-      'real field' => 'feature_id',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Feature => Chado'),
-        'label' => t('Feature => Chado'),
-        'real field' => 'feature_id',
-        'base' => 'chado_feature',
-        'base field' => 'feature_id'
-      ),
-    );
-
-  }
-  
-  // Field: organism_id (forgeign key)
-  //  join between organism table and this one in tripal_organism/views/organism.views.inc
-  
-  // Field: dbxref_id (forgeign key)
-  //  join between dbxref table and this one in tripal_db/views/dbxref.views.inc
-  
-  // Field: type_id (forgeign key)
-  //  join between cvterm table and this one in tripal_cv/views/cvterm.views.inc
-  
-  // Field: name (varchar 255)
-  $data['feature']['name'] = array(
-    'title' => 'Name',
-    'help' => 'The human-readable, non-unique name of a feature.',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database && module_exists('tripal_views')) {
-    $data['feature']['name']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-
-  // Field: unique name (text)
-  $data['feature']['uniquename'] = array(
-    'title' => 'Unique Name',
-    'help' => 'The unique name of a feature.',
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database && module_exists('tripal_views')) {
-    $data['feature']['uniquename']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-
-  // Field: residues (text)
-  $data['feature']['residues'] = array(
-    'title' => 'Residues',
-    'help' => 'The sequence of a feature.',
-    'field' => array(
-      'handler' => 'views_handler_field_residues',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  // Field: sequence length (integer)
-  $data['feature']['seqlen'] = array(
-    'title' => 'Sequence Length',
-    'help' => 'The length of the sequence',
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-  );
-
-  // Field: is analysis (boolean -t/f)
-  $data['feature']['is_analysis'] = array(
-    'title' => 'Is Analysis',
-    'help' => 'A boolean indicating whether this feature was annotated by means of automated analysis.',
-    'field' => array(
-       'handler' => 'views_handler_field_chado_tf_boolean',
-       'click sortable' => TRUE,
-       'label' => t('Is Analysis?'),
-       'type' => 'yes-no',
-    ),
-    'filter' => array(
-       'handler' => 'views_handler_filter_chado_boolean',
-       'label' => t('Is Analysis?'),
-       'type' => 'yes-no',
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-  );
-
-  // Field: is obsolete (boolean -t/f)
-  $data['feature']['is_obsolete'] = array(
-    'title' => 'Is Obsolete',
-    'help' => 'A boolean indicating whether this feature is obsolete.',
-    'field' => array(
-       'handler' => 'views_handler_field_chado_tf_boolean',
-       'click sortable' => TRUE,
-       'label' => t('Is Obsolete?'),
-       'type' => 'yes-no',
-    ),
-    'filter' => array(
-       'handler' => 'views_handler_filter_chado_boolean',
-       'label' => t('Is Obsolete?'),
-       'type' => 'yes-no',
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-  );
-
-  // Field: time accessioned (datetime)
-  $data['feature']['timeaccessioned'] = array(
-    'title' => 'Time Accessioned',
-    'help' => 'The date & time when this feature was accessioned (added into the database)',
-    'field' => array(
-      'handler' => 'views_handler_field_readable_date',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-
-  // Field: time last modified (datetime)
-  $data['feature']['timelastmodified'] = array(
-    'title' => 'Time Last Modified',
-    'help' => 'The date & time when this feature was last modified.',
-    'field' => array(
-      'handler' => 'views_handler_field_readable_date',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-
-  // Calculated Field: Number of Analysis' (Count -Int)
-  // Provides the number of analysis' for a given feature
-  // @see tripal_analysis/views/misc_tables.views.inc
-  
-  //Calculated Field: Number of Libraries (Count -Int)
-  // Provides the number of libraries for a given feature
-  // @see tripal_library/views/misc_tables.views.inc 
-
-	// Calculated Field: feature relationships
-	// uses a custom field handler which pulls results from the view
-	$data['feature']['relationships'] = array(
-    'title' => t('Feature Relationships'),
-    'help' => t('Relationships including the current feature.'),
-    'field' => array(
-      'title' => t('Relationships'),
-      'help' => t('Display a given type of relationships including the current feature.'),
-      'handler' => 'views_handler_field_chado_rel_by_type',
-    ),
-  ); 
-  
-  return $data;
- }

+ 0 - 23
tripal_feature/views/handlers/views_handler_field_computed_feature_nid.inc

@@ -1,23 +0,0 @@
-<?php
-
-/**
- *
- *
- * @ingroup tripal_feature
- * @ingroup views_field_handlers
- */
-class views_handler_field_computed_feature_nid extends views_handler_field_numeric {
-	function construct() {
-		parent::construct();
-		$this->additional_fields['feature_id'] = array('table' => 'feature', 'field' => 'feature_id');
-	}
-
-	function query() { 
-		$this->ensure_my_table();
-		$this->add_additional_fields(); 
-	}
-
-	function render($values) { 
-		return $values->feature_nid;
-	}
-} 

+ 0 - 60
tripal_feature/views/misc_tables.views.inc

@@ -1,60 +0,0 @@
-<?php
-
-/**
- * Purpose: Allows the feature module to add fields to other module views
- *
- *   For example, a field counting the number of features associted with a given organism would be
- *   added to the organism view as follows:
- *   @code
-      $data['organism']['num_features'] = array(
-        'title' => 'Number of features',
-        'help' => 'Provides a count of the number of features associated with a given organism',
-        'field' => array(
-          'handler' => 'views_handler_field_chado_count',
-          'table_to_query' => 'feature',
-        ),
-      ); 
- *   @endcode
- *
- * @ingroup tripal_feature_views
- */
-function retrieve_feature_misc_tables_views_data() {
-  $data = array();
- 
-  // Table: Organism--------------------------------------------------------------------------------
-  // Calculated Field: Number of features (Count -Int)
-  // Provides the number of features for a given organism
-  $data['organism']['num_features'] = array(
-    'title' => 'Number of Features',
-    'help' => 'Provides a count of the number of features associated with a given organism',
-    'field' => array(
-      'handler' => 'views_handler_field_chado_count',
-      'table_to_query' => 'feature',
-    ),
-  );  
-
-  // Table: Library---------------------------------------------------------------------------------
-  // Calculated Field: Number of features (Count -Int)
-  // Provides the number of features for a given organism
-  $data['library']['num_features'] = array(
-    'title' => 'Number of Features',
-    'help' => 'Provides a count of the number of features associated with a given library',
-    'field' => array(
-      'handler' => 'views_handler_field_chado_count',
-      'table_to_query' => 'library_feature',
-    ),
-  );   
-
-  // Table: Analysis--------------------------------------------------------------------------------
-  // Calculated Field: Number of features (Count -Int)
-  // Provides the number of features for a given organism
-  $data['analysis']['num_features'] = array(
-    'title' => 'Number of Features',
-    'help' => 'Provides a count of the number of features associated with a given analysis',
-    'field' => array(
-      'handler' => 'views_handler_field_chado_count',
-      'table_to_query' => 'analysisfeature',
-    ),
-  ); 
-  return $data;
-}

+ 0 - 84
tripal_feature/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_feature.views.inc:tripal_feature_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_feature.views.inc --in tripal_feature_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_feature_views_data() --in tripal_feature.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_feature/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_feature.views.inc:tripal_feature_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_feature.views.inc --in tripal_feature_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_feature_views_data() --in tripal_feature.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 0 - 0
tripal_feature/views/handlers/views_handler_field_residues.inc → tripal_feature/views_handlers/views_handler_field_residues.inc


+ 5 - 8
tripal_genetic/tripal_genetic.views.inc

@@ -6,25 +6,22 @@
  *  chado/tripal_genetic tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
-require_once('views/genotype.views.inc');
 /*************************************************************************
  * 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 
+ *   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_genetic_views_data()  {
   $data = array();
-  
-  //$data = array_merge($data, retrieve_genotype_views_data());
 
   if (module_exists('tripal_views')) {
     $tables = array(
@@ -38,7 +35,7 @@ function tripal_genetic_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-        
+
     $tables = array(
       'environment_cvterm',
       'feautre_genotype',
@@ -52,14 +49,14 @@ function tripal_genetic_views_data()  {
       }
     }
   }
-  
+
   return $data;
 }
 
 /*************************************************************************
  * Implements hook_views_handlers()
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   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

+ 0 - 45
tripal_genetic/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_genetic_views_data() in ../tripal_genetic.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_genetic.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_genetic.views.inc:tripal_genetic_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 180
tripal_genetic/views/genotype.views.inc

@@ -1,180 +0,0 @@
-<?php 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_genetic.views.inc --in tripal_genetic_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the genotype table, it's fields and any joins between it and other tables
- * @see tripal_genetic_views_data() --in tripal_genetic.views.inc
- *
- * Table: genotype
- * @code
- * genotype-Copy/Paste Table SQL code here-genotype
- * @endcode
- */
- function retrieve_genotype_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['genotype']['table']['group'] = t('Chado Genotype');
-  
-  $data['genotype']['table']['base'] = array(
-    'field' => 'genotype_id',
-    'title' => t('Chado Genotype'),
-    'help' => t('A genotype is defined by a collection of features, mutations, balancers, deficiencies, haplotype blocks, or engineered constructs.'),
-  );
-  if($database){
-     $data['genotype']['table']['base']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-
-  //Join: feature => feature_genotype => feature
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['feature']['table']['join']['feature_genotype'] = array(
-    'left_field' => 'feature_id',
-    'field' => 'feature_id',
-  );  
-  $data['feature']['table']['join']['genotype'] = array(
-    'left_table' => 'feature_genotype',
-    'left_field' => 'feature_id',
-    'field' => 'feature_id',
-  );
-  $data['feature_genotype']['table']['join']['genotype'] = array(
-    'left_field' => 'genotype_id',
-    'field' => 'genotype_id',
-  );
-
-  //Join: feature => feature_genotype => feature
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['genotype']['table']['join']['feature_genotype'] = array(
-    'left_field' => 'genotype_id',
-    'field' => 'genotype_id',
-  );  
-  $data['genotype']['table']['join']['feature'] = array(
-    'left_table' => 'feature_genotype',
-    'left_field' => 'genotype_id',
-    'field' => 'genotype_id',
-  );
-  $data['feature_genotype']['table']['join']['feature'] = array(
-    'left_field' => 'feature_id',
-    'field' => 'feature_id',
-  );
-  
-   //Join: stock => stock_genotype => stock
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for stock => library 
-  // describe in both stock.views.inc and library.views.inc)
-  $data['stock']['table']['join']['stock_genotype'] = array(
-    'left_field' => 'stock_id',
-    'field' => 'stock_id',
-  );  
-  $data['stock']['table']['join']['genotype'] = array(
-    'left_table' => 'stock_genotype',
-    'left_field' => 'stock_id',
-    'field' => 'stock_id',
-  );
-  $data['stock_genotype']['table']['join']['genotype'] = array(
-    'left_field' => 'genotype_id',
-    'field' => 'genotype_id',
-  );
-  
-  //Table Field Definitions----------------------------------
-      
-  //Field: genotype_id (primary key)
-  $data['genotype']['genotype_id'] = array(
-    'title' => t('Genotype Primary Key'),
-    'help' => t('A unique index for every genotype.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: name (text)  
-  $data['genotype']['name'] = array(
-    'title' => t('Name'),
-    'help' => t('Human-readable Name of the genotype.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: uniquename (text)  
-  $data['genotype']['uniquename'] = array(
-    'title' => t('Unique Name'),
-    'help' => t('Unique Name of the genotype.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: description (varchar -255)   
-  $data['genotype']['description'] = array(
-    'title' => t('Description/Value'),
-    'help' => t('A Description of the genotype.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-    
-  return $data;
-}

+ 0 - 84
tripal_genetic/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_genetic.views.inc:tripal_genetic_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_genetic.views.inc --in tripal_genetic_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_genetic_views_data() --in tripal_genetic.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_genetic/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_genetic.views.inc:tripal_genetic_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_genetic.views.inc --in tripal_genetic_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_genetic_views_data() --in tripal_genetic.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 9 - 16
tripal_library/tripal_library.views.inc

@@ -6,7 +6,7 @@
  *  chado/tripal organism tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
@@ -16,15 +16,12 @@
  * @ingroup tripal_library
  */
 
-require_once('views/library.views.inc');
-require_once('views/chado_library.views.inc');
-require_once('views/misc_tables.views.inc'); 
 /*************************************************************************
  * 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 
+ *   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)
  *
@@ -32,11 +29,7 @@ require_once('views/misc_tables.views.inc');
  */
 function tripal_library_views_data()  {
   $data = array();
-  
-  //$data = array_merge($data, retrieve_library_views_data());
-  //$data = array_merge($data, retrieve_chado_library_views_data());
-  //$data = array_merge($data, retrieve_library_misc_tables_views_data());
-  
+
   if (module_exists('tripal_views')) {
     $tables = array(
       'library'
@@ -47,7 +40,7 @@ function tripal_library_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-        
+
     $tables = array(
       'library_cvterm',
       'library_feature',
@@ -62,14 +55,14 @@ function tripal_library_views_data()  {
       }
     }
   }
-  
+
   return $data;
 }
 
 /*************************************************************************
  * Implements hook_views_handlers()
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   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
  *
@@ -111,7 +104,7 @@ function tripal_library_views_data_alter(&$data) {
       ),
     );
   }
-  
+
 }
 
 /**
@@ -121,7 +114,7 @@ function tripal_library_views_data_alter(&$data) {
  */
 function tripal_library_views_default_views () {
   $views = array();
-  
+
   // Main default view
   // List all cvterms based on cv
   $view = new view;
@@ -415,6 +408,6 @@ function tripal_library_views_default_views () {
     'name' => 'navigation',
   ));
   $views[$view->name] = $view;
-  
+
   return $views;
 }

+ 0 - 45
tripal_library/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_library_views_data() in ../tripal_library.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_library.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_library.views.inc:tripal_library_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 99
tripal_library/views/chado_library.views.inc

@@ -1,99 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_library drupal table, it's fields and any joins between it and other tables
- * @see tripal_library_views_data() --in tripal_library.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- * @ingroup tripal_library_views
- */
-function retrieve_chado_library_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  // Basic table definition
-  $data['chado_library']['table'] = array(
-    'field' => 'nid',
-    'group' => 'Chado Library'
-  );
-  
-  $data['chado_library']['nid'] = array(
-    'title' => t('Library Node ID'),
-    'help' => t('The node ID for this library'),
-    'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
-    ),
-    'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-     	'handler' => 'views_handler_sort',
-    ),
-  );
-
-  // Note: No joins need to be made from $data['library']['table']
-  
-  // Join the chado library table to library
-  $data['chado_library']['table']['join']['library'] = array(
-  	'left_field' => 'library_id',
-  	'field' => 'library_id',
-  );
-  
-  // Join the node table to chado library
-  $data['node']['table']['join']['chado_library'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to library
-  $data['node']['table']['join']['library'] = array(
-  	'left_table' => 'chado_library',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-  // Add relationship between chado_library and library
-  $data['chado_library']['library_nid'] = array(
-    'group' => 'Library',
-    'title' => 'Library Node',
-    'help' => 'Links Chado Library Fields/Data to the Nodes in the current View.',
-    'real field' => 'library_id',
-    'relationship' => array(
-      'handler' => 'views_handler_relationship',
-      'title' => t('Chado => Library'),
-      'label' => t('Chado => Library'),
-      'real field' => 'library_id',
-      'base' => 'library',
-      'base field' => 'library_id'
-    ),
-  );
-
-  // Add node relationship to library
-  $data['chado_library']['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('Chado => Node'),
-      'label' => t('Chado => Node'),
-      'real field' => 'nid',
-      'base' => 'node',
-      'base field' => 'nid'
-    ),
-  );
-  
-	return $data;
-}

+ 0 - 17
tripal_library/views/handlers/views_handler_field_computed_library_nid.inc

@@ -1,17 +0,0 @@
-<?php
-
-class views_handler_field_computed_library_nid extends views_handler_field_numeric {
-	function construct() {
-		parent::construct();
-		$this->additional_fields['library_id'] = array('table' => 'library', 'field' => 'library_id');
-	}
-
-	function query() { 
-		$this->ensure_my_table();
-		$this->add_additional_fields(); 
-	}
-
-	function render($values) { 
-		return $values->library_nid;
-	}
-} 

+ 0 - 216
tripal_library/views/library.views.inc

@@ -1,216 +0,0 @@
-<?php
-	/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the library table, it's fields and any joins between it and other tables
- * @see tripal_library_views_data() --in tripal_library.views.inc
- *
- * @todo Add support for the following tables: library_cvterm, library_pub, library_synonym, libraryprop
- * @todo Add support for multiple libraries listed per feature
- * @todo Add join to node table within if <chado/drupal same db>; also addd if not around nid field
- *
- * BASE TABLE: library
- * @code
- * create table library (
- *    library_id serial not null,
- *    primary key (library_id),
- *    organism_id int not null,
- *    foreign key (organism_id) references organism (organism_id),
- *    name varchar(255),
- *    uniquename text not null,
- *    type_id int not null,
- *    foreign key (type_id) references cvterm (cvterm_id),
- *    is_obsolete int not null default 0,
- *    timeaccessioned timestamp not null default current_timestamp,
- *    timelastmodified timestamp not null default current_timestamp,
- *    constraint library_c1 unique (organism_id,uniquename,type_id)
- * );
- * @endcode
- *
- * @ingroup tripal_library_views
- */
-function retrieve_library_views_data() {
-	global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     $database = 'chado';
-  }
-  
-  // Basic table definition
-	$data['library']['table']['group'] = 'Chado Library';
-	$data['library']['table']['base'] = array(
-	  'field' => 'library_id',
-	  'title' => 'Chado Library',
-	  'help' => 'Library existing in the Chado Database',                                                                                                                                                                          
-	);
-	if($database){
-	  $data['library']['table']['base']['database'] = $database;
-	}
-	
-	// Define relationships between this table and others
-  $data['library']['table']['join'] = array(
-    'library_feature' => array(
-      'left_field' => 'library_id',
-      'field' => 'library_id',
-    ),
-    'feature' => array(
-      'left_table' => 'library_feature',
-      'left_field' => 'library_id',
-      'field' => 'library_id',
-    ),
-  );
-
-  // Describe the joins with the library_feature table
-  $data['library_feature']['table']['join'] = array(
-    'feature' => array(
-      'left_field' => 'feature_id',
-      'field' => 'feature_id',
-    ),
-  );
-	
-	// Table Field Definitions----------------------
-	// Field: library_id (primary key)
-	$data['library']['library_id'] = array(
-	  'title' => 'Library ID',
-	  'help' => 'The primary key of the library table.',
-	  'field' => array(
-	    'handler' => 'views_handler_field_numeric',
-	    'click sortable' => TRUE,
-	  ),
-	  'filter' => array(
-	    'handler' => 'views_handler_filter_numeric',
-	  ),
-	  'sort' => array(
-	    'handler' => 'views_handler_sort',
-	  ),
-	);
-	
-  // Calculated Field: Node ID
-  //  use custom field handler to query drupal for the node ID
-  //  this is only needed if chado is in a separate database from drupal
-  if($database){
-		$data['library']['library_nid'] = array(
-	  	'title' => 'Node ID',
-	  	'help' => 'The node ID for the current library',
-	  	'field' => array(
-	    	'handler' => 'views_handler_field_computed_library_nid',
-	  	),
-		);
-  } else {
-    // Add relationship between chado_library and library
-    $data['library']['library_nid'] = array(
-      'group' => 'Library',
-      'title' => 'Library Node',
-      'help' => 'Links Chado Library Fields/Data to the Nodes in the current View.',
-      'real field' => 'library_id',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Library => Chado'),
-        'label' => t('Library => Chado'),
-        'real field' => 'library_id',
-        'base' => 'chado_library',
-        'base field' => 'library_id'
-      ),
-    );
-
-  }
-	
-	// Field: organism_id (forgeign key)
-  //  join between organism table and this one in tripal_organism/views/organism.views.inc
-	
-	// Field: type_id (forgeign key)
-  //  join between cvterm table and this one in tripal_cv/views/cvterm.views.inc
-  
-	// Field: Name (varchar 255)
-	$data['library']['name'] = array(
-	  'title' => 'Name',
-	  'help' => 'The human-readable name of the current library.',
-	  'field' => array(
-	    'handler' => 'views_handler_field',
-	    'click sortable' => TRUE,
-	  ),
-	  'sort' => array(
-	    'handler' => 'views_handler_sort',
-	  ),
-	  'filter' => array(
-	    'handler' => 'views_handler_filter_chado_select_string',
-	  ),
-	  'argument' => array(
-	    'handler' => 'views_handler_argument_string',
-	  ),
-	);
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database) {
-    $data['library']['name']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-	
-	// Field: Unique name (text)
-	$data['library']['uniquename'] = array(
-	  'title' => 'Unique Name',
-	  'help' => 'The unique name of the current library.',
-	  'field' => array(
-	    'handler' => 'views_handler_field',
-	    'click sortable' => TRUE,
-	  ),
-	  'filter' => array(
-	    'handler' => 'views_handler_filter_string',
-	  ),
-	  'argument' => array(
-	    'handler' => 'views_handler_argument_string',
-	  ),
-	);
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database) {
-    $data['library']['uniquename']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-	
-	// Field: Is obsolete (integer 0/1)
-	$data['library']['is_obsolete'] = array(
-	  'title' => t('Is Obsolete?'),
-	  'help' => t('Indicates whether a given library is obsolete or not.'),
-	  'field' => array(
-	    'handler' => 'views_handler_field_boolean',
-	    'click sortable' => TRUE,
-	  ),
-	  'filter' => array(
-       'handler' => 'views_handler_filter_chado_boolean',
-       'label' => t('Is Obsolete?'),
-       'type' => 'yes-no',
-	  ),
-	  'sort' => array(
-	    'handler' => 'views_handler_sort',
-	  ),
-	);
-	
-	// Field: time accessioned (datetime)
-	$data['library']['timeaccessioned'] = array(
-	  'title' => t('Date Accessioned'),
-	  'help' => t('Indicates the date a given library was accessioned (entered into the database).'),
-	  'field' => array(
-	    'handler' => 'views_handler_field_readable_date',
-	    'click sortable' => TRUE,
-	  ),
-	  'sort' => array(
-	    'handler' => 'views_handler_sort_date',
-	  ),
-	);
-	
-	// Field: time last modified (datetime)
-	$data['library']['timelastmodified'] = array(
-	  'title' => t('Date Last Modified'),
-	  'help' => t('Indicates the date that a given library was last modified.'),
-	  'field' => array(
-	    'handler' => 'views_handler_field_readable_date',
-	    'click sortable' => TRUE,
-	  ),
-	  'sort' => array(
-	    'handler' => 'views_handler_sort_date',
-	  ),
-	);
-	
-	return $data;
-	
-}

+ 0 - 49
tripal_library/views/misc_tables.views.inc

@@ -1,49 +0,0 @@
-<?php
-
-/**
- * Purpose: Allows the library module to add fields to other module views
- *
- *   For example, a field counting the number of libraries associted with a given feature would be
- *   added to the feature view as follows:
- *   @code
-      $data['feature']['num_libraries'] = array(
-        'title' => "Number of Libraries",
-        'help' => "Provides a count of the number of libraries associated with a given feature",
-        'field' => array(
-          'handler' => 'views_handler_field_chado_count',
-          'table_to_query' => 'library_feature',
-        ),
-      ); 
- *   @endcode
- *
- * @ingroup tripal_library_views
- */
-function retrieve_library_misc_tables_views_data() {
-  $data = array();
- 
-  // Table: Feature---------------------------------------------------------------------------------
-  // Calculated Field: Number of Libraries (Count -Int)
-  // Provides the number of libraries for a given feature
-  $data['feature']['num_libraries'] = array(
-    'title' => "Number of Libraries",
-    'help' => "Provides a count of the number of libraries associated with a given feature",
-    'field' => array(
-      'handler' => 'views_handler_field_chado_count',
-      'table_to_query' => 'library_feature',
-    ),
-  ); 
-
-  // Table: Organism--------------------------------------------------------------------------------
-  // Calculated Field: Number of Libraries (Count -Int)
-  // Provides the number of libraries for a given organism
-  $data['organism']['num_libraries'] = array(
-    'title' => 'Number of Libraries',
-    'help' => 'Provides a count of the number of libraries associated with a given organism',
-    'field' => array(
-      'handler' => 'views_handler_field_chado_count',
-      'table_to_query' => 'library',
-    ),
-  );  
-  
-  return $data;
-}

+ 0 - 84
tripal_library/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_library.views.inc:tripal_library_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_library.views.inc --in tripal_library_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_library_views_data() --in tripal_library.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_library/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_library.views.inc:tripal_library_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_library.views.inc --in tripal_library_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_library_views_data() --in tripal_library.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 6 - 24
tripal_natural_diversity/tripal_natural_diversity.views.inc

@@ -6,40 +6,22 @@
  *  chado/tripal_natural_diversity tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  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 
+ *   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)
  */
-//require_once('views/nd_experiment.views.inc');
-//require_once('views/nd_experimentprop.views.inc');
-//require_once('views/nd_geolocation.views.inc');
-//require_once('views/nd_geolocationprop.views.inc');
-//require_once('views/nd_reagent.views.inc');
-//require_once('views/nd_reagentprop.views.inc');
 function tripal_natural_diversity_views_data()  {
   $data = array();
-  
-  //EXPERIMENT
-  //$data = array_merge($data, retrieve_nd_experiment_views_data());
-  //$data = array_merge($data, retrieve_nd_experimentprop_views_data());
-  
-  // GEOLOCATION
-  //$data = array_merge($data, retrieve_nd_geolocation_views_data());
-  //$data = array_merge($data, retrieve_nd_geolocationprop_views_data());
-  
-  // REAGENTS
-  //$data = array_merge($data, retrieve_nd_reagent_views_data());
-  //$data = array_merge($data, retrieve_nd_reagentprop_views_data());
 
   if (module_exists('tripal_views')) {
     $tables = array(
@@ -54,7 +36,7 @@ function tripal_natural_diversity_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-        
+
     $tables = array(
       'nd_experiment_contact',
       'nd_experiment_dbxref',
@@ -80,14 +62,14 @@ function tripal_natural_diversity_views_data()  {
       }
     }
   }
-  
+
   return $data;
 }
 
 /*************************************************************************
  * Implements hook_views_handlers()
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   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

+ 0 - 45
tripal_natural_diversity/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_natural_diversity_views_data() in ../tripal_natural_diversity.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_natural_diversity.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_natural_diversity.views.inc:tripal_natural_diversity_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 182
tripal_natural_diversity/views/nd_experiment.views.inc

@@ -1,182 +0,0 @@
-<?php
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the nd_experiment table, it's fields and any joins between it and other tables
- * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
- *
- * @todo Add relationship to nd_geolocations.views.inc
- *
- * Table: nd_experiment
- * @code
-  CREATE TABLE nd_experiment (
-    nd_experiment_id serial PRIMARY KEY NOT NULL,
-    nd_geolocation_id integer NOT NULL references nd_geolocation (nd_geolocation_id) on delete cascade INITIALLY DEFERRED,
-    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED 
-  );
- * @endcode
- */
- function retrieve_nd_experiment_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['nd_experiment']['table']['group'] = t('Chado ND Experiment');
-  
-  $data['nd_experiment']['table']['base'] = array(
-    'field' => 'nd_experiment_id',
-    'title' => t('Chado Natural Diversity Experiment'),
-    'help' => t('Represents one data point in a natural diversity project.'),
-  );
-  if($database){
-     $data['nd_experiment']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: nd_experiment => nd_geolocation
-  // In nd_experiment.views.inc
-  
-  //Join: nd_experiment => nd_experiment_contact => contact
-  $data['nd_experiment']['table']['join']['nd_experiment_contact'] = array(
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );  
-  $data['nd_experiment']['table']['join']['contact'] = array(
-    'left_table' => 'nd_experiment_contact',
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );
-  $data['nd_experiment_contact']['table']['join']['contact'] = array(
-    'left_field' => 'contact_id',
-    'field' => 'contact_id',
-  );
-  
-  //Join: nd_experiment => nd_experiment_dbxref => dbxref
-  $data['nd_experiment']['table']['join']['nd_experiment_dbxref'] = array(
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );  
-  $data['nd_experiment']['table']['join']['dbxref'] = array(
-    'left_table' => 'nd_experiment_dbxref',
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );
-  $data['nd_experiment_dbxref']['table']['join']['dbxref'] = array(
-    'left_field' => 'dbxref_id',
-    'field' => 'dbxref_id',
-  );
-  
-  //Join: nd_experiment => nd_experiment_genotype => genotype
-  $data['nd_experiment']['table']['join']['nd_experiment_genotype'] = array(
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );  
-  $data['nd_experiment']['table']['join']['genotype'] = array(
-    'left_table' => 'nd_experiment_genotype',
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );
-  $data['nd_experiment_genotype']['table']['join']['genotype'] = array(
-    'left_field' => 'genotype_id',
-    'field' => 'genotype_id',
-  );
-  
-  //Join: nd_experiment => nd_experiment_phenotype => phenotype
-  $data['nd_experiment']['table']['join']['nd_experiment_phenotype'] = array(
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );  
-  $data['nd_experiment']['table']['join']['phenotype'] = array(
-    'left_table' => 'nd_experiment_phenotype',
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );
-  $data['nd_experiment_phenotype']['table']['join']['phenotype'] = array(
-    'left_field' => 'phenotype_id',
-    'field' => 'phenotype_id',
-  );
-  
-  //Join: nd_experiment => nd_experiment_project => project
-  $data['nd_experiment']['table']['join']['nd_experiment_project'] = array(
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );  
-  $data['nd_experiment']['table']['join']['project'] = array(
-    'left_table' => 'nd_experiment_project',
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );
-  $data['nd_experiment_project']['table']['join']['project'] = array(
-    'left_field' => 'project_id',
-    'field' => 'project_id',
-  );
-  
-  //Join: nd_experiment => nd_experiment_pub => pub
-  $data['nd_experiment']['table']['join']['nd_experiment_pub'] = array(
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );  
-  $data['nd_experiment']['table']['join']['pub'] = array(
-    'left_table' => 'nd_experiment_pub',
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );
-  $data['nd_experiment_pub']['table']['join']['pub'] = array(
-    'left_field' => 'pub_id',
-    'field' => 'pub_id',
-  );
-
-  //Join: nd_experiment => nd_experiment_stock => YYY
-  $data['nd_experiment']['table']['join']['nd_experiment_stock'] = array(
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );  
-  $data['nd_experiment']['table']['join']['stock'] = array(
-    'left_table' => 'nd_experiment_stock',
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );
-  $data['nd_experiment_stock']['table']['join']['stock'] = array(
-    'left_field' => 'stock_id',
-    'field' => 'stock_id',
-  );
-
-  //Table Field Definitions----------------------------------
-      
-  //Field: nd_experiment_id (primary key)
-  $data['nd_experiment']['nd_experiment_id'] = array(
-    'title' => t('ND Experiment Primary Key'),
-    'help' => t('A unique index for every nd_experiment.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-    
-  return $data;
-}

+ 0 - 127
tripal_natural_diversity/views/nd_experimentprop.views.inc

@@ -1,127 +0,0 @@
-<?php
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the nd_experimentprop table, it's fields and any joins between it and other tables
- * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
- *
- * Table: nd_experimentprop
- * @code
- * nd_experimentprop-Copy/Paste Table SQL code here-nd_experimentprop
- * @endcode
- */
- function retrieve_nd_experimentprop_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['nd_experimentprop']['table'] = array(
-    'group' => t('Chado ND Experiment Properties'),
-    'field' => 'nd_experimentprop_id',
-    'title' => t('Chado ND Experiment Property'),
-    'help' => t('Properties of a given Natural Diversity Experiment.'),
-  );
-  if($database){
-     $data['nd_experimentprop']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: nd_experimentprop => nd_experiment
-  $data['nd_experimentprop']['table']['join']['nd_experiment'] = array(
-    'left_field' => 'nd_experiment_id',
-    'field' => 'nd_experiment_id',
-  );
-  
-  //Table Field Definitions----------------------------------
-      
-  //Field: nd_experimentprop_id (primary key)
-  $data['nd_experimentprop']['nd_experimentprop_id'] = array(
-    'title' => t('ND Experiment Property Primary Key'),
-    'help' => t('A unique index for every nd_experimentprop.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: value (varchar 255)   
-  $data['nd_experimentprop']['value'] = array(
-    'title' => t('Property Value'),
-    'help' => t('The value of a given property.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: rank (int)   
-  $data['nd_experimentprop']['rank'] = array(
-    'title' => t('Property Rank'),
-    'help' => t('The rank of a given propery.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Calculated Field: type/cvterm name (varchar 255)   
-  $data['nd_experimentprop']['nd_experimentprop_cvterm_name'] = array(
-    'title' => t('Property Type'),
-    'help' => t('The type of property.'),
-    'field' => array(
-      'handler' => 'views_handler_field_cvterm_name',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );  
-  
-  return $data;
-}

+ 0 - 161
tripal_natural_diversity/views/nd_geolocation.views.inc

@@ -1,161 +0,0 @@
-<?php
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the nd_geolocation table, it's fields and any joins between it and other tables
- * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
- *
- * Table: nd_geolocation
- * @code
- * nd_geolocation-Copy/Paste Table SQL code here-nd_geolocation
- * @endcode
- */
- function retrieve_nd_geolocation_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['nd_geolocation']['table']['group'] = t('Chado ND geolocation');
-  
-  $data['nd_geolocation']['table']['base'] = array(
-    'field' => 'nd_geolocation_id',
-    'title' => t('Chado Natural Diversity Geolocation'),
-    'help' => t('A listing of locations where Natural Diversity Experiments can be performed.'),
-  );
-  if($database){
-     $data['nd_geolocation']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: nd_geolocation => nd_experiment
-  $data['nd_geolocation']['table']['join']['nd_experiment'] = array(
-    'left_field' => 'nd_geolocation_id',
-    'field' => 'nd_geolocation_id',
-  );  
-  
-  //Table Field Definitions----------------------------------
-      
-  //Field: nd_geolocation_id (primary key)
-  $data['nd_geolocation']['nd_geolocation_id'] = array(
-    'title' => t('ND Geolocation Primary Key'),
-    'help' => t('A unique index for every nd_geolocation.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: description (varchar 255)   
-  $data['nd_geolocation']['description'] = array(
-    'title' => t('Description'),
-    'help' => t('A short description of a given geolocation.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: latitude (real)   
-  $data['nd_geolocation']['latitude'] = array(
-    'title' => t('Latitude'),
-    'help' => t('The decimal latitude coordinate of the georeference, using positive and negative sign to indicate N and S, respectively.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: longitude (real)   
-  $data['nd_geolocation']['longitude'] = array(
-    'title' => t('Longitude'),
-    'help' => t('The decimal longitude coordinate of the georeference, using positive and negative sign to indicate E and W, respectively.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: altitude (real)   
-  $data['nd_geolocation']['altitude'] = array(
-    'title' => t('Altitude'),
-    'help' => t('The altitude (elevation) of the location in meters. If the altitude is only known as a range, this is the average, and altitude_dev will hold half of the width of the range.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: geodetic_datum (varchar 255)   
-  $data['nd_geolocation']['geodetic_datum'] = array(
-    'title' => t('Deodetic Datum'),
-    'help' => t('The geodetic system on which the geo-reference coordinates are based. For geo-references measured between 1984 and 2010, this will typically be WGS84.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  
-    
-  return $data;
-}

+ 0 - 127
tripal_natural_diversity/views/nd_geolocationprop.views.inc

@@ -1,127 +0,0 @@
-<?php
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the nd_geolocationprop table, it's fields and any joins between it and other tables
- * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
- *
- * Table: nd_geolocationprop
- * @code
- * nd_geolocationprop-Copy/Paste Table SQL code here-nd_geolocationprop
- * @endcode
- */
- function retrieve_nd_geolocationprop_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['nd_geolocationprop']['table'] = array(
-    'field' => 'nd_geolocationprop_id',
-    'title' => t('Chado ND Geolocation Properties'),
-    'help' => t('Properties of Natural Diversity Geolocations.'),
-    'group' => t('Chado ND Geolocation Properties'),
-  );
-  if($database){
-     $data['nd_geolocationprop']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: nd_geolocation => nd_geolocationprop
-  $data['nd_geolocationprop']['table']['join']['nd_geolocation'] = array(
-    'left_field' => 'nd_geolocation_id',
-    'field' => 'nd_geolocation_id',
-  );
-  
-  //Table Field Definitions----------------------------------
-      
-  //Field: nd_geolocationprop_id (primary key)
-  $data['nd_geolocationprop']['field_name'] = array(
-    'title' => t('ND Geolocation Property Primary Key'),
-    'help' => t('A unique index for every ND Geolocation Property.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-  
-  //Field: value (varchar 255)   
-  $data['nd_geolocationprop']['value'] = array(
-    'title' => t('Property Value'),
-    'help' => t('The value of a given property.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: rank (int)   
-  $data['nd_geolocationprop']['rank'] = array(
-    'title' => t('Property Rank'),
-    'help' => t('The rank of a given propery.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Calculated Field: type/cvterm name (varchar 255)   
-  $data['nd_geolocationprop']['nd_geolocationprop_cvterm_name'] = array(
-    'title' => t('Property Type'),
-    'help' => t('The type of property.'),
-    'field' => array(
-      'handler' => 'views_handler_field_cvterm_name',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );  
-    
-  return $data;
-}

+ 0 - 121
tripal_natural_diversity/views/nd_reagent.views.inc

@@ -1,121 +0,0 @@
-<?php
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the nd_reagent table, it's fields and any joins between it and other tables
- * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
- *
- * Table: nd_reagent
- * @code
-  CREATE TABLE nd_reagent (
-    nd_reagent_id serial PRIMARY KEY NOT NULL,
-    name character varying(80) NOT NULL,
-    type_id integer NOT NULL references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
-    feature_id integer
-  );
- * @endcode
- */
- function retrieve_nd_reagent_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['nd_reagent']['table']['group'] = t('Chado ND Reagent');
-  
-  $data['nd_reagent']['table']['base'] = array(
-    'field' => 'nd_reagent_id',
-    'title' => t('Chado Natural Diversity Reagent'),
-    'help' => t('Reagents used in Natural Diversity Experiments.'),
-  );
-  if($database){
-     $data['nd_reagent']['table']['base']['database'] = $database;
-  }
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: nd_reagent_id (primary key)
-  $data['nd_reagent']['nd_reagent_id'] = array(
-    'title' => t('ND Reagent Primary Key'),
-    'help' => t('A unique index for every ND Reagent.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: name (varchar 255)   
-  $data['nd_reagent']['name'] = array(
-    'title' => t('Name'),
-    'help' => t('The name of the reagent.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: type_id (foreign key)
-  // Join described in cvterm.views.inc
-  
-  //Field: feature_id (foreign key)
-  // Join described in feature.views.inc
- 
- 	//Calculated Field: stock relationships (ALL)
-	// uses a custom field handler which pulls results from the view
-	// actual query performed in chado_stock_views_views_pre_render	(&$view) -file:tripal_stock.views.inc
-	$data['nd_reagent']['all_relationships'] = array(
-  	'title' => t('All Reagent Relationships'),
-  	'help' => t('Relationships including the current reagent.'),
-  	'field' => array(
-    	'title' => t('All Relationships'),
-    	'help' => t('Display all relationships including the current reagent.'),
-    	'handler' => 'views_handler_field_chado_relationship_all',
-  	),
-	);
-
-	//Calculated Field: stock relationships
-	// uses a custom field handler which pulls results from the view
-	// actual query performed in chado_stock_views_views_pre_render	(&$view) -file:tripal_stock.views.inc
-	$data['nd_reagent']['relationships'] = array(
-    'title' => t('ND Reagent Relationships'),
-    'help' => t('Relationships including the current reagent.'),
-    'field' => array(
-      'title' => t('Relationships'),
-      'help' => t('Display a given type of relationships including the current reagent.'),
-      'handler' => 'views_handler_field_chado_relationship_by_type',
-    ),
-  );
-  return $data;
-}

+ 0 - 125
tripal_natural_diversity/views/nd_reagentprop.views.inc

@@ -1,125 +0,0 @@
-<?php
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the nd_reagentprop table, it's fields and any joins between it and other tables
- * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
- *
- * Table: nd_reagentprop
- * @code
- * nd_reagentprop-Copy/Paste Table SQL code here-nd_reagentprop
- * @endcode
- */
- function retrieve_nd_reagentprop_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------  
-  $data['nd_reagentprop']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado ND Reagent Property'),
-    'help' => t('Properties of Natural Diversity Reagents.'),
-    'group' => t('Chado ND Reagent Property'),
-  );
-  if($database){
-     $data['nd_reagentprop']['table']['database'] = $database;
-  }
-
-  //Relationship Definitions---------------------------------
-  //Join: nd_reagentprop => nd_reagent
-  $data['nd_reagentprop']['table']['join']['nd_reagent'] = array(
-    'left_field' => 'nd_reagent_id',
-    'field' => 'nd_reagent_id',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: nd_reagentprop_id (primary key)
-  $data['nd_reagentprop']['nd_reagentprop_id'] = array(
-    'title' => t('ND Reagent Propery Primary Key'),
-    'help' => t('A unique index for every ND Reagent Property.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-  //Field: value (varchar 255)   
-  $data['nd_reagentprop']['value'] = array(
-    'title' => t('Property Value'),
-    'help' => t('The value of a given property.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: rank (int)   
-  $data['nd_reagentprop']['rank'] = array(
-    'title' => t('Property Rank'),
-    'help' => t('The rank of a given propery.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Calculated Field: type/cvterm name (varchar 255)   
-  $data['nd_reagentprop']['nd_reagentprop_cvterm_name'] = array(
-    'title' => t('Property Type'),
-    'help' => t('The type of property.'),
-    'field' => array(
-      'handler' => 'views_handler_field_cvterm_name',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );  
-    
-  return $data;
-}

+ 0 - 84
tripal_natural_diversity/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_natural_diversity.views.inc:tripal_natural_diversity_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_natural_diversity/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_natural_diversity.views.inc:tripal_natural_diversity_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_natural_diversity.views.inc --in tripal_natural_diversity_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_natural_diversity_views_data() --in tripal_natural_diversity.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 8 - 13
tripal_organism/tripal_organism.views.inc

@@ -6,7 +6,7 @@
  *  chado/tripal organism tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
@@ -16,14 +16,12 @@
  * @ingroup tripal_organism
  */
 
-require_once('views/organism.views.inc');
-require_once('views/chado_organism.views.inc'); 
 /**
  * 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 
+ *   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)
  *
@@ -31,10 +29,7 @@ require_once('views/chado_organism.views.inc');
  */
 function tripal_organism_views_data()  {
   $data = array();
-  
-  //$data = array_merge($data, retrieve_organism_views_data());
-  //$data = array_merge($data, retrieve_chado_organism_views_data());
-  
+
   if (module_exists('tripal_views')) {
     // Base Table
     $tables = array(
@@ -46,7 +41,7 @@ function tripal_organism_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-    
+
     // Additional Tables
     $tables = array(
       'organismprop',
@@ -66,7 +61,7 @@ function tripal_organism_views_data()  {
 /**
  * Implements hook_views_handlers()
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   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
  *
@@ -111,7 +106,7 @@ function tripal_organism_views_data_alter(&$data) {
       ),
     );
   }
-  
+
 }
 
 /**
@@ -120,7 +115,7 @@ function tripal_organism_views_data_alter(&$data) {
  */
 function tripal_organism_views_default_views () {
   $views = array();
-  
+
   // Main default view
   // List all cvterms based on cv
   $view = new view;
@@ -400,6 +395,6 @@ function tripal_organism_views_default_views () {
     'name' => 'navigation',
   ));
   $views[$view->name] = $view;
-  
+
   return $views;
 }

+ 0 - 45
tripal_organism/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_organism_views_data() in ../tripal_organism.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_organism.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_organism.views.inc:tripal_organism_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 99
tripal_organism/views/chado_organism.views.inc

@@ -1,99 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_organism drupal table, it's fields and any joins between it and other tables
- * @see tripal_organism_views_data() --in tripal_organism.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- * @ingroup tripal_organism_views
- */
-function retrieve_chado_organism_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  // Basic table definition
-  $data['chado_organism']['table'] = array(
-    'field' => 'nid',
-    'group' => 'Chado Organism'
-  );
-  
-  $data['chado_organism']['nid'] = array(
-    'title' => t('Organism Node ID'),
-    'help' => t('The node ID for this organism'),
-    'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
-    ),
-    'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-     	'handler' => 'views_handler_sort',
-    ),
-  );
-
-  // Note: No joins need to be made from $data['organism']['table']
-  
-  // Join the chado organism table to organism
-  $data['chado_organism']['table']['join']['organism'] = array(
-  	'left_field' => 'organism_id',
-  	'field' => 'organism_id',
-  );
-  
-  // Join the node table to chado organism
-  $data['node']['table']['join']['chado_organism'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to organism
-  $data['node']['table']['join']['organism'] = array(
-  	'left_table' => 'chado_organism',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-  // Add relationship between chado_organism and organism
-  $data['chado_organism']['organism_id'] = array(
-    'group' => 'Organism',
-    'title' => 'Organism Node',
-    'help' => 'Links Chado Organism Fields/Data to the Nodes in the current View.',
-    'real field' => 'organism_id',
-    'relationship' => array(
-      'handler' => 'views_handler_relationship',
-      'title' => t('Chado => Organism'),
-      'label' => t('Chado => Organism'),
-      'real field' => 'organism_id',
-      'base' => 'organism',
-      'base field' => 'organism_id'
-    ),
-  );
-/*
-  // Add node relationship to organism
-  $data['chado_organism']['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('Chado => Node'),
-      'label' => t('Chado => Node'),
-      'real field' => 'nid',
-      'base' => 'node',
-      'base field' => 'nid'
-    ),
-  );
-*/  
-	return $data;
-}

+ 0 - 17
tripal_organism/views/handlers/views_handler_field_computed_organism_nid.inc

@@ -1,17 +0,0 @@
-<?php
-
-class views_handler_field_computed_organism_nid extends views_handler_field_numeric {
-	function construct() {
-		parent::construct();
-		$this->additional_fields['organism_id'] = array('table' => 'organism', 'field' => 'organism_id');
-	}
-
-	function query() { 
-		$this->ensure_my_table();
-		$this->add_additional_fields(); 
-	}
-
-	function render($values) { 
-		return $values->organism_nid;
-	}
-} 

+ 0 - 230
tripal_organism/views/organism.views.inc

@@ -1,230 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the organism table, it's fields and any joins between it and other tables
- * @see tripal_organism_views_data() --in tripal_organism.views.inc
- *
- * @todo Add support for the following tables: organismprop, organism_dbxref
- * @todo Add join to node table within if <chado/drupal same db>; also addd if not around nid field
- *
- * BASE TABLE: organism
- * @code
- * create table organism (
- *        organism_id serial not null,
- *        primary key (organism_id),
- *        abbreviation varchar(255) null,
- *        genus varchar(255) not null,
- *        species varchar(255) not null,
- *        common_name varchar(255) null,
- *        comment text null,
- *        constraint organism_c1 unique (genus,species)
- * );
- * @endcode
- *
- * @ingroup tripal_organism_views
- */
-function retrieve_organism_views_data() {
-	global $db_url;
-	$data = array();
-	
-	// if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     $database = 'chado';
-  }
-
-	
-  // Basic table definition
-  $data['organism']['table']['group'] = 'Chado Organism';
-  $data['organism']['table']['base'] = array(
-    'field' => 'organism_id',
-    'title' => 'Chado Organism',
-    'help' => 'Organisms existing in the Chado Database',                                                                                                                                                                          
-  );
-  if($database){
-     $data['organism']['table']['base']['database'] = $database;
-  }
-
-  // Define relationships between this table and others
-  $data['organism']['table']['join'] = array(
-    'feature' => array(
-      'left_field' => 'organism_id',
-      'field' => 'organism_id',
-    ),
-    'library' => array(
-      'left_field' => 'organism_id',
-      'field' => 'organism_id',
-    ),
-    'stock' => array(
-      'left_field' => 'organism_id',
-      'field' => 'organism_id',
-    ),
-  ); 
-
-  // Table Field Definitions----------------------
-  // Field: organism_id (primary key)
-  $data['organism']['organism_id'] = array(
-    'title' => 'Organism ID',
-    'help' => 'The primary key of the organism.',
-    'field' => array(
-       'handler' => 'views_handler_field_numeric',
-       'click sortable' => TRUE,
-      ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_numeric',
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-     'argument' => array(
-     	 'handler' => 'views_handler_argument',
-     ),
-  );
-
-  // Calculated Field: Node ID
-  //  use custom field handler to query drupal for the node ID
-  //  this is only needed if chado is in a separate database from drupal
-  if($database && module_exists('tripal_views')){
-	  $data['organism']['organism_nid'] = array(
-  	  'title' => 'Node ID',
-    	'help' => 'This is the node ID of this organism. It can be used as a link to the node.',
-    	'field' => array(
-      	'handler' => 'views_handler_field_computed_organism_nid',
-    	),    
-  	);
-  } else {
-    // Add relationship between chado_organism and organism
-    $data['organism']['organism_id'] = array(
-      'group' => 'Organism',
-      'title' => 'Organism Node',
-      'help' => 'Links Chado Organism Fields/Data to the Nodes in the current View.',
-      'real field' => 'organism_id',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Organism => Chado'),
-        'label' => t('Organism => Chado'),
-        'real field' => 'organism_id',
-        'base' => 'chado_organism',
-        'base field' => 'organism_id'
-      ),
-    );
-
-  }
-	
-  // Field: abbreviation (varchar 255)
-  $data['organism']['abbreviation'] = array(
-    'title' => 'Abbreviation',
-    'help' => 'The abbreviation of the organism name ie: A.thaliana.',
-    'field' => array(
-       'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-  );
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database && module_exists('tripal_views')) {
-    $data['organism']['abbreviation']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-
-  // Field: genus (varchar 255)
-  $data['organism']['genus'] = array(
-    'title' => 'Genus',
-    'help' => 'The genus portion of the organism\'s scientific name',
-    'field' => array(
-       'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-  );
-
-  // Field: species (varchar 255)
-  $data['organism']['species'] = array(
-    'title' => 'Species',
-    'help' => 'The species portion of the organism\'s scientific name',
-    'field' => array(
-       'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-  );
-
-  // Field: common name (varchar 255)
-  $data['organism']['common_name'] = array(
-    'title' => 'Common Name',
-    'help' => 'The common name of the organism.',
-    'field' => array(
-       'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'sort' => array(
-       'handler' => 'views_handler_sort',
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-  );
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database && module_exists('tripal_views')) {
-    $data['organism']['common_name']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-
-  // Field: Comment (text)
-  $data['organism']['comment'] = array(
-    'title' => 'Comment',
-    'help' => 'A free-text comment about the organism',
-    'field' => array(
-       'handler' => 'views_handler_field',
-       'click sortable' => TRUE,
-     ),
-     'filter' => array(
-       'handler' => 'views_handler_filter_string',
-     ),
-     'argument' => array(
-       'handler' => 'views_handler_argument_string',
-     ),
-  );
-  
-  //Calculated Field: Count (Int)
-  // Provides the number of features for a given organism
-  // @see tripal_feature/views/misc_tables.views.inc
-
-  //Calculated Field: Count (Int)
-  // Provides the number of stocks for a given organism
-  // @see tripal_stock/views/misc_tables.views.inc
-
-  //Calculated Field: Number of Libraries (Count -Int)
-  // Provides the number of libraries for a given organism
-  // @see tripal_library/views/misc_tables.views.inc
-
-  return $data;
-
-}

+ 0 - 84
tripal_organism/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_organism.views.inc:tripal_organism_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_organism.views.inc --in tripal_organism_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_organism_views_data() --in tripal_organism.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_organism/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_organism.views.inc:tripal_organism_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_organism.views.inc --in tripal_organism_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_organism_views_data() --in tripal_organism.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 0 - 45
tripal_phenotype/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_phenotype_views_data() in ../tripal_phenotype.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_phenotype.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_phenotype.views.inc:tripal_phenotype_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 84
tripal_phenotype/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_phenotype.views.inc:tripal_phenotype_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_phenotype.views.inc --in tripal_phenotype_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_phenotype_views_data() --in tripal_phenotype.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_phenotype/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_phenotype.views.inc:tripal_phenotype_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_phenotype.views.inc --in tripal_phenotype_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_phenotype_views_data() --in tripal_phenotype.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 5 - 10
tripal_project/tripal_project.views.inc

@@ -6,27 +6,22 @@
  *  chado/tripal_project tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
-require_once('views/project.views.inc');
-require_once('views/project.views.inc');
 /*************************************************************************
  * 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 
+ *   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_project_views_data()  {
   $data = array();
-  
-  //$data = array_merge($data, retrieve_project_views_data());
-  //$data = array_merge($data, retrieve_project_views_data());
 
   if (module_exists('tripal_views')) {
     $tables = array(
@@ -38,7 +33,7 @@ function tripal_project_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-        
+
     $tables = array(
     );
     foreach ($tables as $tablename) {
@@ -48,14 +43,14 @@ function tripal_project_views_data()  {
       }
     }
   }
-  
+
   return $data;
 }
 
 /*************************************************************************
  * Implements hook_views_handlers()
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   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

+ 0 - 45
tripal_project/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_project_views_data() in ../tripal_project.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_project.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_project.views.inc:tripal_project_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 98
tripal_project/views/chado_project.views.inc

@@ -1,98 +0,0 @@
-<?php
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_project.views.inc --in tripal_project_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_project linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of project.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_project drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_project_views_data() --in tripal_project.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_project_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_project']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['project']['table']
-  
-  // Join the chado_project table to project
-  $data['chado_project']['table']['join']['project'] = array(
-  	'left_field' => 'project_id',
-  	'field' => 'project_id',
-  );
-  
-  // Join the node table to chado_project
-  $data['node']['table']['join']['chado_project'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to project
-  $data['node']['table']['join']['project'] = array(
-  	'left_table' => 'chado_project',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-  // Add relationship between chado_project and project
-  $data['chado_project']['project_nid'] = array(
-    'group' => 'project',
-    'title' => 'Project Node',
-    'help' => 'Links Chado project Fields/Data to the Nodes in the current View.',
-    'real field' => 'project_id',
-    'relationship' => array(
-      'handler' => 'views_handler_relationship',
-      'title' => t('Chado => Project'),
-      'label' => t('Chado => Project'),
-      'real field' => 'project_id',
-      'base' => 'project',
-      'base field' => 'project_id'
-    ),
-  );
-
-  // Add node relationship to project
-  $data['chado_project']['project_chado_nid'] = array(
-    'group' => 'project',
-    'title' => 'Project Node',
-    'help' => 'Links Chado project 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'
-    ),
-  );
-	return $data;
-}

+ 0 - 251
tripal_project/views/project.views.inc

@@ -1,251 +0,0 @@
-<?php
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_project.views.inc --in tripal_project_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the project table, it's fields and any joins between it and other tables
- * @see tripal_project_views_data() --in tripal_project.views.inc
- *
- * Table: project
- * @code
- * project-Copy/Paste Table SQL code here-project
- * @endcode
- */
- function retrieve_project_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['project']['table']['group'] = t('Chado Project');
-  
-  $data['project']['table']['base'] = array(
-    'field' => 'project_id',
-    'title' => t('Chado Project'),
-    'help' => t('Another way of grouping chado content together.'),
-  );
-  if($database){
-     $data['project']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => project
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  /**
-  $data['project']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in project table',
-  ); 
-  */
-  
-  //Join: project => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  /**
-  $data['project']['table']['join']['XY'] = array(
-    'left_field' => 'matching project key in the XY table',
-    'field' => 'primary key in project table',
-  );  
-  $data['project']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching project key in the XY table',
-    'field' => 'primary key in project table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-  */
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: project_id (primary key)
-  $data['project']['project_id'] = array(
-    'title' => t('Project Primary Key'),
-    'help' => t('A unique index for every project.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  // Calculated Field: Node ID
-  //  use custom field handler to query drupal for the node ID
-  //  this is only needed if chado is in a separate database from drupal
-	if ($database){
-
-  } else {
-    // Add relationship between chado_project and project
-    $data['project']['project_nid'] = array(
-      'group' => 'project',
-      'title' => 'project Node',
-      'help' => 'Links Chado project Fields/Data to the Nodes in the current View.',
-      'real field' => 'project_id',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('project => Chado'),
-        'label' => t('project => Chado'),
-        'real field' => 'project_id',
-        'base' => 'chado_project',
-        'base field' => 'project_id'
-      ),
-    );
-
-  }
-  //Field: name (varchar -255)   
-  $data['project']['name'] = array(
-    'title' => t('Name'),
-    'help' => t('The name of the project.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database) {
-    $data['project']['name']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-  
-  //Field: description (varchar -255)   
-  $data['project']['description'] = array(
-    'title' => t('Description'),
-    'help' => t('A short description of the project'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-
-  //Field: plain_text_field (chado datatype)   
-  $data['project']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['project']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['project']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['project']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['project']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 0 - 84
tripal_project/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_project.views.inc:tripal_project_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_project.views.inc --in tripal_project_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_project_views_data() --in tripal_project.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_project/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_project.views.inc:tripal_project_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_project.views.inc --in tripal_project_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_project_views_data() --in tripal_project.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 0 - 45
tripal_pub/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_pub_views_data() in ../tripal_pub.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_pub.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_pub.views.inc:tripal_pub_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 84
tripal_pub/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_pub.views.inc:tripal_pub_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_pub.views.inc --in tripal_pub_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_pub_views_data() --in tripal_pub.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_pub/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_pub.views.inc:tripal_pub_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_pub.views.inc --in tripal_pub_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_pub_views_data() --in tripal_pub.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 19 - 26
tripal_stock/tripal_stock.views.inc

@@ -6,7 +6,7 @@
  *  chado/tripal stock tables. Supplementary functions can be found in
  *  ./views/
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
 
@@ -16,16 +16,13 @@
  * @ingroup tripal_stock
  */
 
-require_once('views/stock.views.inc');
-require_once('views/chado_stock.views.inc');
-require_once('views/misc_tables.views.inc'); 
 /**
  * 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 
+ *   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)
  *
@@ -34,10 +31,6 @@ require_once('views/misc_tables.views.inc');
 function tripal_stock_views_data()  {
   $data = array();
 
-  //$data = array_merge($data, retrieve_stock_views_data());
-  //$data = array_merge($data, retrieve_chado_stock_views_data());
-  //$data = array_merge($data, retrieve_stock_misc_tables_views_data());
-
   if (module_exists('tripal_views')) {
     $tables = array(
       'stock',
@@ -49,7 +42,7 @@ function tripal_stock_views_data()  {
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
-        
+
     $tables = array(
       'stock_cvterm',
       'stock_dbxref',
@@ -69,7 +62,7 @@ function tripal_stock_views_data()  {
       }
     }
   }
-  
+
   return $data;
 }
 
@@ -77,7 +70,7 @@ function tripal_stock_views_data()  {
  * Implements hook_views_handlers()
  *
  * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field", 
+ *   where a handler describes either "the type of field",
  *   "how a field should be filtered", "how a field should be sorted"
  *
  * @return array
@@ -151,7 +144,7 @@ function tripal_stock_views_data_alter(&$data) {
       ),
     );
   }
-  
+
 }
 
 /**
@@ -168,18 +161,18 @@ function tripal_stock_views_data_alter(&$data) {
  */
 function tripal_stock_views_pre_render	(&$view) {
 	if (preg_match('/stock/', $view->base_table)) {
-		
+
 		//-----Node IDs---------------------------------------------
 		// @see file: tripal_core.views.inc function: tripal_core_add_node_ids_to_view (&$view);
-		
+
 		// retrieve the stock_id for each record in the views current page
 		$stock_ids = array();
 		foreach ($view->result as $row_num => $row) {
 			$stock_ids[$row_num] = $row->stock_id;
 		}
-		
+
 		if (sizeof($stock_ids)) {
-		
+
 			//-----Properties------------------------------------------
 			$field_names = array_keys($view->field);
 			//if any property fields are in the current view
@@ -191,14 +184,14 @@ function tripal_stock_views_pre_render	(&$view) {
 				$previous_db = tripal_db_set_active('chado');
 				$resource = db_query($sql);
 			 tripal_db_set_active($previous_db);
-		
+
 				$view->result[$key]->properties = array();
 				while ($r = db_fetch_object($resource)) {
 					$key = array_search($r->stock_id, $stock_ids);
 					$view->result[$key]->properties[] = $r;
 				}
 			}
-		
+
 			//-----Relationships----------------------------------------
 			//if any relationship fields are in the current view
 			$relationship_field_names = preg_grep('/relationships/', $field_names);
@@ -214,7 +207,7 @@ function tripal_stock_views_pre_render	(&$view) {
 				$previous_db = tripal_db_set_active('chado');
 				$resource = db_query($sql);
 			 tripal_db_set_active($previous_db);
-			
+
 				while ($r = db_fetch_object($resource)) {
 					if (in_array($r->subject_id, $stock_ids)) {
 						$key = array_search($r->subject_id, $stock_ids);
@@ -228,7 +221,7 @@ function tripal_stock_views_pre_render	(&$view) {
 					}
 				}
 			}
-		
+
 			//-----DB References--------------------------------------------
 			//if any dbxref fields are in the current view
 			$dbxref_field_names = preg_grep('/dbxref/',$field_names);
@@ -242,14 +235,14 @@ function tripal_stock_views_pre_render	(&$view) {
 				$previous_db = tripal_db_set_active('chado');
 				$resource = db_query($sql);
 			 tripal_db_set_active($previous_db);
-		
+
 				$view->result[$key]->dbxref = array();
 				while ($r = db_fetch_object($resource)) {
 					$key = array_search($r->stock_id, $stock_ids);
 					$view->result[$key]->dbxref[] = $r;
 				}
 			}
-			
+
 		} //if there are stocks
 	} //if we're dealing with a stock view
 }
@@ -260,7 +253,7 @@ function tripal_stock_views_pre_render	(&$view) {
  */
 function tripal_stock_views_default_views() {
   $views = array();
-  
+
   $view = new view;
   $view->name = 'all_stocks';
   $view->description = 'This view lists all stocks by default. There are exposed filters available but no arguments are used.';
@@ -613,7 +606,7 @@ function tripal_stock_views_default_views() {
     'weight' => 0,
     'name' => 'navigation',
   ));
-  $views[$view->name] = $view;  
-  
+  $views[$view->name] = $view;
+
   return $views;
 }

+ 0 - 45
tripal_stock/views/README

@@ -1,45 +0,0 @@
-
-This directory contains all additional views code needed to integrate this module with views2.
-
-FILE/FOLDER DESCRIPTIONS
----------------------------
-<chado table name>.views.inc:
-	contains a single function retrieve_<chado table name>_views_data()
-	which describes that table to views. This function is called by
-	tripal_stock_views_data() in ../tripal_stock.views.inc.
-	For more information on the form of this data array look up the
-	views2 documentation for hook_views_data() 
-	-http://views2.logrus.com/doc/html/index.html
-	
-handlers/
-	Each file contained within this folder defines a views handler. Only custom
-	handlers are included in this folder and each must be described in 
-	hook_views_handlers() in ../tripal_stock.views.inc.
-	A views handler does one of the following:
-		1) describe the type of a field and how it should be displayed
-		2) describe a method to sort this field
-		3) describe a method to filter this field
-
-
-STANDARDS TO FOLLOW
----------------------------
-
-1. All table definition files should be named tablename.views.inc
-2. All handlers should be in a handlers sub-directory and follow the naming convention of
-   views handlers (ie: views_handler_field/filter/sort_handlername.inc )
-
-Views Table Definitions:
-- Please use the template files provided whenever you are describing a new table to views.
-   For any table in chado simply copy template.table_defn.views.inc to tablename.views.inc and 
-   follow the instructions listed at the top of the template file.
-- ONLY ONE TABLE DEFINITION PER FILE
-- To join a chado table to it's drupal node simply copy template.node_join.views.inc to 
-   basetablename.views.inc and replace all XXX with basetablename.
-   
-   NOTE: Creating the table definition file is not enough. You also need to call the 
-         retrieve_XXX_views_data() function from ../tripal_stock.views.inc:tripal_stock_views_data()
-         by adding the following line:
-            $data = array_merge($data, retrieve_XXX_views_data());
-         to the function and including the file directly above the function (blow the function 
-         header by adding:
-            require_once('views/XXX.views.inc');

+ 0 - 102
tripal_stock/views/chado_stock.views.inc

@@ -1,102 +0,0 @@
-<?php
-
-//module_load_include('inc','views', 'handlers/views_handler_relationship');
-
-/**
- * Purpose: this function returns the portion of the data array which describes the chado_stock 
- * drupal table, it's fields and any joins between it and other tables
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- * @see tripal_stock_views_data() --in tripal_stock.views.inc
- *
- * @ingroup tripal_stock_views
- */
-function retrieve_chado_stock_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  // Basic table definition
-  $data['chado_stock']['table'] = array(
-    'field' => 'stock_id',
-    'group' => 'Chado Stock',
-  );
-
-  $data['chado_stock']['nid'] = array(
-    'title' => t('Stock Node ID'),
-    'help' => t('The node ID for this analysis'),
-    'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
-    ),
-    'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-     	'handler' => 'views_handler_sort',
-    ),
-  );
-  
-  // Note: No joins need to be made from $data['stock']['table']
-  
-  // Join the chado stock table to stock
-  $data['chado_stock']['table']['join']['stock'] = array(
-  	'left_field' => 'stock_id',
-  	'field' => 'stock_id',
-  );
-  
-  // Join the node table to chado stock
-  $data['node']['table']['join']['chado_stock'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to stock
-  $data['node']['table']['join']['stock'] = array(
-  	'left_table' => 'chado_stock',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-  
-  // Add relationship between chado_stock and stock
-  $data['chado_stock']['stock_nid'] = array(
-    'group' => 'Stock',
-    'title' => 'Stock Node',
-    'help' => 'Links Chado Stock Fields/Data to the Nodes in the current View.',
-    'real field' => 'stock_id',
-    'relationship' => array(
-      'handler' => 'views_handler_relationship',
-      'title' => t('Chado => Stock'),
-      'label' => t('Chado => Stock'),
-      'real field' => 'stock_id',
-      'base' => 'stock',
-      'base field' => 'stock_id'
-    ),
-  );
-
-  // Add node relationship to stock
-  $data['chado_stock']['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('Chado => Node'),
-      'label' => t('Chado => Node'),
-      'real field' => 'nid',
-      'base' => 'node',
-      'base field' => 'nid'
-    ),
-  );
-  
-	return $data;
-}

+ 0 - 37
tripal_stock/views/misc_tables.views.inc

@@ -1,37 +0,0 @@
-<?php
-
-/**
- * Purpose: Allows the stock module to add fields to other module views
- *
- *   For example, a field counting the number of stocks associted with a given organism would be
- *   added to the organism view as follows:
- *   @code
-      $data['organism']['num_stocks'] = array(
-        'title' => 'Number of stocks',
-        'help' => 'Provides a count of the number of stocks associated with a given organism',
-        'field' => array(
-          'handler' => 'views_handler_field_chado_count',
-          'table_to_query' => 'stock',
-        ),
-      ); 
- *   @endcode
- *
- * @ingroup tripal_stock_views
- */
-function retrieve_stock_misc_tables_views_data() {
-  $data = array();
- 
-  // Table: Organism--------------------------------------------------------------------------------
-  // Calculated Field: Number of stocks (Count -Int)
-  // Provides the number of stocks for a given organism
-  $data['organism']['num_stocks'] = array(
-    'title' => 'Number of Stocks',
-    'help' => 'Provides a count of the number of stocks associated with a given organism',
-    'field' => array(
-      'handler' => 'views_handler_field_chado_count',
-      'table_to_query' => 'stock',
-    ),
-  );  
-  
-  return $data;
-}

+ 0 - 290
tripal_stock/views/stock.views.inc

@@ -1,290 +0,0 @@
-<?php
-
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the stock table, it's fields and any joins between it and other tables
- * @see tripal_stock_views_data() --in tripal_stock.views.inc
- *
- * @todo add better support for is_obsolete -through a field handler
- * @todo Add support for the following tables: stock_cvterm, stock_pub, stock_genotype
- * @todo Add join to node table within if <chado/drupal same db>; also addd if not around nid field
- *
- * BASE TABLE: stock
- * @code
-      create table stock (
-        stock_id serial not null,
-        primary key (stock_id),
-        dbxref_id int,
-        foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
-        organism_id int,
-        foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
-        name varchar(255),
-        uniquename text not null,
-        description text,
-        type_id int not null,
-        foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
-        is_obsolete boolean not null default 'false',
-        constraint stock_c1 unique (organism_id,uniquename,type_id)
-      );
- * @endcode
- *
- * @ingroup tripal_stock_views
- */
-function retrieve_stock_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     $database = 'chado';
-  }
-
-
-	// Basic table definition
-  $data['stock']['table']['group'] = t('Chado Stock');
-  $data['stock']['table']['base'] = array(
-    'field' => 'stock_id',
-    'title' => t('Chado Stock'),
-    'help' => t('Chado Stocks are a record of any material upon which an experiment can be done. For example, a DNA sample, an individual or a population.'),
-  );
-  if($database){
-     $data['stock']['table']['base']['database'] = $database;
-  }
-
-	// Define relationships between this table and others
-  $data['stock']['table']['join'] = array(
-    'organism' => array(
-      'left_field' => 'organism_id',
-      'field' => 'organism_id',
-    ),
-  ); 
-
-	// Table Field Definitions----------------------
-  // Field: feature_id (primary key)
-  $data['stock']['stock_id'] = array(
-    'title' => 'Stock ID',
-    'help' => 'The primary key of a stock',
-    'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
-    ),
-    'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
-    ),
-    'sort' => array(
-     	'handler' => 'views_handler_sort',
-    ),
-  );
-  
-  // Calculated Field: Node ID
-  //  use custom field handler to query drupal for the node ID
-  //  this is only needed if chado is in a separate database from drupal
-	if ($database){
-  	$data['stock']['stock_nid'] = array(
-    	'title' => 'Node ID',
-    	'help' => 'This is the node ID of this feature. It can be used as a link to the node.',
-    	'field' => array(
-       'handler' => 'views_handler_field_computed_stock_nid',
-      ),
-  	);
-  } else {
-    // Add relationship between chado_stock and stock
-    $data['stock']['stock_nid'] = array(
-      'group' => 'Stock',
-      'title' => 'Stock Node',
-      'help' => 'Links Chado Stock Fields/Data to the Nodes in the current View.',
-      'real field' => 'stock_id',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Stock => Chado'),
-        'label' => t('Stock => Chado'),
-        'real field' => 'stock_id',
-        'base' => 'chado_stock',
-        'base field' => 'stock_id'
-      ),
-    );
-
-  }
-
-  //Field: unique name (text)
-  $data['stock']['uniquename'] = array(
-    'title' => t('Unique Name'),
-    'help' => t('A unique name for this stock.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database) {
-    $data['stock']['uniquename']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-  
-  //Field: name (varchar 255)
-  $data['stock']['name'] = array(
-    'title' => t('Name'),
-    'help' => t('The human-readable name of this stock.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-  // if joined to the node table add a "Link to Node" option for the field  
-  if (!$database) {
-    $data['stock']['name']['field']['handler'] = 'views_handler_field_node_optional';
-  }
-  
-  //Field: description (varchar 255)
-  $data['stock']['description'] = array(
-    'title' => t('Description'),
-    'help' => t('Provides a short description for a given stock.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: is_obsolete (boolean t/f)
-  $data['stock']['is_obsolete'] = array(
-    'title' => t('Is Obsolete?'),
-    'help' => t('A yes/no field indicating whether a given stock is obsolete or not.'),
-    'field' => array(
-      'handler' => 'views_handler_field_chado_tf_boolean',
-      'click sortable' => TRUE,
-    ),
-    'filter' => array(
-       'handler' => 'views_handler_filter_chado_boolean',
-       'label' => t('Is Obsolete?'),
-       'type' => 'yes-no',    
-    ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-  );
-
-	//Calculated Field: stock properties
-	// uses a custom field handler which pulls results from the view
-	// actual query performed in chado_stock_views_views_pre_render	(&$view) -file:tripal_stock.views.inc
-	$data['stock']['properties'] = array(
-    'title' => t('Stock Properties'),
-    'help' => t('Properties of the current stock.'),
-    'field' => array(
-      'title' => t('Properties'),
-      'help' => t('Display a given type of properties associated with a stock.'),
-      'handler' => 'views_handler_field_stockprop_by_type',
-    ),
-    'filter' => array(
-    	'title' => t('Properties'),
-    	'help' => t('Filter by a given property type or value.'),
-    	'handler' => 'views_handler_filter_stockprop_id',
-    ),
-    'argument' => array(
-    	'title' => t('Properties'),
-    	'help' => t('Allow a property to be supplied in the path'),
-    	'handler' => 'views_handler_argument_stockprop_id',
-    ),
-  );
-
-	//Calculated Field: stock properties (ALL)
-	// uses a custom field handler which pulls results from the view
-	// actual query performed in chado_stock_views_views_pre_render	(&$view) -file:tripal_stock.views.inc
-	$data['stock']['all_properties'] = array(
-  	'title' => t('All Stock Properties'),
-  	'help' => t('Properties of the current stock.'),
-  	'field' => array(
-    	'title' => t('All Properties'),
-    	'help' => t('Display all properties associated with a stock.'),
-    	'handler' => 'views_handler_field_stockprop_all',
-  	),
-	);
-	
-	//Calculated Field: stock relationships
-	// uses a custom field handler which pulls results from the view
-	// actual query performed in chado_stock_views_views_pre_render	(&$view) -file:tripal_stock.views.inc
-	$data['stock']['relationships'] = array(
-    'title' => t('Stock Relationships'),
-    'help' => t('Relationships including the current stock.'),
-    'field' => array(
-      'title' => t('Relationships'),
-      'help' => t('Display a given type of relationships including the current stock.'),
-      'handler' => 'views_handler_field_stockrel_by_type',
-    ),
-    'filter' => array(
-    	'handler' => 'views_handler_filter_stock_relationship_id'
-    ),
-  );
-
-	//Calculated Field: stock relationships (ALL)
-	// uses a custom field handler which pulls results from the view
-	// actual query performed in chado_stock_views_views_pre_render	(&$view) -file:tripal_stock.views.inc
-	$data['stock']['all_relationships'] = array(
-  	'title' => t('All Stock Relationships'),
-  	'help' => t('Relationships including the current stock.'),
-  	'field' => array(
-    	'title' => t('All Relationships'),
-    	'help' => t('Display all relationships including the stock.'),
-    	'handler' => 'views_handler_field_stockrel_all',
-  	),
-	);
-	
-	//Calculated Field: stock dbxrefs 
-	// uses a custom field handler which pulls results from the view
-	// actual query performed in chado_stock_views_views_pre_render	(&$view) -file:tripal_stock.views.inc
-	$data['stock']['dbxref'] = array(
-    'title' => t('Stock Database References'),
-    'help' => t('Database References associated with the current stock.'),
-    'field' => array(
-      'title' => t('Database References'),
-      'help' => t('Display database references from a given database for the current stock.'),
-      'handler' => 'views_handler_field_stock_dbxref_by_type',
-    ),
-    'filter' => array(
-    	'title' => t('Database References'),
-    	'help' => t('Filter by a given database reference type and/or value.'),
-    	'handler' => 'views_handler_filter_stock_dbxref_id',
-    ),
-  );
-
-	//Calculated Field: stock dbxrefs (ALL)
-	// uses a custom field handler which pulls results from the view
-	// actual query performed in chado_stock_views_views_pre_render	(&$view) -file:tripal_stock.views.inc
-	$data['stock']['all_dbxref'] = array(
-  	'title' => t('All Stock Database References'),
-  	'help' => t('Database References associated with the current stock.'),
-  	'field' => array(
-    	'title' => t('All Database References'),
-    	'help' => t('Display all database references for the current stock.'),
-    	'handler' => 'views_handler_field_stock_dbxref_all',
-  	),
-	);
-  return $data;
-}

+ 0 - 84
tripal_stock/views/template.node_join.views.inc

@@ -1,84 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
- *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_stock.views.inc:tripal_stock_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_stock.views.inc --in tripal_stock_views_data()
- *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
- *        This file simply defines this linking table and joins the three tables together.
- *        No modification of XXX.views.inc is needed.
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
- 
-/**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
- *   and other tables
- * @see tripal_stock_views_data() --in tripal_stock.views.inc
- *
- * The main need for description of this table to views is to join chado data with drupal nodes
- *
- */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
-  $data = array();
-  
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
-  }
-
-  //Basic table definition-----------------------------------
-  $data['chado_XXX']['table'] = array(
-    'field' => 'nid',
-  );
-  
-  //Relationship Definitions---------------------------------
-  // Note: No joins need to be made from $data['XXX']['table']
-  
-  // Join the chado_XXX table to XXX
-  $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
-  );
-  
-  // Join the node table to chado_XXX
-  $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );
-  
-  // Join the node table to XXX
-  $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
-
-	return $data;
-}

+ 0 - 211
tripal_stock/views/template.table_defn.views.inc

@@ -1,211 +0,0 @@
-<?php
-
-/*************************************************************************
- * @file: THIS IS A TEMPLATE AND SHOULD NOT BE INCLUDED IN THE MODULE CODE
- *
- *   - Every instance of XXX should be replaced with the name of your table
- *   - If this is a base table (you want a view where every row is a row from this table)
- *     then change $data['XXX']['table'] to $data['XXX']['table']['base'] 
- *     and $data['XXX']['table']['database'] to $data['XXX']['table']['base']['database']
- *   - Relationships between this table and others: YYY is the table you are trying to join to this
- *     one. You want to join a table to this one if this table contains a foreign key to the other
- *     table. If the join between this table and another is through a linking table
- *     (ie: library-XXX/YYY => library_feature-XY => feature-XXX/YYY) then make the join in both
- *     directions (ie: in the file XXX.views.inc and the file YYY.views.inc
- *   - Create a field definition for each field in this table using the example fields already
- *     listed. Match the type of the database field to the field definition listed below.
- *     (ie: for a text/varchar field from the database use plain_text_field below)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
- *        retrieve_XXX_views_data() function from ../tripal_stock.views.inc:tripal_stock_views_data()
- *        by adding the following line:
- *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
- *        header by adding:
- *           require_once('views/XXX.views.inc');
- *
- *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
-/**
- *  @file
- *  This file defines the data array for a given chado table. This array
- *  is merged into a larger array containing definitions of all tables associated
- *  with this module in:
- *  @see tripal_stock.views.inc --in tripal_stock_views_data()
- *
- *  Documentation on views integration can be found at 
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/*************************************************************************
- * Purpose: this function returns the portion of the data array 
- *   which describes the XXX table, it's fields and any joins between it and other tables
- * @see tripal_stock_views_data() --in tripal_stock.views.inc
- *
- * Table: XXX
- * @code
- * XXX-Copy/Paste Table SQL code here-XXX
- * @endcode
- */
- function retrieve_XXX_views_data() {
-  global $db_url;
-  $data = array();
-
-  // if the chado database is not local to the drupal database
-  // then we need to set the database name.  This should always
-  // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-    $database = 'chado';
-  }
-   
-  //Basic table definition-----------------------------------
-  $data['XXX']['table']['group'] = t('Chado XXX');
-  
-  $data['XXX']['table'] = array(
-    'field' => 'primary_id',
-    'title' => t('Chado XXX'),
-    'help' => t('Enter some user-friendly description of this tables purpose to the user.'),
-  );
-  if($database){
-     $data['XXX']['table']['database'] = $database;
-  }
-
-  
-  //Relationship Definitions---------------------------------
-  //Join: YYY => XXX
-  // Notice that this relationship tells the primary table to show it's fields to the
-  // table referencing it by a foreign key and thus the relationship is from
-  // primary table to table referenceing it (ie: cvterm => feature)
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_field' => 'foreign key in YYY table',
-    'field' => 'primary key in XXX table',
-  );  
-  
-  //Join: XXX => XY => YYY
-  // This relationship should be described in both directions
-  // in the appropriate files (ie: for feature => library 
-  // describe in both feature.views.inc and library.views.inc)
-  $data['XXX']['table']['join']['XY'] = array(
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );  
-  $data['XXX']['table']['join']['YYY'] = array(
-    'left_table' => 'XY',
-    'left_field' => 'matching XXX key in the XY table',
-    'field' => 'primary key in XXX table',
-  );
-  $data['XY']['table']['join']['YYY'] = array(
-    'left_field' => 'primary key in YYY table',
-    'field' => 'matching YYY key in the XY table',
-  );
-   
-  //Table Field Definitions----------------------------------
-      
-  //Field: XXX_id (primary key)
-  $data['XXX']['field_name'] = array(
-    'title' => t('XXX Primary Key'),
-    'help' => t('A unique index for every XXX.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  /*.......................................................
-   * Beginning of Example Field definitions
-   * Remove this section when done
-   */
-
-  //Field: plain_text_field (chado datatype)   
-  $data['XXX']['plain_text_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_string',
-    ),
-    'argument' => array(
-      'handler' => 'views_handler_argument_string',
-    ),
-  );
-
-  //Field: numeric_field (chado datatype)   
-  $data['XXX']['numeric_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_numeric',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_numeric',
-    ),
-  );
-
-  //Field: boolean_field (chado datatype)   
-  $data['XXX']['boolean_field'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_boolean',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_boolean_operator',
-    ),
-  );
-
-  //Field: unix_timestamp (chado datatype)   
-  $data['XXX']['unix_timestamp'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-    'filter' => array(
-      'handler' => 'views_handler_filter_date',
-    ),
-  );
-
-  //Field: human_readable_date (chado datatype)   
-  $data['XXX']['human_readable_date'] = array(
-    'title' => t('Human-Readable Name'),
-    'help' => t('Description of this field.'),
-    'field' => array(
-      'handler' => 'views_handler_field_readble_date',
-      'click sortable' => TRUE,
-     ),
-    'sort' => array(
-      'handler' => 'views_handler_sort_date',
-    ),
-  );
-   
-   /*
-    * End of Example Field definitions
-    */
-    
-  return $data;
-}

+ 0 - 0
tripal_stock/views/handlers/views_handler_argument_stockprop_id.inc → tripal_views/views/handlers/views_handler_argument_stockprop_id.inc


+ 0 - 0
tripal_natural_diversity/views/handlers/views_handler_field_chado_relationship_all.inc → tripal_views/views/handlers/views_handler_field_chado_relationship_all.inc


+ 0 - 0
tripal_natural_diversity/views/handlers/views_handler_field_chado_relationship_by_type.inc → tripal_views/views/handlers/views_handler_field_chado_relationship_by_type.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_field_computed_stock_nid.inc → tripal_views/views/handlers/views_handler_field_computed_stock_nid.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_field_stock_dbxref_all.inc → tripal_views/views/handlers/views_handler_field_stock_dbxref_all.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_field_stock_dbxref_by_type.inc → tripal_views/views/handlers/views_handler_field_stock_dbxref_by_type.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_field_stockprop_all.inc → tripal_views/views/handlers/views_handler_field_stockprop_all.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_field_stockprop_by_type.inc → tripal_views/views/handlers/views_handler_field_stockprop_by_type.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_field_stockrel_all.inc → tripal_views/views/handlers/views_handler_field_stockrel_all.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_field_stockrel_by_type.inc → tripal_views/views/handlers/views_handler_field_stockrel_by_type.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_filter_stock_dbxref_id.inc → tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_filter_stock_relationship_id.inc → tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc


+ 0 - 0
tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc → tripal_views/views/handlers/views_handler_filter_stockprop_id.inc