Browse Source

Merge branch '7.x-2.x' of git.drupal.org:sandbox/spficklin/1337878 into 7.x-2.x

Stephen Ficklin 11 years ago
parent
commit
c1e2ab8f10
26 changed files with 945 additions and 61 deletions
  1. 16 0
      tripal_analysis/tripal_analysis.module
  2. 43 0
      tripal_analysis/tripal_analysis.views_default.inc
  3. 17 1
      tripal_contact/tripal_contact.module
  4. 48 0
      tripal_contact/tripal_contact.views_default.inc
  5. 19 3
      tripal_feature/tripal_feature.module
  6. 49 0
      tripal_feature/tripal_feature.views_default.inc
  7. 17 1
      tripal_featuremap/tripal_featuremap.module
  8. 48 0
      tripal_featuremap/tripal_featuremap.views_default.inc
  9. 16 0
      tripal_genetic/tripal_genetic.module
  10. 48 0
      tripal_genetic/tripal_genetic.views_default.inc
  11. 16 0
      tripal_library/tripal_library.module
  12. 48 0
      tripal_library/tripal_library.views_default.inc
  13. 16 0
      tripal_organism/tripal_organism.module
  14. 48 0
      tripal_organism/tripal_organism.views_default.inc
  15. 16 0
      tripal_phenotype/tripal_phenotype.module
  16. 48 0
      tripal_phenotype/tripal_phenotype.views_default.inc
  17. 16 0
      tripal_project/tripal_project.module
  18. 48 0
      tripal_project/tripal_project.views_default.inc
  19. 16 0
      tripal_stock/tripal_stock.module
  20. 48 0
      tripal_stock/tripal_stock.views_default.inc
  21. 54 4
      tripal_views/api/tripal_views.api.inc
  22. 1 1
      tripal_views/includes/tripal_views_integration_port.inc
  23. 55 0
      tripal_views/theme/tripal_views_search_biological_content.tpl.php
  24. 8 0
      tripal_views/tripal_views.module
  25. 86 5
      tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc
  26. 100 46
      tripal_views/views/handlers/tripal_views_handler_filter_select_string.inc

+ 16 - 0
tripal_analysis/tripal_analysis.module

@@ -84,6 +84,22 @@ function tripal_analysis_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_analysis_search_biological_data_views() {
+  return array(
+    'tripal_analysis_user_analyses' => array(
+      'machine_name' => 'tripal_analysis_user_analyses',
+      'human_name' => 'Analyses',
+      'description' => 'Bioinformatics analyses which often produces features.',
+      'link' => 'chado/analysis'
+    ),
+  );
+}
+
 /**
 /**
  * Implements hook_help().
  * Implements hook_help().
  * Purpose: Adds a help page to the module list
  * Purpose: Adds a help page to the module list

+ 43 - 0
tripal_analysis/tripal_analysis.views_default.inc

@@ -15,6 +15,14 @@
 function tripal_analysis_views_default_views() {
 function tripal_analysis_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_analysis_search_biological_data_views()
+  $view = tripal_analysis_defaultvalue_user_analysis();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin View
   $view = tripal_analysis_defaultvalue_admin_analysis();
   $view = tripal_analysis_defaultvalue_admin_analysis();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -22,6 +30,41 @@ function tripal_analysis_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the analysis user search default view.
+ *
+ * @ingroup tripal_analysis
+ */
+function tripal_analysis_defaultvalue_user_analysis() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_analysis_defaultvalue_admin_analysis();
+
+  // change some view admin stuff
+  $view->name = 'tripal_analysis_user_analyses';
+  $view->human_name = 'Analysis User Search';
+  $view->description = 'Allows users to search analysis data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/analysis';
+  $view->display['page_1']->display_options['menu']['type'] = 'normal';
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Defines the analysis admin default view.
  * Defines the analysis admin default view.
  *
  *

+ 17 - 1
tripal_contact/tripal_contact.module

@@ -102,6 +102,22 @@ function tripal_contact_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_contact_search_biological_data_views() {
+  return array(
+    'tripal_contact_user_contacts' => array(
+      'machine_name' => 'tripal_contact_user_contacts',
+      'human_name' => 'Contacts',
+      'description' => 'Information about persons, institutes, groups, organizations, etc.',
+      'link' => 'chado/contact'
+    ),
+  );
+}
+
 /**
 /**
  * Implements hook_theme().
  * Implements hook_theme().
  * Register themeing functions for this module
  * Register themeing functions for this module
@@ -267,7 +283,7 @@ function tripal_contact_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == "chado_contact_node_form") {
   if ($form_id == "chado_contact_node_form") {
     // turn of preview button for insert/updates
     // turn of preview button for insert/updates
     $form['actions']['preview']['#access'] = FALSE;
     $form['actions']['preview']['#access'] = FALSE;
-    
+
     //remove the body field
     //remove the body field
     unset($form['body']);
     unset($form['body']);
   }
   }

+ 48 - 0
tripal_contact/tripal_contact.views_default.inc

@@ -14,6 +14,14 @@
 function tripal_contact_views_default_views() {
 function tripal_contact_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_contact_search_biological_data_views()
+  $view = tripal_contact_defaultvalue_user_contacts();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_contact_defaultview_admin_contacts();
   $view = tripal_contact_defaultview_admin_contacts();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -21,6 +29,46 @@ function tripal_contact_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the contact user search default view.
+ *
+ * @ingroup tripal_contact
+ */
+function tripal_contact_defaultvalue_user_contacts() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_contact_defaultview_admin_contacts();
+
+  // change some view admin stuff
+  $view->name = 'tripal_contact_user_contacts';
+  $view->human_name = 'Contact User Search';
+  $view->description = 'Allows users to search contact data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/contact';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Contacts',
+    'description' => 'Contacts can be persons, institutes, groups, or organizations.',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Define the default view for contact administration.
  * Define the default view for contact administration.
  *
  *

+ 19 - 3
tripal_feature/tripal_feature.module

@@ -212,6 +212,22 @@ function tripal_feature_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_feature_search_biological_data_views() {
+  return array(
+    'tripal_feature_user_features' => array(
+      'machine_name' => 'tripal_feature_user_features',
+      'human_name' => 'Features',
+      'description' => 'A biological sequence or a section of a biological sequence, or a collection of such sections.',
+      'link' => 'chado/feature'
+    ),
+  );
+}
+
 /**
 /**
  * Implements hook_theme().
  * Implements hook_theme().
  *
  *
@@ -728,7 +744,7 @@ function tripal_feature_load_organism_feature_counts($organism) {
       $order[] = $feature_type;  // save the order of the these terms
       $order[] = $feature_type;  // save the order of the these terms
       $where .= " OFC.feature_type = :name$i OR ";
       $where .= " OFC.feature_type = :name$i OR ";
       $args[":name$i"] = rtrim($temp2[0]);
       $args[":name$i"] = rtrim($temp2[0]);
-      
+
       // if the admin specified a new name then store that otherwise use the
       // if the admin specified a new name then store that otherwise use the
       // the default sequence ontology term name
       // the default sequence ontology term name
       if(count($temp2) == 2) {
       if(count($temp2) == 2) {
@@ -774,8 +790,8 @@ function tripal_feature_load_organism_feature_counts($organism) {
   foreach ($order as $type) {
   foreach ($order as $type) {
     $ordered_types[] = $types[$type];
     $ordered_types[] = $types[$type];
   }
   }
-  return array( 
-    'types' => $ordered_types, 
+  return array(
+    'types' => $ordered_types,
     'names' => $names
     'names' => $names
   );
   );
 }
 }

+ 49 - 0
tripal_feature/tripal_feature.views_default.inc

@@ -12,6 +12,14 @@
 function tripal_feature_views_default_views() {
 function tripal_feature_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_feature_search_biological_data_views()
+  $view = tripal_feature_defaultvalue_user_features();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_feature_defaultview_admin_features();
   $view = tripal_feature_defaultview_admin_features();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -19,6 +27,47 @@ function tripal_feature_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the feature user search default view.
+ *
+ * @ingroup tripal_feature
+ */
+function tripal_feature_defaultvalue_user_features() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_feature_defaultview_admin_features();
+
+  // change some view admin stuff
+  $view->name = 'tripal_feature_user_feature';
+  $view->human_name = 'Feature User Search';
+  $view->description = 'Allows users to search feature data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/feature';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Features',
+    'description' => 'A biological sequence or a section of a biological sequence, or a collection of such sections.',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+  unset($view->display['default']->display_options['header']['action_links_area_1']);
+
+  return $view;
+}
+
 /**
 /**
  * The default feature administration view
  * The default feature administration view
  *
  *

+ 17 - 1
tripal_featuremap/tripal_featuremap.module

@@ -148,6 +148,22 @@ function tripal_featuremap_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_featuremap_search_biological_data_views() {
+  return array(
+    'tripal_featuremap_user_featuremaps' => array(
+      'machine_name' => 'tripal_featuremap_user_featuremaps',
+      'human_name' => 'Maps',
+      'description' => 'A map of features from the chado database (e.g. genetic map)',
+      'link' => 'chado/featuremap'
+    ),
+  );
+}
+
 /**
 /**
  * Implements hook_views_api().
  * Implements hook_views_api().
  *
  *
@@ -217,7 +233,7 @@ function tripal_featuremap_theme($existing, $type, $theme, $path) {
       'variables' =>  array(NULL),
       'variables' =>  array(NULL),
       'path' => "$path/theme/tripal_featuremap",
       'path' => "$path/theme/tripal_featuremap",
     ),
     ),
-    
+
     // templates for the chado_feature nodes:
     // templates for the chado_feature nodes:
     'tripal_feature_featurepos' => array(
     'tripal_feature_featurepos' => array(
       'arguments' => array('node' => NULL),
       'arguments' => array('node' => NULL),

+ 48 - 0
tripal_featuremap/tripal_featuremap.views_default.inc

@@ -12,6 +12,14 @@
 function tripal_featuremap_views_default_views() {
 function tripal_featuremap_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_featuremap_search_biological_data_views()
+  $view = tripal_featuremap_defaultvalue_user_featuremaps();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_featuremap_defaultview_admin_featuremaps();
   $view = tripal_featuremap_defaultview_admin_featuremaps();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -19,6 +27,46 @@ function tripal_featuremap_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the featuremap user search default view.
+ *
+ * @ingroup tripal_featuremap
+ */
+function tripal_featuremap_defaultvalue_user_featuremaps() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_featuremap_defaultview_admin_featuremaps();
+
+  // change some view admin stuff
+  $view->name = 'tripal_featuremap_user_featuremaps';
+  $view->human_name = 'Feature Map User Search';
+  $view->description = 'Allows users to search feature map data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/featuremap';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Maps',
+    'description' => 'A map of features from the chado database (e.g. genetic map)',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Describes the default featuremap admin view
  * Describes the default featuremap admin view
  *
  *

+ 16 - 0
tripal_genetic/tripal_genetic.module

@@ -75,6 +75,22 @@ function tripal_genetic_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_genetic_search_biological_data_views() {
+  return array(
+    'tripal_genetic_user_genotypes' => array(
+      'machine_name' => 'tripal_genetic_user_genotypes',
+      'human_name' => 'Genotypes',
+      'description' => 'Genetic variations such as SNPs, MNPs and indels.',
+      'link' => 'chado/genotype'
+    ),
+  );
+}
+
 /**
 /**
  * Implements hook_views_api().
  * Implements hook_views_api().
  *
  *

+ 48 - 0
tripal_genetic/tripal_genetic.views_default.inc

@@ -12,6 +12,14 @@
 function tripal_genetic_views_default_views() {
 function tripal_genetic_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_genetic_search_biological_data_views()
+  $view = tripal_genetic_defaultvalue_user_genotypes();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_genetic_defaultviews_admin_genotypes();
   $view = tripal_genetic_defaultviews_admin_genotypes();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -19,6 +27,46 @@ function tripal_genetic_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the genetic user search default view.
+ *
+ * @ingroup tripal_genetic
+ */
+function tripal_genetic_defaultvalue_user_genotypes() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_genetic_defaultviews_admin_genotypes();
+
+  // change some view admin stuff
+  $view->name = 'tripal_genetic_user_genotypes';
+  $view->human_name = 'Genotype User Search';
+  $view->description = 'Allows users to search genotype data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/genotype';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Genotypes',
+    'description' => 'Genetic variations such as SNPs, MNPs and indels.',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Describes the default administration genetic view
  * Describes the default administration genetic view
  *
  *

+ 16 - 0
tripal_library/tripal_library.module

@@ -113,6 +113,22 @@ function tripal_library_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_library_search_biological_data_views() {
+  return array(
+    'tripal_library_user_library' => array(
+      'machine_name' => 'tripal_library_user_library',
+      'human_name' => 'Libraries',
+      'description' => 'Biological library including BAC, cDNA, FOSMID, etc.',
+      'link' => 'chado/library'
+    ),
+  );
+}
+
 /**
 /**
  * Implements hook_views_api().
  * Implements hook_views_api().
  *
  *

+ 48 - 0
tripal_library/tripal_library.views_default.inc

@@ -12,6 +12,14 @@
 function tripal_library_views_default_views() {
 function tripal_library_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_library_search_biological_data_views()
+  $view = tripal_library_defaultvalue_user_library();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_library_admin_defaultviews_library();
   $view = tripal_library_admin_defaultviews_library();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -19,6 +27,46 @@ function tripal_library_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the library user search default view.
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_defaultvalue_user_library() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_library_admin_defaultviews_library();
+
+  // change some view admin stuff
+  $view->name = 'tripal_library_user_library';
+  $view->human_name = 'Library User Search';
+  $view->description = 'Allows users to search library data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/library';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Libraries',
+    'description' => 'Biological library including BAC, cDNA, FOSMID, etc.',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Default administration library view
  * Default administration library view
  *
  *

+ 16 - 0
tripal_organism/tripal_organism.module

@@ -118,6 +118,22 @@ function tripal_organism_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_organism_search_biological_data_views() {
+  return array(
+    'tripal_organism_user_organisms' => array(
+      'machine_name' => 'tripal_organism_user_organisms',
+      'human_name' => 'Organisms',
+      'description' => 'Any living biological entity, such as an animal, plant, fungus, or bacterium.',
+      'link' => 'chado/organism'
+    ),
+  );
+}
+
 /**
 /**
  * Implements hook_help().
  * Implements hook_help().
  * Adds a help page to the module list
  * Adds a help page to the module list

+ 48 - 0
tripal_organism/tripal_organism.views_default.inc

@@ -12,6 +12,14 @@
 function tripal_organism_views_default_views() {
 function tripal_organism_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_organism_search_biological_data_views()
+  $view = tripal_organism_defaultvalue_user_organisms();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_organism_admin_defaultview_organisms();
   $view = tripal_organism_admin_defaultview_organisms();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -19,6 +27,46 @@ function tripal_organism_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the organism user search default view.
+ *
+ * @ingroup tripal_organism
+ */
+function tripal_organism_defaultvalue_user_organisms() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_organism_admin_defaultview_organisms();
+
+  // change some view admin stuff
+  $view->name = 'tripal_organism_user_organisms';
+  $view->human_name = 'Organism User Search';
+  $view->description = 'Allows users to search organism data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/organism';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Organisms',
+    'description' => 'Any living biological entity, such as an animal, plant, fungus, or bacterium.',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Describe the organism administration view.
  * Describe the organism administration view.
  *
  *

+ 16 - 0
tripal_phenotype/tripal_phenotype.module

@@ -70,6 +70,22 @@ function tripal_phenotype_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_phenotype_search_biological_data_views() {
+  return array(
+    'tripal_phenotype_user_phenotypes' => array(
+      'machine_name' => 'tripal_phenotype_user_phenotypes',
+      'human_name' => 'Phenotypes',
+      'description' => 'A controlled sentence describing observable effects of non-wild type function.',
+      'link' => 'chado/phenotype'
+    ),
+  );
+}
+
 /**
 /**
  *  Implements hook_theme().
  *  Implements hook_theme().
  *
  *

+ 48 - 0
tripal_phenotype/tripal_phenotype.views_default.inc

@@ -12,6 +12,14 @@
 function tripal_phenotype_views_default_views() {
 function tripal_phenotype_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_phenotype_search_biological_data_views()
+  $view = tripal_phenotype_defaultvalue_user_phenotypes();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_phenotype_defaultview_admin_phenotypes();
   $view = tripal_phenotype_defaultview_admin_phenotypes();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -19,6 +27,46 @@ function tripal_phenotype_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the phenotype user search default view.
+ *
+ * @ingroup tripal_phenotype
+ */
+function tripal_phenotype_defaultvalue_user_phenotypes() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_phenotype_defaultview_admin_phenotypes();
+
+  // change some view admin stuff
+  $view->name = 'tripal_phenotype_user_phenotypes';
+  $view->human_name = 'Phenotype User Search';
+  $view->description = 'Allows users to search phenotype data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/phenotype';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Phenotypes',
+    'description' => 'A controlled sentence describing observable effects of non-wild type function.',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Default phenotype administration view
  * Default phenotype administration view
  *
  *

+ 16 - 0
tripal_project/tripal_project.module

@@ -88,6 +88,22 @@ function tripal_project_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_project_search_biological_data_views() {
+  return array(
+    'tripal_project_user_projects' => array(
+      'machine_name' => 'tripal_project_user_projects',
+      'human_name' => 'Projects',
+      'description' => 'A project. Can be used for grouping data such as with the natural diversity module data.',
+      'link' => 'chado/project'
+    ),
+  );
+}
+
 /**
 /**
  * Implements hook_help().
  * Implements hook_help().
  * Adds a help page to the module list
  * Adds a help page to the module list

+ 48 - 0
tripal_project/tripal_project.views_default.inc

@@ -12,6 +12,14 @@
 function tripal_project_views_default_views() {
 function tripal_project_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_project_search_biological_data_views()
+  $view = tripal_project_defaultvalue_user_projects();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_project_defaultview_admin_projects();
   $view = tripal_project_defaultview_admin_projects();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -19,6 +27,46 @@ function tripal_project_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the project user search default view.
+ *
+ * @ingroup tripal_project
+ */
+function tripal_project_defaultvalue_user_projects() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_project_defaultview_admin_projects();
+
+  // change some view admin stuff
+  $view->name = 'tripal_project_user_projects';
+  $view->human_name = 'Project User Search';
+  $view->description = 'Allows users to search project data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/project';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Projects',
+    'description' => 'A project. Can be used for grouping data such as with the natural diversity module data.',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Project administration view
  * Project administration view
  *
  *

+ 16 - 0
tripal_stock/tripal_stock.module

@@ -93,6 +93,22 @@ function tripal_stock_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_search_biological_data_views().
+ *
+ * Adds the described views to the "Search Biological Data" Page created by Tripal Views
+ */
+function tripal_stock_search_biological_data_views() {
+  return array(
+    'tripal_stock_user_stocks' => array(
+      'machine_name' => 'tripal_stock_user_stocks',
+      'human_name' => 'Stocks',
+      'description' => 'A stock is the physical entities of an organism, either living or preserved.',
+      'link' => 'chado/stock'
+    ),
+  );
+}
+
 /**
 /**
  * Implements Menu wildcard_load hook
  * Implements Menu wildcard_load hook
  *
  *

+ 48 - 0
tripal_stock/tripal_stock.views_default.inc

@@ -12,6 +12,14 @@
 function tripal_stock_views_default_views() {
 function tripal_stock_views_default_views() {
   $views = array();
   $views = array();
 
 
+  // User View ("Search Biological Content")
+  // Remember, if you change the name/path of this view,
+  // you also want to change it's description in tripal_stock_search_biological_data_views()
+  $view = tripal_stock_defaultvalue_user_stocks();
+  $view = tripal_views_make_view_compatible_with_external($view);
+  $views[$view->name] = $view;
+
+  // Admin view
   $view = tripal_stock_defaultview_admin_stocks();
   $view = tripal_stock_defaultview_admin_stocks();
   $view = tripal_views_make_view_compatible_with_external($view);
   $view = tripal_views_make_view_compatible_with_external($view);
   $views[$view->name] = $view;
   $views[$view->name] = $view;
@@ -19,6 +27,46 @@ function tripal_stock_views_default_views() {
   return $views;
   return $views;
 }
 }
 
 
+/**
+ * Defines the stock user search default view.
+ *
+ * @ingroup tripal_stock
+ */
+function tripal_stock_defaultvalue_user_stocks() {
+
+  // As a shortcut, currently I am copying the admin view and then tweaking it
+  // In thie future this should be replaced by a views export
+  $view = tripal_stock_defaultview_admin_stocks();
+
+  // change some view admin stuff
+  $view->name = 'tripal_stock_user_stocks';
+  $view->human_name = 'Stock User Search';
+  $view->description = 'Allows users to search stock data';
+  $view->tag = 'tripal search';
+
+  // Change the path
+  $view->display['page_1']->display_options['path'] = 'chado/stock';
+  $view->display['page_1']->display_options['menu'] = array(
+    'type' => 'normal',
+    'title' => 'Stocks',
+    'description' => 'A stock is the physical entities of an organism, either living or preserved.',
+    'weight' => '-10'
+  );
+  unset($view->display['page_1']->display_options['tab_options']);
+
+  // Remove edit/delete node
+  unset(
+    $view->display['default']->display_options['fields']['delete_node'],
+    $view->display['default']->display_options['fields']['edit_node'],
+    $view->display['default']->display_options['fields']['nothing']
+  );
+
+  // Remove the admin action links
+  unset($view->display['default']->display_options['header']['action_links_area']);
+
+  return $view;
+}
+
 /**
 /**
  * Default stock administration view
  * Default stock administration view
  *
  *

+ 54 - 4
tripal_views/api/tripal_views.api.inc

@@ -904,10 +904,10 @@ function tripal_remove_views_integration($identifiers, $options = array()) {
   // Remove the views integration using the setup_id
   // Remove the views integration using the setup_id
   if (isset($identifiers['setup_id'])) {
   if (isset($identifiers['setup_id'])) {
 
 
-    db_query('DELETE FROM {tripal_views} WHERE setup_id=:setup', array(':setup' => $setup_id));
-    db_query('DELETE FROM {tripal_views_field} WHERE setup_id=:setup', array(':setup' => $setup_id));
-    db_query('DELETE FROM {tripal_views_handlers} WHERE setup_id=:setup', array(':setup' => $setup_id));
-    db_query('DELETE FROM {tripal_views_join} WHERE setup_id=:setup', array(':setup' => $setup_id));
+    db_query('DELETE FROM {tripal_views} WHERE setup_id=:setup', array(':setup' => $identifiers['setup_id']));
+    db_query('DELETE FROM {tripal_views_field} WHERE setup_id=:setup', array(':setup' => $identifiers['setup_id']));
+    db_query('DELETE FROM {tripal_views_handlers} WHERE setup_id=:setup', array(':setup' => $identifiers['setup_id']));
+    db_query('DELETE FROM {tripal_views_join} WHERE setup_id=:setup', array(':setup' => $identifiers['setup_id']));
 
 
     return TRUE;
     return TRUE;
   }
   }
@@ -1154,6 +1154,56 @@ function tripal_add_field_to_views_integration($table_name, $priority, $field) {
   return $no_errors;
   return $no_errors;
 }
 }
 
 
+/**
+ * Adds the given field to an existing or cloned integration. In the case of a cloned
+ * integration, the lightest integration is used as the template for the clone.
+ *
+ * NOTE: If that field already exists in the specified integration then it will first be
+ * deleted and the new one added.
+ *
+ * @param $table_name
+ *   The name of the table the integration is for
+ * @param $priority
+ *   The priority of the integration to use; pass NULL to use the lightest integration
+ * @param $field
+ *   An array describing the field ot add; uses the same format as the $defn_array
+ *
+ * @return
+ *   TRUE if the field was added successfully; FALSE otherwise
+ *
+ * @ingroup tripal_views_api
+ */
+function tripal_add_join_to_views_integration($table_name, $priority, $join) {
+  $no_errors = TRUE;
+
+  // If no priority is supplied then add the field to the lightest integration
+  if (empty($priority)) {
+    $priority = tripal_get_lightest_views_integration_priority($table_name);
+  }
+
+  // First get the setup_id
+  $setup_id = db_query(
+    "SELECT setup_id FROM {tripal_views} WHERE table_name=:table AND priority=:priority",
+    array(
+      ':table' => $table_name,
+      ':priority' => $priority
+    )
+  );
+  $setup_id = $setup_id->fetchField();
+
+  // If there isn't an integration matching that table/priority combination
+  // then clone the lightest priority integration
+  if (empty($setup_id)) {
+    $setup_id = tripal_clone_views_integration($table_name, $priority);
+    $setup_id = $setup_id->setup_id;
+  }
+
+  // Add the setup_id to the join record passed in
+  $join['setup_id'] = $setup_id;
+
+  drupal_write_record('tripal_views_join', $join);
+}
+
 /**
 /**
  * Remove a join from an integration. This is usually done after cloning an existing
  * Remove a join from an integration. This is usually done after cloning an existing
  * integration using tripal_clone_views_integration().
  * integration using tripal_clone_views_integration().

+ 1 - 1
tripal_views/includes/tripal_views_integration_port.inc

@@ -18,7 +18,7 @@
  *
  *
  * @ingroup tripal_views
  * @ingroup tripal_views
  */
  */
-function tripal_views_integration_export_form($form_state, $setup_id) {
+function tripal_views_integration_export_form($form, $form_state, $setup_id) {
   $form = array();
   $form = array();
 
 
   $defn_array = tripal_views_integration_export_entry($setup_id);
   $defn_array = tripal_views_integration_export_entry($setup_id);

+ 55 - 0
tripal_views/theme/tripal_views_search_biological_content.tpl.php

@@ -0,0 +1,55 @@
+<?php
+/**
+ *
+ */
+$biological_views = module_invoke_all('search_biological_data_views');
+$disabled_views = variable_get('views_defaults', array());
+?>
+
+<p>Use the following to search the various types of biological content available by
+this site:</p>
+<DL>
+<?php foreach ($biological_views as $view) { ?>
+  <?php if (!isset($disabled_views[ $view['machine_name'] ]) OR ($disabled_views[ $view['machine_name'] ] == TRUE)) { ?>
+    <DT><?php print l($view['human_name'], $view['link']); ?></DT>
+    <DD><?php print $view['description']; ?></DD>
+<?php }} ?>
+</DL>
+
+<?php
+// How to disable/remove views from this list
+print tripal_set_message(
+  "To remove a view from this list, simply navigate to the Views UI (Adminster ->
+    Structure -> Views; admin/structure/views) and choose 'disable' from the action
+    drop-down to the right of the view you would like to remove.",
+  TRIPAL_INFO,
+  array('return_html' => 1)
+);
+
+// Tell Tripal admin how to add views to this list
+print tripal_set_message(
+  "In order to add views to the above list you need to implement hook_search_biological_data_views().
+    This hook should return an array as follows: <code><pre>array(
+    '[view-machine-name]' => array(
+      'machine_name' => '[view-machine-name]',
+      'human_name' => '[Human-readable title to show in above list]',
+      'description' => '[description to show in above list]',
+      'link' => '[path to the view]'
+    ),
+  );</pre></code>
+  Where you should replace all instructions in square-brackets([]) with the details of your view.",
+  TRIPAL_INFO,
+  array('return_html' => 1)
+);
+
+// Tell Tripal Admin which template to change
+print tripal_set_message(
+  "Administrators, you can customize the way the content above is presented.  Tripal
+    provides a template file for each block of content.  To customize, copy the template
+    file to your site's default theme, edit then " .
+    l('clear the Drupal cache', 'admin/config/development/performance', array('attributes' => array('target' => '_blank'))) .
+    ". Currently, the content above is provided by this template: <br><br>$template_file",
+  TRIPAL_INFO,
+  array('return_html' => 1)
+);
+?>

+ 8 - 0
tripal_views/tripal_views.module

@@ -33,6 +33,8 @@ function tripal_views_menu() {
   $items['chado'] = array(
   $items['chado'] = array(
     'title' => 'Search Biological Data',
     'title' => 'Search Biological Data',
     'description' => 'Listings of the various biological data available categorized by type.',
     'description' => 'Listings of the various biological data available categorized by type.',
+    'page callback' => 'theme',
+    'page arguments' => array('tripal_views_search_biological_content'),
     'access arguments' => array('access content'),
     'access arguments' => array('access content'),
     'expanded' => TRUE,
     'expanded' => TRUE,
     'type' => MENU_NORMAL_ITEM,
     'type' => MENU_NORMAL_ITEM,
@@ -231,6 +233,12 @@ function tripal_views_theme($existing, $type, $theme, $path) {
       'variables' =>  array(NULL),
       'variables' =>  array(NULL),
       'path' => drupal_get_path('module', 'tripal_views') . '/theme'
       'path' => drupal_get_path('module', 'tripal_views') . '/theme'
     ),
     ),
+    // search biological content page
+    'tripal_views_search_biological_content' => array(
+      'template' => 'tripal_views_search_biological_content',
+      'variables' =>  array(NULL),
+      'path' => drupal_get_path('module', 'tripal_views') . '/theme'
+    ),
   );
   );
 }
 }
 
 

+ 86 - 5
tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc

@@ -61,11 +61,60 @@ class tripal_views_handler_filter_select_cvterm extends tripal_views_handler_fil
 
 
     }
     }
     else {
     else {
+
+      $where = '';
+      if ($this->options['exposed']) {
+        // build a where clause that will filter the list in the drop box
+        // 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--they're fixed.
+        $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) {
+              $value = $details->value;
+              if (is_array($details->value) AND isset($details->value['value'])) {
+                $value = $details->value['value'];
+              }
+
+              $field = $details->field;
+              if (($this->table == $this->view->base_table) AND ($details->field == 'type_id')) {
+                $field = 'cvterm_id';
+              }
+
+              if (is_array($value)) {
+                // we only want to filter on the table we're getting the list from
+                if (strcmp($details->table, $this->table)==0 AND !empty($value)) {
+                  $where .= "$field IN (" . implode(', ', $value) . ')';
+                  $where .= ' AND ';
+                }
+              }
+              else {
+                // we only want to filter on the table we're getting the list from
+                if (strcmp($details->table, 'cvterm')==0 AND !empty($value)) {
+                  $where .= "$field $details->operator " . $value;
+                  $where .= ' AND ';
+                }
+              }
+           }
+        }
+        if ($where) {
+          $where = ' AND ' . $where;
+          $where = substr($where, 0, -5); # remove the final ' AND '
+        }
+      }
+
       // @coder-ignore: non-drupal schema therefore table prefixing does not apply
       // @coder-ignore: non-drupal schema therefore table prefixing does not apply
       // D7 TODO: Check DBTNG changes work
       // D7 TODO: Check DBTNG changes work
-      $sql = "SELECT cvterm_id, name FROM {cvterm} WHERE cvterm_id IN (SELECT distinct(" . $this->field . ") FROM {" . $this->table . "})";
+      $sql = "SELECT cvterm_id, name FROM {cvterm} WHERE cvterm_id IN (SELECT distinct(" . $this->field . ") FROM {" . $this->table . "}) " . $where . ' ORDER BY cvterm.name ASC';
       $resource = chado_query($sql);
       $resource = chado_query($sql);
       $cvterms = array();
       $cvterms = array();
+
+      if ($this->options['select_optional']) {
+        $cvterms['All'] = '- Any -';
+      }
+
       foreach ($resource as $r) {
       foreach ($resource as $r) {
         $cvterms[$r->cvterm_id] = $r->name;
         $cvterms[$r->cvterm_id] = $r->name;
       }
       }
@@ -73,12 +122,44 @@ class tripal_views_handler_filter_select_cvterm extends tripal_views_handler_fil
     //sort cvterms by name (case insensitive)
     //sort cvterms by name (case insensitive)
     natcasesort($cvterms);
     natcasesort($cvterms);
 
 
-    if ($this->options['expose']['select_optional']) {
-      $options['All'] = '--Any--';
-    }
+    return $cvterms;
+
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  function option_definition() {
+    return parent::option_definition();
+  }
 
 
-    return $options + $cvterms;
+  /**
+   * {@inheritdoc}
+   */
+  function expose_form(&$form, &$form_state) {
+    parent::expose_form($form, $form_state);
+    return $form;
+  }
 
 
+  /**
+   * {@inheritdoc}
+   */
+  function expose_submit($form, &$form_state) {
+    parent::expose_submit($form, $form_state);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  function expose_options() {
+    parent::expose_options();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  function value_form(&$form, &$form_state) {
+    parent::value_form($form, $form_state);
   }
   }
 
 
 }
 }

+ 100 - 46
tripal_views/views/handlers/tripal_views_handler_filter_select_string.inc

@@ -15,26 +15,58 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
   /**
   /**
    * {@inheritdoc}
    * {@inheritdoc}
    */
    */
-  function options_definition() {
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+
+    // Backwards compatibility
+    if (isset($this->options['expose']['values_form_type'])) {
+      $this->options['values_form_type'] = $this->options['expose']['values_form_type'];
+      unset($this->options['expose']['values_form_type']);
+    }
+    if (isset($this->options['expose']['select_multiple'])) {
+      $this->options['select_multiple'] = $this->options['expose']['select_multiple'];
+      unset($this->options['expose']['select_multiple']);
+    }
+    if (isset($this->options['expose']['select_optional'])) {
+      $this->options['select_optional'] = $this->options['expose']['select_optional'];
+      unset($this->options['expose']['select_optional']);
+    }
+    if (isset($this->options['expose']['max_length'])) {
+      $this->options['max_length'] = $this->options['expose']['max_length'];
+      unset($this->options['expose']['max_length']);
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  function has_extra_options() {
+    return TRUE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
-    $options['expose']['values_form_type'] = array(
+    $options['values_form_type'] = array(
       'default' => 'textfield',
       'default' => 'textfield',
-      'export' => 'export_plugin'
+      'export' => TRUE
     );
     );
-    $options['expose']['select_multiple'] = array(
+    $options['select_multiple'] = array(
       'default' => FALSE,
       'default' => FALSE,
       'bool' => TRUE,
       'bool' => TRUE,
-      'export' => 'export_plugin'
+      'export' => TRUE
     );
     );
-    $options['expose']['select_optional'] = array(
+    $options['select_optional'] = array(
       'default' => FALSE,
       'default' => FALSE,
       'bool' => TRUE,
       'bool' => TRUE,
-      'export' => 'export_plugin'
+      'export' => TRUE
     );
     );
-    $options['expose']['max_length'] = array(
+    $options['max_length'] = array(
       'default' => 40,
       'default' => 40,
-      'export' => 'export_plugin'
+      'export' => TRUE
     );
     );
 
 
     return $options;
     return $options;
@@ -57,15 +89,30 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
     $where = '';
     $where = '';
     $filters = (is_array($this->view->filter)) ? $this->view->filter : array();
     $filters = (is_array($this->view->filter)) ? $this->view->filter : array();
     foreach ($filters as $filter_name => $details) {
     foreach ($filters as $filter_name => $details) {
-       // we only want to inclue non-exposed filters
-       if ($details->options['exposed'] == FALSE) {
-          $value = (is_array($details->value)) ? $details->value['value'] : $details->value;
+      // we only want to inclue non-exposed filters
+      if ($details->options['exposed'] == FALSE) {
+
+        $value = $details->value;
+        if (is_array($details->value) AND isset($details->value['value'])) {
+         $value = $details->value['value'];
+        }
+
+        if (is_array($value)) {
           // we only want to filter on the table we're getting the list from
           // we only want to filter on the table we're getting the list from
           if (strcmp($details->table, $this->table)==0 AND !empty($value)) {
           if (strcmp($details->table, $this->table)==0 AND !empty($value)) {
-            $where .= "$details->field $details->operator " . $details->value;
+            $where .= "$details->field IN (" . implode(', ', $value) . ')';
             $where .= ' AND ';
             $where .= ' AND ';
           }
           }
-       }
+
+        }
+        else {
+          // we only want to filter on the table we're getting the list from
+          if (strcmp($details->table, $this->table)==0 AND !empty($value)) {
+            $where .= "$details->field $details->operator " . $value;
+            $where .= ' AND ';
+          }
+        }
+      }
     }
     }
     if ($where) {
     if ($where) {
        $where = "WHERE $where";
        $where = "WHERE $where";
@@ -77,12 +124,12 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
     $results = chado_query($sql);
     $results = chado_query($sql);
 
 
     // Build the select box options
     // Build the select box options
-    $max_length = (isset($this->options['expose']['max_length'])) ? $this->options['expose']['max_length'] : 40;
+    $max_length = (isset($this->options['max_length'])) ? $this->options['max_length'] : 40;
     if (!$max_length) {
     if (!$max_length) {
       $max_length = 40;
       $max_length = 40;
     }
     }
     $options = array();
     $options = array();
-    if ($this->options['expose']['select_optional']) {
+    if ($this->options['select_optional']) {
       $options['All'] = '--Any--';
       $options['All'] = '--Any--';
     }
     }
     foreach ($results as $r) {
     foreach ($results as $r) {
@@ -100,41 +147,41 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
   /**
   /**
    * {@inheritdoc}
    * {@inheritdoc}
    */
    */
-  function expose_form(&$form, &$form_state) {
-    parent::expose_form($form, $form_state);
+  function extra_options_form(&$form, &$form_state) {
+    parent::extra_options_form($form, $form_state);
 
 
-    $form['expose']['values_form_type'] = array(
+    $form['values_form_type'] = array(
       '#type' => 'radios',
       '#type' => 'radios',
       '#title' => t('Filter Type'),
       '#title' => t('Filter Type'),
       '#options' => array(
       '#options' => array(
         'textfield' => 'Text Field',
         'textfield' => 'Text Field',
         'select' => 'Drop-Down Box',
         'select' => 'Drop-Down Box',
       ),
       ),
-      '#default_value' => $this->options['expose']['values_form_type'],
+      '#default_value' => $this->options['values_form_type'],
     );
     );
 
 
-    $form['expose']['select_multiple'] = array(
+    $form['select_multiple'] = array(
       '#type' => 'checkbox',
       '#type' => 'checkbox',
       '#title' => t('Select Multiple'),
       '#title' => t('Select Multiple'),
       '#description' => t('Allows more then one option to be selected.'),
       '#description' => t('Allows more then one option to be selected.'),
-      '#default_value' => $this->options['expose']['select_multiple'],
+      '#default_value' => $this->options['select_multiple'],
     );
     );
 
 
-    $form['expose']['select_optional'] = array(
+    $form['select_optional'] = array(
       '#type' => 'checkbox',
       '#type' => 'checkbox',
       '#title' => t('Optional'),
       '#title' => t('Optional'),
       '#description' => t('Adds --Any-- to the available options.'),
       '#description' => t('Adds --Any-- to the available options.'),
-      '#default_value' => $this->options['expose']['select_optional'],
+      '#default_value' => $this->options['select_optional'],
     );
     );
 
 
-    $form['expose']['max_length'] = array(
+    $form['max_length'] = array(
       '#type' => 'textfield',
       '#type' => 'textfield',
       '#title' => t('Max Width'),
       '#title' => t('Max Width'),
       '#description' => t('Specify the maximum width of the select box'),
       '#description' => t('Specify the maximum width of the select box'),
-      '#default_value' => $this->options['expose']['max_length'],
-
+      '#default_value' => $this->options['max_length'],
     );
     );
-    $form['expose']['note'] = array(
+
+    $form['note'] = array(
       '#type' => 'markup',
       '#type' => 'markup',
       '#value' => t('<strong><font color="red">Note:</font></strong> If another filter exists for the same table then '.
       '#value' => t('<strong><font color="red">Note:</font></strong> If another filter exists for the same table then '.
                     'the values shown in the drop box will only include those from rows that are not filtered.'),
                     'the values shown in the drop box will only include those from rows that are not filtered.'),
@@ -148,21 +195,21 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
   /**
   /**
    * {@inheritdoc}
    * {@inheritdoc}
    */
    */
-  function expose_submit($form, &$form_state) {
-    $this->options['expose']['values_form_type'] = $form_state['values']['options']['expose']['values_form_type'];
-    $this->options['expose']['select_multiple'] = $form_state['values']['options']['expose']['select_multiple'];
-    $this->options['expose']['select_optional'] = $form_state['values']['options']['expose']['select_optional'];
-    $this->options['expose']['max_length'] = $form_state['values']['options']['expose']['max_length'];
+  function extra_options_submit($form, &$form_state) {
+    $this->options['values_form_type'] = $form_state['values']['options']['values_form_type'];
+    $this->options['select_multiple'] = $form_state['values']['options']['select_multiple'];
+    $this->options['select_optional'] = $form_state['values']['options']['select_optional'];
+    $this->options['max_length'] = $form_state['values']['options']['max_length'];
   }
   }
 
 
   /**
   /**
    * {@inheritdoc}
    * {@inheritdoc}
    */
    */
-  function expose_options() {
-    $this->options['expose']['values_form_type'] = 'textfield';
-    $this->options['expose']['select_multiple'] = FALSE;
-    $this->options['expose']['select_optional'] = FALSE;
-    $this->options['expose']['max_length'] = 40;
+  function extra_options_options() {
+    $this->options['values_form_type'] = 'textfield';
+    $this->options['select_multiple'] = FALSE;
+    $this->options['select_optional'] = FALSE;
+    $this->options['max_length'] = 40;
   }
   }
 
 
   /**
   /**
@@ -171,9 +218,9 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
   function value_form(&$form, &$form_state) {
   function value_form(&$form, &$form_state) {
     parent::value_form($form, $form_state);
     parent::value_form($form, $form_state);
 
 
-    $this->options['expose']['values_form_type'] = (isset($this->options['expose']['values_form_type'])) ? $this->options['expose']['values_form_type'] : 'textfield';
+    $this->options['values_form_type'] = (isset($this->options['values_form_type'])) ? $this->options['values_form_type'] : 'textfield';
 
 
-    if (preg_match('/select/', $this->options['expose']['values_form_type'])) {
+    if (preg_match('/select/', $this->options['values_form_type'])) {
 
 
       //Select List
       //Select List
       $form['value'] = array(
       $form['value'] = array(
@@ -183,7 +230,7 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
           '#default_value' => $this->value,
           '#default_value' => $this->value,
       );
       );
 
 
-      if ($this->options['expose']['select_multiple']) {
+      if ($this->options['select_multiple']) {
         $form['value']['#multiple'] = TRUE;
         $form['value']['#multiple'] = TRUE;
       }
       }
     }
     }
@@ -204,9 +251,16 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
   function exposed_form(&$form, &$form_state) {
   function exposed_form(&$form, &$form_state) {
     parent::exposed_form($form, $form_state);
     parent::exposed_form($form, $form_state);
 
 
-    if (isset($this->options['expose']['select_multiple'])) {
-      if ($this->options['expose']['select_multiple']) {
-        $form[$this->options['id']]['#multiple'] = TRUE;
+    if (isset($this->options['select_multiple'])) {
+      if ($this->options['select_multiple']) {
+
+        if (isset($this->options['expose']['identifier'])) {
+          $id = $this->options['expose']['identifier'];
+        }
+        else {
+          $id = $this->options['id'];
+        }
+        $form[$id]['#multiple'] = TRUE;
       }
       }
     }
     }
   }
   }
@@ -226,8 +280,8 @@ class tripal_views_handler_filter_select_string extends views_handler_filter_str
     $field = $this->table_alias . "." . $this->real_field;
     $field = $this->table_alias . "." . $this->real_field;
     $table = $this->query->get_table_info($this->table);
     $table = $this->query->get_table_info($this->table);
 
 
-    $this->options['expose']['values_form_type'] = (isset($this->options['expose']['values_form_type'])) ? $this->options['expose']['values_form_type'] : 'textfield';
-    if (preg_match('/select/', $this->options['expose']['values_form_type'])) {
+    $this->options['values_form_type'] = (isset($this->options['values_form_type'])) ? $this->options['values_form_type'] : 'textfield';
+    if (preg_match('/select/', $this->options['values_form_type'])) {
       if (is_array($this->value)) {
       if (is_array($this->value)) {
         if (isset($this->value['All'])) {
         if (isset($this->value['All'])) {
           unset($this->value['All']);
           unset($this->value['All']);