Răsfoiți Sursa

Fixing merge conflict with tripal_views

spficklin 12 ani în urmă
părinte
comite
424a6bca6a
32 a modificat fișierele cu 3754 adăugiri și 1847 ștergeri
  1. 114 218
      tripal_analysis/tripal_analysis.views.inc
  2. 284 5
      tripal_contact/tripal_contact.views.inc
  3. 339 46
      tripal_cv/tripal_cv.views.inc
  4. 349 18
      tripal_db/tripal_db.views.inc
  5. 202 74
      tripal_feature/tripal_feature.views.inc
  6. 0 1
      tripal_genetic/tripal_genetic.info
  7. 257 4
      tripal_genetic/tripal_genetic.views.inc
  8. 63 64
      tripal_library/tripal_library.views.inc
  9. 0 425
      tripal_library/tripal_library.views.inc.orig
  10. 6 1
      tripal_natural_diversity/tripal_natural_diversity.api.inc
  11. 997 16
      tripal_natural_diversity/tripal_natural_diversity.views.inc
  12. 0 105
      tripal_natural_diversity/tripal_natural_diversity.views.inc.orig
  13. 37 102
      tripal_organism/tripal_organism.views.inc
  14. 0 410
      tripal_organism/tripal_organism.views.inc.orig
  15. 496 2
      tripal_phenotype/tripal_phenotype.views.inc
  16. 191 2
      tripal_project/tripal_project.views.inc
  17. 71 110
      tripal_stock/tripal_stock.views.inc
  18. 36 11
      tripal_views/api/tripal_views.api.inc
  19. 27 10
      tripal_views/tripal_views.install
  20. 15 214
      tripal_views/tripal_views.views.inc
  21. 5 3
      tripal_views/views/handlers/chado_views_handler_filter_date.inc
  22. 7 1
      tripal_views/views/handlers/chado_views_handler_filter_float.inc
  23. 27 0
      tripal_views/views/handlers/chado_views_handler_relationship.inc
  24. 0 0
      tripal_views/views/handlers/deprecated/views_handler_field_chado_count.inc
  25. 0 0
      tripal_views/views/handlers/deprecated/views_handler_field_dbxref_accession_link.inc
  26. 0 0
      tripal_views/views/handlers/deprecated/views_handler_field_node_optional.inc
  27. 0 0
      tripal_views/views/handlers/deprecated/views_handler_field_readable_date.inc
  28. 0 0
      tripal_views/views/handlers/deprecated/views_handler_filter_chado_boolean.inc
  29. 0 0
      tripal_views/views/handlers/deprecated/views_handler_filter_chado_select_cvterm_name.inc
  30. 0 0
      tripal_views/views/handlers/deprecated/views_handler_filter_chado_select_string.inc
  31. 229 3
      tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc
  32. 2 2
      tripal_views/views/handlers/tripal_views_handler_filter_select_string.inc

+ 114 - 218
tripal_analysis/tripal_analysis.views.inc

@@ -35,8 +35,13 @@ function tripal_analysis_views_data()  {
   if (module_exists('tripal_views')) {
     // Base Table: Analysis
     $tablename = 'analysis';
-    if (!tripal_views_is_integrated($tablename, 10)) {
+    if (!tripal_views_is_integrated($tablename, 9)) {
       $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+
+      // Make table-specific modifications
+      $table_integration_array['fields']['program']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+      $table_integration_array['fields']['algorithm']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+
       tripal_views_integration_add_entry($table_integration_array);
     }
 
@@ -46,7 +51,7 @@ function tripal_analysis_views_data()  {
       'analysisprop'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -120,15 +125,13 @@ function tripal_analysis_views_default_views() {
   $views = array();
 
   // Main default view
-  // List all cvterms based on cv
   $view = new view;
-  $view->name = 'all_analysis';
-  $view->description = 'A listing of all analysis\'';
-  $view->tag = 'chado';
-  $view->view_php = '';
+  $view->name = 'analysis_listing';
+  $view->description = 'A default listing of analyses provided by Tripal';
+  $view->tag = 'chado default';
   $view->base_table = 'analysis';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
+  $view->core = 0;
+  $view->api_version = '2';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
   $handler = $view->new_display('default', 'Defaults', 'default');
   $handler->override_option('fields', array(
@@ -139,8 +142,10 @@ function tripal_analysis_views_default_views() {
         'text' => '',
         'make_link' => 0,
         'path' => '',
+        'absolute' => 0,
         'link_class' => '',
         'alt' => '',
+        'rel' => '',
         'prefix' => '',
         'suffix' => '',
         'target' => '',
@@ -155,42 +160,16 @@ function tripal_analysis_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
-      'link_to_node' => 1,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
       'exclude' => 0,
+      'link_to_node' => 1,
       'id' => 'name',
       'table' => 'analysis',
       'field' => 'name',
       'relationship' => 'none',
     ),
-    'algorithm' => array(
-      'label' => 'Algorithm',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'algorithm',
-      'table' => 'analysis',
-      'field' => 'algorithm',
-      'relationship' => 'none',
-    ),
     'program' => array(
       'label' => 'Program',
       'alter' => array(
@@ -198,8 +177,10 @@ function tripal_analysis_views_default_views() {
         'text' => '',
         'make_link' => 0,
         'path' => '',
+        'absolute' => 0,
         'link_class' => '',
         'alt' => '',
+        'rel' => '',
         'prefix' => '',
         'suffix' => '',
         'target' => '',
@@ -214,79 +195,24 @@ function tripal_analysis_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
+      'hide_alter_empty' => 1,
       'exclude' => 0,
       'id' => 'program',
       'table' => 'analysis',
       'field' => 'program',
       'relationship' => 'none',
     ),
-    'programversion' => array(
-      'label' => 'Program Version',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'programversion',
-      'table' => 'analysis',
-      'field' => 'programversion',
-      'relationship' => 'none',
-    ),
-    'description' => array(
-      'label' => 'Description',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'description',
-      'table' => 'analysis',
-      'field' => 'description',
-      'relationship' => 'none',
-    ),
     'sourcename' => array(
-      'label' => 'Source Name',
+      'label' => 'Source',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
         'make_link' => 0,
         'path' => '',
+        'absolute' => 0,
         'link_class' => '',
         'alt' => '',
+        'rel' => '',
         'prefix' => '',
         'suffix' => '',
         'target' => '',
@@ -301,21 +227,24 @@ function tripal_analysis_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
+      'hide_alter_empty' => 1,
       'exclude' => 0,
       'id' => 'sourcename',
       'table' => 'analysis',
       'field' => 'sourcename',
       'relationship' => 'none',
     ),
-    'sourceuri' => array(
-      'label' => 'Source URL',
+    'timeexecuted' => array(
+      'label' => 'Time Executed',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
         'make_link' => 0,
         'path' => '',
+        'absolute' => 0,
         'link_class' => '',
         'alt' => '',
+        'rel' => '',
         'prefix' => '',
         'suffix' => '',
         'target' => '',
@@ -330,121 +259,109 @@ function tripal_analysis_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'date_format' => 'custom',
+      'custom_date_format' => 'F j, Y',
       'exclude' => 0,
-      'id' => 'sourceuri',
+      'id' => 'timeexecuted',
       'table' => 'analysis',
-      'field' => 'sourceuri',
+      'field' => 'timeexecuted',
+      'override' => array(
+        'button' => 'Override',
+      ),
       'relationship' => 'none',
     ),
-    'sourceversion' => array(
-      'label' => 'Source Version',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
+  ));
+  $handler->override_option('filters', array(
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
       ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'sourceversion',
-      'table' => 'analysis',
-      'field' => 'sourceversion',
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
       'relationship' => 'none',
+      'apply_button' => 'Show ',
+      'no_results_text' => 'Click "Show" to see a list of all analysis matching the entered criteria. If you leave a any of the criteria blank then the analysis will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all analysis will be listed.',
     ),
-    'num_features' => array(
-      'label' => 'Number of Features',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
+    'program' => array(
+      'operator' => '=',
+      'value' => array(),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'program_op',
+        'identifier' => 'program',
+        'label' => 'Program',
+        'remember' => 0,
       ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_features',
+      'case' => 1,
+      'id' => 'program',
       'table' => 'analysis',
-      'field' => 'num_features',
+      'field' => 'program',
       'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 0,
+      ),
     ),
     'timeexecuted' => array(
-      'label' => 'Time Executed',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
+      'operator' => '>',
+      'value' => array(
+        'type' => 'date',
+        'value' => '',
+        'min' => '',
+        'max' => '',
+      ),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 1,
+        'operator' => 'timeexecuted_op',
+        'identifier' => 'timeexecuted',
+        'label' => 'Time Executed',
+        'optional' => 1,
+        'remember' => 0,
       ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'date_format' => 'large',
-      'custom_date_format' => '',
-      'exclude' => 0,
       'id' => 'timeexecuted',
       'table' => 'analysis',
       'field' => 'timeexecuted',
       'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 0,
+      ),
     ),
-  ));
-  $handler->override_option('filters', array(
-    'program' => array(
-      'operator' => '=',
-      'value' => 'All',
+    'name' => array(
+      'operator' => 'contains',
+      'value' => '',
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
         'use_operator' => 0,
-        'operator' => 'program_op',
-        'identifier' => 'program',
-        'label' => 'Program',
-        'optional' => 1,
+        'operator' => 'name_op',
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'bef_filter_description' => '',
         'remember' => 0,
       ),
       'case' => 0,
-      'id' => 'program',
+      'id' => 'name',
       'table' => 'analysis',
-      'field' => 'program',
+      'field' => 'name',
       'relationship' => 'none',
+      'values_form_type' => 'textfield',
+      'multiple' => 0,
+      'optional' => 0,
     ),
     'sourcename' => array(
       'operator' => 'contains',
@@ -455,8 +372,8 @@ function tripal_analysis_views_default_views() {
         'use_operator' => 0,
         'operator' => 'sourcename_op',
         'identifier' => 'sourcename',
-        'label' => 'Source Name Contains',
-        'optional' => 1,
+        'label' => 'Source Contains',
+        'bef_filter_description' => '',
         'remember' => 0,
       ),
       'case' => 0,
@@ -474,6 +391,9 @@ function tripal_analysis_views_default_views() {
     'type' => 'none',
   ));
   $handler->override_option('title', 'Analysis');
+  $handler->override_option('header', 'Click "Show" to see a list of all analysis matching the entered criteria. If you leave a any of the criteria blank then the analysis will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all analysis will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 1);
   $handler->override_option('empty', 'No analysis match the supplied criteria.');
   $handler->override_option('empty_format', '1');
   $handler->override_option('items_per_page', 50);
@@ -484,52 +404,28 @@ function tripal_analysis_views_default_views() {
     'override' => 1,
     'sticky' => 0,
     'order' => 'asc',
+    'summary' => '',
     'columns' => array(
-      'algorithm' => 'algorithm',
-      'description' => 'description',
       'name' => 'name',
-      'num_features' => 'num_features',
       'program' => 'program',
-      'programversion' => 'programversion',
       'sourcename' => 'sourcename',
-      'sourceuri' => 'sourceuri',
-      'sourceversion' => 'sourceversion',
+      'num_features' => 'num_features',
       'timeexecuted' => 'timeexecuted',
     ),
     'info' => array(
-      'algorithm' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'description' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
       'name' => array(
         'sortable' => 1,
         'separator' => '',
       ),
-      'num_features' => array(
-        'separator' => '',
-      ),
       'program' => array(
         'sortable' => 1,
         'separator' => '',
       ),
-      'programversion' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
       'sourcename' => array(
         'sortable' => 1,
         'separator' => '',
       ),
-      'sourceuri' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'sourceversion' => array(
-        'sortable' => 1,
+      'num_features' => array(
         'separator' => '',
       ),
       'timeexecuted' => array(
@@ -537,7 +433,7 @@ function tripal_analysis_views_default_views() {
         'separator' => '',
       ),
     ),
-    'default' => 'timeexecuted',
+    'default' => 'name',
   ));
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->override_option('path', 'analyses');

+ 284 - 5
tripal_contact/tripal_contact.views.inc

@@ -28,10 +28,13 @@ function tripal_contact_views_data()  {
   if (module_exists('tripal_views')) {
 
     // Base Table: contact
-    $table_name = 'contact';
-    if (!tripal_views_is_integrated($tablename, 10)) {
+    $tablename = 'contact';
+    if (!tripal_views_is_integrated($tablename, 9)) {
       $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
-      tripal_views_integration_add_entry($table_integration_array);
+      $status = tripal_views_integration_add_entry($table_integration_array);
+        if (!$status) {
+          drupal_set_message(t('Tripal Contact is unable to integrate %table', array('%table' => $tablename)), 'error');
+        }
     }
 
     // Additional tables
@@ -39,9 +42,12 @@ function tripal_contact_views_data()  {
       'contact_relationship',
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
-        tripal_views_integration_add_entry($table_integration_array);
+        $status = tripal_views_integration_add_entry($table_integration_array);
+        if (!$status) {
+          drupal_set_message(t('Tripal Contact is unable to integrate %table', array('%table' => $tablename)), 'error');
+        }
       }
     }
   }
@@ -69,3 +75,276 @@ function tripal_contact_views_handlers() {
   ),
   );
 }
+
+/**
+ *
+ * @ingroup tripal_feature_views
+ */
+function tripal_contact_views_default_views() {
+  $views = array();
+
+  // Main default view
+  $view = new view;
+  $view->name = 'contact_listing';
+  $view->description = 'A listing of chado contacts';
+  $view->tag = 'chado default';
+  $view->base_table = 'contact';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'name' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'contact',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'name_1' => array(
+      'label' => 'Type',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name_1',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'description' => array(
+      'label' => 'Description',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'description',
+      'table' => 'contact',
+      'field' => 'description',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all contacts matching the entered criteria. If you leave a any of the criteria blank then the contacts will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all contacts will be listed.',
+    ),
+    'type_id' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'type_id_op',
+        'identifier' => 'type_id',
+        'label' => 'Type',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'type_id',
+      'table' => 'contact',
+      'field' => 'type_id',
+      'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'name' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'name_op',
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'name',
+      'table' => 'contact',
+      'field' => 'name',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'description' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'description_op',
+        'identifier' => 'description',
+        'label' => 'Description Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'description',
+      'table' => 'contact',
+      'field' => 'description',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Contacts');
+  $handler->override_option('header', 'Click "Show" to see a list of all contacts matching the entered criteria. If you leave a any of the criteria blank then the contacts will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all contacts will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No contacts match the current criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'name' => 'name',
+      'name_1' => 'name_1',
+      'description' => 'description',
+    ),
+    'info' => array(
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name_1' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'description' => array(
+        'sortable' => 0,
+        'separator' => '',
+      ),
+    ),
+    'default' => 'name',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'contacts');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Contacts',
+    'description' => '',
+    'weight' => '0',
+    'name' => 'primary-links',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 339 - 46
tripal_cv/tripal_cv.views.inc

@@ -40,14 +40,17 @@ function tripal_cv_views_data() {
       'cvterm'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         // get default integration array
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
 
         // add specialty handlers
         if ($tablename == 'cvterm') {
-          $table_integration_array['fields']['name']['handlers']['filter']['name'] = 'views_handler_filter_chado_select_cvterm_name';
-        }  
+          $table_integration_array['fields']['name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+        }
+        elseif ($tablename == 'cv') {
+          $table_integration_array['fields']['name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+        }
 
         // add integration
         tripal_views_integration_add_entry($table_integration_array);
@@ -63,7 +66,7 @@ function tripal_cv_views_data() {
       'cvtermsynonym'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -108,25 +111,26 @@ function tripal_cv_views_default_views() {
   // Main default view
   // List all cvterms based on cv
   $view = new view;
-  $view->name = 'all_cvterms';
-  $view->description = 'A listing of all controlled vocabulary terms';
-  $view->tag = 'chado';
-  $view->view_php = '';
+  $view->name = 'cvterm_listing';
+  $view->description = 'A listing of all controlled vocabulary terms filtered by controlled vocabulary';
+  $view->tag = 'chado default';
   $view->base_table = 'cvterm';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
+  $view->core = 0;
+  $view->api_version = '2';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
   $handler = $view->new_display('default', 'Defaults', 'default');
   $handler->override_option('fields', array(
-    'name' => array(
-      'label' => 'Name',
+    'name_1' => array(
+      'label' => 'Vocabulary',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
         'make_link' => 0,
         'path' => '',
+        'absolute' => 0,
         'link_class' => '',
         'alt' => '',
+        'rel' => '',
         'prefix' => '',
         'suffix' => '',
         'target' => '',
@@ -141,14 +145,17 @@ function tripal_cv_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
       'exclude' => 0,
-      'id' => 'name',
-      'table' => 'cvterm',
+      'id' => 'name_1',
+      'table' => 'cv',
       'field' => 'name',
       'relationship' => 'none',
     ),
-    'definition' => array(
-      'label' => 'Definition',
+    'name' => array(
+      'label' => 'Name',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
@@ -171,13 +178,13 @@ function tripal_cv_views_default_views() {
       'hide_empty' => 0,
       'empty_zero' => 0,
       'exclude' => 0,
-      'id' => 'definition',
+      'id' => 'name',
       'table' => 'cvterm',
-      'field' => 'definition',
+      'field' => 'name',
       'relationship' => 'none',
     ),
-    'is_obsolete' => array(
-      'label' => 'Is Obsolete',
+    'definition' => array(
+      'label' => 'Definition',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
@@ -199,16 +206,14 @@ function tripal_cv_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
-      'type' => 'yes-no',
-      'not' => 0,
       'exclude' => 0,
-      'id' => 'is_obsolete',
+      'id' => 'definition',
       'table' => 'cvterm',
-      'field' => 'is_obsolete',
+      'field' => 'definition',
       'relationship' => 'none',
     ),
-    'is_relationshiptype' => array(
-      'label' => 'Is Relationship',
+    'is_obsolete' => array(
+      'label' => 'Is Obsolete',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
@@ -233,13 +238,13 @@ function tripal_cv_views_default_views() {
       'type' => 'yes-no',
       'not' => 0,
       'exclude' => 0,
-      'id' => 'is_relationshiptype',
+      'id' => 'is_obsolete',
       'table' => 'cvterm',
-      'field' => 'is_relationshiptype',
+      'field' => 'is_obsolete',
       'relationship' => 'none',
     ),
-    'accession_link' => array(
-      'label' => 'Accession Link',
+    'is_relationshiptype' => array(
+      'label' => 'Is Relationship',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
@@ -261,17 +266,35 @@ function tripal_cv_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
+      'type' => 'yes-no',
+      'not' => 0,
       'exclude' => 0,
-      'id' => 'accession_link',
-      'table' => 'dbxref',
-      'field' => 'accession_link',
+      'id' => 'is_relationshiptype',
+      'table' => 'cvterm',
+      'field' => 'is_relationshiptype',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('sorts', array(
+    'name' => array(
+      'order' => 'ASC',
+      'id' => 'name',
+      'table' => 'cv',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'name_1' => array(
+      'order' => 'ASC',
+      'id' => 'name_1',
+      'table' => 'cvterm',
+      'field' => 'name',
       'relationship' => 'none',
     ),
   ));
   $handler->override_option('filters', array(
     'name' => array(
       'operator' => '=',
-      'value' => '<select cv>',
+      'value' => array(),
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
@@ -279,7 +302,6 @@ function tripal_cv_views_default_views() {
         'operator' => 'name_op',
         'identifier' => 'cv',
         'label' => 'Vocabulary',
-        'optional' => 0,
         'remember' => 0,
       ),
       'case' => 1,
@@ -287,9 +309,16 @@ function tripal_cv_views_default_views() {
       'table' => 'cv',
       'field' => 'name',
       'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
     ),
     'name_1' => array(
-      'operator' => '~',
+      'operator' => 'contains',
       'value' => '',
       'group' => '0',
       'exposed' => TRUE,
@@ -298,7 +327,6 @@ function tripal_cv_views_default_views() {
         'operator' => '',
         'identifier' => 'name',
         'label' => 'Name Contains',
-        'optional' => 1,
         'remember' => 0,
       ),
       'case' => 0,
@@ -307,6 +335,13 @@ function tripal_cv_views_default_views() {
       'field' => 'name',
       'relationship' => 'none',
       'values_form_type' => 'textfield',
+      'multiple' => 0,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
     ),
     'definition' => array(
       'operator' => 'contains',
@@ -318,7 +353,6 @@ function tripal_cv_views_default_views() {
         'operator' => 'definition_op',
         'identifier' => 'definition',
         'label' => 'Definition Contains',
-        'optional' => 1,
         'remember' => 0,
       ),
       'case' => 0,
@@ -326,6 +360,26 @@ function tripal_cv_views_default_views() {
       'table' => 'cvterm',
       'field' => 'definition',
       'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 0,
+      ),
+    ),
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all controlled vocabulary terms matching the entered criteria. If you leave a any of the criteria blank then the controlled vocabulary terms will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all controlled vocabulary terms will be listed.',
     ),
   ));
   $handler->override_option('access', array(
@@ -336,6 +390,9 @@ function tripal_cv_views_default_views() {
     'type' => 'none',
   ));
   $handler->override_option('title', 'Controlled Vocabulary Terms');
+  $handler->override_option('header', 'Click "Show" to see a list of all controlled vocabulary terms matching the entered criteria. If you leave a any of the criteria blank then the controlled vocabulary terms will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all controlled vocabulary terms will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
   $handler->override_option('empty', 'There are no terms associated with the selected controlled vocabulary. Please select a different vocabulary from the list above.');
   $handler->override_option('empty_format', '1');
   $handler->override_option('items_per_page', 50);
@@ -346,14 +403,23 @@ function tripal_cv_views_default_views() {
     'override' => 1,
     'sticky' => 0,
     'order' => 'asc',
+    'summary' => '',
     'columns' => array(
+      'name_1' => 'name_1',
+      'name' => 'name',
       'definition' => 'definition',
       'is_obsolete' => 'is_obsolete',
       'is_relationshiptype' => 'is_relationshiptype',
-      'name' => 'name',
-      'accession_link' => 'accession_link',
     ),
     'info' => array(
+      'name_1' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
       'definition' => array(
         'sortable' => 0,
         'separator' => '',
@@ -366,23 +432,250 @@ function tripal_cv_views_default_views() {
         'sortable' => 1,
         'separator' => '',
       ),
+    ),
+    'default' => '-1',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'admin/tripal/tripal_cv/list_cvterms');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Term Listing',
+    'description' => 'A listing of a controlled vocabulary terms for a given vocabulary',
+    'weight' => '0',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  // Main cv default listing
+  $view = new view;
+  $view->name = 'cv_listing';
+  $view->description = 'A listing of all controlled vocabularies';
+  $view->tag = 'chado default';
+  $view->base_table = 'cv';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'name' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'cv',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'definition' => array(
+      'label' => 'Definition',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'definition',
+      'table' => 'cv',
+      'field' => 'definition',
+      'relationship' => 'none',
+    ),
+    'nothing' => array(
+      'label' => 'Terms',
+      'alter' => array(
+        'text' => 'view',
+        'make_link' => 1,
+        'path' => 'admin/tripal/tripal_cv/list_cvterms?cv%5B%5D=[name]',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'exclude' => 0,
+      'id' => 'nothing',
+      'table' => 'views',
+      'field' => 'nothing',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'name' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'name_op',
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'name',
+      'table' => 'cv',
+      'field' => 'name',
+      'relationship' => 'none',
+      'values_form_type' => 'textfield',
+      'multiple' => 0,
+      'optional' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 0,
+      ),
+    ),
+    'definition' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'definition_op',
+        'identifier' => 'definition',
+        'label' => 'Definition Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'definition',
+      'table' => 'cv',
+      'field' => 'definition',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 0,
+      ),
+    ),
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all controlled vocabularies matching the entered criteria. If you leave a any of the criteria blank then the controlled vocabularies will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all controlled vocabularies will be listed.',
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access chado_cv content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Controlled Vocabularies');
+  $handler->override_option('header', 'Click "Show" to see a list of all controlled vocabularies matching the entered criteria. If you leave a any of the criteria blank then the controlled vocabularies will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all controlled vocabularies will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No controlled vocabularies match the supplied criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'name' => 'name',
+      'definition' => 'definition',
+      'nothing' => 'nothing',
+    ),
+    'info' => array(
       'name' => array(
         'sortable' => 1,
         'separator' => '',
       ),
-      'accession_link' => array(
-        'sortable' => 1,
+      'definition' => array(
+        'sortable' => 0,
+        'separator' => '',
+      ),
+      'nothing' => array(
         'separator' => '',
       ),
     ),
-    'default' => '-1',
+    'default' => 'name',
   ));
   $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'admin/tripal/tripal_cv/list_cvterms');
+  $handler->override_option('path', 'admin/tripal/tripal_cv/list_cvs');
   $handler->override_option('menu', array(
     'type' => 'normal',
-    'title' => 'Term Listing',
-    'description' => 'A listing of a controlled vocabulary terms for a given vocabulary',
+    'title' => 'CV Listing',
+    'description' => 'A listing of all controlled vocabularies',
     'weight' => '0',
     'name' => 'navigation',
   ));

+ 349 - 18
tripal_db/tripal_db.views.inc

@@ -37,8 +37,14 @@ function tripal_db_views_data()  {
       'dbxref'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+
+        // add specialty handlers
+        if ($tablename == 'db') {
+          $table_integration_array['fields']['name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+        }
+
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
@@ -48,7 +54,7 @@ function tripal_db_views_data()  {
       'dbxrefprop'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -66,17 +72,293 @@ function tripal_db_views_data()  {
 function tripal_db_views_default_views() {
   $views = array();
 
-  // Main default view
-  // List all cvterms based on cv
+  // Main DB default view
   $view = new view;
+  $view->name = 'db_listing';
+  $view->description = 'A listing of all databases.';
+  $view->tag = 'chado default';
+  $view->base_table = 'db';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'name' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'db',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'description' => array(
+      'label' => 'Description',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'description',
+      'table' => 'db',
+      'field' => 'description',
+      'relationship' => 'none',
+    ),
+    'url' => array(
+      'label' => 'Url',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 1,
+        'path' => '[url]',
+        'absolute' => 1,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '_blank',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'url',
+      'table' => 'db',
+      'field' => 'url',
+      'relationship' => 'none',
+    ),
+    'urlprefix' => array(
+      'label' => 'Urlprefix',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'urlprefix',
+      'table' => 'db',
+      'field' => 'urlprefix',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'name' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'name_op',
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'name',
+      'table' => 'db',
+      'field' => 'name',
+      'relationship' => 'none',
+      'values_form_type' => 'textfield',
+      'multiple' => 0,
+      'optional' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 0,
+      ),
+    ),
+    'description' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'description_op',
+        'identifier' => 'description',
+        'label' => 'Description Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'description',
+      'table' => 'db',
+      'field' => 'description',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 0,
+      ),
+    ),
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all databases matching the entered criteria. If you leave a any of the criteria blank then the databases will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all databases will be listed.',
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access chado_db content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Databases');
+  $handler->override_option('header', 'Click "Show" to see a list of all databases matching the entered criteria. If you leave a any of the criteria blank then the databases will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all databases will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No databases match the supplied criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'name' => 'name',
+      'url' => 'url',
+      'urlprefix' => 'urlprefix',
+      'description' => 'description',
+    ),
+    'info' => array(
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'url' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'urlprefix' => array(
+        'sortable' => 0,
+        'separator' => '',
+      ),
+      'description' => array(
+        'sortable' => 0,
+        'separator' => '',
+      ),
+    ),
+    'default' => 'name',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'admin/tripal/tripal_db/list_dbs');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'DB Listing',
+    'description' => 'Lists all databases available to create database references for.',
+    'weight' => '0',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  // Main dbxref default view
   $view = new view;
-  $view->name = 'all_dbxrefs';
+  $view->name = 'dbxref_listing';
   $view->description = 'A listing of all database references filtered by database';
-  $view->tag = 'chado';
-  $view->view_php = '';
+  $view->tag = 'chado default';
   $view->base_table = 'dbxref';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
+  $view->core = 0;
+  $view->api_version = '2';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
   $handler = $view->new_display('default', 'Defaults', 'default');
   $handler->override_option('fields', array(
@@ -196,18 +478,20 @@ function tripal_db_views_default_views() {
       'field' => 'version',
       'relationship' => 'none',
     ),
-    'accession_link' => array(
+    'urlprefix' => array(
       'label' => 'External Link',
       'alter' => array(
         'alter_text' => 1,
-        'text' => 'link',
+        'text' => '[name]:[accession]',
         'make_link' => 1,
-        'path' => '[accession_link]',
+        'path' => '[urlprefix][accession]',
+        'absolute' => 1,
         'link_class' => '',
         'alt' => '',
+        'rel' => '',
         'prefix' => '',
         'suffix' => '',
-        'target' => '',
+        'target' => '_blank',
         'help' => '',
         'trim' => 0,
         'max_length' => '',
@@ -219,17 +503,36 @@ function tripal_db_views_default_views() {
       'empty' => '',
       'hide_empty' => 1,
       'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
       'exclude' => 0,
-      'id' => 'accession_link',
+      'id' => 'urlprefix',
+      'table' => 'db',
+      'field' => 'urlprefix',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('sorts', array(
+    'name' => array(
+      'order' => 'ASC',
+      'id' => 'name',
+      'table' => 'db',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'accession' => array(
+      'order' => 'ASC',
+      'id' => 'accession',
       'table' => 'dbxref',
-      'field' => 'accession_link',
+      'field' => 'accession',
       'relationship' => 'none',
     ),
   ));
   $handler->override_option('filters', array(
     'name' => array(
       'operator' => '=',
-      'value' => '<select db>',
+      'value' => array(),
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
@@ -237,7 +540,6 @@ function tripal_db_views_default_views() {
         'operator' => 'name_op',
         'identifier' => 'db',
         'label' => 'Database',
-        'optional' => 1,
         'remember' => 0,
       ),
       'case' => 1,
@@ -245,6 +547,13 @@ function tripal_db_views_default_views() {
       'table' => 'db',
       'field' => 'name',
       'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
     ),
     'accession' => array(
       'operator' => 'contains',
@@ -256,7 +565,6 @@ function tripal_db_views_default_views() {
         'operator' => 'accession_op',
         'identifier' => 'accession',
         'label' => 'Accession Contains',
-        'optional' => 1,
         'remember' => 0,
       ),
       'case' => 0,
@@ -264,6 +572,26 @@ function tripal_db_views_default_views() {
       'table' => 'dbxref',
       'field' => 'accession',
       'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all database references matching the entered criteria. If you leave a any of the criteria blank then the database references will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all database references will be listed.',
     ),
   ));
   $handler->override_option('access', array(
@@ -274,6 +602,9 @@ function tripal_db_views_default_views() {
     'type' => 'none',
   ));
   $handler->override_option('title', 'Database References');
+  $handler->override_option('header', 'Click "Show" to see a list of all database references matching the entered criteria. If you leave a any of the criteria blank then the database references will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all database references will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
   $handler->override_option('empty', 'There are no database references matching the above criteria. Please select a database in order to display all references to that database.');
   $handler->override_option('empty_format', '1');
   $handler->override_option('items_per_page', 50);

+ 202 - 74
tripal_feature/tripal_feature.views.inc

@@ -37,7 +37,7 @@ function tripal_feature_views_data()  {
       'feature',
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -66,7 +66,7 @@ function tripal_feature_views_data()  {
       'featurerange'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -134,17 +134,15 @@ function tripal_feature_views_default_views() {
   $views = array();
 
   // Main default view
-  // List all cvterms based on cv
   $view = new view;
-  $view->name = 'all_features';
-  $view->description = 'A listing of all Sequence FEatures';
-  $view->tag = 'chado';
-  $view->view_php = '';
+  $view->name = 'feature_listing';
+  $view->description = 'A listing of chado sequence features.';
+  $view->tag = 'chado default';
   $view->base_table = 'feature';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
+  $view->core = 0;
+  $view->api_version = '2';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
-  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler = $view->new_display('default', 'features_all', 'default');
   $handler->override_option('fields', array(
     'uniquename' => array(
       'label' => 'Unique Name',
@@ -152,7 +150,7 @@ function tripal_feature_views_default_views() {
         'alter_text' => 0,
         'text' => '',
         'make_link' => 0,
-        'path' => '',
+        'path' => 'node/[nid]',
         'link_class' => '',
         'alt' => '',
         'prefix' => '',
@@ -169,12 +167,15 @@ function tripal_feature_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
-      'link_to_node' => 1,
+      'link_to_node' => 0,
       'exclude' => 0,
       'id' => 'uniquename',
       'table' => 'feature',
       'field' => 'uniquename',
       'relationship' => 'none',
+      'override' => array(
+        'button' => 'Override',
+      ),
     ),
     'name' => array(
       'label' => 'Name',
@@ -205,9 +206,12 @@ function tripal_feature_views_default_views() {
       'table' => 'feature',
       'field' => 'name',
       'relationship' => 'none',
+      'override' => array(
+        'button' => 'Override',
+      ),
     ),
-    'common_name' => array(
-      'label' => 'Organism',
+    'name_1' => array(
+      'label' => 'Type',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
@@ -229,15 +233,14 @@ function tripal_feature_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
-      'link_to_node' => 1,
       'exclude' => 0,
-      'id' => 'common_name',
-      'table' => 'organism',
-      'field' => 'common_name',
+      'id' => 'name_1',
+      'table' => 'cvterm',
+      'field' => 'name',
       'relationship' => 'none',
     ),
-    'name_3' => array(
-      'label' => 'Type',
+    'common_name' => array(
+      'label' => 'Common Name',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
@@ -259,14 +262,18 @@ function tripal_feature_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
+      'link_to_node' => 1,
       'exclude' => 0,
-      'id' => 'name_3',
-      'table' => 'cvterm',
-      'field' => 'name',
+      'id' => 'common_name',
+      'table' => 'organism',
+      'field' => 'common_name',
       'relationship' => 'none',
+      'override' => array(
+        'button' => 'Override',
+      ),
     ),
-    'accession_link' => array(
-      'label' => 'External Reference',
+    'seqlen' => array(
+      'label' => 'Sequence Length',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
@@ -288,21 +295,29 @@ function tripal_feature_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
+      'set_precision' => FALSE,
+      'precision' => 0,
+      'decimal' => '.',
+      'separator' => ',',
+      'prefix' => '',
+      'suffix' => '',
       'exclude' => 0,
-      'id' => 'accession_link',
-      'table' => 'dbxref',
-      'field' => 'accession_link',
+      'id' => 'seqlen',
+      'table' => 'feature',
+      'field' => 'seqlen',
       'relationship' => 'none',
     ),
-    'name_1' => array(
-      'label' => 'Library',
+    'is_obsolete' => array(
+      'label' => 'Is Obsolete',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
         'make_link' => 0,
         'path' => '',
+        'absolute' => 0,
         'link_class' => '',
         'alt' => '',
+        'rel' => '',
         'prefix' => '',
         'suffix' => '',
         'target' => '',
@@ -317,22 +332,27 @@ function tripal_feature_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
-      'link_to_node' => 1,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'not' => 0,
+      'separator' => ', ',
       'exclude' => 0,
-      'id' => 'name_1',
-      'table' => 'library',
-      'field' => 'name',
+      'id' => 'is_obsolete',
+      'table' => 'feature',
+      'field' => 'is_obsolete',
       'relationship' => 'none',
     ),
-    'name_2' => array(
-      'label' => 'Analysis',
+    'timeaccessioned' => array(
+      'label' => 'Accessioned On',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
         'make_link' => 0,
         'path' => '',
+        'absolute' => 0,
         'link_class' => '',
         'alt' => '',
+        'rel' => '',
         'prefix' => '',
         'suffix' => '',
         'target' => '',
@@ -347,10 +367,37 @@ function tripal_feature_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
-      'link_to_node' => 1,
+      'hide_alter_empty' => 1,
+      'date_format' => 'large',
+      'custom_date_format' => '',
+      'type' => 'separator',
+      'separator' => ', ',
       'exclude' => 0,
-      'id' => 'name_2',
-      'table' => 'analysis',
+      'id' => 'timeaccessioned',
+      'table' => 'feature',
+      'field' => 'timeaccessioned',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('sorts', array(
+    'common_name' => array(
+      'order' => 'ASC',
+      'id' => 'common_name',
+      'table' => 'organism',
+      'field' => 'common_name',
+      'relationship' => 'none',
+    ),
+    'name' => array(
+      'order' => 'ASC',
+      'id' => 'name',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'name_1' => array(
+      'order' => 'ASC',
+      'id' => 'name_1',
+      'table' => 'feature',
       'field' => 'name',
       'relationship' => 'none',
     ),
@@ -358,15 +405,14 @@ function tripal_feature_views_default_views() {
   $handler->override_option('filters', array(
     'common_name' => array(
       'operator' => '=',
-      'value' => '<select organism>',
+      'value' => array(),
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
         'use_operator' => 0,
         'operator' => 'common_name_op',
         'identifier' => 'organism',
-        'label' => 'Organism',
-        'optional' => 1,
+        'label' => 'Organism Common Name',
         'remember' => 0,
       ),
       'case' => 1,
@@ -374,63 +420,81 @@ function tripal_feature_views_default_views() {
       'table' => 'organism',
       'field' => 'common_name',
       'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'override' => array(
+        'button' => 'Override',
+      ),
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
     ),
-    'name' => array(
-      'operator' => 'contains',
-      'value' => '',
+    'type_id' => array(
+      'operator' => '=',
+      'value' => array(),
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
         'use_operator' => 0,
-        'operator' => 'name_op',
-        'identifier' => 'name',
-        'label' => 'Name Contains',
-        'optional' => 1,
+        'operator' => 'type_id_op',
+        'identifier' => 'type_id',
+        'label' => 'Type',
         'remember' => 0,
       ),
-      'case' => 0,
-      'id' => 'name',
+      'case' => 1,
+      'id' => 'type_id',
       'table' => 'feature',
-      'field' => 'name',
+      'field' => 'type_id',
       'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
     ),
     'name_1' => array(
-      'operator' => 'contains',
+      'operator' => 'allwords',
       'value' => '',
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
         'use_operator' => 0,
         'operator' => 'name_1_op',
-        'identifier' => 'library',
-        'label' => 'Library Name Contains',
-        'optional' => 1,
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'bef_filter_description' => '',
         'remember' => 0,
       ),
       'case' => 0,
       'id' => 'name_1',
-      'table' => 'library',
+      'table' => 'feature',
       'field' => 'name',
       'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
     ),
-    'name_2' => array(
-      'operator' => 'contains',
+    'search_results' => array(
+      'operator' => '=',
       'value' => '',
       'group' => '0',
-      'exposed' => TRUE,
+      'exposed' => FALSE,
       'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'name_2_op',
-        'identifier' => 'analysis',
-        'label' => 'Analysis Name Contains',
-        'optional' => 1,
-        'remember' => 0,
+        'operator' => FALSE,
+        'label' => '',
       ),
-      'case' => 0,
-      'id' => 'name_2',
-      'table' => 'analysis',
-      'field' => 'name',
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
       'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all features matching the entered criteria. If you leave a any of the criteria blank then the features will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all features will be listed.',
     ),
   ));
   $handler->override_option('access', array(
@@ -441,16 +505,80 @@ function tripal_feature_views_default_views() {
     'type' => 'none',
   ));
   $handler->override_option('title', 'Sequence Features');
-  $handler->override_option('empty', 'There are no features matching that criteria. Please select a different organism above.');
-  $handler->override_option('empty_format', '1');
+  $handler->override_option('header', 'Click "Show" to see a list of all features matching the entered criteria. If you leave a any of the criteria blank then the features will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all features will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'There are currently no features sync\'d with drupal.');
+  $handler->override_option('empty_format', '2');
   $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
   $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'columns' => array(
+      'accession' => 'accession',
+      'accession_link' => 'accession_link',
+      'name' => 'name',
+      'uniquename' => 'uniquename',
+      'name_1' => 'name_1',
+      'common_name' => 'common_name',
+      'seqlen' => 'seqlen',
+      'is_obsolete' => 'is_obsolete',
+      'is_analysis' => 'is_analysis',
+      'nid' => 'nid',
+    ),
+    'info' => array(
+      'accession' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'accession_link' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'uniquename' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name_1' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'common_name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'seqlen' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'is_obsolete' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'is_analysis' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'nid' => array(
+        'separator' => '',
+      ),
+    ),
+    'default' => '-1',
+  ));
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->override_option('path', 'features');
   $handler->override_option('menu', array(
     'type' => 'normal',
-    'title' => 'Sequence Features',
-    'description' => '',
+    'title' => 'Features View',
+    'description' => 'Provides a table of sequence features',
     'weight' => '0',
     'name' => 'primary-links',
   ));

+ 0 - 1
tripal_genetic/tripal_genetic.info

@@ -8,4 +8,3 @@ dependencies[] = tripal_core
 dependencies[] = tripal_cv
 dependencies[] = tripal_feature
 dependencies[] = tripal_phenotype
-dependencies[] = tripal_pub

+ 257 - 4
tripal_genetic/tripal_genetic.views.inc

@@ -30,9 +30,12 @@ function tripal_genetic_views_data()  {
       'phenstatement'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
-        tripal_views_integration_add_entry($table_integration_array);
+        $status = tripal_views_integration_add_entry($table_integration_array);
+        if (!$status) {
+          drupal_set_message(t('Tripal Genetic is unable to integrate %table', array('%table' => $tablename)), 'error');
+        }
       }
     }
 
@@ -43,9 +46,12 @@ function tripal_genetic_views_data()  {
       'phenotype_comparison'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
-        tripal_views_integration_add_entry($table_integration_array);
+        $status = tripal_views_integration_add_entry($table_integration_array);
+        if (!$status) {
+          drupal_set_message(t('Tripal Genetic is unable to integrate %table', array('%table' => $tablename)), 'error');
+        }
       }
     }
   }
@@ -71,3 +77,250 @@ function tripal_genetic_views_handlers() {
   ),
   );
 }
+
+/**
+ *
+ * @ingroup tripal_feature_views
+ */
+function tripal_genetic_views_default_views() {
+  $views = array();
+
+  // Main default view
+  $view = new view;
+  $view->name = 'genotype_listing';
+  $view->description = 'A listing of observed genotypes and the features displaying them';
+  $view->tag = 'chado default';
+  $view->base_table = 'genotype';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'uniquename' => array(
+      'label' => 'Uniquename',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'uniquename',
+      'table' => 'genotype',
+      'field' => 'uniquename',
+      'relationship' => 'none',
+    ),
+    'name' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'genotype',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'description' => array(
+      'label' => 'Description',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'description',
+      'table' => 'genotype',
+      'field' => 'description',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'uniquename' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'uniquename_op',
+        'identifier' => 'uniquename',
+        'label' => 'Unique Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'uniquename',
+      'table' => 'genotype',
+      'field' => 'uniquename',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'description' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'description_op',
+        'identifier' => 'description',
+        'label' => 'Description Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'description',
+      'table' => 'genotype',
+      'field' => 'description',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all genotypes matching the entered criteria. If you leave a any of the criteria blank then the genotypes will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all genotypes will be listed.',
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Genotypes Observed');
+  $handler->override_option('header', 'Click "Show" to see a list of all genotypes matching the entered criteria. If you leave a any of the criteria blank then the genotypes will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all genotypes will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No genotypes match the current criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'uniquename' => 'uniquename',
+      'name' => 'name',
+      'description' => 'description',
+    ),
+    'info' => array(
+      'uniquename' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'description' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+    ),
+    'default' => 'uniquename',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'genotypes');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Genotypes',
+    'description' => '',
+    'weight' => '0',
+    'name' => 'primary-links',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 63 - 64
tripal_library/tripal_library.views.inc

@@ -35,7 +35,7 @@ function tripal_library_views_data()  {
       'library'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -49,7 +49,7 @@ function tripal_library_views_data()  {
       'libraryprop'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -116,15 +116,13 @@ function tripal_library_views_default_views() {
   $views = array();
 
   // Main default view
-  // List all cvterms based on cv
   $view = new view;
-  $view->name = 'all_libraries';
+  $view->name = 'library_listing';
   $view->description = 'A listing of all libraries';
-  $view->tag = 'chado';
-  $view->view_php = '';
+  $view->tag = 'chado default';
   $view->base_table = 'library';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
+  $view->core = 0;
+  $view->api_version = '2';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
   $handler = $view->new_display('default', 'Defaults', 'default');
   $handler->override_option('fields', array(
@@ -278,40 +276,18 @@ function tripal_library_views_default_views() {
       'field' => 'is_obsolete',
       'relationship' => 'none',
     ),
-    'num_features' => array(
-      'label' => 'Number of Features',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_features',
+  ));
+  $handler->override_option('sorts', array(
+    'name' => array(
+      'id' => 'name',
       'table' => 'library',
-      'field' => 'num_features',
-      'relationship' => 'none',
+      'field' => 'name',
     ),
   ));
   $handler->override_option('filters', array(
     'common_name' => array(
       'operator' => '=',
-      'value' => 'All',
+      'value' => array(),
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
@@ -319,7 +295,6 @@ function tripal_library_views_default_views() {
         'operator' => 'common_name_op',
         'identifier' => 'organism_common_name',
         'label' => 'Organism',
-        'optional' => 1,
         'remember' => 0,
       ),
       'case' => 1,
@@ -327,6 +302,39 @@ function tripal_library_views_default_views() {
       'table' => 'organism',
       'field' => 'common_name',
       'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'type_id' => array(
+      'operator' => '=',
+      'value' => array(),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'type_id_op',
+        'identifier' => 'type_id',
+        'label' => 'Type',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'type_id',
+      'table' => 'library',
+      'field' => 'type_id',
+      'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 0,
+      ),
     ),
   ));
   $handler->override_option('access', array(
@@ -337,8 +345,12 @@ function tripal_library_views_default_views() {
     'type' => 'none',
   ));
   $handler->override_option('title', 'Libraries');
+  $handler->override_option('header', 'Click "Show" to see a list of all libraries matching the entered criteria. If you leave a any of the criteria blank then the libraries will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all libraries will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
   $handler->override_option('empty', 'There are no libraries matching the current criteria. If you think there should be, check that all chado libraries are sync\'d with your website.');
   $handler->override_option('empty_format', '1');
+  $handler->override_option('items_per_page', 50);
   $handler->override_option('use_pager', '1');
   $handler->override_option('style_plugin', 'table');
   $handler->override_option('style_options', array(
@@ -346,50 +358,37 @@ function tripal_library_views_default_views() {
     'override' => 1,
     'sticky' => 0,
     'order' => 'asc',
+    'summary' => '',
     'columns' => array(
-      'name' => 'name',
-      'timeaccessioned' => 'timeaccessioned',
-      'timelastmodified' => 'timelastmodified',
-      'is_obsolete' => 'is_obsolete',
-      'name_1' => 'name_1',
       'uniquename' => 'uniquename',
+      'name_1' => 'name_1',
       'common_name' => 'common_name',
-      'num_libraries' => 'num_libraries',
+      'name' => 'name',
+      'is_obsolete' => 'is_obsolete',
     ),
     'info' => array(
-      'name' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'timeaccessioned' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'timelastmodified' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'is_obsolete' => array(
-        'sortable' => 0,
+      'uniquename' => array(
+        'sortable' => 1,
         'separator' => '',
       ),
       'name_1' => array(
-        'sortable' => 0,
+        'sortable' => 1,
         'separator' => '',
       ),
-      'uniquename' => array(
-        'sortable' => 0,
+      'common_name' => array(
+        'sortable' => 1,
         'separator' => '',
       ),
-      'common_name' => array(
-        'sortable' => 0,
+      'name' => array(
+        'sortable' => 1,
         'separator' => '',
       ),
-      'num_libraries' => array(
+      'is_obsolete' => array(
+        'sortable' => 1,
         'separator' => '',
       ),
     ),
-    'default' => '-1',
+    'default' => 'uniquename',
   ));
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->override_option('path', 'libraries');

+ 0 - 425
tripal_library/tripal_library.views.inc.orig

@@ -1,425 +0,0 @@
-<?php
-
-/**
- *  @file
- *  This file contains the basic functions for views integration of
- *  chado/tripal organism tables. Supplementary functions can be found in
- *  ./views/
- *
- *  Documentation on views integration can be found at
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/**
- * @defgroup tripal_library_views Library Views Integration
- * @ingroup views
- * @ingroup tripal_library
- */
-
-<<<<<<< HEAD
-=======
-require_once('views/library.views.inc');
-require_once('views/chado_library.views.inc');
-require_once('views/misc_tables.views.inc');
->>>>>>> 6.x-0.4-dev
-/*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_library_views
- */
-function tripal_library_views_data()  {
-  $data = array();
-
-<<<<<<< HEAD
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'library'
-    );
-    foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,TRUE);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-    $tables = array(
-      'library_cvterm',
-      'library_feature',
-      'library_pub',
-      'library_synonym',
-      'libraryprop'
-    );
-    foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,FALSE);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-=======
-  $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());
->>>>>>> 6.x-0.4-dev
-
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- * @return: An array of handler definitions
- *
- * @ingroup tripal_library_views
- */
-function tripal_library_views_handlers() {
- return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_library') . '/views/handlers',
-   ),
-   'handlers' => array(
-     'views_handler_field_computed_library_nid' => array(
-       'parent' => 'views_handler_field_numeric',
-     ),
-   ),
- );
-}
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_library_views_data_alter(&$data) {
-
-  if ( !(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['library_chado_nid'] = array(
-      'group' => 'Library',
-      'title' => 'Library Node',
-      'help' => 'Links Chado Library Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_library',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
-/**
- *
- *
- * @ingroup tripal_library_views
- */
-function tripal_library_views_default_views() {
-  $views = array();
-
-  // Main default view
-  // List all cvterms based on cv
-  $view = new view;
-  $view->name = 'all_libraries';
-  $view->description = 'A listing of all libraries';
-  $view->tag = 'chado';
-  $view->view_php = '';
-  $view->base_table = 'library';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
-  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
-  $handler = $view->new_display('default', 'Defaults', 'default');
-  $handler->override_option('fields', array(
-    'uniquename' => array(
-      'label' => 'Unique Name',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'link_to_node' => 1,
-      'exclude' => 0,
-      'id' => 'uniquename',
-      'table' => 'library',
-      'field' => 'uniquename',
-      'relationship' => 'none',
-    ),
-    'name_1' => array(
-      'label' => 'Name',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'link_to_node' => 1,
-      'exclude' => 0,
-      'id' => 'name_1',
-      'table' => 'library',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-    'common_name' => array(
-      'label' => 'Organism',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'link_to_node' => 1,
-      'exclude' => 0,
-      'id' => 'common_name',
-      'table' => 'organism',
-      'field' => 'common_name',
-      'relationship' => 'none',
-    ),
-    'name' => array(
-      'label' => 'Type',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'name',
-      'table' => 'cvterm',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-    'is_obsolete' => array(
-      'label' => 'Is Obsolete?',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'type' => 'yes-no',
-      'not' => 0,
-      'exclude' => 0,
-      'id' => 'is_obsolete',
-      'table' => 'library',
-      'field' => 'is_obsolete',
-      'relationship' => 'none',
-    ),
-    'num_features' => array(
-      'label' => 'Number of Features',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_features',
-      'table' => 'library',
-      'field' => 'num_features',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'common_name' => array(
-      'operator' => '=',
-      'value' => 'All',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'common_name_op',
-        'identifier' => 'organism_common_name',
-        'label' => 'Organism',
-        'optional' => 1,
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'common_name',
-      'table' => 'organism',
-      'field' => 'common_name',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_library content',
-  ));
-  $handler->override_option('cache', array(
-    'type' => 'none',
-  ));
-  $handler->override_option('title', 'Libraries');
-  $handler->override_option('empty', 'There are no libraries matching the current criteria. If you think there should be, check that all chado libraries are sync\'d with your website.');
-  $handler->override_option('empty_format', '1');
-  $handler->override_option('use_pager', '1');
-  $handler->override_option('style_plugin', 'table');
-  $handler->override_option('style_options', array(
-    'grouping' => '',
-    'override' => 1,
-    'sticky' => 0,
-    'order' => 'asc',
-    'columns' => array(
-      'name' => 'name',
-      'timeaccessioned' => 'timeaccessioned',
-      'timelastmodified' => 'timelastmodified',
-      'is_obsolete' => 'is_obsolete',
-      'name_1' => 'name_1',
-      'uniquename' => 'uniquename',
-      'common_name' => 'common_name',
-      'num_libraries' => 'num_libraries',
-    ),
-    'info' => array(
-      'name' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'timeaccessioned' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'timelastmodified' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'is_obsolete' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'name_1' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'uniquename' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'common_name' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'num_libraries' => array(
-        'separator' => '',
-      ),
-    ),
-    'default' => '-1',
-  ));
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'libraries');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Sequence Libraries',
-    'description' => '',
-    'weight' => '0',
-    'name' => 'primary-links',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 6 - 1
tripal_natural_diversity/tripal_natural_diversity.api.inc

@@ -553,7 +553,7 @@ function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_stock() {
 function tripal_natural_diversity_chado_schema_v1_2_nd_experiment_stock() {
   $description = array();
 
-  $description = array( 
+  $description = array(
     'referring_tables' => array(
       'nd_experiment_stock_dbxref',
       'nd_experiment_stockprop',
@@ -1078,6 +1078,11 @@ function tripal_natural_diversity_chado_schema_v1_11_nd_reagent() {
         'type' => 'serial',
         'not null' => '1',
       ),
+      'name' => array(
+        'type' => 'varchar',
+        'length' => 80,
+        'not null' => TRUE
+      ),
       'type_id' => array(
         'type' => 'int',
         'not null' => '1',

+ 997 - 16
tripal_natural_diversity/tripal_natural_diversity.views.inc

@@ -3,14 +3,13 @@
 /**
  *  @file
  *  This file contains the basic functions for views integration of
- *  chado/tripal_natural_diversity tables. Supplementary functions can be found in
- *  ./views/
+ *  chado/tripal_natural_diversity tables.
  *
  *  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
  *
@@ -31,8 +30,20 @@ function tripal_natural_diversity_views_data()  {
       'nd_reagent'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+
+        // Add specialty handlers
+        switch ($tablename) {
+          case 'nd_geolocation':
+            $table_integration_array['fields']['description']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+            $table_integration_array['fields']['geodetic_datum']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+            $table_integration_array['fields']['latitude']['handlers']['filter']['name'] = 'chado_views_handler_filter_float';
+            $table_integration_array['fields']['longitude']['handlers']['filter']['name'] = 'chado_views_handler_filter_float';
+            $table_integration_array['fields']['altitude']['handlers']['filter']['name'] = 'chado_views_handler_filter_float';
+            break;
+        }
+
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
@@ -56,7 +67,7 @@ function tripal_natural_diversity_views_data()  {
       'nd_reagentprop'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -66,7 +77,7 @@ 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",
@@ -76,16 +87,986 @@ function tripal_natural_diversity_views_data()  {
  */
 function tripal_natural_diversity_views_handlers() {
   return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_natural_diversity') . '/views/handlers',
-  ),
-   'handlers' => array(
-  'views_handler_field_chado_relationship_all' => array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'tripal_natural_diversity') . '/views/handlers',
+    ),
+    'handlers' => array(
+      'views_handler_field_chado_relationship_all' => array(
+        'parent' => 'views_handler_field_prerender_list',
+      ),
+      'views_handler_field_chado_relationship_by_type' => array(
        'parent' => 'views_handler_field_prerender_list',
-  ),
-  'views_handler_field_chado_relationship_by_type' => array(
-       'parent' => 'views_handler_field_prerender_list',
-  ),
-  ),
+      ),
+    ),
   );
 }
+
+/**
+ * Created Default views related to the tables integrated by this module
+ *
+ * @ingroup tripal_feature_views
+ */
+function tripal_natural_diversity_views_default_views() {
+  $views = array();
+
+  // Experiment Listing
+  $view = new view;
+  $view->name = 'natdiv_experiment_listing';
+  $view->description = 'A listing of all natural diversity experiments';
+  $view->tag = 'chado default';
+  $view->base_table = 'nd_experiment';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'name' => array(
+      'label' => 'Type',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'description' => array(
+      'label' => 'Location Experiment Performed',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'description',
+      'table' => 'nd_geolocation',
+      'field' => 'description',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('sorts', array(
+    'name' => array(
+      'order' => 'ASC',
+      'id' => 'name',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'description' => array(
+      'order' => 'ASC',
+      'id' => 'description',
+      'table' => 'nd_geolocation',
+      'field' => 'description',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'type_id' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'type_id_op',
+        'identifier' => 'type_id',
+        'label' => 'Experiment Type',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'type_id',
+      'table' => 'nd_experiment',
+      'field' => 'type_id',
+      'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'description' => array(
+      'operator' => '=',
+      'value' => 'University of Saskatchewan',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'description_op',
+        'identifier' => 'geolocation',
+        'label' => 'Location Experiment Performed',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'description',
+      'table' => 'nd_geolocation',
+      'field' => 'description',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+    ),
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all experiments matching the entered criteria. If you leave a any of the criteria blank then the experiments will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all experiments will be listed.',
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Natural Diversity Experiments');
+  $handler->override_option('header', 'Click "Show" to see a list of all experiments matching the entered criteria. If you leave a any of the criteria blank then the experiments will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all experiments will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No natural diversity experiments match the current criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'name' => 'name',
+      'description' => 'description',
+    ),
+    'info' => array(
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'description' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+    ),
+    'default' => '-1',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'natdiv_experiments');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Natural Diversity Experiments',
+    'description' => '',
+    'weight' => '0',
+    'name' => 'primary-links',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  // List geolocations
+  $view = new view;
+  $view->name = 'geolocation_listing';
+  $view->description = 'A listing of locations where natural diversity experiments took place';
+  $view->tag = 'chado default';
+  $view->base_table = 'nd_geolocation';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'description' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'description',
+      'table' => 'nd_geolocation',
+      'field' => 'description',
+      'relationship' => 'none',
+    ),
+    'latitude' => array(
+      'label' => 'Latitude',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'latitude',
+      'table' => 'nd_geolocation',
+      'field' => 'latitude',
+      'relationship' => 'none',
+    ),
+    'longitude' => array(
+      'label' => 'Longitude',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'longitude',
+      'table' => 'nd_geolocation',
+      'field' => 'longitude',
+      'relationship' => 'none',
+    ),
+    'altitude' => array(
+      'label' => 'Altitude',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'altitude',
+      'table' => 'nd_geolocation',
+      'field' => 'altitude',
+      'relationship' => 'none',
+    ),
+    'geodetic_datum' => array(
+      'label' => 'Geodetic Datum',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'geodetic_datum',
+      'table' => 'nd_geolocation',
+      'field' => 'geodetic_datum',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'geodetic_datum' => array(
+      'operator' => '=',
+      'value' => array(),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'geodetic_datum_op',
+        'identifier' => 'geodetic_datum',
+        'label' => 'Geodetic Datum',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'geodetic_datum',
+      'table' => 'nd_geolocation',
+      'field' => 'geodetic_datum',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+    ),
+    'latitude' => array(
+      'operator' => '=',
+      'value' => array(
+        'value' => '',
+        'min' => '',
+        'max' => '',
+      ),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 1,
+        'operator' => 'latitude_op',
+        'identifier' => 'latitude',
+        'label' => 'Latitude',
+        'optional' => 0,
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'latitude',
+      'table' => 'nd_geolocation',
+      'field' => 'latitude',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'longitude' => array(
+      'operator' => '=',
+      'value' => array(
+        'value' => '',
+        'min' => '',
+        'max' => '',
+      ),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 1,
+        'operator' => 'longitude_op',
+        'identifier' => 'longitude',
+        'label' => 'Longitude',
+        'optional' => 0,
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'longitude',
+      'table' => 'nd_geolocation',
+      'field' => 'longitude',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'altitude' => array(
+      'operator' => '=',
+      'value' => array(
+        'value' => '',
+        'min' => '',
+        'max' => '',
+      ),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 1,
+        'operator' => 'altitude_op',
+        'identifier' => 'altitude',
+        'label' => 'Altitude',
+        'optional' => 0,
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'altitude',
+      'table' => 'nd_geolocation',
+      'field' => 'altitude',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'description' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'description_op',
+        'identifier' => 'description',
+        'label' => 'Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'description',
+      'table' => 'nd_geolocation',
+      'field' => 'description',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+      'values_form_type' => 'textfield',
+      'multiple' => 0,
+      'optional' => 0,
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Geographical Locations');
+  $handler->override_option('header', 'Use the following criteria to limit the locations listed. If you leave a any of the criteria blank then the locations will be not be filtered based on that field.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No locations matched the current criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'description' => 'description',
+      'latitude' => 'latitude',
+      'longitude' => 'longitude',
+      'altitude' => 'altitude',
+      'geodetic_datum' => 'geodetic_datum',
+    ),
+    'info' => array(
+      'description' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'latitude' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'longitude' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'altitude' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'geodetic_datum' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+    ),
+    'default' => 'description',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'natdiv_geolocations');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Geographical Locations',
+    'description' => '',
+    'weight' => '0',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  // List protocols
+  $view = new view;
+  $view->name = 'natdiv_protocol_listing';
+  $view->description = 'A listing of protocols used for natural diversity experiments';
+  $view->tag = 'chado default';
+  $view->base_table = 'nd_protocol';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'name' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'nd_protocol',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'name' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'name_op',
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'name',
+      'table' => 'nd_protocol',
+      'field' => 'name',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all protocols matching the entered criteria. If you leave a any of the criteria blank then the protocols will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all protocols will be listed.',
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Protocols');
+  $handler->override_option('header', 'Click "Show" to see a list of all protocols matching the entered criteria. If you leave a any of the criteria blank then the protocols will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all protocols will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No protocols match the current criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'name' => 'name',
+    ),
+    'info' => array(
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+    ),
+    'default' => 'name',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'natdiv_protocols');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Natural Diversity Protocols',
+    'description' => 'The protcols used for natural diversity experiments',
+    'weight' => '0',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  // List Reagents
+  $view = new view;
+  $view->name = 'natdiv_reagent_listing';
+  $view->description = 'A listing of reagents used in natural diversity experiments';
+  $view->tag = 'chado default';
+  $view->base_table = 'nd_reagent';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'name_1' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name_1',
+      'table' => 'nd_reagent',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'name' => array(
+      'label' => 'Type',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'residues' => array(
+      'label' => 'Sequence',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'residues',
+      'table' => 'feature',
+      'field' => 'residues',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'type_id' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'type_id_op',
+        'identifier' => 'type_id',
+        'label' => 'Type',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'type_id',
+      'table' => 'nd_reagent',
+      'field' => 'type_id',
+      'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all reagents matching the entered criteria. If you leave a any of the criteria blank then the reagents will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all reagents will be listed.',
+    ),
+    'name' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'name_op',
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'name',
+      'table' => 'nd_reagent',
+      'field' => 'name',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Reagents');
+  $handler->override_option('header', 'Click "Show" to see a list of all reagents matching the entered criteria. If you leave a any of the criteria blank then the reagents will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all reagents will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No reagents match the current criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'natdiv_reagents');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Natural Diversity Protocol Reagents',
+    'description' => 'Reagents used in natural diversity experiments',
+    'weight' => '0',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}
+

+ 0 - 105
tripal_natural_diversity/tripal_natural_diversity.views.inc.orig

@@ -1,105 +0,0 @@
-<?php
-
-/**
- *  @file
- *  This file contains the basic functions for views integration of
- *  chado/tripal_natural_diversity tables. Supplementary functions can be found in
- *  ./views/
- *
- *  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
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- */
-function tripal_natural_diversity_views_data()  {
-  $data = array();
-
-<<<<<<< HEAD
-  if (module_exists('tripal_views')) {
-    $tables = array(
-      'nd_experiment',
-      'nd_geolocation',
-      'nd_protocol',
-      'nd_reagent'
-    );
-    foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,TRUE);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-    $tables = array(
-      'nd_experiment_contact',
-      'nd_experiment_dbxref',
-      'nd_experiment_genotype',
-      'nd_experiment_phenotype',
-      'nd_experiment_project',
-      'nd_experiment_protocol',
-      'nd_experiment_pub',
-      'nd_experiment_stock',
-      'nd_experiment_stock_dbxref',
-      'nd_experiment_stockprop',
-      'nd_experimentprop',
-      'nd_geolocationprop',
-      'nd_protocol_reagent',
-      'nd_protocolprop',
-      'nd_reagent_relationship',
-      'nd_reagentprop'
-    );
-    foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,FALSE);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-=======
-  //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());
->>>>>>> 6.x-0.4-dev
-
-  return $data;
-}
-
-/*************************************************************************
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return: An array of handler definitions
- */
-function tripal_natural_diversity_views_handlers() {
- return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_natural_diversity') . '/views/handlers',
-   ),
-   'handlers' => array(
-  'views_handler_field_chado_relationship_all' => array(
-       'parent' => 'views_handler_field_prerender_list',
-     ),
-  'views_handler_field_chado_relationship_by_type' => array(
-       'parent' => 'views_handler_field_prerender_list',
-     ),
-   ),
- );
-}

+ 37 - 102
tripal_organism/tripal_organism.views.inc

@@ -36,8 +36,15 @@ function tripal_organism_views_data()  {
       'organism'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+
+        // Add specialty handlers
+        $table_integration_array['fields']['common_name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+        $table_integration_array['fields']['genus']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+        $table_integration_array['fields']['species']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+        $table_integration_array['fields']['abbreviation']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
+
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
@@ -48,7 +55,7 @@ function tripal_organism_views_data()  {
       'organism_dbxref'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -117,15 +124,13 @@ function tripal_organism_views_default_views() {
   $views = array();
 
   // Main default view
-  // List all cvterms based on cv
   $view = new view;
-  $view->name = 'all_organisms';
+  $view->name = 'organism_listing';
   $view->description = 'A listing of all organism in chado';
-  $view->tag = 'chado';
-  $view->view_php = '';
+  $view->tag = 'chado default';
   $view->base_table = 'organism';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
+  $view->core = 0;
+  $view->api_version = '2';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
   $handler = $view->new_display('default', 'Defaults', 'default');
   $handler->override_option('fields', array(
@@ -159,36 +164,6 @@ function tripal_organism_views_default_views() {
       'field' => 'common_name',
       'relationship' => 'none',
     ),
-    'abbreviation' => array(
-      'label' => 'Abbreviation',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'link_to_node' => 0,
-      'exclude' => 0,
-      'id' => 'abbreviation',
-      'table' => 'organism',
-      'field' => 'abbreviation',
-      'relationship' => 'none',
-    ),
     'genus' => array(
       'label' => 'Genus',
       'alter' => array(
@@ -247,8 +222,8 @@ function tripal_organism_views_default_views() {
       'field' => 'species',
       'relationship' => 'none',
     ),
-    'num_features' => array(
-      'label' => 'Number of Features',
+    'abbreviation' => array(
+      'label' => 'Abbreviation',
       'alter' => array(
         'alter_text' => 0,
         'text' => '',
@@ -270,68 +245,27 @@ function tripal_organism_views_default_views() {
       'empty' => '',
       'hide_empty' => 0,
       'empty_zero' => 0,
+      'link_to_node' => 0,
       'exclude' => 0,
-      'id' => 'num_features',
+      'id' => 'abbreviation',
       'table' => 'organism',
-      'field' => 'num_features',
+      'field' => 'abbreviation',
       'relationship' => 'none',
     ),
-    'num_stocks' => array(
-      'label' => 'Number of Stocks',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_stocks',
+  ));
+  $handler->override_option('sorts', array(
+    'genus' => array(
+      'order' => 'ASC',
+      'id' => 'genus',
       'table' => 'organism',
-      'field' => 'num_stocks',
+      'field' => 'genus',
       'relationship' => 'none',
     ),
-    'num_libraries' => array(
-      'label' => 'Number of Libraries',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_libraries',
+    'species' => array(
+      'order' => 'ASC',
+      'id' => 'species',
       'table' => 'organism',
-      'field' => 'num_libraries',
+      'field' => 'species',
       'relationship' => 'none',
     ),
   ));
@@ -352,27 +286,28 @@ function tripal_organism_views_default_views() {
     'override' => 1,
     'sticky' => 0,
     'order' => 'asc',
+    'summary' => '',
     'columns' => array(
-      'abbreviation' => 'abbreviation',
       'common_name' => 'common_name',
       'genus' => 'genus',
       'species' => 'species',
+      'abbreviation' => 'abbreviation',
     ),
     'info' => array(
-      'abbreviation' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
       'common_name' => array(
-        'sortable' => 0,
+        'sortable' => 1,
         'separator' => '',
       ),
       'genus' => array(
-        'sortable' => 0,
+        'sortable' => 1,
         'separator' => '',
       ),
       'species' => array(
-        'sortable' => 0,
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'abbreviation' => array(
+        'sortable' => 1,
         'separator' => '',
       ),
     ),

+ 0 - 410
tripal_organism/tripal_organism.views.inc.orig

@@ -1,410 +0,0 @@
-<?php
-
-/**
- *  @file
- *  This file contains the basic functions for views integration of
- *  chado/tripal organism tables. Supplementary functions can be found in
- *  ./views/
- *
- *  Documentation on views integration can be found at
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/**
- * @defgroup tripal_organism_views Organism Views Integration
- * @ingroup views
- * @ingroup tripal_organism
- */
-
-<<<<<<< HEAD
-=======
-require_once('views/organism.views.inc');
-require_once('views/chado_organism.views.inc');
->>>>>>> 6.x-0.4-dev
-/**
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_organism_views
- */
-function tripal_organism_views_data()  {
-  $data = array();
-
-<<<<<<< HEAD
-  if (module_exists('tripal_views')) {
-    // Base Table
-    $tables = array(
-      'organism'
-    );
-    foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,TRUE);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-    // Additional Tables
-    $tables = array(
-      'organismprop',
-      'organism_dbxref'
-    );
-    foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,FALSE);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-  }
-=======
-  $data = array_merge($data, retrieve_organism_views_data());
-  $data = array_merge($data, retrieve_chado_organism_views_data());
->>>>>>> 6.x-0.4-dev
-
-  return $data;
-}
-
-/**
- * Implements hook_views_handlers()
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- * @return: An array of handler definitions
- *
- * @ingroup tripal_organism_views
- */
-function tripal_organism_views_handlers() {
- return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_organism') . '/views/handlers',
-   ),
-   'handlers' => array(
-     'views_handler_field_computed_organism_nid' => array(
-       'parent' => 'views_handler_field_numeric',
-     ),
-     'views_handler_filter_organism_common_name' => array(
-      'parent' => 'views_handler_filter_string',
-     ),
-   ),
- );
-}
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_organism_views_data_alter(&$data) {
-
-  if ( !(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['organism_chado_nid'] = array(
-      'group' => 'Organism',
-      'title' => 'Organism Node',
-      'help' => 'Links Chado Organism Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_organism',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
-/**
- *
- * @ingroup tripal_organism_views
- */
-function tripal_organism_views_default_views() {
-  $views = array();
-
-  // Main default view
-  // List all cvterms based on cv
-  $view = new view;
-  $view->name = 'all_organisms';
-  $view->description = 'A listing of all organism in chado';
-  $view->tag = 'chado';
-  $view->view_php = '';
-  $view->base_table = 'organism';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
-  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
-  $handler = $view->new_display('default', 'Defaults', 'default');
-  $handler->override_option('fields', array(
-    'common_name' => array(
-      'label' => 'Common Name',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'link_to_node' => 1,
-      'exclude' => 0,
-      'id' => 'common_name',
-      'table' => 'organism',
-      'field' => 'common_name',
-      'relationship' => 'none',
-    ),
-    'abbreviation' => array(
-      'label' => 'Abbreviation',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'link_to_node' => 0,
-      'exclude' => 0,
-      'id' => 'abbreviation',
-      'table' => 'organism',
-      'field' => 'abbreviation',
-      'relationship' => 'none',
-    ),
-    'genus' => array(
-      'label' => 'Genus',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'genus',
-      'table' => 'organism',
-      'field' => 'genus',
-      'relationship' => 'none',
-    ),
-    'species' => array(
-      'label' => 'Species',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'species',
-      'table' => 'organism',
-      'field' => 'species',
-      'relationship' => 'none',
-    ),
-    'num_features' => array(
-      'label' => 'Number of Features',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_features',
-      'table' => 'organism',
-      'field' => 'num_features',
-      'relationship' => 'none',
-    ),
-    'num_stocks' => array(
-      'label' => 'Number of Stocks',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_stocks',
-      'table' => 'organism',
-      'field' => 'num_stocks',
-      'relationship' => 'none',
-    ),
-    'num_libraries' => array(
-      'label' => 'Number of Libraries',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_libraries',
-      'table' => 'organism',
-      'field' => 'num_libraries',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_organism content',
-  ));
-  $handler->override_option('cache', array(
-    'type' => 'none',
-  ));
-  $handler->override_option('title', 'Organisms');
-  $handler->override_option('empty', 'No organism currently in your chado database.');
-  $handler->override_option('empty_format', '1');
-  $handler->override_option('items_per_page', 0);
-  $handler->override_option('style_plugin', 'table');
-  $handler->override_option('style_options', array(
-    'grouping' => '',
-    'override' => 1,
-    'sticky' => 0,
-    'order' => 'asc',
-    'columns' => array(
-      'abbreviation' => 'abbreviation',
-      'common_name' => 'common_name',
-      'genus' => 'genus',
-      'species' => 'species',
-    ),
-    'info' => array(
-      'abbreviation' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'common_name' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'genus' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-      'species' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-    ),
-    'default' => '-1',
-  ));
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'organisms');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Organisms',
-    'description' => '',
-    'weight' => '0',
-    'name' => 'primary-links',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 496 - 2
tripal_phenotype/tripal_phenotype.views.inc

@@ -28,8 +28,19 @@ function tripal_phenotype_views_data()  {
       'phenotype'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+
+        // Add specialty handlers
+        switch ($tablename) {
+          case 'phenotype':
+            $table_integration_array['fields']['attr_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
+            $table_integration_array['fields']['assay_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
+            $table_integration_array['fields']['cvalue_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
+            $table_integration_array['fields']['observable_id']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
+            break;
+        }
+
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
@@ -39,7 +50,7 @@ function tripal_phenotype_views_data()  {
       'phenotype_cvterm'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -67,3 +78,486 @@ function tripal_phenotype_views_handlers() {
   ),
   );
 }
+
+/**
+ *
+ * @ingroup tripal_feature_views
+ */
+function tripal_phenotype_views_default_views() {
+  $views = array();
+
+  // Main default view
+  $view = new view;
+  $view->name = 'phenotype_listing';
+  $view->description = 'A listing of chado phenotypes';
+  $view->tag = 'chado default';
+  $view->base_table = 'phenotype';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('relationships', array(
+    'assay_id' => array(
+      'label' => 'assay_id to cvterm',
+      'required' => 0,
+      'id' => 'assay_id',
+      'table' => 'phenotype',
+      'field' => 'assay_id',
+      'relationship' => 'none',
+    ),
+    'attr_id' => array(
+      'label' => 'attr_id to cvterm',
+      'required' => 0,
+      'id' => 'attr_id',
+      'table' => 'phenotype',
+      'field' => 'attr_id',
+      'relationship' => 'none',
+    ),
+    'cvalue_id' => array(
+      'label' => 'cvalue_id to cvterm',
+      'required' => 0,
+      'id' => 'cvalue_id',
+      'table' => 'phenotype',
+      'field' => 'cvalue_id',
+      'relationship' => 'none',
+    ),
+    'observable_id' => array(
+      'label' => 'observable_id to cvterm',
+      'required' => 0,
+      'id' => 'observable_id',
+      'table' => 'phenotype',
+      'field' => 'observable_id',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('fields', array(
+    'uniquename' => array(
+      'label' => 'Unique Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'uniquename',
+      'table' => 'phenotype',
+      'field' => 'uniquename',
+      'relationship' => 'none',
+    ),
+    'name_1' => array(
+      'label' => 'Phenotypic Attribute',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name_1',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'attr_id',
+    ),
+    'name_3' => array(
+      'label' => 'Controlled Value',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name_3',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'cvalue_id',
+    ),
+    'value' => array(
+      'label' => 'Value',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'value',
+      'table' => 'phenotype',
+      'field' => 'value',
+      'relationship' => 'none',
+    ),
+    'name_2' => array(
+      'label' => 'Observation Type',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name_2',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'observable_id',
+    ),
+    'name' => array(
+      'label' => 'Evidence Type',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'assay_id',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all phenotypes matching the entered criteria. If you leave a any of the criteria blank then the phenotypes will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all phenotypes will be listed.',
+    ),
+    'attr_id' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'attr_id_op',
+        'identifier' => 'attr_id',
+        'label' => 'Phenotypic Attribute',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'attr_id',
+      'table' => 'phenotype',
+      'field' => 'attr_id',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+    ),
+    'cvalue_id' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'cvalue_id_op',
+        'identifier' => 'cvalue_id',
+        'label' => 'Controlled Value',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'cvalue_id',
+      'table' => 'phenotype',
+      'field' => 'cvalue_id',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+    ),
+    'observable_id' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'observable_id_op',
+        'identifier' => 'observable_id',
+        'label' => 'Observation Type',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'observable_id',
+      'table' => 'phenotype',
+      'field' => 'observable_id',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+    ),
+    'assay_id' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'assay_id_op',
+        'identifier' => 'assay_id',
+        'label' => 'Evidence Type',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'assay_id',
+      'table' => 'phenotype',
+      'field' => 'assay_id',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+    ),
+    'uniquename' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'uniquename_op',
+        'identifier' => 'uniquename',
+        'label' => 'Unique Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'uniquename',
+      'table' => 'phenotype',
+      'field' => 'uniquename',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'value' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'value_op',
+        'identifier' => 'phen_value',
+        'label' => 'Value Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'value',
+      'table' => 'phenotype',
+      'field' => 'value',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Phenotypes');
+  $handler->override_option('header', 'Click "Show" to see a list of all phenotypes matching the entered criteria. If you leave a any of the criteria blank then the phenotypes will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all phenotypes will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No phenotypes match the current criteria.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'uniquename' => 'uniquename',
+      'value' => 'value',
+    ),
+    'info' => array(
+      'uniquename' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'value' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+    ),
+    'default' => 'uniquename',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'phenotypes');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Phenotypes',
+    'description' => '',
+    'weight' => '0',
+    'name' => 'primary-links',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}
+

+ 191 - 2
tripal_project/tripal_project.views.inc

@@ -28,7 +28,7 @@ function tripal_project_views_data()  {
       'project'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -37,7 +37,7 @@ function tripal_project_views_data()  {
     $tables = array(
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -65,3 +65,192 @@ function tripal_project_views_handlers() {
   ),
   );
 }
+
+/**
+ *
+ * @ingroup tripal_feature_views
+ */
+function tripal_project_views_default_views() {
+  $views = array();
+
+  // Main default view
+  $view = new view;
+  $view->name = 'project_listing';
+  $view->description = 'A listing of chado projects';
+  $view->tag = 'chado default';
+  $view->base_table = 'project';
+  $view->core = 6;
+  $view->api_version = '2';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'name' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'project',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'description' => array(
+      'label' => 'Description',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'absolute' => 0,
+        'link_class' => '',
+        'alt' => '',
+        'rel' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'html' => 0,
+        'strip_tags' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'description',
+      'table' => 'project',
+      'field' => 'description',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'name' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'name_op',
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'name',
+      'table' => 'project',
+      'field' => 'name',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'description' => array(
+      'operator' => 'contains',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'description_op',
+        'identifier' => 'description',
+        'label' => 'Description Contains',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'description',
+      'table' => 'project',
+      'field' => 'description',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access chado_projects',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Projects');
+  $handler->override_option('empty', 'There are currently no projects available.');
+  $handler->override_option('empty_format', '2');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'summary' => '',
+    'columns' => array(
+      'name' => 'name',
+      'description' => 'description',
+    ),
+    'info' => array(
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'description' => array(
+        'sortable' => 0,
+        'separator' => '',
+      ),
+    ),
+    'default' => 'name',
+  ));
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'projects');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Projects',
+    'description' => '',
+    'weight' => '0',
+    'name' => 'primary-links',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 71 - 110
tripal_stock/tripal_stock.views.inc

@@ -37,7 +37,7 @@ function tripal_stock_views_data()  {
       'stockcollection'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -56,7 +56,7 @@ function tripal_stock_views_data()  {
       'stockprop_pub'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
+      if (!tripal_views_is_integrated($tablename, 9)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
@@ -254,14 +254,14 @@ function tripal_stock_views_pre_render  (&$view) {
 function tripal_stock_views_default_views() {
   $views = array();
 
+  // Main default view
   $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.';
-  $view->tag = 'chado';
-  $view->view_php = '';
+  $view->name = 'stock_listing';
+  $view->description = 'This view lists all stocks by default.';
+  $view->tag = 'chado default';
   $view->base_table = 'stock';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
+  $view->core = 0;
+  $view->api_version = '2';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
   $handler = $view->new_display('default', 'Defaults', 'default');
   $handler->override_option('fields', array(
@@ -384,99 +384,6 @@ function tripal_stock_views_default_views() {
       'field' => 'common_name',
       'relationship' => 'none',
     ),
-    'all_dbxref' => array(
-      'label' => 'All Database References',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'type' => 'ul',
-      'separator' => ', ',
-      'exclude' => 0,
-      'id' => 'all_dbxref',
-      'table' => 'stock',
-      'field' => 'all_dbxref',
-      'relationship' => 'none',
-    ),
-    'all_properties' => array(
-      'label' => 'All Properties',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'type' => 'ul',
-      'separator' => ', ',
-      'exclude' => 0,
-      'id' => 'all_properties',
-      'table' => 'stock',
-      'field' => 'all_properties',
-      'relationship' => 'none',
-    ),
-    'all_relationships' => array(
-      'label' => 'All Relationships',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'type' => 'ul',
-      'separator' => ', ',
-      'exclude' => 0,
-      'id' => 'all_relationships',
-      'table' => 'stock',
-      'field' => 'all_relationships',
-      'relationship' => 'none',
-    ),
   ));
   $handler->override_option('sorts', array(
     'common_name' => array(
@@ -497,7 +404,7 @@ function tripal_stock_views_default_views() {
   $handler->override_option('filters', array(
     'common_name' => array(
       'operator' => '=',
-      'value' => 'All',
+      'value' => array(),
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
@@ -505,7 +412,6 @@ function tripal_stock_views_default_views() {
         'operator' => 'common_name_op',
         'identifier' => 'organism_common_name',
         'label' => 'Organism',
-        'optional' => 1,
         'remember' => 0,
       ),
       'case' => 1,
@@ -513,25 +419,77 @@ function tripal_stock_views_default_views() {
       'table' => 'organism',
       'field' => 'common_name',
       'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
     ),
-    'name' => array(
+    'search_results' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'search_results',
+      'table' => 'views',
+      'field' => 'search_results',
+      'relationship' => 'none',
+      'apply_button' => 'Show',
+      'no_results_text' => 'Click "Show" to see a list of all stocks matching the entered criteria. If you leave a any of the criteria blank then the stocks will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all stocks will be listed.',
+    ),
+    'type_id' => array(
       'operator' => '=',
-      'value' => 'All',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'type_id_op',
+        'identifier' => 'type_id',
+        'label' => 'Type',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'type_id',
+      'table' => 'stock',
+      'field' => 'type_id',
+      'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'name' => array(
+      'operator' => 'contains',
+      'value' => '',
       'group' => '0',
       'exposed' => TRUE,
       'expose' => array(
         'use_operator' => 0,
         'operator' => 'name_op',
         'identifier' => 'name',
-        'label' => 'Chado CV Terms: Name',
-        'optional' => 1,
+        'label' => 'Name Contains',
         'remember' => 0,
       ),
-      'case' => 1,
+      'case' => 0,
       'id' => 'name',
-      'table' => 'cvterm',
+      'table' => 'stock',
       'field' => 'name',
       'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
     ),
   ));
   $handler->override_option('access', array(
@@ -542,9 +500,12 @@ function tripal_stock_views_default_views() {
     'type' => 'none',
   ));
   $handler->override_option('title', 'Stocks');
+  $handler->override_option('header', 'Click "Show" to see a list of all stocks matching the entered criteria. If you leave a any of the criteria blank then the stocks will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all stocks will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
   $handler->override_option('empty', 'There are no stocks that match this criteria. If you think there should be, ensure that all stocks in chado are sync\'d with your website.');
   $handler->override_option('empty_format', '1');
-  $handler->override_option('items_per_page', 25);
+  $handler->override_option('items_per_page', 50);
   $handler->override_option('use_pager', '1');
   $handler->override_option('style_plugin', 'table');
   $handler->override_option('style_options', array(

+ 36 - 11
tripal_views/api/tripal_views.api.inc

@@ -155,7 +155,7 @@ function tripal_views_integration_add_entry($defn_array) {
 
     // Need to update the tripal_views record so base_table can be false
     // this is a fix because drupal_write_record() puts in defaults if !isset()
-    // and a variable is considered not set if its null!
+    // and a variable is considered not set if it's null!
     db_query(
       "UPDATE {tripal_views} SET base_table=%d WHERE table_name='%s' AND priority=%d",
       $defn_array['base_table'],
@@ -176,7 +176,7 @@ function tripal_views_integration_add_entry($defn_array) {
         $status = drupal_write_record('tripal_views_field', $field_record);
       }
       else {
-        drupal_set_message(t('Unable to integrate %name field due to a missing required fields.', array('%name' => $field['name'])), 'error');
+        drupal_set_message(t('Unable to integrate %name field due to missing required fields.', array('%name' => $field['name'])), 'error');
         $status = FALSE;
       }
 
@@ -248,14 +248,14 @@ function tripal_views_integration_add_entry($defn_array) {
 
       }
       else {
-        drupal_set_message(t('Unable to integrate field: %field_name', array('%field_name' => $field['name'])), 'error');
+        drupal_set_message(t('Unable to integrate %field_name field', array('%field_name' => $field['name'])), 'error');
         $no_errors = FALSE;
       }
     }
 
   }
   else {
-    drupal_set_message(t('Unable to set default views integration'), 'error');
+    drupal_set_message(t('Unable to set default tripal views integration'), 'error');
     $no_errors = FALSE;
   }
 
@@ -362,6 +362,22 @@ function tripal_views_integration_remove_entry_by_setup_id($setup_id) {
 
 }
 
+/**
+ * Integrate all chado tables in the schema api
+ */
+function tripal_views_integrate_all_chado_tables() {
+
+  $tables = tripal_core_get_chado_tables();
+  foreach ($tables as $tablename) {
+    if (!tripal_views_is_integrated($tablename, 10)) {
+      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, 10);
+      if ($table_integration_array) {
+        tripal_views_integration_add_entry($table_integration_array);
+      }
+    }
+  }
+}
+
 /**
  * Returns the array needed to integrate a given chado table with views
  *
@@ -371,7 +387,7 @@ function tripal_views_integration_remove_entry_by_setup_id($setup_id) {
  *   The tripal views integration array which is the parameter for
  *   tripal_views_integration_add_entry($defn_array)
  */
-function tripal_views_get_integration_array_for_chado_table($table_name, $base_table = TRUE) {
+function tripal_views_get_integration_array_for_chado_table($table_name, $base_table = TRUE, $priority = 9) {
 
   // Get the schema for this table (via the chado schema api)
   $schema = tripal_core_get_chado_table_schema($table_name);
@@ -382,14 +398,14 @@ function tripal_views_get_integration_array_for_chado_table($table_name, $base_t
     'type' => 'chado',
     'name' => 'Chado ' . ucwords(str_replace('_', ' ', $table_name)),
     'description' => (!empty($schema['description'])) ? $schema['description'] : ' ',
-    'priority' => 10,
+    'priority' => $priority,
     'base_table' => $base_table,
     'fields' => array(),
   );
   // Add fields
   if (!isset($schema['fields'])) {
-    $schema['fields'] = array();
-    drupal_set_message(t('There are no fields defined for %table in the Chado Schema API.', array('%table' => $table_name)), 'warning');
+    watchdog('tripal_views', 'There are no fields defined for %table in the Chado Schema API.', array('%table' => $table_name), WATCHDOG_NOTICE);
+    return FALSE;
   }
   foreach ($schema['fields'] as $field_name => $field_schema) {
 
@@ -458,23 +474,32 @@ function tripal_views_get_integration_array_for_chado_table($table_name, $base_t
 
       // Specify specialty handlers
       if ($field_name == 'type_id' OR $field_name == 'cvterm_id') {
-        $defn_array['fields'][$field_name]['handlers']['filter']['name'] = 'chado_views_handler_filter_select_cvterm';
+        $defn_array['fields'][$field_name]['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_cvterm';
       }
     }
   }
 
-  // Add Joins to fields
+  // Add Joins & Relationship Handlers to fields
   if (!isset($schema['foreign keys'])) {
     $schema['foreign keys'] = array();
-    drupal_set_message(t('There are no foreign keys defined for %table in the Chado Schema API.', array('%table' => $table_name)), 'warning');
+    watchdog('tripal_views','There are no foreign keys defined for %table in the Chado Schema API.', array('%table' => $table_name), WATCHDOG_WARNING);
   }
   foreach ($schema['foreign keys'] as $foreign_key_schema) {
     foreach ($foreign_key_schema['columns'] as $left_field => $right_field) {
+      // Join
       $defn_array['fields'][$left_field]['joins'][ $foreign_key_schema['table'] ] = array(
         'table' => $foreign_key_schema['table'],
         'field' => $right_field,
         'handler' => 'views_handler_join_chado_aggregator'
       );
+
+      // Relationship Handler
+      $defn_array['fields'][$left_field]['handlers']['relationship'] = array(
+        'name' => 'chado_views_handler_relationship',
+        'base' => $foreign_key_schema['table'],
+        'base field' => $right_field,
+        'label' => $table_name . ' ' . $left_field . ' to ' . $foreign_key_schema['table'] . ' ' .$right_field
+      );
     }
   }
 

+ 27 - 10
tripal_views/tripal_views.install

@@ -18,7 +18,7 @@ function tripal_views_install() {
   // create the tables that manage materialized views and jobs
   drupal_install_schema('tripal_views');
 
-  // we want views to pick up our changes  
+  // we want views to pick up our changes
   views_invalidate_cache();
 
 }
@@ -85,6 +85,18 @@ function tripal_views_update_6040() {
   db_add_field($ret, 'tripal_views', 'base_table', array('type' => 'int', 'not null ' => TRUE,
       'default' => 1));
 
+  // Add arguments to joins
+  db_add_field(
+    $ret,
+    'tripal_views_join',
+    'arguments',
+    array(
+      'description' => 'arguments that may get passed to the handler',
+      'type' => 'text',
+      'size' => 'normal'
+    )
+  );
+
   return $ret;
 }
 
@@ -118,7 +130,7 @@ function tripal_views_views_schema() {
       ),
       'base_table' => array(
          'description' => 'either TRUE (1) or FALSE (0) depending on whether the current table should be a bast table of a View',
-         'type' => 'int', 
+         'type' => 'int',
          'not null ' => TRUE,
          'default' => 1
       ),
@@ -237,14 +249,19 @@ function tripal_views_views_schema() {
         'length' => '255',
         'not null' => TRUE,
         'default' => '',
-        ),
-        'handler' => array(
-          'description' => 'the name of the handler',
-          'type' => 'varchar',
-          'length' => '255',
-          'not null' => TRUE,
-          'default' => '',
-        ),
+      ),
+      'handler' => array(
+        'description' => 'the name of the handler',
+        'type' => 'varchar',
+        'length' => '255',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'arguments' => array(
+        'description' => 'arguments that may get passed to the handler',
+        'type' => 'text',
+        'size' => 'normal',
+      ),
     ),
     'unique_keys' => array(
       'setup_id' => array('view_join_id'),

+ 15 - 214
tripal_views/tripal_views.views.inc

@@ -70,7 +70,7 @@ function tripal_views_views_handlers() {
         'parent' => 'views_handler_filter'
       ),
       'tripal_views_handler_filter_select_cvterm' => array(
-        'parent' => 'views_handler_filter_chado_select_cvterm_name',
+        'parent' => 'views_handler_filter_string',
       ),
       'tripal_views_handler_filter_select_string' => array(
         'parent' => 'chado_views_handler_filter_string',
@@ -95,32 +95,9 @@ function tripal_views_views_handlers() {
         'parent' => 'views_join',
       ),
 
-      // Old Handlers no longer used (deprecated)
-      'views_handler_field_node_optional' => array(
-        'parent' => 'views_handler_field_node',
-      ),
-      'views_handler_field_chado_tf_boolean' => array(
-        'parent' => 'views_handler_field_boolean',
-      ),
-      'views_handler_field_chado_count' => array(
-        'parent' => 'views_handler_field',
-      ),
-      'views_handler_filter_chado_boolean' => array(
-        'parent' => 'views_handler_filter_boolean_operator',
-      ),
-      'views_handler_field_dbxref_accession_link' => array(
-        'parent' => 'views_handler_field',
-      ),
-      'views_handler_field_readable_date' => array(
-        'parent' => 'views_handler_field',
-      ),
-
-      // Old handlers with new counterparts (deprecated)
-      'views_handler_filter_chado_select_string' => array(
-        'parent' => 'views_handler_filter_string',
-      ),
-      'views_handler_filter_chado_select_cvterm_name' => array(
-        'parent' => 'views_handler_filter_string',
+      // Relationship Handlers
+      'chado_views_handler_relationship' => array(
+        'parent' => 'views_handler_relationship'
       ),
 
       // Wrappers for Default Views Handlers-----
@@ -205,10 +182,6 @@ function tripal_views_views_handlers() {
  */
 function tripal_views_views_pre_render(&$view) {
 
-  //Add Node IDs in to every table that needs them
-  // @see tripal_views.views.inc
-  tripal_views_add_node_ids_to_view($view);
-
   // We need to unset the exposed_input for the view so we can repopulate that
   // variable. This is necessary if we're using the file_upload_combo
   // custom form element which adds the file_path variable to the $_GET after the
@@ -223,188 +196,6 @@ function tripal_views_views_pre_render(&$view) {
   $view->attachment_after = $form;
 }
 
-/**
- * Adds nid fields to all pertinent view results
- *
- * Purpose: To add basetable_nid fields to all result arrays of a view
- *   only if the basetable_nid field is added. This function will only be
- *   called if chado/drupal are not in the same database (ie: only if
- *   a join between the base and node table isn't possible.
- *
- * Note: Supports adding Node IDs to analysis, feature, library, organism, stock
- *
- * @param $view
- *   the view object passed to hook_views_pre_render
- *
- * @return the views object with nids added to the result array
- *
- * @ingroup tripal_views
- */
-function tripal_views_add_node_ids_to_view(&$view) {
-
-  //-----Analysis----------------------------------------------
-  if (!empty($view->field['analysis_nid'])) {
-    // retrieve the analysis_id for each record in the views current page
-    $analysis_ids = array();
-    foreach ($view->result as $row_num => $row) {
-      if (!empty($row->analysis_id)) {
-        //we're looking at analysis id field already in table
-        $analysis_ids[$row_num] = $row->analysis_id;
-      }
-      else {
-        //we're looking at analysis id added by field handler
-        $analysis_ids[$row_num] = $row->analysis_analysis_id;
-      }
-    }
-    $unique_analysis_ids = array_filter($analysis_ids);
-    $unique_analysis_ids = array_unique($unique_analysis_ids);
-
-    if (!empty($unique_analysis_ids)) {
-      // Using the list of analysis_ids from the view
-      // lookup the NIDs from drupal
-      // and add that to the results of the view
-      $sql = "SELECT nid, analysis_id FROM {chado_analysis} WHERE analysis_id IN (" . implode(',', $unique_analysis_ids) . ")";
-      $resource = db_query($sql);
-      while ($r = db_fetch_object($resource)) {
-        $keys = array_keys($analysis_ids, $r->analysis_id);
-        foreach ($keys as $k) {
-          $view->result[$k]->analysis_nid = $r->nid;
-        }
-      }
-    } // if there are any analysis'
-  } //end of case for analysis NID
-
-  //-----Feature-----------------------------------------------
-  if (!empty($view->field['feature_nid'])) {
-    // retrieve the feature_id for each record in the views current page
-    $feature_ids = array();
-    foreach ($view->result as $row_num => $row) {
-      if (!empty($row->feature_id)) {
-        //we're looking at feature id field already in table
-        $feature_ids[$row_num] = $row->feature_id;
-      }
-      else {
-        //we're looking at feature id added by field handler
-        $feature_ids[$row_num] = $row->feature_feature_id;
-      }
-    }
-    $unique_feature_ids = array_filter($feature_ids);
-    $unique_feature_ids = array_unique($unique_feature_ids);
-
-    if (!empty($unique_feature_ids)) {
-      // Using the list of feature_ids from the view
-      // lookup the NIDs from drupal
-      // and add that to the results of the view
-      $sql = "SELECT nid, feature_id FROM {chado_feature} WHERE feature_id IN (" . implode(',', $unique_feature_ids) . ")";
-      $resource = db_query($sql);
-      while ($r = db_fetch_object($resource)) {
-        $keys = array_keys($feature_ids, $r->feature_id);
-        foreach ($keys as $k) {
-          $view->result[$k]->feature_nid = $r->nid;
-        }
-      }
-    } // if there are any features
-  } //end of case for feature NID
-
-  //-----Library-----------------------------------------------
-  if (!empty($view->field['library_nid'])) {
-    // retrieve the library_id for each record in the views current page
-    $library_ids = array();
-    foreach ($view->result as $row_num => $row) {
-      if (!empty($row->library_id)) {
-        //we're looking at library id field already in table
-        $library_ids[$row_num] = $row->library_id;
-      }
-      else {
-        //we're looking at library id added by field handler
-        $library_ids[$row_num] = $row->library_library_id;
-      }
-    }
-    $unique_library_ids = array_filter($library_ids);
-    $unique_library_ids = array_unique($unique_library_ids);
-
-    if (!empty($unique_library_ids)) {
-      // Using the list of library_ids from the view
-      // lookup the NIDs from drupal
-      // and add that to the results of the view
-      $sql = "SELECT nid, library_id FROM {chado_library} WHERE library_id IN (" . implode(',', $unique_library_ids) . ")";
-      $resource = db_query($sql);
-      while ($r = db_fetch_object($resource)) {
-        $keys = array_keys($library_ids, $r->library_id);
-        foreach ($keys as $k) {
-          $view->result[$k]->library_nid = $r->nid;
-        }
-      }
-    } // if there are libraries
-  } //end of case for library NID
-
-  //-----Organism----------------------------------------------
-  if (!empty($view->field['organism_nid'])) {
-    // retrieve the organism_id for each record in the views current page
-    $organism_ids = array();
-    foreach ($view->result as $row_num => $row) {
-      if (!empty($row->organism_id)) {
-        //we're looking at organism id field already in table
-        $organism_ids[$row_num] = $row->organism_id;
-      }
-      else {
-        //we're looking at organism id added by field handler
-        $organism_ids[$row_num] = $row->organism_organism_id;
-      }
-    }
-    $unique_organism_ids = array_filter($organism_ids);
-    $unique_organism_ids = array_unique($unique_organism_ids);
-
-    if (!empty($unique_organism_ids)) {
-      // Using the list of organism_ids from the view
-      // lookup the NIDs from drupal
-      // and add that to the results of the view
-      $sql = "SELECT nid, organism_id FROM {chado_organism} WHERE organism_id IN (" . implode(',', $unique_organism_ids) . ")";
-      $resource = db_query($sql);
-      while ($r = db_fetch_object($resource)) {
-        $keys = array_keys($organism_ids, $r->organism_id);
-        foreach ($keys as $k) {
-          $view->result[$k]->organism_nid = $r->nid;
-        }
-      }
-    } // if there are organisms
-  } //end of case for organism NID
-
-  //-----Stock-------------------------------------------------
-  if (!empty($view->field['stock_nid'])) {
-    // retrieve the stock_id for each record in the views current page
-    $stock_ids = array();
-    foreach ($view->result as $row_num => $row) {
-      if (!empty($row->stock_id)) {
-        //we're looking at stock id field already in table
-        $stock_ids[$row_num] = $row->stock_id;
-      }
-      else {
-        //we're looking at stock id added by field handler
-        $stock_ids[$row_num] = $row->stock_stock_id;
-      }
-    }
-    $unique_stock_ids = array_filter($stock_ids);
-    $unique_stock_ids = array_unique($unique_stock_ids);
-
-    if (!empty($unique_stock_ids)) {
-      // Using the list of stock_ids from the view
-      // lookup the NIDs from drupal
-      // and add that to the results of the view
-      $sql = "SELECT nid, stock_id FROM {chado_stock} WHERE stock_id IN (" . implode(',', $unique_stock_ids) . ")";
-      $resource = db_query($sql);
-      while ($r = db_fetch_object($resource)) {
-        $keys = array_keys($stock_ids, $r->stock_id);
-        foreach ($keys as $k) {
-          $view->result[$k]->stock_nid = $r->nid;
-        }
-      }
-    } //if there are stocks
-  } //end of case for stock NID
-
-  return $view;
-}
-
 /**
  * Generates a dynamic data array for Views
  *
@@ -420,6 +211,9 @@ function tripal_views_add_node_ids_to_view(&$view) {
 
 function tripal_views_views_data() {
 
+  // Make sure all chado tables are integrated
+  tripal_views_integrate_all_chado_tables();
+
   // Define Global Fields
   // Filter handler that lets the admin say:
   // "Show no results until they enter search parameters"
@@ -497,7 +291,7 @@ function tripal_views_views_data() {
       $fields = $table_desc['fields'];
       if (!is_array($fields)) {
         $fields = array();
-        drupal_set_message(t('No fields were described for this table (%table) through the Tripal Schema API.', array('%table' => $base_table)), 'error');
+        watchdog('tripal_views', 'No fields were described for this table (%table) through the Tripal Schema API.', array('%table' => $base_table), WATCHDOG_ERROR);
       }
       foreach ($fields as $column => $attrs) {
         $base_fields[$column] = array(
@@ -549,6 +343,12 @@ function tripal_views_views_data() {
         $handlers = db_query($sql, $setup_id, $column_name);
         while ($handler = db_fetch_object($handlers)) {
           $data[$base_table][$column_name][$handler->handler_type]['handler'] = $handler->handler_name;
+
+          // Add in any additional arguments
+          // This should be a serialized array including (at a minimum) name => <handler name>
+          if ($handler->arguments) {
+            $data[$base_table][$column_name][$handler->handler_type] = array_merge($data[$base_table][$column_name][$handler->handler_type], unserialize($handler->arguments));
+          }
         };
     }
 
@@ -649,6 +449,7 @@ function tripal_views_views_data_alter(&$data) {
         }
       }
     }
+
     return $data;
 }
 

+ 5 - 3
tripal_views/views/handlers/chado_views_handler_filter_date.inc

@@ -139,9 +139,11 @@ class chado_views_handler_filter_date extends views_handler_filter_date {
     $operators = $this->operators();
 
     if ($operators[$operator]['values'] == 1) {
-      $convert = strtotime($value);
-      if (!empty($form) && ($convert == -1 || $convert === FALSE)) {
-        form_set_error($form['value'], t('Invalid date format.'));
+      if (!empty($value['value'])) {
+        $convert = strtotime($value['value']);
+        if (!empty($form) && ($convert == -1 || $convert === FALSE)) {
+          form_set_error($form['value'], t('Invalid date format.'));
+        }
       }
     }
     elseif ($operators[$operator]['values'] == 2) {

+ 7 - 1
tripal_views/views/handlers/chado_views_handler_filter_float.inc

@@ -50,9 +50,15 @@ class chado_views_handler_filter_float extends views_handler_filter_float {
 
     // make optional
     // if it is not set or empty then don't restrict the query
-    if (!$this->value) {
+    if (!$this->value AND !is_array($this->value)) {
       return;
     }
+    elseif (is_array($this->value)) {
+      $tmp = array_filter($this->value);
+      if (!$tmp) {
+        return;
+      }
+    }
 
     $this->ensure_my_table();
 

+ 27 - 0
tripal_views/views/handlers/chado_views_handler_relationship.inc

@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * Simple relationship handler that allows a new version of the chado primary table
+ * to be linked in.
+ *
+ * The base relationship handler can only handle a single join. Some relationships
+ * are more complex and might require chains of joins; for those, you must
+ * utilize a custom relationship handler.
+ *
+ * Definition items:
+ * - base: The new base table this relationship will be adding. This does not
+ *   have to be a declared base table, but if there are no tables that
+ *   utilize this base table, it won't be very effective.
+ * - base field: The field to use in the relationship; if left out this will be
+ *   assumed to be the primary field.
+ * - relationship table: The actual table this relationship operates against.
+ *   This is analogous to using a 'table' override.
+ * - relationship field: The actual field this relationship operates against.
+ *   This is analogous to using a 'real field' override.
+ * - label: The default label to provide for this relationship, which is
+ *   shown in parentheses next to any field/sort/filter/argument that uses
+ *   the relationship.
+ */
+class chado_views_handler_relationship extends views_handler_relationship {
+
+}

+ 0 - 0
tripal_views/views/handlers/views_handler_field_chado_count.inc → tripal_views/views/handlers/deprecated/views_handler_field_chado_count.inc


+ 0 - 0
tripal_views/views/handlers/views_handler_field_dbxref_accession_link.inc → tripal_views/views/handlers/deprecated/views_handler_field_dbxref_accession_link.inc


+ 0 - 0
tripal_views/views/handlers/views_handler_field_node_optional.inc → tripal_views/views/handlers/deprecated/views_handler_field_node_optional.inc


+ 0 - 0
tripal_views/views/handlers/views_handler_field_readable_date.inc → tripal_views/views/handlers/deprecated/views_handler_field_readable_date.inc


+ 0 - 0
tripal_views/views/handlers/views_handler_filter_chado_boolean.inc → tripal_views/views/handlers/deprecated/views_handler_filter_chado_boolean.inc


+ 0 - 0
tripal_views/views/handlers/views_handler_filter_chado_select_cvterm_name.inc → tripal_views/views/handlers/deprecated/views_handler_filter_chado_select_cvterm_name.inc


+ 0 - 0
tripal_views/views/handlers/views_handler_filter_chado_select_string.inc → tripal_views/views/handlers/deprecated/views_handler_filter_chado_select_string.inc


+ 229 - 3
tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc

@@ -10,7 +10,7 @@
  * @ingroup views_filter_handlers
  * @ingroup tripal_core
  */
-class tripal_views_handler_filter_select_cvterm extends views_handler_filter_chado_select_cvterm_name {
+class tripal_views_handler_filter_select_cvterm extends views_handler_filter_string {
 
  /**
   * Executed when the field is added
@@ -19,8 +19,64 @@ class tripal_views_handler_filter_select_cvterm extends views_handler_filter_cha
   function init(&$view, $options) {
 
     include_once('chado_wrapper_functions.inc');
+
     parent::init($view, $options);
 
+    if ($this->options['show_all']) {
+      $cv_id = variable_get('chado_' . $this->view->base_table . '_cv', NULL);
+      if ($cv_id) {
+        $results = tripal_core_chado_select('cvterm', array('cvterm_id', 'name'), array('cv_id' => $cv_id));
+        if (empty($results)) {
+          $results = array();
+        }
+        foreach ($results as $c) {
+          $cvterms[$c->cvterm_id] = $c->name;
+        }
+      }
+      else {
+        //get a list of cvs currently used
+        if ($this->view->base_table == 'cvterm') {
+          $sql = 'SELECT distinct(cv.cv_id) FROM ' . $this->view->base_table
+            .' LEFT JOIN cv cv ON cv.cv_id=cvterm.cv_id';
+        }
+        else {
+          $sql = 'SELECT distinct(cv.cv_id) FROM ' . $this->view->base_table
+            .' LEFT JOIN cvterm cvterm ON cvterm.cvterm_id=' . $this->view->base_table . '.type_id '
+            .'LEFT JOIN cv cv ON cv.cv_id=cvterm.cv_id';
+        }
+        $previous_db = tripal_db_set_active('chado');
+        $resource = db_query($sql);
+        tripal_db_set_active($previous_db);
+        $cvterms = array();
+        while ( $r = db_fetch_object($resource) ) {
+          $results = tripal_core_chado_select('cvterm', array('cvterm_id', 'name'), array('cv_id' => $r->cv_id));
+          if (empty($results)) {
+            $results = array();
+          }
+          foreach ($results as $c) {
+            $cvterms[$c->cvterm_id] = $c->name;
+          }
+        }
+      }// end of if variable not defined
+
+    }
+    else {
+      // @coder-ignore: non-drupal schema therefore table prefixing does not apply
+      $sql = "SELECT cvterm_id, name FROM cvterm WHERE cvterm_id IN (SELECT distinct(%s) FROM %s)";
+      $previous_db = tripal_db_set_active('chado');
+      $resource = db_query($sql, $this->field, $this->table);
+      tripal_db_set_active($previous_db);
+      $cvterms = array();
+      while ( $r = db_fetch_object($resource) ) {
+        $cvterms[$r->cvterm_id] = $r->name;
+      }
+    }
+    //sort cvterms by name (case insensitive)
+    natcasesort($cvterms);
+
+    //add to this handler
+    $this->cvterm_options = $cvterms;
+
   }
 
   /**
@@ -34,6 +90,36 @@ class tripal_views_handler_filter_select_cvterm extends views_handler_filter_cha
 
     parent::options_form($form, $form_state);
 
+    $form['values_form_type'] = array(
+      '#type' => 'radios',
+      '#title' => t('Filter Type'),
+      '#options' => array(
+        'textfield' => 'Text Field',
+        'select' => 'Drop-Down Box',
+      ),
+      '#default_value' => ($this->options['values_form_type']) ? $this->options['values_form_type'] : 'select',
+    );
+
+    $form['multiple'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Select Multiple'),
+      '#description' => t('Allows more then one option to be selected.'),
+      '#default_value' => (isset($this->options['multiple'])) ? $this->options['multiple'] : FALSE,
+    );
+
+    $form['optional'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Optional'),
+      '#description' => t('Adds --Any-- to the available options.'),
+      '#default_value' => (isset($this->options['optional'])) ? $this->options['optional'] : TRUE,
+    );
+
+    $form['show_all'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show All Terms'),
+      '#description' => 'Otherwise only cvterms used in the base table will be used'
+    );
+
     $form['agg'] = array(
       '#type' => 'fieldset',
       '#title' => 'Apply to fields that are aggregated'
@@ -68,6 +154,7 @@ class tripal_views_handler_filter_select_cvterm extends views_handler_filter_cha
     }
 
     $this->ensure_my_table();
+    $field = "$this->table_alias.$this->real_field";
 
     $table = $this->query->get_table_info($this->table);
     if (preg_match('/aggregator/', $table['join']->definition['handler'])) {
@@ -78,14 +165,42 @@ class tripal_views_handler_filter_select_cvterm extends views_handler_filter_cha
     }
 
     if (!$this->aggregated) {
-      parent::query();
+
+      if ($this->options['multiple']) {
+        // Remove any if it's there
+        unset($this->value['All']);
+
+        if (sizeof($this->value)) {
+          $holders = array();
+          foreach ($this->value as $v) {
+            if (preg_match('/^[\d\.]+$/', $v)) {
+              $holders[] = '%d';
+            }
+            else {
+              $holders[] = "'%s'";
+            }
+          }
+          $where = $field . " IN (" . implode(", ", $holders) . ")";
+        }
+      }
+      elseif ($this->value != 'All') {
+        if (preg_match('/^\d+$/', $this->value)) {
+          $where = $field . ' = %d';
+        }
+        else {
+          $where = $field . " " . $this->operator . " '%s'";
+        }
+      }
+
+      if ($where) {
+        $this->query->add_where($this->options['group'], $where, $this->value);
+      }
     }
     else {
 
       // Only base records with value in the aggregated field
       // This doesn't restrict the items in the aggregate field
       $this->ensure_my_table();
-      $field = "$this->table_alias.$this->real_field";
       if ($this->options['agg']['records_with']) {
         $where = "'%s' = ANY($field)";
         $this->query->add_where($this->options['group'], $where, $this->value);
@@ -102,4 +217,115 @@ class tripal_views_handler_filter_select_cvterm extends views_handler_filter_cha
     }
 
   }
+
+ /**
+  * Defines the value field in both the views filter options form
+  *   and the exposed form
+  */
+  function value_form(&$form, &$form_state) {
+    parent::value_form($form, $form_state);
+
+    if (preg_match('/select/', $this->options['values_form_type'])) {
+      // Get Options
+      if ($this->options['optional']) {
+        $options['<select ' . $this->table . '>'] = '--None--';
+        $options['All'] = '--Any--';
+      }
+      $max_length = 40;
+      foreach ($this->cvterm_options as $cvterm_id => $cvterm_name) {
+        if (drupal_strlen($cvterm_name) > $max_length) {
+          $options[$cvterm_id] = drupal_substr($cvterm_name, 0, $max_length) . '...';
+        }
+        else {
+          $options[$cvterm_id] = $cvterm_name;
+        }
+      }
+
+      if (empty($options)) {
+        $options[0] = '';
+      }
+
+      //Select List
+      $form['value'] = array(
+          '#type' => 'select',
+          '#title' => t('%label', array('%label' => $this->options['label'])),
+          '#options' => $options,
+          '#default_value' => $this->value,
+      );
+
+      if ($this->options['multiple']) {
+        $form['value']['#multiple'] = TRUE;
+      }
+
+    }
+    else {
+      $form['value'] = array(
+        '#type' => 'textfield',
+        '#title' => t('%label', array('%label' => $this->options['label'])),
+        '#default_value' => $this->value,
+      );
+    }
+  }
+
+ /**
+  * Ensures the select list gets rendered when the filter is exposed
+  */
+  function exposed_form(&$form, &$form_state) {
+    if (empty($this->options['exposed'])) {
+      return;
+    }
+
+    $value = $this->options['expose']['identifier'];
+    $this->value_form($form, $form_state);
+    $form[$value] = $form['value'];
+
+    if (isset($form[$value]['#title']) && !empty($form[$value]['#type']) && $form[$value]['#type'] != 'checkbox') {
+      unset($form[$value]['#title']);
+    }
+
+    $this->exposed_translate($form[$value], 'value');
+
+    if (!empty($form['#type']) && ($form['#type'] == 'checkboxes' || ($form['#type'] == 'select' && !empty($form['#multiple'])))) {
+      unset($form[$value]['#default_value']);
+    }
+
+    if (!empty($form['#type']) && $form['#type'] == 'select' && empty($form['#multiple'])) {
+      $form[$value]['#default_value'] = 'All';
+    }
+
+    if ($value != 'value') {
+      unset($form['value']);
+    }
+
+  }
+
+  /**
+   * This kind of construct makes it relatively easy for a child class
+   * to add or remove functionality by overriding this function and
+   * adding/removing items from this array.
+   */
+  function operators() {
+    $operators = array(
+      '=' => array(
+        'title' => t('Is equal to'),
+        'short' => t('='),
+        'method' => 'op_equal',
+        'values' => 1,
+      ),
+      '!=' => array(
+        'title' => t('Is not equal to'),
+        'short' => t('!='),
+        'method' => 'op_equal',
+        'values' => 1,
+      ),
+      '~' => array(
+        'title' => t('Contains'),
+        'short' => t('contains'),
+        'method' => 'op_contains',
+        'values' => 1,
+      ),
+    );
+
+    return $operators;
+  }
 }

+ 2 - 2
tripal_views/views/handlers/tripal_views_handler_filter_select_string.inc

@@ -74,9 +74,9 @@ class tripal_views_handler_filter_select_string extends chado_views_handler_filt
       // using fields that are not exposed and that are for the table
       // from whcih the values in the drop box will be slected and
       // we only want to use non-exposed fields because these are not
-      // available to the user to edit--their fixed.
+      // available to the user to edit--they're fixed.
       $where = '';
-      $filters = ($this->view->filter) ? $this->view->filter : array();
+      $filters = (is_array($this->view->filter)) ? $this->view->filter : array();
       foreach ($filters as $filter_name => $details) {
          // we only want to inclue non-exposed filters
          if ($details->options['exposed'] == FALSE) {