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
bf528093b8
77 changed files with 5965 additions and 6494 deletions
  1. 33 1
      tripal_analysis/includes/tripal_analysis.admin.inc
  2. 1 0
      tripal_analysis/tripal_analysis.info
  3. 45 31
      tripal_analysis/tripal_analysis.install
  4. 19 15
      tripal_analysis/tripal_analysis.module
  5. 0 421
      tripal_analysis/tripal_analysis.views.inc
  6. 195 0
      tripal_analysis/tripal_analysis.views_default.inc
  7. 1 0
      tripal_bulk_loader/tripal_bulk_loader.info
  8. 14 0
      tripal_bulk_loader/tripal_bulk_loader.install
  9. 39 23
      tripal_bulk_loader/tripal_bulk_loader.views_default.inc
  10. 38 3
      tripal_contact/includes/tripal_contact.admin.inc
  11. 0 0
      tripal_contact/theme/tripal_contact_help.tpl.php
  12. 2 0
      tripal_contact/tripal_contact.info
  13. 18 4
      tripal_contact/tripal_contact.install
  14. 72 62
      tripal_contact/tripal_contact.module
  15. 1 280
      tripal_contact/tripal_contact.views.inc
  16. 208 0
      tripal_contact/tripal_contact.views_default.inc
  17. 43 40
      tripal_cv/includes/cv_form.inc
  18. 109 94
      tripal_cv/includes/cvterm_form.inc
  19. 1 570
      tripal_cv/includes/tripal_cv_admin.inc
  20. 1 0
      tripal_cv/tripal_cv.info
  21. 29 12
      tripal_cv/tripal_cv.install
  22. 16 8
      tripal_cv/tripal_cv.module
  23. 398 351
      tripal_cv/tripal_cv.views_default.inc
  24. 1 0
      tripal_db/tripal_db.info
  25. 14 0
      tripal_db/tripal_db.install
  26. 3 3
      tripal_db/tripal_db.module
  27. 12 11
      tripal_db/tripal_db.views_default.inc
  28. 1 0
      tripal_feature/tripal_feature.info
  29. 32 15
      tripal_feature/tripal_feature.install
  30. 0 547
      tripal_feature/tripal_feature.views.inc
  31. 549 0
      tripal_feature/tripal_feature.views_default.inc
  32. 2 0
      tripal_featuremap/tripal_featuremap.info
  33. 39 25
      tripal_featuremap/tripal_featuremap.install
  34. 1 372
      tripal_featuremap/tripal_featuremap.views.inc
  35. 372 0
      tripal_featuremap/tripal_featuremap.views_default.inc
  36. 2 0
      tripal_genetic/tripal_genetic.info
  37. 15 0
      tripal_genetic/tripal_genetic.install
  38. 1 253
      tripal_genetic/tripal_genetic.views.inc
  39. 253 0
      tripal_genetic/tripal_genetic.views_default.inc
  40. 59 30
      tripal_library/includes/tripal_library.admin.inc
  41. 2 0
      tripal_library/tripal_library.info
  42. 40 23
      tripal_library/tripal_library.install
  43. 20 9
      tripal_library/tripal_library.module
  44. 0 383
      tripal_library/tripal_library.views.inc
  45. 219 0
      tripal_library/tripal_library.views_default.inc
  46. 2 0
      tripal_natural_diversity/tripal_natural_diversity.info
  47. 21 9
      tripal_natural_diversity/tripal_natural_diversity.install
  48. 1 952
      tripal_natural_diversity/tripal_natural_diversity.views.inc
  49. 942 0
      tripal_natural_diversity/tripal_natural_diversity.views_default.inc
  50. 41 8
      tripal_organism/includes/tripal_organism.admin.inc
  51. 1 0
      tripal_organism/tripal_organism.info
  52. 18 4
      tripal_organism/tripal_organism.install
  53. 25 16
      tripal_organism/tripal_organism.module
  54. 0 298
      tripal_organism/tripal_organism.views.inc
  55. 209 0
      tripal_organism/tripal_organism.views_default.inc
  56. 2 0
      tripal_phenotype/tripal_phenotype.info
  57. 15 0
      tripal_phenotype/tripal_phenotype.install
  58. 0 487
      tripal_phenotype/tripal_phenotype.views.inc
  59. 488 0
      tripal_phenotype/tripal_phenotype.views_default.inc
  60. 37 3
      tripal_project/includes/tripal_project.admin.inc
  61. 0 0
      tripal_project/theme/tripal_project_help.tpl.php
  62. 1 0
      tripal_project/tripal_project.info
  63. 20 6
      tripal_project/tripal_project.install
  64. 17 6
      tripal_project/tripal_project.module
  65. 1 309
      tripal_project/tripal_project.views.inc
  66. 192 0
      tripal_project/tripal_project.views_default.inc
  67. 2 0
      tripal_pub/tripal_pub.info
  68. 39 25
      tripal_pub/tripal_pub.install
  69. 0 373
      tripal_pub/tripal_pub.views.inc
  70. 374 0
      tripal_pub/tripal_pub.views_default.inc
  71. 2 0
      tripal_stock/tripal_stock.info
  72. 14 0
      tripal_stock/tripal_stock.install
  73. 0 405
      tripal_stock/tripal_stock.views.inc
  74. 406 0
      tripal_stock/tripal_stock.views_default.inc
  75. 14 1
      tripal_views/tripal_views.views.inc
  76. 151 0
      tripal_views/views/handlers/tripal_views_handler_area_action_links.inc
  77. 10 6
      tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc

+ 33 - 1
tripal_analysis/includes/tripal_analysis.admin.inc

@@ -5,6 +5,38 @@
  * Contains functions displaying administrative pages and forms
  * Contains functions displaying administrative pages and forms
  */
  */
 
 
+/**
+ *
+ */
+function tripal_analysis_admin_analysis_view() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado', 'admin/tripal/chado');
+  $breadcrumb[] = l('Analysis', 'admin/tripal/chado/tripal_analysis');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_analysis_admin_analyses','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Analysis module uses primarily views to provide an '
+      . 'administrative interface. Currently one or more views needed for this '
+      . 'administrative interface are disabled. <strong>Click each of the following links to '
+      . 'enable the pertinent views</strong>:</p>';
+    $output .= '<ul>';
+      $output .= '<li>'.l('Analysis View', 'admin/tripal/chado/tripal_analysis/views/analyses/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
 
 
 /**
 /**
  * Administration page callbacks for the Tripal Analysis module
  * Administration page callbacks for the Tripal Analysis module
@@ -53,7 +85,7 @@ function tripal_analysis_admin() {
     }
     }
     $counter++;
     $counter++;
   }
   }
-  
+
   if($counter == 0) {
   if($counter == 0) {
     $form['nothing'] = array(
     $form['nothing'] = array(
       '#markup' => t('There are currently no settings to configure. However, analysis extension modules may add items here when they are installed.')
       '#markup' => t('There are currently no settings to configure. However, analysis extension modules may add items here when they are installed.')

+ 1 - 0
tripal_analysis/tripal_analysis.info

@@ -7,5 +7,6 @@ version = 7.x-2.0-beta1
 configure = admin/tripal/chado/tripal_analysis/configuration
 configure = admin/tripal/chado/tripal_analysis/configuration
 
 
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_db
 dependencies[] = tripal_db
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv

+ 45 - 31
tripal_analysis/tripal_analysis.install

@@ -5,7 +5,21 @@
  */
  */
 
 
 /**
 /**
- * Implementation of hook_requirements(). 
+ * Disable default views when module is disabled
+ */
+function tripal_analysis_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_analysis.views_default.inc");
+  $views = tripal_analysis_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
+/**
+ * Implementation of hook_requirements().
  */
  */
 function tripal_analysis_requirements($phase) {
 function tripal_analysis_requirements($phase) {
   $requirements = array();
   $requirements = array();
@@ -32,10 +46,10 @@ function tripal_analysis_install() {
 
 
   // we may need the analysisfeatureprop table if it doesn't already exist
   // we may need the analysisfeatureprop table if it doesn't already exist
   tripal_analysis_create_analysisfeatureprop();
   tripal_analysis_create_analysisfeatureprop();
-  
+
   // add cvterms
   // add cvterms
   tripal_analysis_add_cvterms();
   tripal_analysis_add_cvterms();
-  
+
   // add materialized views
   // add materialized views
   tripal_analysis_add_mview_analysis_organism();
   tripal_analysis_add_mview_analysis_organism();
 }
 }
@@ -57,52 +71,52 @@ function tripal_analysis_uninstall() {
   }
   }
 }
 }
 /*
 /*
- * 
+ *
  */
  */
 function tripal_analysis_create_analysisfeatureprop() {
 function tripal_analysis_create_analysisfeatureprop() {
-  
-  // Create analysisfeatureprop table in chado.  This is needed for Chado 
-  // version 1.11, the table exists in Chado 1.2. 
+
+  // Create analysisfeatureprop table in chado.  This is needed for Chado
+  // version 1.11, the table exists in Chado 1.2.
   if (!db_table_exists('chado.analysisfeatureprop')) {
   if (!db_table_exists('chado.analysisfeatureprop')) {
     $sql = "
     $sql = "
       CREATE TABLE chado.analysisfeatureprop (
       CREATE TABLE chado.analysisfeatureprop (
-        analysisfeatureprop_id SERIAL PRIMARY KEY, 
-        analysisfeature_id     INTEGER NOT NULL REFERENCES chado.analysisfeature(analysisfeature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
-        type_id                INTEGER NOT NULL REFERENCES chdo.cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
-        value                  TEXT, 
-        rank                   INTEGER NOT NULL, 
+        analysisfeatureprop_id SERIAL PRIMARY KEY,
+        analysisfeature_id     INTEGER NOT NULL REFERENCES chado.analysisfeature(analysisfeature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+        type_id                INTEGER NOT NULL REFERENCES chdo.cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+        value                  TEXT,
+        rank                   INTEGER NOT NULL,
         CONSTRAINT analysisfeature_id_type_id_rank UNIQUE(analysisfeature_id, type_id, rank)
         CONSTRAINT analysisfeature_id_type_id_rank UNIQUE(analysisfeature_id, type_id, rank)
       )
       )
     ";
     ";
     chado_query($sql);
     chado_query($sql);
-  } 
+  }
 }
 }
 /*
 /*
- * 
+ *
  */
  */
 function tripal_analysis_add_cvterms() {
 function tripal_analysis_add_cvterms() {
-  
+
   tripal_cv_add_cv('tripal_analysis', 'Terms used for managing analyses in Tripal');
   tripal_cv_add_cv('tripal_analysis', 'Terms used for managing analyses in Tripal');
 
 
   // add analysis_date.  This is no longer used (as far as we can tell) but we don't
   // add analysis_date.  This is no longer used (as far as we can tell) but we don't
   // get rid of it in case it is used, so just keep it in the Tripal CV
   // get rid of it in case it is used, so just keep it in the Tripal CV
   $term = array(
   $term = array(
-    'name' => 'analysis_date', 
+    'name' => 'analysis_date',
     'def' => 'The date that an analysis was performed.'
     'def' => 'The date that an analysis was performed.'
   );
   );
   tripal_cv_add_cvterm($term, 'tripal', 0, 1, 'tripal');
   tripal_cv_add_cvterm($term, 'tripal', 0, 1, 'tripal');
-  
+
   // add analysis_short_name.  This is no longer used (as far as we can tell) but we don't
   // add analysis_short_name.  This is no longer used (as far as we can tell) but we don't
   // get rid of it in case it is used, so just keep it in the Tripal CV
   // get rid of it in case it is used, so just keep it in the Tripal CV
   $term = array(
   $term = array(
-    'name' => 'analysis_short_name', 
+    'name' => 'analysis_short_name',
     'def' => 'A computer legible (no spaces or special characters) abbreviation for the analysis.'
     'def' => 'A computer legible (no spaces or special characters) abbreviation for the analysis.'
-  );     
-  tripal_cv_add_cvterm($term, 'tripal', 0, 1 , 'tripal');     
-  
-  
+  );
+  tripal_cv_add_cvterm($term, 'tripal', 0, 1 , 'tripal');
+
+
   // the 'analysis_property' vocabulary is for user definable properties.
   // the 'analysis_property' vocabulary is for user definable properties.
-  tripal_cv_add_cvterm(array('name' => 'Analysis Type', 'def' => 'The type of analysis that was performed.'), 
+  tripal_cv_add_cvterm(array('name' => 'Analysis Type', 'def' => 'The type of analysis that was performed.'),
      'analysis_property', 0, 1, 'tripal');
      'analysis_property', 0, 1, 'tripal');
 }
 }
 
 
@@ -116,7 +130,7 @@ function tripal_analysis_add_cvterms() {
  *     with this module.
  *     with this module.
  */
  */
 function tripal_analysis_schema() {
 function tripal_analysis_schema() {
-  
+
   // chado_analysis table
   // chado_analysis table
   $schema['chado_analysis'] = array(
   $schema['chado_analysis'] = array(
     'fields' => array(
     'fields' => array(
@@ -168,13 +182,13 @@ function tripal_analysis_schema() {
 }
 }
 
 
 /*
 /*
- * 
+ *
  * @ingroup tripal_network
  * @ingroup tripal_network
  */
  */
 function tripal_analysis_add_mview_analysis_organism() {
 function tripal_analysis_add_mview_analysis_organism() {
   $view_name = 'analysis_organism';
   $view_name = 'analysis_organism';
   $comment = t('This view is for associating an organism (via it\'s associated features) to an analysis.');
   $comment = t('This view is for associating an organism (via it\'s associated features) to an analysis.');
-  
+
   // this is the SQL used to identify the organism to which an analsysis
   // this is the SQL used to identify the organism to which an analsysis
   // has been used.  This is obtained though the analysisfeature -> feature -> organism
   // has been used.  This is obtained though the analysisfeature -> feature -> organism
   // joins
   // joins
@@ -185,12 +199,12 @@ function tripal_analysis_add_mview_analysis_organism() {
       INNER JOIN feature F          ON AF.feature_id = F.feature_id
       INNER JOIN feature F          ON AF.feature_id = F.feature_id
       INNER JOIN organism O         ON O.organism_id = F.organism_id
       INNER JOIN organism O         ON O.organism_id = F.organism_id
   ";
   ";
-  
+
   // the schema array for describing this view
   // the schema array for describing this view
   $schema = array(
   $schema = array(
     'table' => $view_name,
     'table' => $view_name,
     'description' => $comment,
     'description' => $comment,
-    'fields' => array(  
+    'fields' => array(
       'analysis_id' => array(
       'analysis_id' => array(
         'type' => 'int',
         'type' => 'int',
         'not null' => TRUE,
         'not null' => TRUE,
@@ -198,7 +212,7 @@ function tripal_analysis_add_mview_analysis_organism() {
       'organism_id' => array(
       'organism_id' => array(
         'type' => 'int',
         'type' => 'int',
         'not null' => TRUE,
         'not null' => TRUE,
-      ),       
+      ),
     ),
     ),
     'indexes' => array(
     'indexes' => array(
       'networkmod_qtl_indx0' => array('analysis_id'),
       'networkmod_qtl_indx0' => array('analysis_id'),
@@ -216,10 +230,10 @@ function tripal_analysis_add_mview_analysis_organism() {
         'columns' => array(
         'columns' => array(
           'organism_id' => 'organism_id',
           'organism_id' => 'organism_id',
         ),
         ),
-      ),      
+      ),
     ),
     ),
   );
   );
-  
+
   // add the view
   // add the view
   tripal_add_mview($view_name, 'tripal_analysis', $schema, $sql, $comment);
   tripal_add_mview($view_name, 'tripal_analysis', $schema, $sql, $comment);
 }
 }

+ 19 - 15
tripal_analysis/tripal_analysis.module

@@ -56,11 +56,12 @@ function tripal_analysis_node_info() {
  * @ingroup tripal_analysis
  * @ingroup tripal_analysis
  */
  */
 function tripal_analysis_menu() {
 function tripal_analysis_menu() {
-  
+
   // Tripal Analysis administrative settings
   // Tripal Analysis administrative settings
   $items['admin/tripal/chado/tripal_analysis'] = array(
   $items['admin/tripal/chado/tripal_analysis'] = array(
     'title' => 'Analyses',
     'title' => 'Analyses',
     'description' => 'A bioinformatics analysis producing features.',
     'description' => 'A bioinformatics analysis producing features.',
+    'page callback' => 'tripal_analysis_admin_analysis_view',
     'access arguments' => array('administer tripal analyses'),
     'access arguments' => array('administer tripal analyses'),
     'type' => MENU_NORMAL_ITEM,
     'type' => MENU_NORMAL_ITEM,
   );
   );
@@ -71,25 +72,28 @@ function tripal_analysis_menu() {
     'page callback' => 'theme',
     'page callback' => 'theme',
     'page arguments' => array('tripal_analysis_help'),
     'page arguments' => array('tripal_analysis_help'),
     'access arguments' => array('administer tripal analyses'),
     'access arguments' => array('administer tripal analyses'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10,
   );
   );
 
 
   $items['admin/tripal/chado/tripal_analysis/configuration'] = array(
   $items['admin/tripal/chado/tripal_analysis/configuration'] = array(
-    'title' => 'Configuration',
+    'title' => 'Settings',
     'description' => 'Settings for the displays of analysis results.',
     'description' => 'Settings for the displays of analysis results.',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_analysis_admin'),
     'page arguments' => array('tripal_analysis_admin'),
     'access arguments' => array('administer tripal analyses'),
     'access arguments' => array('administer tripal analyses'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 5
   );
   );
-  
+
   $items['admin/tripal/chado/tripal_analysis/sync'] = array(
   $items['admin/tripal/chado/tripal_analysis/sync'] = array(
-    'title' => 'Sync Analyses',
+    'title' => 'Sync',
     'description' => 'Sync Chado analyses with Drupal.',
     'description' => 'Sync Chado analyses with Drupal.',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_analysis_sync_form'),
     'page arguments' => array('tripal_analysis_sync_form'),
     'access arguments' => array('administer tripal analyses'),
     'access arguments' => array('administer tripal analyses'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 0
   );
   );
 
 
   return $items;
   return $items;
@@ -177,7 +181,7 @@ function tripal_analysis_theme($existing, $type, $theme, $path) {
     'chado_analysis_form' => array(
     'chado_analysis_form' => array(
       'render element' => 'form',
       'render element' => 'form',
     )
     )
-    
+
   );
   );
 
 
   return $items;
   return $items;
@@ -284,19 +288,19 @@ function chado_analysis_insert($node) {
   $node->sourcename = trim($node->sourcename);
   $node->sourcename = trim($node->sourcename);
   $node->sourceversion = trim($node->sourceversion);
   $node->sourceversion = trim($node->sourceversion);
   $node->sourceuri = trim($node->sourceuri);
   $node->sourceuri = trim($node->sourceuri);
-  
+
   // if there is an analysis_id in the $node object then this must be a sync so
   // if there is an analysis_id in the $node object then this must be a sync so
   // we can skip adding the analysis as it is already there, although
   // we can skip adding the analysis as it is already there, although
   // we do need to proceed with the rest of the insert
   // we do need to proceed with the rest of the insert
   if (!property_exists($node,'analysis_id')) {
   if (!property_exists($node,'analysis_id')) {
-    
+
     // Create a timestamp so we can insert it into the chado database
     // Create a timestamp so we can insert it into the chado database
     $time  = $node->timeexecuted;
     $time  = $node->timeexecuted;
     $month = $time['month'];
     $month = $time['month'];
     $day   = $time['day'];
     $day   = $time['day'];
     $year  = $time['year'];
     $year  = $time['year'];
     $timestamp = $month . '/' . $day . '/' . $year;
     $timestamp = $month . '/' . $day . '/' . $year;
-    
+
     // insert and then get the newly inserted analysis record
     // insert and then get the newly inserted analysis record
     $values = array(
     $values = array(
       'name'           => $node->analysisname,
       'name'           => $node->analysisname,
@@ -321,10 +325,10 @@ function chado_analysis_insert($node) {
   else {
   else {
     $analysis_id = $node->analysis_id;
     $analysis_id = $node->analysis_id;
   }
   }
-  
+
   // Make sure the entry for this analysis doesn't already exist in the
   // Make sure the entry for this analysis doesn't already exist in the
   // chado_analysis table if it doesn't exist then we want to add it.
   // chado_analysis table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('analysis', $node->nid);  
+  $check_org_id = chado_get_id_for_node('analysis', $node->nid);
   if (!$check_org_id) {
   if (!$check_org_id) {
     $record = new stdClass();
     $record = new stdClass();
     $record->nid = $node->nid;
     $record->nid = $node->nid;
@@ -435,7 +439,7 @@ function chado_analysis_update($node) {
   $node->sourcename = trim($node->sourcename);
   $node->sourcename = trim($node->sourcename);
   $node->sourceversion = trim($node->sourceversion);
   $node->sourceversion = trim($node->sourceversion);
   $node->sourceuri = trim($node->sourceuri);
   $node->sourceuri = trim($node->sourceuri);
-    
+
   if ($node->revision) {
   if ($node->revision) {
     // TODO -- decide what to do about revisions
     // TODO -- decide what to do about revisions
   }
   }
@@ -586,7 +590,7 @@ function chado_analysis_load($nodes) {
     // build the analysis variable
     // build the analysis variable
     $values = array('analysis_id' => $analysis_id);
     $values = array('analysis_id' => $analysis_id);
     $analysis = tripal_core_generate_chado_var('analysis', $values);
     $analysis = tripal_core_generate_chado_var('analysis', $values);
-    
+
 
 
     // add in the description field
     // add in the description field
     $analysis = tripal_core_expand_chado_vars($analysis, 'field', 'analysis.description');
     $analysis = tripal_core_expand_chado_vars($analysis, 'field', 'analysis.description');

+ 0 - 421
tripal_analysis/tripal_analysis.views.inc

@@ -14,424 +14,3 @@
  * @defgroup tripal_analysis_views Analysis Views Integration
  * @defgroup tripal_analysis_views Analysis Views Integration
  * @ingroup views
  * @ingroup views
  */
  */
-
-/**
- * Implements hook_views_default_views().
- *
- * @ingroup tripal_analysis_views
- */
-function tripal_analysis_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // Main default view
-  $view = new view;
-  $view->name = 'analysis_listing';
-  $view->description = 'A default listing of analyses provided by Tripal';
-  $view->tag = 'chado default';
-  $view->base_table = 'analysis';
-  $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',
-      '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,
-      'link_to_node' => 1,
-      'id' => 'name',
-      'table' => 'analysis',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-    'program' => array(
-      'label' => 'Program',
-      '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,
-      'exclude' => 0,
-      'id' => 'program',
-      'table' => 'analysis',
-      'field' => 'program',
-      'relationship' => 'none',
-    ),
-    'sourcename' => array(
-      'label' => 'Source',
-      '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,
-      'exclude' => 0,
-      'id' => 'sourcename',
-      'table' => 'analysis',
-      'field' => 'sourcename',
-      'relationship' => 'none',
-    ),
-    'timeexecuted' => array(
-      'label' => 'Time Executed',
-      '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,
-      'date_format' => 'custom',
-      'custom_date_format' => 'F j, Y',
-      'exclude' => 0,
-      'id' => 'timeexecuted',
-      'table' => 'analysis',
-      'field' => 'timeexecuted',
-      'override' => array(
-        'button' => 'Override',
-      ),
-      '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 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.',
-    ),
-    'program' => array(
-      'operator' => '=',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'program_op',
-        'identifier' => 'program',
-        'label' => 'Program',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'program',
-      'table' => 'analysis',
-      'field' => 'program',
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 1,
-      'optional' => 0,
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 0,
-      ),
-    ),
-    'timeexecuted' => array(
-      '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,
-      ),
-      'id' => 'timeexecuted',
-      'table' => 'analysis',
-      'field' => 'timeexecuted',
-      'relationship' => 'none',
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 0,
-      ),
-    ),
-    'name' => array(
-      'operator' => '~',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'name_op',
-        'identifier' => 'name',
-        'label' => 'Name Contains',
-        'bef_filter_description' => '',
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'name',
-      'table' => 'analysis',
-      'field' => 'name',
-      'relationship' => 'none',
-      'values_form_type' => 'textfield',
-      'multiple' => 0,
-      'optional' => 0,
-    ),
-    'sourcename' => array(
-      'operator' => '~',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'sourcename_op',
-        'identifier' => 'sourcename',
-        'label' => 'Source Contains',
-        'bef_filter_description' => '',
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'sourcename',
-      'table' => 'analysis',
-      'field' => 'sourcename',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_analysis content',
-  ));
-  $handler->override_option('cache', array(
-    '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 analyses match the supplied criteria.');
-  $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(
-    'grouping' => '',
-    'override' => 1,
-    'sticky' => 0,
-    'order' => 'asc',
-    'summary' => '',
-    'columns' => array(
-      'name' => 'name',
-      'program' => 'program',
-      'sourcename' => 'sourcename',
-      'num_features' => 'num_features',
-      'timeexecuted' => 'timeexecuted',
-    ),
-    'info' => array(
-      'name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'program' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'sourcename' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'num_features' => array(
-        'separator' => '',
-      ),
-      'timeexecuted' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-    ),
-    'default' => 'name',
-  ));
-  // this is needed so that fields/filters can be added to the default display later
-  $default_handler = $handler;
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/analyses');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Analyses',
-    'description' => 'An analysis is a particular type of a computational analysis; it may be a blast of one sequence against another, or an all by all blast, or a different kind of analysis altogether. It is a single unit of computation.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        '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,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Adds analysis => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Analysis to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_analysis',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Change analysis.name to have a link to the node
-    $fields['name']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Only show records with published nodes
-    /**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-    */
-  }
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 195 - 0
tripal_analysis/tripal_analysis.views_default.inc

@@ -0,0 +1,195 @@
+<?php
+
+/**
+ * Implements hook_views_default_views().
+ *
+ * @ingroup tripal_analysis_views
+ */
+function tripal_analysis_views_default_views() {
+  $views = array();
+
+  $view = tripal_analysis_defaultvalue_admin_analysis();
+  $views[$view->name] = $view;
+
+  return $views;
+}
+
+function tripal_analysis_defaultvalue_admin_analysis() {
+
+  $view = new view();
+  $view->name = 'tripal_analysis_admin_analyses';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
+  $view->base_table = 'analysis';
+  $view->human_name = 'Analysis Admin';
+  $view->core = 0;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Defaults */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->display->display_options['title'] = 'Analysis';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'perm';
+  $handler->display->display_options['access']['perm'] = 'access chado_analysis content';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
+  $handler->display->display_options['pager']['options']['offset'] = '0';
+  $handler->display->display_options['pager']['options']['id'] = '0';
+  $handler->display->display_options['pager']['options']['quantity'] = '9';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['grouping'] = '';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'name' => 'name',
+    'program' => 'program',
+    'sourcename' => 'sourcename',
+    'num_features' => 'num_features',
+    'timeexecuted' => 'timeexecuted',
+  );
+  $handler->display->display_options['style_options']['default'] = 'name';
+  $handler->display->display_options['style_options']['info'] = array(
+    'name' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'program' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'sourcename' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'num_features' => array(
+      'separator' => '',
+    ),
+    'timeexecuted' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+  );
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Analysis',
+    'path-1' => 'node/add/tripal-analysis',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => '',
+    'path-2' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+    'label-3' => '',
+    'path-3' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+    'label-4' => '',
+    'path-4' => '',
+  );
+  /* No results behavior: Global: Text area */
+  $handler->display->display_options['empty']['text']['id'] = 'text';
+  $handler->display->display_options['empty']['text']['table'] = 'views';
+  $handler->display->display_options['empty']['text']['field'] = 'area';
+  $handler->display->display_options['empty']['text']['empty'] = TRUE;
+  $handler->display->display_options['empty']['text']['content'] = 'No analyses match the supplied criteria.';
+  $handler->display->display_options['empty']['text']['format'] = 'full_html';
+  /* Relationship: Analysis: Analysis => Node */
+  $handler->display->display_options['relationships']['analysis_id']['id'] = 'analysis_id';
+  $handler->display->display_options['relationships']['analysis_id']['table'] = 'chado_analysis';
+  $handler->display->display_options['relationships']['analysis_id']['field'] = 'analysis_id';
+  /* Field: Content: Nid */
+  $handler->display->display_options['fields']['nid']['id'] = 'nid';
+  $handler->display->display_options['fields']['nid']['table'] = 'node';
+  $handler->display->display_options['fields']['nid']['field'] = 'nid';
+  $handler->display->display_options['fields']['nid']['relationship'] = 'analysis_id';
+  $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
+  /* Field: Chado Analysis: Name */
+  $handler->display->display_options['fields']['name']['id'] = 'name';
+  $handler->display->display_options['fields']['name']['table'] = 'analysis';
+  $handler->display->display_options['fields']['name']['field'] = 'name';
+  /* Field: Chado Analysis: Program */
+  $handler->display->display_options['fields']['program']['id'] = 'program';
+  $handler->display->display_options['fields']['program']['table'] = 'analysis';
+  $handler->display->display_options['fields']['program']['field'] = 'program';
+  /* Field: Chado Analysis: Sourcename */
+  $handler->display->display_options['fields']['sourcename']['id'] = 'sourcename';
+  $handler->display->display_options['fields']['sourcename']['table'] = 'analysis';
+  $handler->display->display_options['fields']['sourcename']['field'] = 'sourcename';
+  $handler->display->display_options['fields']['sourcename']['label'] = 'Source';
+  /* Field: Content: Delete link */
+  $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['relationship'] = 'analysis_id';
+  $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
+  /* Field: Content: Edit link */
+  $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['relationship'] = 'analysis_id';
+  $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['label'] = '';
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node]   [delete_node]';
+  $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
+  /* Filter criterion: Chado Analysis: Name */
+  $handler->display->display_options['filters']['name']['id'] = 'name';
+  $handler->display->display_options['filters']['name']['table'] = 'analysis';
+  $handler->display->display_options['filters']['name']['field'] = 'name';
+  $handler->display->display_options['filters']['name']['operator'] = '~';
+  $handler->display->display_options['filters']['name']['group'] = 1;
+  $handler->display->display_options['filters']['name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
+  $handler->display->display_options['filters']['name']['expose']['label'] = 'Name Contains';
+  $handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
+  $handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
+  /* Filter criterion: Chado Analysis: Program */
+  $handler->display->display_options['filters']['program']['id'] = 'program';
+  $handler->display->display_options['filters']['program']['table'] = 'analysis';
+  $handler->display->display_options['filters']['program']['field'] = 'program';
+  $handler->display->display_options['filters']['program']['operator'] = 'contains';
+  $handler->display->display_options['filters']['program']['group'] = 1;
+  $handler->display->display_options['filters']['program']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['program']['expose']['operator_id'] = 'program_op';
+  $handler->display->display_options['filters']['program']['expose']['label'] = 'Program Name Contains';
+  $handler->display->display_options['filters']['program']['expose']['operator'] = 'program_op';
+  $handler->display->display_options['filters']['program']['expose']['identifier'] = 'program';
+  $handler->display->display_options['filters']['program']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Analysis: Sourcename */
+  $handler->display->display_options['filters']['sourcename']['id'] = 'sourcename';
+  $handler->display->display_options['filters']['sourcename']['table'] = 'analysis';
+  $handler->display->display_options['filters']['sourcename']['field'] = 'sourcename';
+  $handler->display->display_options['filters']['sourcename']['operator'] = '~';
+  $handler->display->display_options['filters']['sourcename']['group'] = 1;
+  $handler->display->display_options['filters']['sourcename']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['sourcename']['expose']['operator_id'] = 'sourcename_op';
+  $handler->display->display_options['filters']['sourcename']['expose']['label'] = 'Source Contains';
+  $handler->display->display_options['filters']['sourcename']['expose']['operator'] = 'sourcename_op';
+  $handler->display->display_options['filters']['sourcename']['expose']['identifier'] = 'sourcename';
+
+  /* Display: Page */
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_analysis/analysis';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Analyses';
+  $handler->display->display_options['menu']['weight'] = '-10';
+  $handler->display->display_options['menu']['context'] = 0;
+  $handler->display->display_options['menu']['context_only_inline'] = 0;
+  $handler->display->display_options['tab_options']['weight'] = '0';
+
+  return $view;
+}

+ 1 - 0
tripal_bulk_loader/tripal_bulk_loader.info

@@ -6,3 +6,4 @@ package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
 
 
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views

+ 14 - 0
tripal_bulk_loader/tripal_bulk_loader.install

@@ -4,6 +4,20 @@
  * @todo Add file header description
  * @todo Add file header description
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_bulk_loader_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_bulk_loader.views_default.inc");
+  $views = tripal_bulk_loader_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implements hook_schema
  * Implements hook_schema
  *
  *

+ 39 - 23
tripal_bulk_loader/tripal_bulk_loader.views_default.inc

@@ -23,7 +23,7 @@ function tripal_bulk_loader_defaultview_admin_job_listing() {
 
 
   $view = new view();
   $view = new view();
   $view->name = 'tripal_bulk_loading_jobs';
   $view->name = 'tripal_bulk_loading_jobs';
-  $view->description = 'Administration of Tripal Bulk Loading Jobs (add, edit, delete).';
+  $view->description = 'DO NOT DISABLE';
   $view->tag = 'tripal admin';
   $view->tag = 'tripal admin';
   $view->base_table = 'tripal_bulk_loader';
   $view->base_table = 'tripal_bulk_loader';
   $view->human_name = 'Tripal Bulk Loading Jobs';
   $view->human_name = 'Tripal Bulk Loading Jobs';
@@ -102,16 +102,28 @@ function tripal_bulk_loader_defaultview_admin_job_listing() {
       'empty_column' => 0,
       'empty_column' => 0,
     ),
     ),
   );
   );
-  /* Header: Global: Text area */
-  $handler->display->display_options['header']['area']['id'] = 'area';
-  $handler->display->display_options['header']['area']['table'] = 'views';
-  $handler->display->display_options['header']['area']['field'] = 'area';
-  $handler->display->display_options['header']['area']['label'] = 'Add Job';
-  $handler->display->display_options['header']['area']['empty'] = TRUE;
-  $handler->display->display_options['header']['area']['content'] = '<ul class="action-links">
-    <li><a href="../../../../node/add/tripal-bulk-loader">Add Bulk Loading Job</a></li>
-    </ul>';
-  $handler->display->display_options['header']['area']['format'] = 'full_html';
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Bulk Loading Job',
+    'path-1' => 'node/add/tripal-bulk-loader',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => '',
+    'path-2' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+    'label-3' => '',
+    'path-3' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+    'label-4' => '',
+    'path-4' => '',
+  );
   /* No results behavior: Global: Text area */
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['area']['id'] = 'area';
   $handler->display->display_options['empty']['area']['id'] = 'area';
   $handler->display->display_options['empty']['area']['table'] = 'views';
   $handler->display->display_options['empty']['area']['table'] = 'views';
@@ -251,6 +263,7 @@ function tripal_bulk_loader_defaultview_admin_job_listing() {
   $handler->display->display_options['menu']['context_only_inline'] = 0;
   $handler->display->display_options['menu']['context_only_inline'] = 0;
   $handler->display->display_options['tab_options']['weight'] = '0';
   $handler->display->display_options['tab_options']['weight'] = '0';
 
 
+
   return $view;
   return $view;
 }
 }
 
 
@@ -261,7 +274,7 @@ function tripal_bulk_loader_defaultview_admin_template_listing() {
 
 
   $view = new view();
   $view = new view();
   $view->name = 'tripal_bulk_loader_templates';
   $view->name = 'tripal_bulk_loader_templates';
-  $view->description = 'Administration of Tripal Bulk Loading Templates (add, import, edit, delete, export).';
+  $view->description = 'DO NOT DISABLE';
   $view->tag = 'tripal admin';
   $view->tag = 'tripal admin';
   $view->base_table = 'tripal_bulk_loader_template';
   $view->base_table = 'tripal_bulk_loader_template';
   $view->human_name = 'Tripal Bulk Loader Templates';
   $view->human_name = 'Tripal Bulk Loader Templates';
@@ -282,17 +295,20 @@ function tripal_bulk_loader_defaultview_admin_template_listing() {
   $handler->display->display_options['pager']['type'] = 'full';
   $handler->display->display_options['pager']['type'] = 'full';
   $handler->display->display_options['pager']['options']['items_per_page'] = '25';
   $handler->display->display_options['pager']['options']['items_per_page'] = '25';
   $handler->display->display_options['style_plugin'] = 'table';
   $handler->display->display_options['style_plugin'] = 'table';
-  /* Header: Global: Text area */
-  $handler->display->display_options['header']['area']['id'] = 'area';
-  $handler->display->display_options['header']['area']['table'] = 'views';
-  $handler->display->display_options['header']['area']['field'] = 'area';
-  $handler->display->display_options['header']['area']['label'] = 'Add Template';
-  $handler->display->display_options['header']['area']['empty'] = TRUE;
-  $handler->display->display_options['header']['area']['content'] = '<ul class="action-links">
-      <li><a href="template/create">Add Template</a></li>
-      <li><a href="templates/import">Import Template</a></li>
-      </ul>';
-  $handler->display->display_options['header']['area']['format'] = 'full_html';
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Template',
+    'path-1' => 'admin/tripal/loaders/bulk/template/create',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => 'Import Template',
+    'path-2' => 'admin/tripal/loaders/bulk/templates/import',
+  );
   /* Field: Tripal Bulk Loader Templates: Name */
   /* Field: Tripal Bulk Loader Templates: Name */
   $handler->display->display_options['fields']['name']['id'] = 'name';
   $handler->display->display_options['fields']['name']['id'] = 'name';
   $handler->display->display_options['fields']['name']['table'] = 'tripal_bulk_loader_template';
   $handler->display->display_options['fields']['name']['table'] = 'tripal_bulk_loader_template';

+ 38 - 3
tripal_contact/includes/tripal_contact.admin.inc

@@ -1,4 +1,39 @@
 <?php
 <?php
+
+/**
+ *
+ */
+function tripal_contact_admin_contact_view() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado', 'admin/tripal/chado');
+  $breadcrumb[] = l('Contacts', 'admin/tripal/chado/tripal_contact');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_contact_admin_contacts','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Contact module uses primarily views to provide an '
+      . 'administrative interface. Currently one or more views needed for this '
+      . 'administrative interface are disabled. <strong>Click each of the following links to '
+      . 'enable the pertinent views</strong>:</p>';
+    $output .= '<ul>';
+      $output .= '<li>'.l('Contacts View', 'admin/tripal/chado/tripal_contact/views/contacts/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
+
+
 /**
 /**
  * Administrative settings form
  * Administrative settings form
  *
  *
@@ -18,7 +53,7 @@ function tripal_contact_admin() {
   // add the field set for syncing maps
   // add the field set for syncing maps
   if (!$active_jobs) {
   if (!$active_jobs) {
     get_tripal_contact_admin_form_cleanup_set($form);
     get_tripal_contact_admin_form_cleanup_set($form);
-// TODO: complete coding of indexing and taxonomy assignment to features.    
+// TODO: complete coding of indexing and taxonomy assignment to features.
 //    get_tripal_contact_admin_form_reindex_set($form);
 //    get_tripal_contact_admin_form_reindex_set($form);
 //    get_tripal_contact_admin_form_taxonomy_set($form);
 //    get_tripal_contact_admin_form_taxonomy_set($form);
   }
   }
@@ -125,7 +160,7 @@ function tripal_contact_admin_validate($form, &$form_state) {
       }
       }
     }
     }
   }
   }
-  
+
   // -------------------------------------
   // -------------------------------------
   // Submit the Cleanup Job if selected
   // Submit the Cleanup Job if selected
   if ($form_state['values']['op'] == t('Clean up orphaned maps')) {
   if ($form_state['values']['op'] == t('Clean up orphaned maps')) {
@@ -148,7 +183,7 @@ function tripal_contact_admin_validate($form, &$form_state) {
 function tripal_contact_cleanup($dummy = NULL, $job_id = NULL) {
 function tripal_contact_cleanup($dummy = NULL, $job_id = NULL) {
 
 
   return tripal_core_clean_orphaned_nodes('contact', $job_id);
   return tripal_core_clean_orphaned_nodes('contact', $job_id);
-  
+
 }
 }
 /**
 /**
  * Add the map as a taxonomy term for associating with map_features
  * Add the map as a taxonomy term for associating with map_features

+ 0 - 0
tripal_contact/theme/tripal_contact_admin.tpl.php → tripal_contact/theme/tripal_contact_help.tpl.php


+ 2 - 0
tripal_contact/tripal_contact.info

@@ -4,5 +4,7 @@ core = 7.x
 project = tripal_contact
 project = tripal_contact
 package = Tripal
 package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
+
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv

+ 18 - 4
tripal_contact/tripal_contact.install

@@ -10,6 +10,20 @@
  * multiple contact/mysql instances as well as manage and create such contact instances
  * multiple contact/mysql instances as well as manage and create such contact instances
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_contact_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_contact.views_default.inc");
+  $views = tripal_contact_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  *
  *
@@ -33,13 +47,13 @@ function tripal_contact_requirements($phase) {
  * Implementation of hook_install().
  * Implementation of hook_install().
  */
  */
 function tripal_contact_install() {
 function tripal_contact_install() {
-	
+
 	// create the module's data directory
 	// create the module's data directory
   tripal_create_moddir('tripal_contact');
   tripal_create_moddir('tripal_contact');
-  
+
   // add the contactprop table to Chado
   // add the contactprop table to Chado
   tripal_contact_add_custom_tables();
   tripal_contact_add_custom_tables();
-  
+
   // add loading of the the tripal contact ontology to the job queue
   // add loading of the the tripal contact ontology to the job queue
   $obo_path = drupal_realpath(drupal_get_path('module', 'tripal_contact') . '/files/tcontact.obo');
   $obo_path = drupal_realpath(drupal_get_path('module', 'tripal_contact') . '/files/tcontact.obo');
   $obo_id = tripal_cv_add_obo_ref('Tripal Contacts', $obo_path);
   $obo_id = tripal_cv_add_obo_ref('Tripal Contacts', $obo_path);
@@ -91,7 +105,7 @@ function tripal_contact_schema() {
 
 
 
 
 /*
 /*
- * 
+ *
  */
  */
 function tripal_contact_add_custom_tables(){
 function tripal_contact_add_custom_tables(){
   $schema = array (
   $schema = array (

+ 72 - 62
tripal_contact/tripal_contact.module

@@ -49,7 +49,7 @@ function tripal_contact_views_api() {
 function tripal_contact_init() {
 function tripal_contact_init() {
   drupal_add_js(drupal_get_path('module', 'tripal_contact') . '/theme/js/tripal_contact.js');
   drupal_add_js(drupal_get_path('module', 'tripal_contact') . '/theme/js/tripal_contact.js');
   drupal_add_css(drupal_get_path('module', 'tripal_contact') . '/theme/css/tripal_contact.css');
   drupal_add_css(drupal_get_path('module', 'tripal_contact') . '/theme/css/tripal_contact.css');
-    
+
 }
 }
 
 
 /**
 /**
@@ -87,34 +87,44 @@ function tripal_contact_menu() {
 
 
   $items = array();
   $items = array();
 
 
-  $items[ 'admin/tripal/tripal_contact' ]= array(
+  $items['admin/tripal/chado/tripal_contact']= array(
     'title' => 'Contacts',
     'title' => 'Contacts',
-    'description' => ('A module for interfacing the GMOD chado database with Drupal, providing viewing of contacts'),
-    'page callback' => 'theme',
-    'page arguments' => array('tripal_contact_admin'),
+    'description' => ('Model persons, institutes, groups, organizations, etc.'),
+    'page callback' => 'tripal_contact_admin_contact_view',
     'access arguments' => array('administer tripal contacts'),
     'access arguments' => array('administer tripal contacts'),
     'type' => MENU_NORMAL_ITEM
     'type' => MENU_NORMAL_ITEM
   );
   );
-  
-  $items['admin/tripal/tripal_contact/configuration'] = array(
-    'title' => 'Configuration',
+
+  $items['admin/tripal/chado/tripal_contact/configuration'] = array(
+    'title' => 'Settings',
     'description' => 'Integration of Chado contacts.',
     'description' => 'Integration of Chado contacts.',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_contact_admin'),
     'page arguments' => array('tripal_contact_admin'),
     'access arguments' => array('administer tripal contact'),
     'access arguments' => array('administer tripal contact'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 5
+  );
+
+  $items['admin/tripal/chado/tripal_contact/help']= array(
+    'title' => 'Help',
+    'description' => ('Help with the contact module.'),
+    'page callback' => 'theme',
+    'page arguments' => array('tripal_contact_help'),
+    'access arguments' => array('administer tripal contacts'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10
   );
   );
-  
-  
-  $items['admin/tripal/tripal_contact/sync'] = array(
-    'title' => ' Sync Contacts',
+
+  $items['admin/tripal/chado/tripal_contact/sync'] = array(
+    'title' => ' Sync',
     'description' => 'Sync contacts in Chado with Drupal',
     'description' => 'Sync contacts in Chado with Drupal',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_contact_sync_form'),
     'page arguments' => array('tripal_contact_sync_form'),
     'access arguments' => array('administer tripal contacts'),
     'access arguments' => array('administer tripal contacts'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 0
   );
   );
-  
+
   // AJAX calls for adding/removing properties to a contact
   // AJAX calls for adding/removing properties to a contact
   $items['tripal_contact/properties/add'] = array(
   $items['tripal_contact/properties/add'] = array(
     'page callback' => 'tripal_contact_property_add',
     'page callback' => 'tripal_contact_property_add',
@@ -132,10 +142,10 @@ function tripal_contact_menu() {
     'access arguments' => array('edit chado_contact content'),
     'access arguments' => array('edit chado_contact content'),
     'type ' => MENU_CALLBACK,
     'type ' => MENU_CALLBACK,
   );
   );
-  
+
   return $items;
   return $items;
 }
 }
-  
+
 /**
 /**
  * Implements hook_theme(): Register themeing functions for this module
  * Implements hook_theme(): Register themeing functions for this module
  *
  *
@@ -163,12 +173,12 @@ function tripal_contact_theme() {
       'arguments' => array('node' => NULL),
       'arguments' => array('node' => NULL),
       'template' => 'tripal_contact_publications',
       'template' => 'tripal_contact_publications',
     ),
     ),
-    'tripal_contact_admin' => array(
-      'template' => 'tripal_contact_admin',  
-      'arguments' =>  array(NULL),  
-      'path' => drupal_get_path('module', 'tripal_contact') . '/theme' 
+    'tripal_contact_help' => array(
+      'template' => 'tripal_contact_help',
+      'arguments' =>  array(NULL),
+      'path' => drupal_get_path('module', 'tripal_contact') . '/theme'
     ),
     ),
-    
+
     // Themed Forms
     // Themed Forms
     'chado_contact_node_form' => array(
     'chado_contact_node_form' => array(
       'arguments' => array('form'),
       'arguments' => array('form'),
@@ -263,7 +273,7 @@ function tripal_contact_permissions() {
  *  @param $node
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
  *  type of node to be created
- *  
+ *
  *  @param $op
  *  @param $op
  *  The operation to be performed
  *  The operation to be performed
  *
  *
@@ -273,7 +283,7 @@ function tripal_contact_permissions() {
  *  @return
  *  @return
  *  If the permission for the specified operation is not set then return FALSE. If the
  *  If the permission for the specified operation is not set then return FALSE. If the
  *  permission is set then return NULL as this allows other modules to disable
  *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always 
+ *  access.  The only exception is when the $op == 'create'.  We will always
  *  return TRUE if the permission is set.
  *  return TRUE if the permission is set.
  *
  *
  */
  */
@@ -317,8 +327,8 @@ function chado_contact_node_access($node, $op, $account ) {
  *
  *
  */
  */
 function chado_contact_insert($node) {
 function chado_contact_insert($node) {
- 
-  // if a contact_id already exists for this node then it already exists in Chado and 
+
+  // if a contact_id already exists for this node then it already exists in Chado and
   // we get here because we are syncing the node.  Therefore, we can skip the insert
   // we get here because we are syncing the node.  Therefore, we can skip the insert
   if ($node->contact_id) {
   if ($node->contact_id) {
     $contact['contact_id'] = $node->contact_id;
     $contact['contact_id'] = $node->contact_id;
@@ -336,12 +346,12 @@ function chado_contact_insert($node) {
     if (!$contact) {
     if (!$contact) {
       drupal_set_message(t('Could not add the contact'), 'error');
       drupal_set_message(t('Could not add the contact'), 'error');
       watchdog('tripal_contact','Could not add the contact', array(), WATCHDOG_ERROR);
       watchdog('tripal_contact','Could not add the contact', array(), WATCHDOG_ERROR);
-      return FALSE; 
+      return FALSE;
     }
     }
-    
+
     // now add the properties
     // now add the properties
     $properties = array(); // stores all of the properties we need to add
     $properties = array(); // stores all of the properties we need to add
-  
+
     // get the list of properties for easy lookup (without doing lots of database queries
     // get the list of properties for easy lookup (without doing lots of database queries
     $properties_list = array();
     $properties_list = array();
     $sql = "
     $sql = "
@@ -350,16 +360,16 @@ function chado_contact_insert($node) {
         INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
         INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
         INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
         INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
         INNER JOIN {cv} CV       ON CVTO.cv_id = CV.cv_id
         INNER JOIN {cv} CV       ON CVTO.cv_id = CV.cv_id
-      WHERE 
-        CV.name = 'tripal_contact' AND 
-        NOT CVTO.name = 'Contact Type' 
-      ORDER BY CVTS.name ASC 
+      WHERE
+        CV.name = 'tripal_contact' AND
+        NOT CVTO.name = 'Contact Type'
+      ORDER BY CVTS.name ASC
     ";
     ";
     $prop_types = chado_query($sql);
     $prop_types = chado_query($sql);
     while ($prop = $prop_types->fetchObject()) {
     while ($prop = $prop_types->fetchObject()) {
       $properties_list[$prop->cvterm_id] = $prop->name;
       $properties_list[$prop->cvterm_id] = $prop->name;
-    }   
-  
+    }
+
     // get the properties that should be added. Properties are in one of two forms:
     // get the properties that should be added. Properties are in one of two forms:
     //  1) prop_value-[type id]-[index]
     //  1) prop_value-[type id]-[index]
     //  2) new_value-[type id]-[index]
     //  2) new_value-[type id]-[index]
@@ -377,11 +387,11 @@ function chado_contact_insert($node) {
       $index = count($properties[$name]);
       $index = count($properties[$name]);
       $name = $properties_list[$type_id];
       $name = $properties_list[$type_id];
       $properties[$name][$index] = trim($node->new_value);
       $properties[$name][$index] = trim($node->new_value);
-    } 
+    }
     // now add in the properties
     // now add in the properties
     foreach ($properties as $property => $elements) {
     foreach ($properties as $property => $elements) {
       foreach ($elements as $rank => $value) {
       foreach ($elements as $rank => $value) {
-         
+
         $status = tripal_contact_insert_property($contact['contact_id'], $property, $value, FALSE);
         $status = tripal_contact_insert_property($contact['contact_id'], $property, $value, FALSE);
         if (!$status) {
         if (!$status) {
           drupal_set_message("Error cannot add property: $property", "error");
           drupal_set_message("Error cannot add property: $property", "error");
@@ -389,16 +399,16 @@ function chado_contact_insert($node) {
           array('%property' => $property), WATCHDOG_ERROR);
           array('%property' => $property), WATCHDOG_ERROR);
         }
         }
       }
       }
-    } 
+    }
   }
   }
 
 
   // add the record to the chado_contact table in Drupal
   // add the record to the chado_contact table in Drupal
-  if ($contact) {   
-   
+  if ($contact) {
+
     // add the description property
     // add the description property
     tripal_contact_insert_property($contact['contact_id'], 'contact_description',
     tripal_contact_insert_property($contact['contact_id'], 'contact_description',
       $node->description, TRUE);
       $node->description, TRUE);
-    
+
     // make sure the entry for this contact doesn't already exist in the chado_contact table
     // make sure the entry for this contact doesn't already exist in the chado_contact table
     // if it doesn't exist then we want to add it.
     // if it doesn't exist then we want to add it.
     $contact_id = chado_get_id_for_node('contact', $node->nid) ;
     $contact_id = chado_get_id_for_node('contact', $node->nid) ;
@@ -435,17 +445,17 @@ function chado_contact_update($node) {
     // there is no way to handle revisions in Chado but leave
     // there is no way to handle revisions in Chado but leave
     // this here just to make not we've addressed it.
     // this here just to make not we've addressed it.
   }
   }
-  
+
   $contact_id = chado_get_id_for_node('contact', $node->nid) ;
   $contact_id = chado_get_id_for_node('contact', $node->nid) ;
-  
-  // check to see if this contact name doens't already exists.    
+
+  // check to see if this contact name doens't already exists.
   $sql = "SELECT contact_id FROM {contact} WHERE NOT contact_id = :contact_id AND name = :name";
   $sql = "SELECT contact_id FROM {contact} WHERE NOT contact_id = :contact_id AND name = :name";
   $contact = chado_query($sql, array(':contact_id' => $contact_id, ':name' => $node->contact_name))->fetchObject();
   $contact = chado_query($sql, array(':contact_id' => $contact_id, ':name' => $node->contact_name))->fetchObject();
   if ($contact) {
   if ($contact) {
     drupal_set_message(t('A contact with this name already exists. Cannot perform update.'), 'warning');
     drupal_set_message(t('A contact with this name already exists. Cannot perform update.'), 'warning');
-    return;  
-  }    
-  
+    return;
+  }
+
   // update the contact record
   // update the contact record
   $match = array(
   $match = array(
      'contact_id' => $contact_id,
      'contact_id' => $contact_id,
@@ -461,10 +471,10 @@ function chado_contact_update($node) {
     watchdog('t_contact', "Error updating contact", array(), WATCHDOG_ERROR);
     watchdog('t_contact', "Error updating contact", array(), WATCHDOG_ERROR);
     return;
     return;
   }
   }
-  
+
   // now update the properties
   // now update the properties
   $properties = array(); // stores all of the properties we need to add
   $properties = array(); // stores all of the properties we need to add
-   
+
   // get the list of properties for easy lookup (without doing lots of database queries
   // get the list of properties for easy lookup (without doing lots of database queries
   $properties_list = array();
   $properties_list = array();
   $sql = "
   $sql = "
@@ -473,16 +483,16 @@ function chado_contact_update($node) {
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
       INNER JOIN {cv} CV       ON CVTO.cv_id = CV.cv_id
       INNER JOIN {cv} CV       ON CVTO.cv_id = CV.cv_id
-    WHERE 
-      CV.name = 'tripal_contact' AND 
-      NOT CVTO.name = 'Contact Type' 
-    ORDER BY CVTS.name ASC 
+    WHERE
+      CV.name = 'tripal_contact' AND
+      NOT CVTO.name = 'Contact Type'
+    ORDER BY CVTS.name ASC
   ";
   ";
   $prop_types = chado_query($sql);
   $prop_types = chado_query($sql);
   while ($prop = $prop_types->fetchObject()) {
   while ($prop = $prop_types->fetchObject()) {
     $properties_list[$prop->cvterm_id] = $prop->name;
     $properties_list[$prop->cvterm_id] = $prop->name;
   }
   }
-  
+
   // get the properties that should be added. Properties are in one of three forms:
   // get the properties that should be added. Properties are in one of three forms:
   //  1) prop_value-[type id]-[index]
   //  1) prop_value-[type id]-[index]
   //  2) new_value-[type id]-[index]
   //  2) new_value-[type id]-[index]
@@ -508,7 +518,7 @@ function chado_contact_update($node) {
     $index = count($properties[$name]);
     $index = count($properties[$name]);
     $properties[$name][$index] = trim($node->new_value);
     $properties[$name][$index] = trim($node->new_value);
   }
   }
-  
+
   // now add in the properties by first removing any the contact
   // now add in the properties by first removing any the contact
   // already has and adding the ones we have
   // already has and adding the ones we have
   tripal_core_chado_delete('contactprop', array('contact_id' => $contact_id));
   tripal_core_chado_delete('contactprop', array('contact_id' => $contact_id));
@@ -521,8 +531,8 @@ function chado_contact_update($node) {
         array('%prop' => $property), WATCHDOG_ERROR);
         array('%prop' => $property), WATCHDOG_ERROR);
       }
       }
     }
     }
-  } 
-  
+  }
+
   tripal_contact_update_property($contact_id, 'contact_description', $node->description, 1);
   tripal_contact_update_property($contact_id, 'contact_description', $node->description, 1);
 }
 }
 
 
@@ -547,7 +557,7 @@ function chado_contact_load($node) {
 
 
   // get the contact description and replace the contact.description field with this one
   // get the contact description and replace the contact.description field with this one
   $values = array(
   $values = array(
-    'contact_id' => $contact->contact_id, 
+    'contact_id' => $contact->contact_id,
     'type_id' => array(
     'type_id' => array(
       'name' => 'contact_description',
       'name' => 'contact_description',
     ),
     ),
@@ -556,12 +566,12 @@ function chado_contact_load($node) {
     'return_array' => 1,
     'return_array' => 1,
     'include_fk' => array('type_id' => 1),
     'include_fk' => array('type_id' => 1),
   );
   );
-  $description = tripal_core_generate_chado_var('contactprop', $values, $options);    
+  $description = tripal_core_generate_chado_var('contactprop', $values, $options);
   if (count($description) == 1) {
   if (count($description) == 1) {
-    $description = tripal_core_expand_chado_vars($description, 'field', 'contactprop.value');  
+    $description = tripal_core_expand_chado_vars($description, 'field', 'contactprop.value');
     $contact->description = $description[0]->value;
     $contact->description = $description[0]->value;
   }
   }
-    
+
 
 
   $additions = new stdClass();
   $additions = new stdClass();
   $additions->contact = $contact;
   $additions->contact = $contact;
@@ -676,7 +686,7 @@ function tripal_contact_preprocess_tripal_contact_relationships(&$variables) {
 }
 }
 
 
 /*
 /*
- * 
+ *
  */
  */
 function tripal_contact_form_alter(&$form, &$form_state, $form_id) {
 function tripal_contact_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == "chado_contact_node_form") {
   if ($form_id == "chado_contact_node_form") {

+ 1 - 280
tripal_contact/tripal_contact.views.inc

@@ -8,283 +8,4 @@
  *
  *
  *  Documentation on views integration can be found at
  *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  *  http://views2.logrus.com/doc/html/index.html.
- */
-
-
-
-/**
- *
- * @ingroup tripal_feature_views
- */
-function tripal_contact_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // 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' => '~',
-      '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' => '~',
-      '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', 'chado/contacts');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Contacts',
-    'description' => 'Contacts can be persons, institutes, groups, or organizations.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  $views[$view->name] = $view;
-
-  return $views;
-}
+ */

+ 208 - 0
tripal_contact/tripal_contact.views_default.inc

@@ -0,0 +1,208 @@
+<?php
+
+/**
+ *
+ * @ingroup tripal_feature_views
+ */
+function tripal_contact_views_default_views() {
+  $views = array();
+
+  $view = tripal_contact_defaultview_admin_contacts();
+  $views[$view->name] = $view;
+
+  return $views;
+}
+
+/**
+ *
+ */
+function tripal_contact_defaultview_admin_contacts() {
+
+  $view = new view();
+  $view->name = 'tripal_contact_admin_contacts';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
+  $view->base_table = 'contact';
+  $view->human_name = 'Contact Admin';
+  $view->core = 6;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Defaults */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->display->display_options['title'] = 'Contacts';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'perm';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
+  $handler->display->display_options['pager']['options']['offset'] = '0';
+  $handler->display->display_options['pager']['options']['id'] = '0';
+  $handler->display->display_options['pager']['options']['quantity'] = '9';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['grouping'] = '';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'name' => 'name',
+    'name_1' => 'name_1',
+    'description' => 'description',
+  );
+  $handler->display->display_options['style_options']['default'] = 'name';
+  $handler->display->display_options['style_options']['info'] = array(
+    'name' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'name_1' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'description' => array(
+      'sortable' => 0,
+      'separator' => '',
+    ),
+  );
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Contact',
+    'path-1' => 'node/add/tripal-contact',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => '',
+    'path-2' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+    'label-3' => '',
+    'path-3' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+    'label-4' => '',
+    'path-4' => '',
+  );
+  /* No results behavior: Global: Text area */
+  $handler->display->display_options['empty']['text']['id'] = 'area';
+  $handler->display->display_options['empty']['text']['table'] = 'views';
+  $handler->display->display_options['empty']['text']['field'] = 'area';
+  $handler->display->display_options['empty']['text']['content'] = 'No contacts match the current criteria.';
+  $handler->display->display_options['empty']['text']['format'] = '2';
+  /* Relationship: Contact: Contact => Node */
+  $handler->display->display_options['relationships']['contact_id']['id'] = 'contact_id';
+  $handler->display->display_options['relationships']['contact_id']['table'] = 'chado_contact';
+  $handler->display->display_options['relationships']['contact_id']['field'] = 'contact_id';
+  /* Field: Content: Nid */
+  $handler->display->display_options['fields']['nid']['id'] = 'nid';
+  $handler->display->display_options['fields']['nid']['table'] = 'node';
+  $handler->display->display_options['fields']['nid']['field'] = 'nid';
+  $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
+  /* Field: Chado Contact: Name */
+  $handler->display->display_options['fields']['name']['id'] = 'name';
+  $handler->display->display_options['fields']['name']['table'] = 'contact';
+  $handler->display->display_options['fields']['name']['field'] = 'name';
+  /* Field: Chado Cvterm: Name */
+  $handler->display->display_options['fields']['name_1']['id'] = 'name_1';
+  $handler->display->display_options['fields']['name_1']['table'] = 'cvterm';
+  $handler->display->display_options['fields']['name_1']['field'] = 'name';
+  $handler->display->display_options['fields']['name_1']['label'] = 'Type';
+  /* Field: Chado Contact: Description */
+  $handler->display->display_options['fields']['description']['id'] = 'description';
+  $handler->display->display_options['fields']['description']['table'] = 'contact';
+  $handler->display->display_options['fields']['description']['field'] = 'description';
+  /* Field: Content: Delete link */
+  $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['relationship'] = 'contact_id';
+  /* Field: Content: Edit link */
+  $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['relationship'] = 'contact_id';
+  $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['label'] = '';
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node]  [delete_node]';
+  $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
+  /* Filter criterion: Chado Contact: Type Id */
+  $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['table'] = 'contact';
+  $handler->display->display_options['filters']['type_id']['field'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['value'] = 'All';
+  $handler->display->display_options['filters']['type_id']['group'] = '0';
+  $handler->display->display_options['filters']['type_id']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['operator_id'] = 'type_id_op';
+  $handler->display->display_options['filters']['type_id']['expose']['label'] = 'Type';
+  $handler->display->display_options['filters']['type_id']['expose']['operator'] = 'type_id_op';
+  $handler->display->display_options['filters']['type_id']['expose']['identifier'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Contact: Name */
+  $handler->display->display_options['filters']['name']['id'] = 'name';
+  $handler->display->display_options['filters']['name']['table'] = 'contact';
+  $handler->display->display_options['filters']['name']['field'] = 'name';
+  $handler->display->display_options['filters']['name']['operator'] = 'contains';
+  $handler->display->display_options['filters']['name']['group'] = '0';
+  $handler->display->display_options['filters']['name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
+  $handler->display->display_options['filters']['name']['expose']['label'] = 'Name Contains';
+  $handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
+  $handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
+  $handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Contact: Description */
+  $handler->display->display_options['filters']['description']['id'] = 'description';
+  $handler->display->display_options['filters']['description']['table'] = 'contact';
+  $handler->display->display_options['filters']['description']['field'] = 'description';
+  $handler->display->display_options['filters']['description']['operator'] = 'contains';
+  $handler->display->display_options['filters']['description']['group'] = '0';
+  $handler->display->display_options['filters']['description']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['description']['expose']['operator_id'] = 'description_op';
+  $handler->display->display_options['filters']['description']['expose']['label'] = 'Description Contains';
+  $handler->display->display_options['filters']['description']['expose']['operator'] = 'description_op';
+  $handler->display->display_options['filters']['description']['expose']['identifier'] = 'description';
+  $handler->display->display_options['filters']['description']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+
+  /** MANUALLY ADD since filter handler no exporting correctly */
+  $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
+
+  /* Display: Page */
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_contact/contacts';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Contacts';
+  $handler->display->display_options['menu']['description'] = 'Contacts can be persons, institutes, groups, or organizations.';
+  $handler->display->display_options['menu']['weight'] = '-10';
+  $handler->display->display_options['menu']['name'] = 'management';
+  $handler->display->display_options['menu']['context'] = 0;
+  $handler->display->display_options['menu']['context_only_inline'] = 0;
+  $handler->display->display_options['tab_options']['weight'] = '0';
+
+  /** MANUALLY ADD since filter handler no exporting correctly
+  $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
+  */
+  return $view;
+}

+ 43 - 40
tripal_cv/includes/cv_form.inc

@@ -1,4 +1,4 @@
-<?php 
+<?php
 /**
 /**
  * Purpose: Provides the actual "Select CV" form on the Update/Delete Controlled
  * Purpose: Provides the actual "Select CV" form on the Update/Delete Controlled
  *   Vocabulary page. This form also triggers the edit javascript
  *   Vocabulary page. This form also triggers the edit javascript
@@ -12,8 +12,11 @@ function tripal_cv_cv_edit_form($form, &$form_state) {
   $cv_id = 0;
   $cv_id = 0;
   if (array_key_exists('values', $form_state)) {
   if (array_key_exists('values', $form_state)) {
     $cv_id = $form_state['values']['cv_id'];
     $cv_id = $form_state['values']['cv_id'];
-  }    
-  
+  }
+  elseif (isset($form_state['build_info']['args'][0])) {
+    $cv_id = $form_state['build_info']['args'][0];
+  }
+
   // get a list of db from chado for user to choose
   // get a list of db from chado for user to choose
   $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
   $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
   $results = chado_query($sql);
   $results = chado_query($sql);
@@ -35,15 +38,15 @@ function tripal_cv_cv_edit_form($form, &$form_state) {
       'event'    => 'change',
       'event'    => 'change',
       'method'   => 'replace',
       'method'   => 'replace',
     ),
     ),
-    '#default_value' => $cv_id, 
+    '#default_value' => $cv_id,
   );
   );
 
 
-        
+
   // if we don't have a db_id then we can  return the form, otherwise
   // if we don't have a db_id then we can  return the form, otherwise
   // add in the other fields
   // add in the other fields
   if ($cv_id) {
   if ($cv_id) {
     tripal_cv_add_cv_form_fields($form, $form_state, $cv_id);
     tripal_cv_add_cv_form_fields($form, $form_state, $cv_id);
-        
+
     $form['update'] = array(
     $form['update'] = array(
       '#type'         => 'submit',
       '#type'         => 'submit',
       '#value'        => t('Update'),
       '#value'        => t('Update'),
@@ -51,7 +54,7 @@ function tripal_cv_cv_edit_form($form, &$form_state) {
     $form['delete'] = array(
     $form['delete'] = array(
       '#type'         => 'submit',
       '#type'         => 'submit',
       '#value'        => t('Delete'),
       '#value'        => t('Delete'),
-      '#attributes'   => array('onclick' => 'if(!confirm("Really Delete?")){return false;}'), 
+      '#attributes'   => array('onclick' => 'if(!confirm("Really Delete?")){return false;}'),
     );
     );
   }
   }
   else {
   else {
@@ -62,21 +65,21 @@ function tripal_cv_cv_edit_form($form, &$form_state) {
       '#prefix' => '<div id="cv-edit-div">',
       '#prefix' => '<div id="cv-edit-div">',
       '#suffix' => '</div>',
       '#suffix' => '</div>',
     );
     );
-  } 
+  }
   return $form;
   return $form;
 }
 }
 /**
 /**
- * 
+ *
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
- * 
+ *
  * @ingroup tripal_db
  * @ingroup tripal_db
  */
  */
 function tripal_cv_cv_add_form($form, $form_state) {
 function tripal_cv_cv_add_form($form, $form_state) {
-  
+
   // add in the form fields to this form
   // add in the form fields to this form
   tripal_cv_add_cv_form_fields($form, $form_state);
   tripal_cv_add_cv_form_fields($form, $form_state);
-  
+
   $form['add'] = array(
   $form['add'] = array(
     '#type'         => 'submit',
     '#type'         => 'submit',
     '#value'        => t('Add'),
     '#value'        => t('Add'),
@@ -85,11 +88,11 @@ function tripal_cv_cv_add_form($form, $form_state) {
   return $form;
   return $form;
 }
 }
 /**
 /**
- * 
+ *
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
  * @param $cv_id
  * @param $cv_id
- * 
+ *
  * @ingroup tripal_db
  * @ingroup tripal_db
  */
  */
 function tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) {
 function tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) {
@@ -100,17 +103,17 @@ function tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) {
   if ($cv_id) {
   if ($cv_id) {
     $values = array('cv_id' => $cv_id);
     $values = array('cv_id' => $cv_id);
     $result = tripal_core_chado_select('cv', array('*'), $values);
     $result = tripal_core_chado_select('cv', array('*'), $values);
-    $cv = $result[0]; 
+    $cv = $result[0];
     $default_name = $cv->name;
     $default_name = $cv->name;
-    $default_desc = $cv->definition; 
-  }   
-  
+    $default_desc = $cv->definition;
+  }
+
   // add a fieldset for the Drupal Schema API
   // add a fieldset for the Drupal Schema API
   $form['fields'] = array(
   $form['fields'] = array(
     '#type' => 'fieldset',
     '#type' => 'fieldset',
     '#title' => 'Controlled Vocabulary Details',
     '#title' => 'Controlled Vocabulary Details',
     '#collapsible' => 0,
     '#collapsible' => 0,
-  );      
+  );
 
 
   $form['fields']['name']= array(
   $form['fields']['name']= array(
     '#type'          => 'textfield',
     '#type'          => 'textfield',
@@ -118,7 +121,7 @@ function tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) {
     '#description'   => t('Please enter the name for this vocabulary.'),
     '#description'   => t('Please enter the name for this vocabulary.'),
     '#required'      => TRUE,
     '#required'      => TRUE,
     '#default_value' => $default_name,
     '#default_value' => $default_name,
-    '#maxlength'     => 255,  
+    '#maxlength'     => 255,
   );
   );
 
 
   $form['fields']['definition']= array(
   $form['fields']['definition']= array(
@@ -135,44 +138,44 @@ function tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) {
  * Validation fucntion for tripal_cv_cv_add_form
  * Validation fucntion for tripal_cv_cv_add_form
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
- * 
+ *
  * @ingroup tripal_cv
  * @ingroup tripal_cv
  */
  */
 function tripal_cv_cv_add_form_validate($form, &$form_state) {
 function tripal_cv_cv_add_form_validate($form, &$form_state) {
-  tripal_cv_form_fields_validate($form, $form_state); 
+  tripal_cv_form_fields_validate($form, $form_state);
 }
 }
 /**
 /**
  * Validation fucntion for tripal_cv_cv_edit_form
  * Validation fucntion for tripal_cv_cv_edit_form
  * @param unknown_type $form
  * @param unknown_type $form
  * @param unknown_type $form_state
  * @param unknown_type $form_state
- * 
+ *
  * @ingroup tripal_cv
  * @ingroup tripal_cv
  */
  */
 function tripal_cv_cv_edit_form_validate($form, &$form_state) {
 function tripal_cv_cv_edit_form_validate($form, &$form_state) {
-  tripal_cv_form_fields_validate($form, $form_state); 
+  tripal_cv_form_fields_validate($form, $form_state);
 }
 }
 /**
 /**
  * Genetic validation form for shared fields of both the edit and add forms
  * Genetic validation form for shared fields of both the edit and add forms
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
- * 
+ *
  * @ingroup tripal_cv
  * @ingroup tripal_cv
  */
  */
 function tripal_cv_form_fields_validate($form, &$form_state) {
 function tripal_cv_form_fields_validate($form, &$form_state) {
   $name =  array_key_exists('name', $form_state['values'])       ? trim($form_state['values']['name']) : '';
   $name =  array_key_exists('name', $form_state['values'])       ? trim($form_state['values']['name']) : '';
   $desc =  array_key_exists('definition', $form_state['values']) ? trim($form_state['values']['definition']) : '';
   $desc =  array_key_exists('definition', $form_state['values']) ? trim($form_state['values']['definition']) : '';
   $cv_id = array_key_exists('cv_id', $form_state['values'])      ? trim($form_state['values']['cv_id']) : '';
   $cv_id = array_key_exists('cv_id', $form_state['values'])      ? trim($form_state['values']['cv_id']) : '';
-  
-   
+
+
   // make sure the cv name is unique
   // make sure the cv name is unique
   $values = array('name' => $name);
   $values = array('name' => $name);
-  $results = tripal_core_chado_select('cv', array('cv_id'), $values);   
+  $results = tripal_core_chado_select('cv', array('cv_id'), $values);
   if (count($results) > 0 and $results[0]->cv_id != $cv_id) {
   if (count($results) > 0 and $results[0]->cv_id != $cv_id) {
     form_set_error('name', 'The vocabulary name must be unique');
     form_set_error('name', 'The vocabulary name must be unique');
   }
   }
 }
 }
 /**
 /**
- * 
+ *
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
  */
  */
@@ -191,10 +194,10 @@ function tripal_cv_cv_add_form_submit($form, &$form_state) {
   }
   }
   else {
   else {
     drupal_set_message(t("Failed to add controlled vocabulary."));
     drupal_set_message(t("Failed to add controlled vocabulary."));
-  }     
+  }
 }
 }
 /**
 /**
- * 
+ *
  * @param unknown_type $form
  * @param unknown_type $form
  * @param unknown_type $form_state
  * @param unknown_type $form_state
  */
  */
@@ -203,12 +206,12 @@ function tripal_cv_cv_edit_form_submit($form, &$form_state) {
   $desc  = array_key_exists('definition', $form_state['values']) ? trim($form_state['values']['definition']) : '';
   $desc  = array_key_exists('definition', $form_state['values']) ? trim($form_state['values']['definition']) : '';
   $cv_id = array_key_exists('cv_id', $form_state['values'])      ? trim($form_state['values']['cv_id']) : '';
   $cv_id = array_key_exists('cv_id', $form_state['values'])      ? trim($form_state['values']['cv_id']) : '';
   $op    = array_key_exists('op', $form_state['values'])         ? trim($form_state['values']['op']) : '';
   $op    = array_key_exists('op', $form_state['values'])         ? trim($form_state['values']['op']) : '';
-  
+
   $values = array(
   $values = array(
     'name' => $name,
     'name' => $name,
     'definition' => $desc,
     'definition' => $desc,
   );
   );
-  if (strcmp($op, 'Update')==0) {      
+  if (strcmp($op, 'Update')==0) {
     $match = array('cv_id' => $cv_id);
     $match = array('cv_id' => $cv_id);
     $success = tripal_core_chado_update('cv', $match, $values);
     $success = tripal_core_chado_update('cv', $match, $values);
     if ($success) {
     if ($success) {
@@ -235,25 +238,25 @@ function tripal_cv_cv_edit_form_submit($form, &$form_state) {
  * @ingroup tripal_cv
  * @ingroup tripal_cv
  */
  */
 function tripal_cv_edit_form_ajax($form, $form_state) {
 function tripal_cv_edit_form_ajax($form, $form_state) {
-  
+
   $elements = array();
   $elements = array();
-  
-  // add in the form fields and the buttons 
+
+  // add in the form fields and the buttons
   if (array_key_exists('cv_id', $form_state['values'])) {
   if (array_key_exists('cv_id', $form_state['values'])) {
     $elements['fields'] = $form['fields'];
     $elements['fields'] = $form['fields'];
     $elements['update'] = $form['update'];
     $elements['update'] = $form['update'];
     $elements['delete'] = $form['delete'];
     $elements['delete'] = $form['delete'];
   }
   }
-  
+
    // add back in the cv-edit-div that is used for the next round of AJAX
    // add back in the cv-edit-div that is used for the next round of AJAX
   $elements['fields']['#prefix'] =  '<div id="cv-edit-div">';
   $elements['fields']['#prefix'] =  '<div id="cv-edit-div">';
   $elements['fields']['#suffix'] =  '</div">';
   $elements['fields']['#suffix'] =  '</div">';
-  
+
   // reset the values for the fields to the defaults
   // reset the values for the fields to the defaults
   $elements['fields']['name']['#value']        = $elements['fields']['name']['#default_value'];
   $elements['fields']['name']['#value']        = $elements['fields']['name']['#default_value'];
   $elements['fields']['definition']['#value']  = $elements['fields']['definition']['#default_value'];
   $elements['fields']['definition']['#value']  = $elements['fields']['definition']['#default_value'];
-  
+
   //drupal_set_message('<pre>' . print_r($elements, TRUE) . '</pre>', "status");
   //drupal_set_message('<pre>' . print_r($elements, TRUE) . '</pre>', "status");
-  
+
   return $elements;
   return $elements;
 }
 }

+ 109 - 94
tripal_cv/includes/cvterm_form.inc

@@ -1,7 +1,7 @@
-<?php 
+<?php
 
 
 /**
 /**
- * 
+ *
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
  */
  */
@@ -20,16 +20,28 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
     $cv_id = $form_state['storage']['cv_id'];
     $cv_id = $form_state['storage']['cv_id'];
     $cvterm_name = $form_state['storage']['name'];
     $cvterm_name = $form_state['storage']['name'];
     $cvterm_id = $form_state['storage']['cvterm_id'];
     $cvterm_id = $form_state['storage']['cvterm_id'];
-  }  
+  }
   // get the cv if form was submitted via AJAX
   // get the cv if form was submitted via AJAX
   $cvterm = '';
   $cvterm = '';
   if (array_key_exists('values', $form_state)) {
   if (array_key_exists('values', $form_state)) {
-    $cv_id = $form_state['values']['cv_id'];   
+    $cv_id = $form_state['values']['cv_id'];
     if (array_key_exists('cvterm', $form_state['values'])) {
     if (array_key_exists('cvterm', $form_state['values'])) {
       $cvterm = $form_state['values']['cvterm'];
       $cvterm = $form_state['values']['cvterm'];
-    }    
-  }   
-    
+    }
+  }
+  elseif (isset($form_state['build_info']['args'][0])) {
+    $cv_id = $form_state['build_info']['args'][0];
+    $cvterm_id = $form_state['build_info']['args'][1];
+    if ($form_state['build_info']['args'][1]) {
+      $result = db_select('chado.cvterm','c')
+        ->fields('c', array('name'))
+        ->condition('c.cvterm_id',$cvterm_id)
+        ->execute();
+      $cvterm_name = $result->fetchObject()->name;
+      $step = 1;
+    }
+  }
+
   // get a list of CVs
   // get a list of CVs
   $cvs = array();
   $cvs = array();
   $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
   $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
@@ -37,7 +49,7 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
   $cvs[] = 'Select a vocabulary';
   $cvs[] = 'Select a vocabulary';
   foreach ($results as $cv) {
   foreach ($results as $cv) {
     $cvs[$cv->cv_id] = $cv->name;
     $cvs[$cv->cv_id] = $cv->name;
-  }    
+  }
   $form['cv_id'] = array(
   $form['cv_id'] = array(
     '#title' => t('Controlled Vocabulary (Ontology) Name'),
     '#title' => t('Controlled Vocabulary (Ontology) Name'),
     '#type' => 'select',
     '#type' => 'select',
@@ -50,11 +62,11 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
        'event'   => 'change',
        'event'   => 'change',
        'method'  => 'replace',
        'method'  => 'replace',
        'event'    => 'change',
        'event'    => 'change',
-    ),    
+    ),
   );
   );
-    
+
   if ($cv_id and $step == 0) {
   if ($cv_id and $step == 0) {
-    
+
     $form['name']= array(
     $form['name']= array(
       '#type'          => 'textfield',
       '#type'          => 'textfield',
       '#title'         => t("Term Name"),
       '#title'         => t("Term Name"),
@@ -68,16 +80,16 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
       '#value'         => 'continue',
       '#value'         => 'continue',
     );
     );
   }
   }
-  elseif ($step == 1) {    
-       
+  elseif ($step == 1) {
+
     tripal_cv_add_cvterm_form_fields($form, $form_state, $cv_id, $cvterm_name);
     tripal_cv_add_cvterm_form_fields($form, $form_state, $cv_id, $cvterm_name);
-    
+
     // when editing there are certain fields the user should not change for a term
     // when editing there are certain fields the user should not change for a term
     // let's mark those as disabled
     // let's mark those as disabled
     $form['cv_id']['#disabled'] = TRUE;
     $form['cv_id']['#disabled'] = TRUE;
     $form['fields']['db_id']['#disabled'] = TRUE;
     $form['fields']['db_id']['#disabled'] = TRUE;
     $form['fields']['accession']['#disabled'] = TRUE;
     $form['fields']['accession']['#disabled'] = TRUE;
-    
+
     // add in the div for replacing the fields if needed
     // add in the div for replacing the fields if needed
     $form['fields']['#prefix'] = '<div id="cvterm-edit-div">';
     $form['fields']['#prefix'] = '<div id="cvterm-edit-div">';
     $form['fields']['#suffix'] = '</div>';
     $form['fields']['#suffix'] = '</div>';
@@ -87,7 +99,7 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
       '#type' => 'hidden',
       '#type' => 'hidden',
       '#value' =>  $cvterm_id,
       '#value' =>  $cvterm_id,
     );
     );
-    
+
     $form['update'] = array(
     $form['update'] = array(
       '#type'         => 'submit',
       '#type'         => 'submit',
       '#value'        => t('Update'),
       '#value'        => t('Update'),
@@ -95,10 +107,10 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
     $form['delete'] = array(
     $form['delete'] = array(
       '#type'         => 'submit',
       '#type'         => 'submit',
       '#value'        => t('Delete'),
       '#value'        => t('Delete'),
-      '#attributes'   => array('onclick' => 'if(!confirm("Really Delete?")){return false;}'), 
-    );    
-  } 
-  
+      '#attributes'   => array('onclick' => 'if(!confirm("Really Delete?")){return false;}'),
+    );
+  }
+
   if ($step == 0) {
   if ($step == 0) {
     // if we don't have a cv_id then this is the first time the form has
     // if we don't have a cv_id then this is the first time the form has
     // benn loaded and we need to create the div where ajax replacement elements get stored
     // benn loaded and we need to create the div where ajax replacement elements get stored
@@ -111,16 +123,19 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
   return $form;
   return $form;
 }
 }
 /**
 /**
- * 
+ *
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
  */
  */
 function tripal_cv_cvterm_add_form($form, &$form_state) {
 function tripal_cv_cvterm_add_form($form, &$form_state) {
   $cv_id = 0;
   $cv_id = 0;
   if (array_key_exists('values', $form_state)) {
   if (array_key_exists('values', $form_state)) {
-    $cv_id = $form_state['values']['cv_id'];   
+    $cv_id = $form_state['values']['cv_id'];
   }
   }
-  
+  elseif (isset($form_state['build_info']['args'][0])) {
+    $cv_id = $form_state['build_info']['args'][0];
+  }
+
   // get a list of CVs
   // get a list of CVs
   $cvs = array();
   $cvs = array();
   $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
   $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
@@ -128,7 +143,7 @@ function tripal_cv_cvterm_add_form($form, &$form_state) {
   $cvs[] = 'Select a vocabulary';
   $cvs[] = 'Select a vocabulary';
   foreach ($results as $cv) {
   foreach ($results as $cv) {
     $cvs[$cv->cv_id] = $cv->name;
     $cvs[$cv->cv_id] = $cv->name;
-  }    
+  }
   $form['cv_id'] = array(
   $form['cv_id'] = array(
     '#title' => t('Controlled Vocabulary (Ontology) Name'),
     '#title' => t('Controlled Vocabulary (Ontology) Name'),
     '#type' => 'select',
     '#type' => 'select',
@@ -137,21 +152,21 @@ function tripal_cv_cvterm_add_form($form, &$form_state) {
     '#default_value' => $cv_id,
     '#default_value' => $cv_id,
   );
   );
   tripal_cv_add_cvterm_form_fields($form, $form_state);
   tripal_cv_add_cvterm_form_fields($form, $form_state);
-  
+
   $form['add'] = array(
   $form['add'] = array(
     '#type'         => 'submit',
     '#type'         => 'submit',
     '#value'        => t('Add Term'),
     '#value'        => t('Add Term'),
   );
   );
-  
+
   return $form;
   return $form;
 }
 }
 
 
 /**
 /**
- * 
+ *
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
  * @param $cv_id
  * @param $cv_id
- * 
+ *
  * @ingroup tripal_db
  * @ingroup tripal_db
  */
  */
 function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvterm_name = '') {
 function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvterm_name = '') {
@@ -168,47 +183,47 @@ function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvte
     $values = array('cv_id' => $cv_id, 'name' => $cvterm_name);
     $values = array('cv_id' => $cv_id, 'name' => $cvterm_name);
     $cvterm = tripal_core_generate_chado_var('cvterm', $values);
     $cvterm = tripal_core_generate_chado_var('cvterm', $values);
     $name = $cvterm->name;
     $name = $cvterm->name;
-    $definition = $cvterm->definition; 
+    $definition = $cvterm->definition;
     $is_relationship = $cvterm->is_relationshiptype;
     $is_relationship = $cvterm->is_relationshiptype;
     $is_obsolete = $cvterm->is_obsolete;
     $is_obsolete = $cvterm->is_obsolete;
     $db_id = $cvterm->dbxref_id->db_id->db_id;
     $db_id = $cvterm->dbxref_id->db_id->db_id;
     $accession = $cvterm->dbxref_id->accession;
     $accession = $cvterm->dbxref_id->accession;
-  }    
-  
+  }
+
   // add a fieldset for the Drupal Schema API
   // add a fieldset for the Drupal Schema API
   $form['fields'] = array(
   $form['fields'] = array(
     '#type' => 'fieldset',
     '#type' => 'fieldset',
     '#title' => 'Term Details',
     '#title' => 'Term Details',
     '#collapsible' => 0,
     '#collapsible' => 0,
-  );      
-  
-  
+  );
+
+
   $form['fields']['name']= array(
   $form['fields']['name']= array(
     '#type'          => 'textfield',
     '#type'          => 'textfield',
     '#title'         => t("Term Name"),
     '#title'         => t("Term Name"),
     '#default_value' => $name,
     '#default_value' => $name,
     '#required'      => TRUE,
     '#required'      => TRUE,
   );
   );
-  
+
   $form['fields']['definition']= array(
   $form['fields']['definition']= array(
     '#type'          => 'textarea',
     '#type'          => 'textarea',
     '#title'         => t('Description'),
     '#title'         => t('Description'),
     '#description'   => t('Please enter a description for this term'),
     '#description'   => t('Please enter a description for this term'),
     '#default_value' => $definition,
     '#default_value' => $definition,
   );
   );
-  
+
   $form['fields']['is_relationship'] = array(
   $form['fields']['is_relationship'] = array(
     '#type'          => 'checkbox',
     '#type'          => 'checkbox',
     '#title'         => t('This term describes a relationship?'),
     '#title'         => t('This term describes a relationship?'),
     '#default_value' => $is_relationship,
     '#default_value' => $is_relationship,
   );
   );
-  
+
   $form['fields']['is_obsolete'] = array(
   $form['fields']['is_obsolete'] = array(
     '#type'          => 'checkbox',
     '#type'          => 'checkbox',
     '#title'         => t('This term is obsolete?'),
     '#title'         => t('This term is obsolete?'),
     '#default_value' => $is_obsolete,
     '#default_value' => $is_obsolete,
   );
   );
-  
+
   $values = array();
   $values = array();
   $columns = array('db_id', 'name');
   $columns = array('db_id', 'name');
   $options = array('order_by' => array('name' => 'ASC'));
   $options = array('order_by' => array('name' => 'ASC'));
@@ -228,22 +243,22 @@ function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvte
     '#default_value' => $db_id,
     '#default_value' => $db_id,
     '#required' => TRUE,
     '#required' => TRUE,
   );
   );
-  
+
   $form['fields']['accession']= array(
   $form['fields']['accession']= array(
     '#type'          => 'textfield',
     '#type'          => 'textfield',
     '#title'         => t("Accession"),
     '#title'         => t("Accession"),
-    '#description'   => t('If this term has an existing accession (unique identifier) in the database 
+    '#description'   => t('If this term has an existing accession (unique identifier) in the database
        please enter that here.  If the accession is numeric with a database prefix (e.g. GO:003023), please
        please enter that here.  If the accession is numeric with a database prefix (e.g. GO:003023), please
-       enter just the numeric value.  The database prefix will be appended whenever the term is displayed. 
-       If the accession is not numeric then enter it as is.  If no value is provied, the term name 
+       enter just the numeric value.  The database prefix will be appended whenever the term is displayed.
+       If the accession is not numeric then enter it as is.  If no value is provied, the term name
        provided above will be used as the accession.'),
        provided above will be used as the accession.'),
     '#required'      => TRUE,
     '#required'      => TRUE,
     '#default_value' => $accession,
     '#default_value' => $accession,
-  );     
+  );
 }
 }
 
 
 /**
 /**
- * 
+ *
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
  */
  */
@@ -253,14 +268,14 @@ function tripal_cv_cvterm_edit_form_validate($form, &$form_state) {
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $cvterm_id = array_key_exists('cvterm_id', $form_state['values']) ? $form_state['values']['cvterm_id'] : '';
   $cvterm_id = array_key_exists('cvterm_id', $form_state['values']) ? $form_state['values']['cvterm_id'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
-  
+
   $step = $form_state['storage']['step'];
   $step = $form_state['storage']['step'];
-   
+
   // make sure the cv term name is unique for this vocabulary
   // make sure the cv term name is unique for this vocabulary
   if ($step == 1) {
   if ($step == 1) {
     $values = array('name' => $name, 'cv_id' => $cv_id);
     $values = array('name' => $name, 'cv_id' => $cv_id);
     $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
     $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
-    foreach ($results as $r) {   
+    foreach ($results as $r) {
       if ($r->cvterm_id != $cvterm_id) {
       if ($r->cvterm_id != $cvterm_id) {
         form_set_error('name', 'The term name must be unique for this vocabulary. Another term with this name already exists.');
         form_set_error('name', 'The term name must be unique for this vocabulary. Another term with this name already exists.');
       }
       }
@@ -268,7 +283,7 @@ function tripal_cv_cvterm_edit_form_validate($form, &$form_state) {
   }
   }
 }
 }
 /**
 /**
- * 
+ *
  * @param $form
  * @param $form
  * @param $form_state
  * @param $form_state
  */
  */
@@ -277,7 +292,7 @@ function tripal_cv_cvterm_add_form_validate($form, &$form_state) {
   $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
   $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
-    
+
   $values = array('cv_id' => $cv_id);
   $values = array('cv_id' => $cv_id);
   $results = tripal_core_chado_select('cv', array('name'), $values);
   $results = tripal_core_chado_select('cv', array('name'), $values);
   if (!$results or count($results) == 0) {
   if (!$results or count($results) == 0) {
@@ -290,20 +305,20 @@ function tripal_cv_cvterm_add_form_validate($form, &$form_state) {
   if (!$results or count($results) == 0) {
   if (!$results or count($results) == 0) {
     form_set_error('db_id', 'The database name does not exist');
     form_set_error('db_id', 'The database name does not exist');
   }
   }
-  
+
   // make sure the cv term name is unique for this vocabulary
   // make sure the cv term name is unique for this vocabulary
   $values = array('name' => $name, 'cv_id' => $cv_id);
   $values = array('name' => $name, 'cv_id' => $cv_id);
-  $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);   
+  $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
   if (count($results) > 0) {
   if (count($results) > 0) {
     form_set_error('name', 'The term name must be unique for this vocabulary. Another term with this name already exists.');
     form_set_error('name', 'The term name must be unique for this vocabulary. Another term with this name already exists.');
   }
   }
-  
+
   // make sure this accession is unique for the database
   // make sure this accession is unique for the database
   $values = array('accession' => $accession, 'db_id' => $db_id);
   $values = array('accession' => $accession, 'db_id' => $db_id);
-  $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values);   
+  $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values);
   if (count($results) > 0 ) {
   if (count($results) > 0 ) {
     form_set_error('accession', 'The accession is not uniuqe for this vocabulary\'s database.');
     form_set_error('accession', 'The accession is not uniuqe for this vocabulary\'s database.');
-  }  
+  }
 
 
 }
 }
 
 
@@ -314,85 +329,85 @@ function tripal_cv_cvterm_add_form_validate($form, &$form_state) {
  * @ingroup tripal_cv
  * @ingroup tripal_cv
  */
  */
 function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
 function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
-  
+
   $cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
   $cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $definition = array_key_exists('definition', $form_state['values']) ? $form_state['values']['definition'] : '';
   $definition = array_key_exists('definition', $form_state['values']) ? $form_state['values']['definition'] : '';
   $is_relationship = array_key_exists('is_relationship', $form_state['values']) ? $form_state['values']['is_relationship'] : '';
   $is_relationship = array_key_exists('is_relationship', $form_state['values']) ? $form_state['values']['is_relationship'] : '';
   $is_obsolete = array_key_exists('is_obsolete', $form_state['values']) ? $form_state['values']['is_obsolete'] : '';
   $is_obsolete = array_key_exists('is_obsolete', $form_state['values']) ? $form_state['values']['is_obsolete'] : '';
   $cvterm_id = array_key_exists('cvterm_id', $form_state['values']) ? $form_state['values']['cvterm_id'] : '';
   $cvterm_id = array_key_exists('cvterm_id', $form_state['values']) ? $form_state['values']['cvterm_id'] : '';
-  
+
   $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
   $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
-  
+
   $op    = array_key_exists('op', $form_state['values'])         ? trim($form_state['values']['op']) : '';
   $op    = array_key_exists('op', $form_state['values'])         ? trim($form_state['values']['op']) : '';
-  
-  
+
+
   $step = $form_state['storage']['step'];
   $step = $form_state['storage']['step'];
 
 
   switch ($step) {
   switch ($step) {
     case 0:  // a cvterm name has been selected
     case 0:  // a cvterm name has been selected
       $cv_id = array_key_exists('cv_id', $form_state['values']) ? trim($form_state['values']['cv_id']) : '';
       $cv_id = array_key_exists('cv_id', $form_state['values']) ? trim($form_state['values']['cv_id']) : '';
       $name  = array_key_exists('name', $form_state['values'])  ? trim($form_state['values']['name'])  : '';
       $name  = array_key_exists('name', $form_state['values'])  ? trim($form_state['values']['name'])  : '';
-      
+
       // get the original cvterm_id
       // get the original cvterm_id
       $values = array('name' => $name, 'cv_id' => $cv_id);
       $values = array('name' => $name, 'cv_id' => $cv_id);
-      $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);  
-      $cvterm = $results[0]; 
-    
+      $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+      $cvterm = $results[0];
+
       $form_state['storage']['cv_id'] = $cv_id;
       $form_state['storage']['cv_id'] = $cv_id;
       $form_state['storage']['name'] = $name;
       $form_state['storage']['name'] = $name;
       $form_state['storage']['step'] = 1;
       $form_state['storage']['step'] = 1;
       $form_state['storage']['cvterm_id'] = $cvterm->cvterm_id;
       $form_state['storage']['cvterm_id'] = $cvterm->cvterm_id;
       $form_state['rebuild'] = TRUE;
       $form_state['rebuild'] = TRUE;
       break;
       break;
-      
-    case 1:  // update/delete button has been clicked          
-      
+
+    case 1:  // update/delete button has been clicked
+
       if ($op == 'Update') {
       if ($op == 'Update') {
         // get the cv
         // get the cv
         $values = array('cv_id' => $cv_id);
         $values = array('cv_id' => $cv_id);
         $results = tripal_core_chado_select('cv', array('name'), $values);
         $results = tripal_core_chado_select('cv', array('name'), $values);
         $cv = $results[0];
         $cv = $results[0];
-        
+
         // get the db
         // get the db
         $values = array('db_id' => $db_id);
         $values = array('db_id' => $db_id);
         $results = tripal_core_chado_select('db', array('name'), $values);
         $results = tripal_core_chado_select('db', array('name'), $values);
         $db = $results[0];
         $db = $results[0];
-        
+
         // now add the term
         // now add the term
-        $term = array(    
+        $term = array(
           'name' => $name,
           'name' => $name,
           'namespace' => $cv->name,
           'namespace' => $cv->name,
           'id' => $accession,
           'id' => $accession,
           'def' => $definition,
           'def' => $definition,
           'is_obsolete' => $is_obsolete,
           'is_obsolete' => $is_obsolete,
-        );  
-        
+        );
+
         $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, TRUE, $db->name);
         $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, TRUE, $db->name);
         if ($cvterm) {
         if ($cvterm) {
           drupal_set_message('Term updated successfully.');
           drupal_set_message('Term updated successfully.');
-        } 
+        }
         else {
         else {
-          drupal_set_message('Could not add term. Check Drupal recent logs for error messages.', 'error');  
+          drupal_set_message('Could not add term. Check Drupal recent logs for error messages.', 'error');
         }
         }
       }
       }
       if ($op == 'Delete') {
       if ($op == 'Delete') {
         $values = array('cvterm_id' => $cvterm_id);
         $values = array('cvterm_id' => $cvterm_id);
         $success = tripal_core_chado_delete('cvterm', $values);
         $success = tripal_core_chado_delete('cvterm', $values);
         if ($success) {
         if ($success) {
-          drupal_set_message('Term deleted successfully.');  
-        } 
+          drupal_set_message('Term deleted successfully.');
+        }
         else {
         else {
-          drupal_set_message('Could not delete term term. Check Drupal recent logs for error messages.', 'error');  
-        }             
+          drupal_set_message('Could not delete term term. Check Drupal recent logs for error messages.', 'error');
+        }
       }
       }
       break;
       break;
-  }      
+  }
 }
 }
 
 
 /**
 /**
- * 
+ *
  * @param unknown_type $form
  * @param unknown_type $form
  * @param unknown_type $form_state
  * @param unknown_type $form_state
  */
  */
@@ -402,36 +417,36 @@ function tripal_cv_cvterm_add_form_submit($form, &$form_state) {
   $definition = array_key_exists('definition', $form_state['values']) ? $form_state['values']['definition'] : '';
   $definition = array_key_exists('definition', $form_state['values']) ? $form_state['values']['definition'] : '';
   $is_relationship = array_key_exists('is_relationship', $form_state['values']) ? $form_state['values']['is_relationship'] : '';
   $is_relationship = array_key_exists('is_relationship', $form_state['values']) ? $form_state['values']['is_relationship'] : '';
   $is_obsolete = array_key_exists('is_obsolete', $form_state['values']) ? $form_state['values']['is_obsolete'] : '';
   $is_obsolete = array_key_exists('is_obsolete', $form_state['values']) ? $form_state['values']['is_obsolete'] : '';
-  
+
   $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
   $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
-  
+
   // get the database
   // get the database
   $values = array('db_id' => $db_id);
   $values = array('db_id' => $db_id);
   $results = tripal_core_chado_select('db', array('name'), $values);
   $results = tripal_core_chado_select('db', array('name'), $values);
   $db = $results[0];
   $db = $results[0];
-      
+
   // get the cv
   // get the cv
   $values = array('cv_id' => $cv_id);
   $values = array('cv_id' => $cv_id);
   $results = tripal_core_chado_select('cv', array('name'), $values);
   $results = tripal_core_chado_select('cv', array('name'), $values);
   $cv = $results[0];
   $cv = $results[0];
 
 
   // now add the term
   // now add the term
-  $term = array(    
+  $term = array(
     'name' => $name,
     'name' => $name,
     'namespace' => $cv->name,
     'namespace' => $cv->name,
     'id' => $accession,
     'id' => $accession,
     'def' => $definition,
     'def' => $definition,
     'is_obsolete' => $is_obsolete,
     'is_obsolete' => $is_obsolete,
-  );  
-      
+  );
+
   $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, TRUE, $db->name);
   $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, TRUE, $db->name);
   if ($cvterm) {
   if ($cvterm) {
     drupal_set_message('Term added successfully.');
     drupal_set_message('Term added successfully.');
-  } 
+  }
   else {
   else {
-    drupal_set_message('Could not add term. Check Drupal recent logs for error messages.', 'error');  
-  }    
+    drupal_set_message('Could not add term. Check Drupal recent logs for error messages.', 'error');
+  }
 }
 }
 /**
 /**
  * Ajax callback for the tripal_cv_form
  * Ajax callback for the tripal_cv_form
@@ -440,14 +455,14 @@ function tripal_cv_cvterm_add_form_submit($form, &$form_state) {
 function tripal_cv_cvterm_edit_form_ajax($form, $form_state) {
 function tripal_cv_cvterm_edit_form_ajax($form, $form_state) {
 
 
   $elements = array();
   $elements = array();
-  
+
   $elements['name'] = $form['name'];
   $elements['name'] = $form['name'];
-  $elements['continue'] = $form['continue'];   
-  
+  $elements['continue'] = $form['continue'];
+
   // add back in the cv-edit-div that is used for the next round of AJAX
   // add back in the cv-edit-div that is used for the next round of AJAX
   $elements['name']['#prefix'] =  '<div id="cvterm-edit-div">';
   $elements['name']['#prefix'] =  '<div id="cvterm-edit-div">';
-  $elements['name']['#suffix'] =  '</div">';  
-  
-    
+  $elements['name']['#suffix'] =  '</div">';
+
+
   return $elements;
   return $elements;
 }
 }

+ 1 - 570
tripal_cv/includes/tripal_cv_admin.inc

@@ -37,573 +37,4 @@ function tripal_cv_admin_cv_listing() {
   }
   }
 
 
   return $output;
   return $output;
-}
-
-/**
- * Purpose: Provides the form for Updating and Deleteing existing
- *   chado controlled vocabularies (See chado cv table)
- *
- * @ingroup tripal_cv
- *
-function tripal_cv_edit_page() {
-  $output .= drupal_get_form('tripal_cv_select_form');
-  $output .= '<div id="cv-edit-div">Please select a vocabulary above to view or edit</div>';
-
-  return $output;
-}
-*/
-
-/**
- * Purpose: Provides the actual "Select CV" form on the Update/Delete Controlled
- *   Vocabulary page. This form also triggers the edit javascript
- * @todo Modify this form to use Drupal AJAX
- *
- * @ingroup tripal_cv
- *
-function tripal_cv_select_form() {
-
-  // get a list of db from chado for user to choose
-  $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
-  $results = chado_query($sql);
-
-  $cvs = array();
-  $cvs[] = '';
-  while ($cv = db_fetch_object($results)) {
-    $cvs[$cv->cv_id] = $cv->name;
-  }
-
-  $form['cvid'] = array(
-    '#title' => t('Controlled Vocabulary/Ontology Name'),
-    '#type' => 'select',
-    '#options' => $cvs,
-    '#ahah' => array(
-      'path' => 'admin/tripal/tripal_cv/cv/edit/js',
-      'wrapper' => 'cv-edit-div',
-      'effect' => 'fade',
-      'event' => 'change',
-      'method' => 'replace',
-    ),
-  );
-
-  return $form;
-}
-*/
-
-/**
- * Purpose: The edit controlled vocabulary javascript
- *
- * @ingroup tripal_cv
- *
-function tripal_ajax_cv_edit() {
-
-  // get the database id, build the form and then return the JSON object
-  $cvid = filter_xss($_POST['cvid']);
-  $form = drupal_get_form('tripal_cv_edit_form', $cvid);
-  drupal_json(array('status' => TRUE, 'data' => $form));
-
-}
-*/
-
-/**
- * Purpose: Provides a form to allow updating/deleteing of controlled vocabularies
- *
- * @ingroup tripal_cv
- *
-function tripal_cv_edit_form(&$form_state = NULL, $cvid = NULL) {
-
-  $sql = "SELECT * FROM {cv} WHERE cv_id = :cv_id ";
-  $cv = chado_query($sql, array(':cv_id' => $cvid));
-  $cv = $cv->fetch_object();
-
-  // set the default values.  If there is a value set in the
-  // form_state then let's use that, otherwise, we'll pull
-  // the values from the database
-  $default_db = $form_state['values']['name'];
-  $default_desc = $form_state['values']['description'];
-  $default_url = $form_state['values']['url'];
-  $default_urlprefix = $form_state['values']['urlprefix'];
-  if (!$default_db) {
-    $default_cv = $cv->name;
-  }
-  if (!$default_desc) {
-    $default_desc = $cv->definition;
-  }
-
-  $form['cvid'] = array(
-    '#type' => 'hidden',
-    '#value' => $cvid
-  );
-
-  $form['name']= array(
-    '#type'          => 'textfield',
-    '#title'         => t("Controlled Vocabulary name"),
-    '#description'   => t('Please enter the name for this vocabulary.'),
-    '#required'      => FALSE,
-    '#default_value' => $default_cv,
-    '#weight'        => 1
-  );
-
-  $form['definition']= array(
-    '#type'          => 'textarea',
-    '#title'         => t('Description'),
-    '#description'   => t('Please enter a description for this vocabulary'),
-    '#default_value' => $default_desc,
-    '#weight'        => 2
-  );
-
-  $form['update'] = array(
-    '#type'         => 'submit',
-    '#value'        => t('Update'),
-    '#weight'       => 5,
-    '#executes_submit_callback' => TRUE,
-  );
-  $form['delete'] = array(
-    '#type'         => 'submit',
-    '#value'        => t('Delete'),
-    '#weight'       => 6,
-    '#executes_submit_callback' => TRUE,
-  );
-
-  $form['#redirect'] = 'admin/tripal/tripal_cv';
-
-
-  return $form;
-}
-*/
-
-/**
- * Purpose: The submit function of the update/delete controlled vocabulary form
- *
- * @ingroup tripal_cv
- *
-function tripal_cv_edit_form_submit($form, &$form_state) {
-
-  $name =  $form_state['values']['name'];
-  $desc =  $form_state['values']['definition'];
-  $cvid =  $form_state['values']['cvid'];
-  $op   =  $form_state['values']['op'];
-
-  if (strcmp($op, 'Update') == 0) {
-    $sql = "
-       UPDATE {cv} SET
-         name = :name,
-         definition = :description
-       WHERE cv_id = :cv_id
-    ";
-    $db = chado_query($sql, array(':name' => $name, ':description' => $desc, ':cv_id' => $cvid));
-    if ($db) {
-      drupal_set_message(t("Controlled vocabulary updated"));
-    }
-    else {
-      drupal_set_message(t("Failed to update controlled vocabulary."), 'error');
-    }
-  }
-  if (strcmp($op, 'Delete')==0) {
-    $sql = "
-       DELETE FROM {cv}
-       WHERE cv_id = :cv_id
-    ";
-    $db = chado_query($sql, array(':cv_id' => $cvid));
-    if ($db) {
-      drupal_set_message(t("Controlled vocabulary deleted"));
-    }
-    else {
-      drupal_set_message(t("Failed to delete controlled vocabulary."), 'error');
-    }
-  }
-
-}
-*/
-
-/**
- * Purpose: Provides the Add controlled vocabulary form
- *
-  * @ingroup tripal_cv
- *
-function tripal_cv_add_form(&$form_state = NULL) {
-
-  $form['cvid'] = array(
-    '#type' => 'hidden',
-    '#value' => $cvid
-  );
-
-  $form['name']= array(
-    '#type'          => 'textfield',
-    '#title'         => t("Controlled Vocabulary name"),
-    '#description'   => t('Please enter the name for this vocabulary.  This field will be ignored if an OBO file or URL is provided above'),
-    '#required'      => FALSE,
-    '#default_value' => $default_cv,
-    '#weight'        => 1
-  );
-
-  $form['definition']= array(
-    '#type'          => 'textarea',
-    '#title'         => t('Description'),
-    '#description'   => t('Please enter a description for this vocabulary'),
-    '#default_value' => $default_desc,
-    '#weight'        => 2
-  );
-
-  $form['add'] = array(
-    '#type'         => 'submit',
-    '#value'        => t('Add'),
-    '#weight'       => 5,
-    '#executes_submit_callback' => TRUE,
-  );
-
-  $form['#redirect'] = 'admin/tripal/tripal_cv';
-
-  return $form;
-}
-*/
-/**
- * Purpose: The submit function for the add controlled vocabulary form
- *
- * @ingroup tripal_cv
- *
-function tripal_cv_add_form_submit($form, &$form_state) {
-
-  $name =  $form_state['values']['name'];
-  $desc =  $form_state['values']['definition'];
-
-  $sql = "
-    INSERT INTO {cv}
-     (name,definition)
-    VALUES
-     (:name, :description)
-  ";
-  $db = chado_query($sql, array(':name' => $name, ':description' => $desc));
-  if ($db) {
-    drupal_set_message(t("Controlled vocabulary added"));
-  }
-  else {
-    drupal_set_message(t("Failed to add controlled vocabulary."), 'error');
-  }
-
-}
-*/
-/**
- * Purpose: Provides the form that allows adding of terms to an existing
- *   controlled vocabulary
- *
-  * @ingroup tripal_cv
- *
-function tripal_cv_cvterm_form(&$form_state, $action = 'add') {
-  tripal_core_ahah_init_form();
-
-  $form = array();
-
-  // get defaults
-  $cv_id = $form_state['values']['cv_id'] ? $form_state['values']['cv_id'] : FALSE;
-  $name  = $form_state['values']['name'] ? $form_state['values']['name'] : '';
-
-  // if we have a cv_id and a term name then get the rest of the term details
-  if ($cv_id and $name) {
-     $values = array(
-       'cv_id' => $cv_id,
-       'name' => $name,
-     );
-     $results = tripal_core_chado_select('cvterm', array('*'), $values);
-     if (!$results or count($results) == 0) {
-       // we can't find the cvterm so reset the name to blank
-       $name = '';
-     }
-     else {
-       $cvterm = $results[0];
-       $definition = $cvterm->definition;
-       $is_relationshiptype = $cvterm->is_relationshiptype;
-       $is_obsolete = $cvterm->is_obsolete;
-
-       // now get the database
-       $values = array('dbxref_id' => $cvterm->dbxref_id);
-       $results = tripal_core_chado_select('dbxref', array('*'), $values);
-       $dbxref = $results[0];
-       $accession = $dbxref->accession;
-       $db_id = $dbxref->db_id;
-     }
-  }
-
-  $values = array();
-  $columns = array('cv_id', 'name');
-  $options = array('order_by' => array('name' => 'ASC'));
-  $results = tripal_core_chado_select('cv', $columns, $values, $options);
-  $cvs = array();
-  $cvs[] = '';
-  foreach ($results as $cv) {
-    $cvs[$cv->cv_id] = $cv->name;
-  }
-
-  $form['wrapper-top'] = array(
-    '#type' => 'markup',
-    '#value' => '<div id="cvterm-form">',
-  );
-
-  $form['form_action'] = array(
-    '#type' => 'hidden',
-    '#value' => $action,
-  );
-
-  $form['cv_id'] = array(
-    '#title' => t('Controlled Vocabulary (Ontology) Name'),
-    '#type' => 'select',
-    '#options' => $cvs,
-    '#required' => TRUE,
-    '#default_value' => $cv_id,
-    '#ahah' => array(
-       'path'    => 'admin/tripal/tripal_cv/cvterm/ahah',
-       'wrapper' => 'cvterm-form',
-       'event'   => 'change',
-       'method'  => 'replace',
-    ),
-  );
-
-  if ($cv_id) {
-    $form['add_cvterm'] = array(
-      '#type'           => 'fieldset',
-      '#title'          => t('Term Details'),
-      '#prefix'         => '<div id="cvterm-add-div">',
-      '#suffix'         => '</div>'
-    );
-    $description = t('Please enter the name for this vocabulary term.');
-    if ($action == 'edit') {
-      $description = t('Enter the name of the term to edit.  This field will update automatically as you type. Click outside of the box after entering the term.');
-    }
-    $form['add_cvterm']['name']= array(
-      '#type'          => 'textfield',
-      '#title'         => t("Term Name"),
-      '#description'   => $description,
-      '#default_value' => $name,
-      '#required'      => TRUE,
-    );
-    if ($action == 'edit') {
-      if ($name) {
-        $form['add_cvterm']['name']['#attributes'] = array('readonly' => 'readonly');
-        $form['add_cvterm']['name']['#description'] = 'The term name cannot be changed. If the name is incorrect, please create a new term and make this one as obsolete.';
-      }
-      else {
-        $form['add_cvterm']['name']['#autocomplete_path'] = "admin/tripal/tripal_cv/cvterm/auto_name/$cv_id";
-        $form['add_cvterm']['name']['#ahah'] = array(
-           'path'    => 'admin/tripal/tripal_cv/cvterm/ahah',
-           'wrapper' => 'cvterm-form',
-           'method'  => 'replace',
-        );
-      }
-    }
-
-    if ($action == 'add' or $name) {
-
-
-      $form['add_cvterm']['definition']= array(
-        '#type'          => 'textarea',
-        '#title'         => t('Description'),
-        '#description'   => t('Please enter a description for this term'),
-        '#default_value' => $definition,
-      );
-
-      $form['add_cvterm']['is_relationshiptype'] = array(
-        '#type'          => 'checkbox',
-        '#title'         => t('This term describes a relationship?'),
-        '#default_value' => $is_relationshiptype,
-      );
-
-      $form['add_cvterm']['is_obsolete'] = array(
-        '#type'          => 'checkbox',
-        '#title'         => t('This term is obsolete?'),
-        '#default_value' => $is_obsolete,
-      );
-
-      $values = array();
-      $columns = array('db_id', 'name');
-      $options = array('order_by' => array('name' => 'ASC'));
-      $results = tripal_core_chado_select('db', $columns, $values, $options);
-      $dbs = array();
-      $dbs[] = '';
-      foreach ($results as $db) {
-        $dbs[$db->db_id] = $db->name;
-      }
-      $form['add_cvterm']['db_id'] = array(
-        '#type'         => 'select',
-        '#title'         => t('Database'),
-        '#description'   => t('All terms must be assocated with an external database.
-                            Please select the external database to associate with
-                            this term'),
-        '#options'      => $dbs,
-        '#default_value' => $db_id,
-        '#required' => TRUE,
-      );
-      if ($action == 'edit') {
-        // we don't want to allow the user to change the database on an edit.
-        $form['add_cvterm']['db_id']['#disabled'] = TRUE;
-        $form['add_cvterm']['db_id']['#description'] = 'The database to which this term belongs cannot be changed.';
-      }
-
-      $form['add_cvterm']['accession']= array(
-        '#type'          => 'textfield',
-        '#title'         => t("Accession"),
-        '#description'   => t('If this term has an existing accession (unique identifier) in the database
-           please enter that here.  If the accession is numeric with a database prefix (e.g. GO:003023), please
-           enter just the numeric value.  The database prefix will be appended whenever the term is displayed.
-           If the accession is not numeric then enter it as is.  If no value is provied, the term name
-           provided above will be used as the accession.'),
-        '#required'      => FALSE,
-        '#default_value' => $accession,
-      );
-      if ($action == 'edit') {
-        $form['add_cvterm']['accession']['#attributes'] = array('readonly' => 'readonly');
-        $form['add_cvterm']['accession']['#description'] = 'Cannot change the term accession.';
-      }
-      $button_text = 'Add Term';
-      if ($action == 'edit') {
-        $button_text = 'Update Term';
-      }
-      $form['add_cvterm']['submit'] = array(
-        '#type'  => 'submit',
-        '#value' => $button_text,
-      );
-    } // end if name selected (or action == 'add')
-  } //end of if cv selected
-
-
-  $form['wrapper-bottom'] = array(
-    '#type' => 'markup',
-    '#value' => '</div>',
-  );
-
-  return $form;
-}
-*/
-
-/**
- * Purpose: Validates the input for adding a cvterm
- *
-  * @ingroup tripal_cv
- *
-function tripal_cv_cvterm_form_validate($form, &$form_state) {
-
-  // Ensure that submit does not get called unless the AHAH in the form was called
-  if (!empty($form_state['ahah_submission'])) {
-    return;
-  }
-
-}
-*/
-/**
- * Purpose: Adds terms to an existing controlled vocabulary
- *
- * @ingroup tripal_cv
- *
-function tripal_cv_cvterm_form_submit($form, &$form_state) {
-
-  // Ensure the AHAH in the form was called
-  if (!empty($form_state['ahah_submission'])) {
-    return;
-  }
-
-  // get the database
-  $values = array('db_id' => $form_state['values']['db_id']);
-  $results = tripal_core_chado_select('db', array('name'), $values);
-  if (!$results or count($results) == 0) {
-    drupal_set_message(t('Unable to add term.  Cannot find the database.'), 'error');
-    return;
-  }
-  $db = $results[0];
-
-  // get the cv
-  $values = array('cv_id' => $form_state['values']['cv_id']);
-  $results = tripal_core_chado_select('cv', array('name'), $values);
-  if (!$results or count($results) == 0) {
-    drupal_set_message(t('Unable to add term.  Cannot find the vocabulary.'), 'error');
-    return;
-  }
-  $cv = $results[0];
-
-  // get the accession for this term
-  $accession = $form_state['values']['accession'];
-  if (!$accession) {
-    $accession = $form_state['values']['name'];
-  }
-  if (is_numeric($accession)) {
-    $accession = $db->name . ":" . $accession;
-  }
-
-
-  $update = 0;
-  if ($form_state['values']['form_action'] == 'edit') {
-    $update = 1;
-  }
-
-  // now add the term
-  $term = array(
-    'name' => $form_state['values']['name'],
-    'namespace' => $cv->name,
-    'id' => $accession,
-    'def' => $form_state['values']['definition'],
-    'is_obsolete' => $form_state['values']['is_obsolete'],
-  );
-
-  $is_relationship = $form_state['values']['is_relationshiptype'];
-  $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, $update, $db->name);
-  if ($cvterm) {
-    if (!$update) {
-      drupal_set_message('Term added successfully.');
-    }
-    else {
-      drupal_set_message('Term updated successfully.');
-    }
-  }
-  else {
-    drupal_set_message('Could not add term. Check Drupal recent logs for error messages.', 'error');
-  }
-
-}
-*/
-/**
- * Purpose: This function gets called when the selecting of a cv from
- *   the select list triggers it. This function simply rebuilds the form
- *   with new information. No elements are created here
- *
- * @ingroup tripal_cv
- *
-function tripal_cv_cvterm_callback() {
-  $status = TRUE;
-
-  // prepare and render the form
-  $form = tripal_core_ahah_prepare_form();
-  $data = drupal_render($form);
-
-  // bind javascript events to the new objects that will be returned
-  // so that AHAH enabled elements will work.
-  $settings = tripal_core_ahah_bind_events();
-
-  // return the updated JSON
-  drupal_json(
-    array(
-      'status'   => $status,
-      'data'     => $data,
-      'settings' => $settings,
-    )
-  );
-}
-*/
-/**
- * Cvterm path form submit
- *
- * @ingroup tripal_cv
- *
-function tripal_cv_cvtermpath_form_submit($form, &$form_state) {
-  global $user;
-
-  $cvid =  $form_state['values']['cvid'];
-
-  // first get the controlled vocabulary name:
-  $cv = chado_query("SELECT * FROM {cv} WHERE cv_id = :cv_id", array(':cv_id' => $cvid));
-  $cv = $cv->fetch_object();
-
-  // Submit a job to update cvtermpath
-  $job_args = array($cvid);
-  if ($form_state['values']['op'] == t('Update cvtermpath')) {
-    tripal_add_job("Update cvtermpath: $cv->name", 'tripal_cv',
-       'tripal_cv_update_cvtermpath', $job_args, $user->uid);
-  }
-}
-*/
+}

+ 1 - 0
tripal_cv/tripal_cv.info

@@ -7,4 +7,5 @@ version = 7.x-2.0-beta1
 configure = admin/tripal/chado/tripal_cv
 configure = admin/tripal/chado/tripal_cv
 
 
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_db
 dependencies[] = tripal_db

+ 29 - 12
tripal_cv/tripal_cv.install

@@ -5,6 +5,20 @@
  * Contains functions executed only on install/uninstall of this module
  * Contains functions executed only on install/uninstall of this module
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_cv_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_cv.views_default.inc");
+  $views = tripal_cv_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  */
  */
@@ -31,10 +45,10 @@ function tripal_cv_install() {
 
 
   // create the module's data directory
   // create the module's data directory
   tripal_create_moddir('tripal_cv');
   tripal_create_moddir('tripal_cv');
-    
-  // add the cv_root_mview 
+
+  // add the cv_root_mview
   tripal_cv_add_cv_root_mview();
   tripal_cv_add_cv_root_mview();
-  
+
   // create the tables that correlate OBO files/references with a chado CV
   // create the tables that correlate OBO files/references with a chado CV
   tripal_cv_add_obo_defaults();
   tripal_cv_add_obo_defaults();
 }
 }
@@ -45,9 +59,12 @@ function tripal_cv_install() {
  */
  */
 function tripal_cv_uninstall() {
 function tripal_cv_uninstall() {
   // remove the materialized view
   // remove the materialized view
+  // D7 @todo Fix tripal_mviews_get_mview_id()
+  /**
   if ($mview = tripal_mviews_get_mview_id('cv_root_mview')) {
   if ($mview = tripal_mviews_get_mview_id('cv_root_mview')) {
     tripal_mviews_action('delete', $mview);
     tripal_mviews_action('delete', $mview);
   }
   }
+  */
 }
 }
 
 
 /**
 /**
@@ -56,20 +73,20 @@ function tripal_cv_uninstall() {
  * @ingroup tripal_cv
  * @ingroup tripal_cv
  */
  */
 function tripal_cv_schema() {
 function tripal_cv_schema() {
-  
+
   $schema['tripal_cv_obo'] = array(
   $schema['tripal_cv_obo'] = array(
     'fields' => array(
     'fields' => array(
       'obo_id' => array(
       'obo_id' => array(
-        'type' => 'serial', 
-        'unsigned' => TRUE, 
+        'type' => 'serial',
+        'unsigned' => TRUE,
         'not null' => TRUE
         'not null' => TRUE
       ),
       ),
       'name' => array(
       'name' => array(
-        'type' => 'varchar', 
+        'type' => 'varchar',
          'length' => 255
          'length' => 255
        ),
        ),
       'path'  => array(
       'path'  => array(
-        'type' => 'varchar', 
+        'type' => 'varchar',
         'length' => 1024
         'length' => 1024
       ),
       ),
     ),
     ),
@@ -83,7 +100,7 @@ function tripal_cv_schema() {
 }
 }
 
 
 /**
 /**
- * 
+ *
  * @ingroup tripal_cv
  * @ingroup tripal_cv
  */
  */
 function tripal_cv_add_cv_root_mview() {
 function tripal_cv_add_cv_root_mview() {
@@ -104,7 +121,7 @@ function tripal_cv_add_cv_root_mview() {
       ),
       ),
       'cv_id' => array(
       'cv_id' => array(
         'type' => 'int',
         'type' => 'int',
-        'not null' => TRUE, 
+        'not null' => TRUE,
       ),
       ),
       'cv_name' => array(
       'cv_name' => array(
         'type' => 'varchar',
         'type' => 'varchar',
@@ -117,7 +134,7 @@ function tripal_cv_add_cv_root_mview() {
       'cv_root_mview_indx2' => array('cv_id'),
       'cv_root_mview_indx2' => array('cv_id'),
     ),
     ),
   );
   );
-  
+
   $sql = "
   $sql = "
     SELECT DISTINCT CVT.name,CVT.cvterm_id, CV.cv_id, CV.name
     SELECT DISTINCT CVT.name,CVT.cvterm_id, CV.cv_id, CV.name
     FROM cvterm_relationship CVTR
     FROM cvterm_relationship CVTR
@@ -126,7 +143,7 @@ function tripal_cv_add_cv_root_mview() {
     WHERE CVTR.object_id not in
     WHERE CVTR.object_id not in
       (SELECT subject_id FROM cvterm_relationship)
       (SELECT subject_id FROM cvterm_relationship)
   ";
   ";
-  
+
   // Create the MView
   // Create the MView
   tripal_add_mview($mv_name, 'tripal_cv', $schema, $sql, $comment);
   tripal_add_mview($mv_name, 'tripal_cv', $schema, $sql, $comment);
 }
 }

+ 16 - 8
tripal_cv/tripal_cv.module

@@ -58,7 +58,7 @@ function tripal_cv_menu() {
     'title' => 'Help',
     'title' => 'Help',
     'description' => "A description of the Tripal Controlled Vocabulary module including a short description of it's usage.",
     'description' => "A description of the Tripal Controlled Vocabulary module including a short description of it's usage.",
     'page callback' => 'theme',
     'page callback' => 'theme',
-    'page arguments' => array('tripal_cv_help'),
+    'page arguments' => array('tripal_cv_admin'),
     'access arguments' => array('administer controlled vocabularies'),
     'access arguments' => array('administer controlled vocabularies'),
     'type' => MENU_LOCAL_TASK,
     'type' => MENU_LOCAL_TASK,
     'weight' => 10
     'weight' => 10
@@ -89,17 +89,17 @@ function tripal_cv_menu() {
   /*
   /*
    * Menu items for adding and editing CVs
    * Menu items for adding and editing CVs
    */
    */
-  $items['admin/tripal/chado/tripal_cv/edit_cv'] = array(
+  $items['admin/tripal/chado/tripal_cv/cv/edit/%'] = array(
     'title' => 'Edit a Controlled Vocabulary',
     'title' => 'Edit a Controlled Vocabulary',
     'description' => 'Edit the details such as name and description for an existing controlled vocabulary.',
     'description' => 'Edit the details such as name and description for an existing controlled vocabulary.',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_cv_cv_edit_form'),
+    'page arguments' => array('tripal_cv_cv_edit_form', 6),
     'access callback' => 'user_access',
     'access callback' => 'user_access',
     'access arguments' => array('administer controlled vocabularies'),
     'access arguments' => array('administer controlled vocabularies'),
     'type' => MENU_CALLBACK,
     'type' => MENU_CALLBACK,
   );
   );
 
 
-  $items['admin/tripal/chado/tripal_cv/add_cv'] = array(
+  $items['admin/tripal/chado/tripal_cv/cv/add'] = array(
     'title' => 'Add a Controlled Vocabulary',
     'title' => 'Add a Controlled Vocabulary',
     'description' => 'Manually a new controlled vocabulary.',
     'description' => 'Manually a new controlled vocabulary.',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
@@ -112,6 +112,14 @@ function tripal_cv_menu() {
   /*
   /*
    * Menu items for adding and editing CVterms
    * Menu items for adding and editing CVterms
    */
    */
+  $items['admin/tripal/chado/tripal_cv/cv/%/cvterm/add'] = array(
+    'title' => 'Add a Controlled Vocabulary Term',
+    'description' => 'Add a new controlled vocabulary term.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tripal_cv_cvterm_add_form',5),
+    'access arguments' => array('administer controlled vocabularies'),
+    'type' => MENU_CALLBACK,
+  );
   $items['admin/tripal/chado/tripal_cv/cvterm/add'] = array(
   $items['admin/tripal/chado/tripal_cv/cvterm/add'] = array(
     'title' => 'Add a Controlled Vocabulary Term',
     'title' => 'Add a Controlled Vocabulary Term',
     'description' => 'Add a new controlled vocabulary term.',
     'description' => 'Add a new controlled vocabulary term.',
@@ -120,11 +128,11 @@ function tripal_cv_menu() {
     'access arguments' => array('administer controlled vocabularies'),
     'access arguments' => array('administer controlled vocabularies'),
     'type' => MENU_CALLBACK,
     'type' => MENU_CALLBACK,
   );
   );
-  $items['admin/tripal/chado/tripal_cv/cvterm/edit/%'] = array(
+  $items['admin/tripal/chado/tripal_cv/cv/%/cvterm/edit/%'] = array(
     'title' => 'Edit a Controlled Vocabulary Term',
     'title' => 'Edit a Controlled Vocabulary Term',
     'description' => 'Edit an existing controlled vocabulary term.',
     'description' => 'Edit an existing controlled vocabulary term.',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_cv_cvterm_edit_form'),
+    'page arguments' => array('tripal_cv_cvterm_edit_form',5,8),
     'access arguments' => array('administer controlled vocabularies'),
     'access arguments' => array('administer controlled vocabularies'),
     'type' => MENU_CALLBACK,
     'type' => MENU_CALLBACK,
   );
   );
@@ -287,8 +295,8 @@ function tripal_cv_form_alter(&$form, &$form_state, $form_id) {
 function tripal_cv_theme() {
 function tripal_cv_theme() {
   $theme_path = drupal_get_path('module', 'tripal_cv') . '/theme';
   $theme_path = drupal_get_path('module', 'tripal_cv') . '/theme';
   $items = array(
   $items = array(
-    'tripal_cv_help' => array(
-      'template' => 'tripal_cv_help',
+    'tripal_cv_admin' => array(
+      'template' => 'tripal_cv_admin',
       'arguments' =>  array(NULL),
       'arguments' =>  array(NULL),
       'path' => $theme_path,
       'path' => $theme_path,
     ),
     ),

+ 398 - 351
tripal_cv/tripal_cv.views_default.inc

@@ -21,159 +21,185 @@ function tripal_cv_views_default_views() {
  */
  */
 function tripal_cv_defaultview_admin_cvs_listing() {
 function tripal_cv_defaultview_admin_cvs_listing() {
 
 
-  $view = new view();
-  $view->name = 'tripal_cv_admin_cvs';
-  $view->description = 'A listing of all controlled vocabularies';
-  $view->tag = 'tripal admin';
-  $view->base_table = 'cv';
-  $view->human_name = 'CVs Admin';
-  $view->core = 6;
-  $view->api_version = '3.0';
-  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+$view = new view();
+$view->name = 'tripal_cv_admin_cvs';
+$view->description = 'DO NOT DISABLE';
+$view->tag = 'tripal admin';
+$view->base_table = 'cv';
+$view->human_name = 'CVs Admin';
+$view->core = 6;
+$view->api_version = '3.0';
+$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
 
 
-  /* Display: Defaults */
-  $handler = $view->new_display('default', 'Defaults', 'default');
-  $handler->display->display_options['title'] = 'Controlled Vocabularies';
-  $handler->display->display_options['use_more_always'] = FALSE;
-  $handler->display->display_options['access']['type'] = 'perm';
-  $handler->display->display_options['access']['perm'] = 'administer controlled vocabularies';
-  $handler->display->display_options['cache']['type'] = 'none';
-  $handler->display->display_options['query']['type'] = 'views_query';
-  $handler->display->display_options['exposed_form']['type'] = 'basic';
-  $handler->display->display_options['pager']['type'] = 'full';
-  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
-  $handler->display->display_options['pager']['options']['offset'] = '0';
-  $handler->display->display_options['pager']['options']['id'] = '0';
-  $handler->display->display_options['pager']['options']['quantity'] = '9';
-  $handler->display->display_options['style_plugin'] = 'table';
-  $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
-    'name' => 'name',
-    'definition' => 'definition',
-    'nothing' => 'nothing',
+/* Display: Defaults */
+$handler = $view->new_display('default', 'Defaults', 'default');
+$handler->display->display_options['title'] = 'Controlled Vocabularies';
+$handler->display->display_options['use_more_always'] = FALSE;
+$handler->display->display_options['access']['type'] = 'perm';
+$handler->display->display_options['access']['perm'] = 'administer controlled vocabularies';
+$handler->display->display_options['cache']['type'] = 'none';
+$handler->display->display_options['query']['type'] = 'views_query';
+$handler->display->display_options['exposed_form']['type'] = 'basic';
+$handler->display->display_options['pager']['type'] = 'full';
+$handler->display->display_options['pager']['options']['items_per_page'] = '25';
+$handler->display->display_options['pager']['options']['offset'] = '0';
+$handler->display->display_options['pager']['options']['id'] = '0';
+$handler->display->display_options['pager']['options']['quantity'] = '9';
+$handler->display->display_options['style_plugin'] = 'table';
+$handler->display->display_options['style_options']['grouping'] = '';
+$handler->display->display_options['style_options']['columns'] = array(
+  'name' => 'name',
+  'definition' => 'definition',
+  'nothing' => 'nothing',
+);
+$handler->display->display_options['style_options']['default'] = 'name';
+$handler->display->display_options['style_options']['info'] = array(
+  'name' => array(
+    'sortable' => 1,
+    'separator' => '',
+  ),
+  'definition' => array(
+    'sortable' => 0,
+    'separator' => '',
+  ),
+  'nothing' => array(
+    'separator' => '',
+  ),
+);
+/* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Vocabulary',
+    'path-1' => 'admin/tripal/chado/tripal_cv/cv/add',
   );
   );
-  $handler->display->display_options['style_options']['default'] = 'name';
-  $handler->display->display_options['style_options']['info'] = array(
-    'name' => array(
-      'sortable' => 1,
-      'separator' => '',
-    ),
-    'definition' => array(
-      'sortable' => 0,
-      'separator' => '',
-    ),
-    'nothing' => array(
-      'separator' => '',
-    ),
-  );
-  /* Header: Global: Text area */
-  $handler->display->display_options['header']['text']['id'] = 'text';
-  $handler->display->display_options['header']['text']['table'] = 'views';
-  $handler->display->display_options['header']['text']['field'] = 'area';
-  $handler->display->display_options['header']['text']['label'] = 'Add Cv';
-  $handler->display->display_options['header']['text']['empty'] = TRUE;
-  $handler->display->display_options['header']['text']['content'] = '<ul class="action-links">
-          <li><a href="tripal_cv/add_cv">Add Vocabulary</a></li>
-          <li><a href="tripal_cv/obo_loader">Load Ontology</a></li>
-     </ul>';
-  $handler->display->display_options['header']['text']['format'] = 'full_html';
-  /* No results behavior: Global: Text area */
-  $handler->display->display_options['empty']['text']['id'] = 'area';
-  $handler->display->display_options['empty']['text']['table'] = 'views';
-  $handler->display->display_options['empty']['text']['field'] = 'area';
-  $handler->display->display_options['empty']['text']['content'] = 'No controlled vocabularies match the supplied criteria.';
-  $handler->display->display_options['empty']['text']['format'] = '2';
-  /* Field: Chado Cv: Cv Id */
-  $handler->display->display_options['fields']['cv_id']['id'] = 'cv_id';
-  $handler->display->display_options['fields']['cv_id']['table'] = 'cv';
-  $handler->display->display_options['fields']['cv_id']['field'] = 'cv_id';
-  $handler->display->display_options['fields']['cv_id']['exclude'] = TRUE;
-  $handler->display->display_options['fields']['cv_id']['separator'] = '';
-  /* Field: Chado Cv: Name */
-  $handler->display->display_options['fields']['name']['id'] = 'name';
-  $handler->display->display_options['fields']['name']['table'] = 'cv';
-  $handler->display->display_options['fields']['name']['field'] = 'name';
-  /* Field: Chado Cv: Definition */
-  $handler->display->display_options['fields']['definition']['id'] = 'definition';
-  $handler->display->display_options['fields']['definition']['table'] = 'cv';
-  $handler->display->display_options['fields']['definition']['field'] = 'definition';
-  /* Field: Global: Custom text */
-  $handler->display->display_options['fields']['nothing_1']['id'] = 'nothing_1';
-  $handler->display->display_options['fields']['nothing_1']['table'] = 'views';
-  $handler->display->display_options['fields']['nothing_1']['field'] = 'nothing';
-  $handler->display->display_options['fields']['nothing_1']['label'] = 'Edit Link';
-  $handler->display->display_options['fields']['nothing_1']['exclude'] = TRUE;
-  $handler->display->display_options['fields']['nothing_1']['alter']['text'] = 'edit';
-  $handler->display->display_options['fields']['nothing_1']['alter']['make_link'] = TRUE;
-  $handler->display->display_options['fields']['nothing_1']['alter']['path'] = 'tripal_cv/edit_cv/[cv_id]';
-  /* Field: Global: Custom text */
-  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
-  $handler->display->display_options['fields']['nothing']['table'] = 'views';
-  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
-  $handler->display->display_options['fields']['nothing']['label'] = 'View Terms link';
-  $handler->display->display_options['fields']['nothing']['exclude'] = TRUE;
-  $handler->display->display_options['fields']['nothing']['alter']['text'] = 'View Terms';
-  $handler->display->display_options['fields']['nothing']['alter']['make_link'] = TRUE;
-  $handler->display->display_options['fields']['nothing']['alter']['path'] = 'admin/tripal/tripal_cv/list_cvterms?cv%5B%5D=[name]';
-  $handler->display->display_options['fields']['nothing']['hide_alter_empty'] = TRUE;
-  /* Field: Global: Custom text */
-  $handler->display->display_options['fields']['nothing_2']['id'] = 'nothing_2';
-  $handler->display->display_options['fields']['nothing_2']['table'] = 'views';
-  $handler->display->display_options['fields']['nothing_2']['field'] = 'nothing';
-  $handler->display->display_options['fields']['nothing_2']['label'] = '';
-  $handler->display->display_options['fields']['nothing_2']['alter']['text'] = '[nothing_1]<br />
-  [nothing]';
-  $handler->display->display_options['fields']['nothing_2']['element_class'] = 'short-column';
-  $handler->display->display_options['fields']['nothing_2']['element_label_class'] = 'short-column';
-  $handler->display->display_options['fields']['nothing_2']['element_label_colon'] = FALSE;
-  /* Sort criterion: Chado Cv: Name */
-  $handler->display->display_options['sorts']['name']['id'] = 'name';
-  $handler->display->display_options['sorts']['name']['table'] = 'cv';
-  $handler->display->display_options['sorts']['name']['field'] = 'name';
-  /* Filter criterion: Chado Cv: Name */
-  $handler->display->display_options['filters']['name']['id'] = 'name';
-  $handler->display->display_options['filters']['name']['table'] = 'cv';
-  $handler->display->display_options['filters']['name']['field'] = 'name';
-  $handler->display->display_options['filters']['name']['operator'] = 'contains';
-  $handler->display->display_options['filters']['name']['group'] = '0';
-  $handler->display->display_options['filters']['name']['exposed'] = TRUE;
-  $handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
-  $handler->display->display_options['filters']['name']['expose']['label'] = 'Name Contains';
-  $handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
-  $handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
-  $handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
-    2 => '2',
-    1 => 0,
-    3 => 0,
-  );
-  /* Filter criterion: Chado Cv: Definition */
-  $handler->display->display_options['filters']['definition']['id'] = 'definition';
-  $handler->display->display_options['filters']['definition']['table'] = 'cv';
-  $handler->display->display_options['filters']['definition']['field'] = 'definition';
-  $handler->display->display_options['filters']['definition']['operator'] = 'contains';
-  $handler->display->display_options['filters']['definition']['group'] = '0';
-  $handler->display->display_options['filters']['definition']['exposed'] = TRUE;
-  $handler->display->display_options['filters']['definition']['expose']['operator_id'] = 'definition_op';
-  $handler->display->display_options['filters']['definition']['expose']['label'] = 'Definition Contains';
-  $handler->display->display_options['filters']['definition']['expose']['operator'] = 'definition_op';
-  $handler->display->display_options['filters']['definition']['expose']['identifier'] = 'definition';
-  $handler->display->display_options['filters']['definition']['expose']['remember_roles'] = array(
-    2 => '2',
-    1 => 0,
-    3 => 0,
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => 'Load Ontology',
+    'path-2' => 'admin/tripal/chado/tripal_cv/obo_loader',
   );
   );
+/* No results behavior: Global: Text area */
+$handler->display->display_options['empty']['text']['id'] = 'area';
+$handler->display->display_options['empty']['text']['table'] = 'views';
+$handler->display->display_options['empty']['text']['field'] = 'area';
+$handler->display->display_options['empty']['text']['content'] = 'No controlled vocabularies match the supplied criteria.';
+$handler->display->display_options['empty']['text']['format'] = '2';
+/* Field: Chado Cv: Cv Id */
+$handler->display->display_options['fields']['cv_id']['id'] = 'cv_id';
+$handler->display->display_options['fields']['cv_id']['table'] = 'cv';
+$handler->display->display_options['fields']['cv_id']['field'] = 'cv_id';
+$handler->display->display_options['fields']['cv_id']['exclude'] = TRUE;
+$handler->display->display_options['fields']['cv_id']['separator'] = '';
+/* Field: Chado Cv: Name */
+$handler->display->display_options['fields']['name']['id'] = 'name';
+$handler->display->display_options['fields']['name']['table'] = 'cv';
+$handler->display->display_options['fields']['name']['field'] = 'name';
+/* Field: Chado Cv: Definition */
+$handler->display->display_options['fields']['definition']['id'] = 'definition';
+$handler->display->display_options['fields']['definition']['table'] = 'cv';
+$handler->display->display_options['fields']['definition']['field'] = 'definition';
+/* Field: Global: Custom text */
+$handler->display->display_options['fields']['nothing_1']['id'] = 'nothing_1';
+$handler->display->display_options['fields']['nothing_1']['table'] = 'views';
+$handler->display->display_options['fields']['nothing_1']['field'] = 'nothing';
+$handler->display->display_options['fields']['nothing_1']['label'] = 'Edit Link';
+$handler->display->display_options['fields']['nothing_1']['exclude'] = TRUE;
+$handler->display->display_options['fields']['nothing_1']['alter']['text'] = 'edit';
+$handler->display->display_options['fields']['nothing_1']['alter']['make_link'] = TRUE;
+$handler->display->display_options['fields']['nothing_1']['alter']['path'] = 'admin/tripal/chado/tripal_cv/cv/edit/[cv_id]';
+/* Field: Global: Custom text */
+$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+$handler->display->display_options['fields']['nothing']['table'] = 'views';
+$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+$handler->display->display_options['fields']['nothing']['label'] = 'View Terms link';
+$handler->display->display_options['fields']['nothing']['exclude'] = TRUE;
+$handler->display->display_options['fields']['nothing']['alter']['text'] = 'View Terms';
+$handler->display->display_options['fields']['nothing']['alter']['make_link'] = TRUE;
+$handler->display->display_options['fields']['nothing']['alter']['path'] = 'admin/tripal/chado/tripal_cv/cvterms?cv=[name]';
+$handler->display->display_options['fields']['nothing']['hide_alter_empty'] = TRUE;
+/* Field: Global: Custom text */
+$handler->display->display_options['fields']['nothing_3']['id'] = 'nothing_3';
+$handler->display->display_options['fields']['nothing_3']['table'] = 'views';
+$handler->display->display_options['fields']['nothing_3']['field'] = 'nothing';
+$handler->display->display_options['fields']['nothing_3']['label'] = 'Add term';
+$handler->display->display_options['fields']['nothing_3']['exclude'] = TRUE;
+$handler->display->display_options['fields']['nothing_3']['alter']['text'] = 'Add Term';
+$handler->display->display_options['fields']['nothing_3']['alter']['make_link'] = TRUE;
+$handler->display->display_options['fields']['nothing_3']['alter']['path'] = 'admin/tripal/chado/tripal_cv/cv/[cv_id]/cvterm/add';
+/* Field: Global: Custom text */
+$handler->display->display_options['fields']['nothing_2']['id'] = 'nothing_2';
+$handler->display->display_options['fields']['nothing_2']['table'] = 'views';
+$handler->display->display_options['fields']['nothing_2']['field'] = 'nothing';
+$handler->display->display_options['fields']['nothing_2']['label'] = '';
+$handler->display->display_options['fields']['nothing_2']['alter']['text'] = '[nothing_1]<br />
+  [nothing]   [nothing_3]';
+$handler->display->display_options['fields']['nothing_2']['element_class'] = 'short-column';
+$handler->display->display_options['fields']['nothing_2']['element_label_class'] = 'short-column';
+$handler->display->display_options['fields']['nothing_2']['element_label_colon'] = FALSE;
+/* Sort criterion: Chado Cv: Name */
+$handler->display->display_options['sorts']['name']['id'] = 'name';
+$handler->display->display_options['sorts']['name']['table'] = 'cv';
+$handler->display->display_options['sorts']['name']['field'] = 'name';
+/* Filter criterion: Chado Cv: Name */
+$handler->display->display_options['filters']['name']['id'] = 'name';
+$handler->display->display_options['filters']['name']['table'] = 'cv';
+$handler->display->display_options['filters']['name']['field'] = 'name';
+$handler->display->display_options['filters']['name']['operator'] = 'contains';
+$handler->display->display_options['filters']['name']['group'] = '0';
+$handler->display->display_options['filters']['name']['exposed'] = TRUE;
+$handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
+$handler->display->display_options['filters']['name']['expose']['label'] = 'Name Contains';
+$handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
+$handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
+$handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
+  2 => '2',
+  1 => 0,
+  3 => 0,
+);
+/* Filter criterion: Chado Cv: Definition */
+$handler->display->display_options['filters']['definition']['id'] = 'definition';
+$handler->display->display_options['filters']['definition']['table'] = 'cv';
+$handler->display->display_options['filters']['definition']['field'] = 'definition';
+$handler->display->display_options['filters']['definition']['operator'] = 'contains';
+$handler->display->display_options['filters']['definition']['group'] = '0';
+$handler->display->display_options['filters']['definition']['exposed'] = TRUE;
+$handler->display->display_options['filters']['definition']['expose']['operator_id'] = 'definition_op';
+$handler->display->display_options['filters']['definition']['expose']['label'] = 'Definition Contains';
+$handler->display->display_options['filters']['definition']['expose']['operator'] = 'definition_op';
+$handler->display->display_options['filters']['definition']['expose']['identifier'] = 'definition';
+$handler->display->display_options['filters']['definition']['expose']['remember_roles'] = array(
+  2 => '2',
+  1 => 0,
+  3 => 0,
+);
+
+  /** MANUALLY ADD since filter handler no exporting correctly */
+  $handler->display->display_options['filters']['name']['expose']['values_form_type'] = 'textfield';
+  $handler->display->display_options['filters']['name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['name']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['name']['expose']['max_length'] = 40;
 
 
-  /* Display: Page */
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_cv/cvs';
-  $handler->display->display_options['menu']['type'] = 'default tab';
-  $handler->display->display_options['menu']['title'] = 'Vocabularies';
-  $handler->display->display_options['menu']['description'] = 'A listing of all controlled vocabularies';
-  $handler->display->display_options['menu']['weight'] = '-10';
-  $handler->display->display_options['menu']['name'] = 'management';
-  $handler->display->display_options['menu']['context'] = 0;
-  $handler->display->display_options['menu']['context_only_inline'] = 0;
-  $handler->display->display_options['tab_options']['weight'] = '0';
+/* Display: Page */
+$handler = $view->new_display('page', 'Page', 'page_1');
+$handler->display->display_options['path'] = 'admin/tripal/chado/tripal_cv/cvs';
+$handler->display->display_options['menu']['type'] = 'default tab';
+$handler->display->display_options['menu']['title'] = 'Vocabularies';
+$handler->display->display_options['menu']['description'] = 'A listing of all controlled vocabularies';
+$handler->display->display_options['menu']['weight'] = '-10';
+$handler->display->display_options['menu']['name'] = 'management';
+$handler->display->display_options['menu']['context'] = 0;
+$handler->display->display_options['menu']['context_only_inline'] = 0;
+$handler->display->display_options['tab_options']['weight'] = '0';
+
+
+  /** MANUALLY ADD since filter handler no exporting correctly
+  $handler->display->display_options['filters']['name']['expose']['values_form_type'] = 'textfield';
+  $handler->display->display_options['filters']['name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['name']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['name']['expose']['max_length'] = 40;
+  */
 
 
   return $view;
   return $view;
 }
 }
@@ -183,217 +209,238 @@ function tripal_cv_defaultview_admin_cvs_listing() {
  */
  */
 function tripal_cv_defaultview_admin_cvterms_listing() {
 function tripal_cv_defaultview_admin_cvterms_listing() {
 
 
-  $view = new view();
-  $view->name = 'tripal_cv_admin_cvterms';
-  $view->description = 'A listing of all controlled vocabulary terms filtered by controlled vocabulary';
-  $view->tag = 'tripal admin';
-  $view->base_table = 'cvterm';
-  $view->human_name = 'CV Terms Admin';
-  $view->core = 0;
-  $view->api_version = '3.0';
-  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+$view = new view();
+$view->name = 'tripal_cv_admin_cvterms';
+$view->description = 'DO NOT DISABLE';
+$view->tag = 'tripal admin';
+$view->base_table = 'cvterm';
+$view->human_name = 'CV Terms Admin';
+$view->core = 0;
+$view->api_version = '3.0';
+$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
 
 
-  /* Display: Defaults */
-  $handler = $view->new_display('default', 'Defaults', 'default');
-  $handler->display->display_options['title'] = 'Controlled Vocabulary Terms';
-  $handler->display->display_options['use_more_always'] = FALSE;
-  $handler->display->display_options['access']['type'] = 'perm';
-  $handler->display->display_options['access']['perm'] = 'administer controlled vocabularies';
-  $handler->display->display_options['cache']['type'] = 'none';
-  $handler->display->display_options['query']['type'] = 'views_query';
-  $handler->display->display_options['exposed_form']['type'] = 'basic';
-  $handler->display->display_options['pager']['type'] = 'full';
-  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
-  $handler->display->display_options['pager']['options']['offset'] = '0';
-  $handler->display->display_options['pager']['options']['id'] = '0';
-  $handler->display->display_options['pager']['options']['quantity'] = '9';
-  $handler->display->display_options['style_plugin'] = 'table';
-  $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
-    'name_1' => 'name_1',
-    'name' => 'name',
-    'definition' => 'definition',
-    'is_obsolete' => 'is_obsolete',
-    'is_relationshiptype' => 'is_relationshiptype',
+/* Display: Defaults */
+$handler = $view->new_display('default', 'Defaults', 'default');
+$handler->display->display_options['title'] = 'Controlled Vocabulary Terms';
+$handler->display->display_options['use_more_always'] = FALSE;
+$handler->display->display_options['access']['type'] = 'perm';
+$handler->display->display_options['access']['perm'] = 'administer controlled vocabularies';
+$handler->display->display_options['cache']['type'] = 'none';
+$handler->display->display_options['query']['type'] = 'views_query';
+$handler->display->display_options['exposed_form']['type'] = 'basic';
+$handler->display->display_options['pager']['type'] = 'full';
+$handler->display->display_options['pager']['options']['items_per_page'] = '25';
+$handler->display->display_options['pager']['options']['offset'] = '0';
+$handler->display->display_options['pager']['options']['id'] = '0';
+$handler->display->display_options['pager']['options']['quantity'] = '9';
+$handler->display->display_options['style_plugin'] = 'table';
+$handler->display->display_options['style_options']['grouping'] = '';
+$handler->display->display_options['style_options']['columns'] = array(
+  'name_1' => 'name_1',
+  'name' => 'name',
+  'definition' => 'definition',
+  'is_obsolete' => 'is_obsolete',
+  'is_relationshiptype' => 'is_relationshiptype',
+);
+$handler->display->display_options['style_options']['default'] = '-1';
+$handler->display->display_options['style_options']['info'] = array(
+  'name_1' => array(
+    'sortable' => 1,
+    'separator' => '',
+  ),
+  'name' => array(
+    'sortable' => 1,
+    'separator' => '',
+  ),
+  'definition' => array(
+    'sortable' => 0,
+    'separator' => '',
+  ),
+  'is_obsolete' => array(
+    'sortable' => 1,
+    'separator' => '',
+  ),
+  'is_relationshiptype' => array(
+    'sortable' => 1,
+    'separator' => '',
+  ),
+);
+/* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Term',
+    'path-1' => 'admin/tripal/chado/tripal_cv/cvterm/add',
   );
   );
-  $handler->display->display_options['style_options']['default'] = '-1';
-  $handler->display->display_options['style_options']['info'] = array(
-    'name_1' => array(
-      'sortable' => 1,
-      'separator' => '',
-    ),
-    'name' => array(
-      'sortable' => 1,
-      'separator' => '',
-    ),
-    'definition' => array(
-      'sortable' => 0,
-      'separator' => '',
-    ),
-    'is_obsolete' => array(
-      'sortable' => 1,
-      'separator' => '',
-    ),
-    'is_relationshiptype' => array(
-      'sortable' => 1,
-      'separator' => '',
-    ),
-  );
-  /* Header: Global: Text area */
-  $handler->display->display_options['header']['text']['id'] = 'text';
-  $handler->display->display_options['header']['text']['table'] = 'views';
-  $handler->display->display_options['header']['text']['field'] = 'area';
-  $handler->display->display_options['header']['text']['label'] = 'Add cvterm';
-  $handler->display->display_options['header']['text']['empty'] = TRUE;
-  $handler->display->display_options['header']['text']['content'] = '<ul class="action-links">
-        <li><a href="cvterm/add">Add Term</a></li>
-   </ul>';
-  $handler->display->display_options['header']['text']['format'] = 'full_html';
-  /* No results behavior: Global: Text area */
-  $handler->display->display_options['empty']['text']['id'] = 'area';
-  $handler->display->display_options['empty']['text']['table'] = 'views';
-  $handler->display->display_options['empty']['text']['field'] = 'area';
-  $handler->display->display_options['empty']['text']['content'] = 'There are no terms associated with the selected controlled vocabulary. Please select a different vocabulary from the list above.';
-  $handler->display->display_options['empty']['text']['format'] = '1';
-  /* Field: Chado Cv: Name */
-  $handler->display->display_options['fields']['name_1']['id'] = 'name_1';
-  $handler->display->display_options['fields']['name_1']['table'] = 'cv';
-  $handler->display->display_options['fields']['name_1']['field'] = 'name';
-  $handler->display->display_options['fields']['name_1']['label'] = 'Vocabulary';
-  $handler->display->display_options['fields']['name_1']['alter']['make_link'] = TRUE;
-  $handler->display->display_options['fields']['name_1']['alter']['path'] = 'cvs?name=[name_1]';
-  /* Field: Chado Cvterm: Cvterm Id */
-  $handler->display->display_options['fields']['cvterm_id']['id'] = 'cvterm_id';
-  $handler->display->display_options['fields']['cvterm_id']['table'] = 'cvterm';
-  $handler->display->display_options['fields']['cvterm_id']['field'] = 'cvterm_id';
-  $handler->display->display_options['fields']['cvterm_id']['exclude'] = TRUE;
-  $handler->display->display_options['fields']['cvterm_id']['separator'] = '';
-  /* Field: Chado Cvterm: Name */
-  $handler->display->display_options['fields']['name']['id'] = 'name';
-  $handler->display->display_options['fields']['name']['table'] = 'cvterm';
-  $handler->display->display_options['fields']['name']['field'] = 'name';
-  /* Field: Chado Cvterm: Definition */
-  $handler->display->display_options['fields']['definition']['id'] = 'definition';
-  $handler->display->display_options['fields']['definition']['table'] = 'cvterm';
-  $handler->display->display_options['fields']['definition']['field'] = 'definition';
-  $handler->display->display_options['fields']['definition']['element_class'] = 'wide-column';
-  $handler->display->display_options['fields']['definition']['element_label_class'] = 'wide-column';
-  /* Field: Chado Cvterm: Is Obsolete */
-  $handler->display->display_options['fields']['is_obsolete']['id'] = 'is_obsolete';
-  $handler->display->display_options['fields']['is_obsolete']['table'] = 'cvterm';
-  $handler->display->display_options['fields']['is_obsolete']['field'] = 'is_obsolete';
-  $handler->display->display_options['fields']['is_obsolete']['label'] = 'Obsolete?';
-  $handler->display->display_options['fields']['is_obsolete']['alter']['alter_text'] = TRUE;
-  $handler->display->display_options['fields']['is_obsolete']['alter']['text'] = 'Yes';
-  $handler->display->display_options['fields']['is_obsolete']['element_class'] = 'short-column';
-  $handler->display->display_options['fields']['is_obsolete']['element_label_class'] = 'short-column';
-  $handler->display->display_options['fields']['is_obsolete']['empty'] = 'No';
-  $handler->display->display_options['fields']['is_obsolete']['empty_zero'] = TRUE;
-  $handler->display->display_options['fields']['is_obsolete']['separator'] = '';
-  /* Field: Chado Cvterm: Is Relationshiptype */
-  $handler->display->display_options['fields']['is_relationshiptype']['id'] = 'is_relationshiptype';
-  $handler->display->display_options['fields']['is_relationshiptype']['table'] = 'cvterm';
-  $handler->display->display_options['fields']['is_relationshiptype']['field'] = 'is_relationshiptype';
-  $handler->display->display_options['fields']['is_relationshiptype']['label'] = 'Relation-ship?';
-  $handler->display->display_options['fields']['is_relationshiptype']['alter']['alter_text'] = TRUE;
-  $handler->display->display_options['fields']['is_relationshiptype']['alter']['text'] = 'Yes';
-  $handler->display->display_options['fields']['is_relationshiptype']['element_class'] = 'short-column';
-  $handler->display->display_options['fields']['is_relationshiptype']['element_label_class'] = 'short-column';
-  $handler->display->display_options['fields']['is_relationshiptype']['empty'] = 'No';
-  $handler->display->display_options['fields']['is_relationshiptype']['empty_zero'] = TRUE;
-  $handler->display->display_options['fields']['is_relationshiptype']['separator'] = '';
-  /* Field: Global: Custom text */
-  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
-  $handler->display->display_options['fields']['nothing']['table'] = 'views';
-  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
-  $handler->display->display_options['fields']['nothing']['label'] = 'Edit Link';
-  $handler->display->display_options['fields']['nothing']['exclude'] = TRUE;
-  $handler->display->display_options['fields']['nothing']['alter']['text'] = 'edit';
-  $handler->display->display_options['fields']['nothing']['alter']['make_link'] = TRUE;
-  $handler->display->display_options['fields']['nothing']['alter']['path'] = 'admin/tripal/chado/tripal_cv/cvterm/edit/[cvterm_id]';
-  /* Field: Global: Custom text */
-  $handler->display->display_options['fields']['nothing_1']['id'] = 'nothing_1';
-  $handler->display->display_options['fields']['nothing_1']['table'] = 'views';
-  $handler->display->display_options['fields']['nothing_1']['field'] = 'nothing';
-  $handler->display->display_options['fields']['nothing_1']['label'] = '';
-  $handler->display->display_options['fields']['nothing_1']['alter']['text'] = '[nothing]';
-  $handler->display->display_options['fields']['nothing_1']['element_class'] = 'short-column';
-  $handler->display->display_options['fields']['nothing_1']['element_label_class'] = 'short-column';
-  $handler->display->display_options['fields']['nothing_1']['element_label_colon'] = FALSE;
-  /* Sort criterion: Chado Cv: Name */
-  $handler->display->display_options['sorts']['name']['id'] = 'name';
-  $handler->display->display_options['sorts']['name']['table'] = 'cv';
-  $handler->display->display_options['sorts']['name']['field'] = 'name';
-  /* Sort criterion: Chado Cvterm: Name */
-  $handler->display->display_options['sorts']['name_1']['id'] = 'name_1';
-  $handler->display->display_options['sorts']['name_1']['table'] = 'cvterm';
-  $handler->display->display_options['sorts']['name_1']['field'] = 'name';
-  /* Filter criterion: Chado Cv: Name */
-  $handler->display->display_options['filters']['name']['id'] = 'name';
-  $handler->display->display_options['filters']['name']['table'] = 'cv';
-  $handler->display->display_options['filters']['name']['field'] = 'name';
-  $handler->display->display_options['filters']['name']['value'] = 'All';
-  $handler->display->display_options['filters']['name']['group'] = '0';
-  $handler->display->display_options['filters']['name']['exposed'] = TRUE;
-  $handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
-  $handler->display->display_options['filters']['name']['expose']['label'] = 'Vocabulary';
-  $handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
-  $handler->display->display_options['filters']['name']['expose']['identifier'] = 'cv';
+/* No results behavior: Global: Text area */
+$handler->display->display_options['empty']['text']['id'] = 'area';
+$handler->display->display_options['empty']['text']['table'] = 'views';
+$handler->display->display_options['empty']['text']['field'] = 'area';
+$handler->display->display_options['empty']['text']['content'] = 'There are no terms associated with the selected controlled vocabulary. Please select a different vocabulary from the list above.';
+$handler->display->display_options['empty']['text']['format'] = '1';
+/* Field: Chado Cv: Cv Id */
+$handler->display->display_options['fields']['cv_id']['id'] = 'cv_id';
+$handler->display->display_options['fields']['cv_id']['table'] = 'cv';
+$handler->display->display_options['fields']['cv_id']['field'] = 'cv_id';
+$handler->display->display_options['fields']['cv_id']['exclude'] = TRUE;
+$handler->display->display_options['fields']['cv_id']['separator'] = '';
+/* Field: Chado Cv: Name */
+$handler->display->display_options['fields']['name_1']['id'] = 'name_1';
+$handler->display->display_options['fields']['name_1']['table'] = 'cv';
+$handler->display->display_options['fields']['name_1']['field'] = 'name';
+$handler->display->display_options['fields']['name_1']['label'] = 'Vocabulary';
+$handler->display->display_options['fields']['name_1']['alter']['make_link'] = TRUE;
+$handler->display->display_options['fields']['name_1']['alter']['path'] = 'admin/tripal/chado/tripal_cv/cvs?name=[name_1]';
+/* Field: Chado Cvterm: Cvterm Id */
+$handler->display->display_options['fields']['cvterm_id']['id'] = 'cvterm_id';
+$handler->display->display_options['fields']['cvterm_id']['table'] = 'cvterm';
+$handler->display->display_options['fields']['cvterm_id']['field'] = 'cvterm_id';
+$handler->display->display_options['fields']['cvterm_id']['exclude'] = TRUE;
+$handler->display->display_options['fields']['cvterm_id']['separator'] = '';
+/* Field: Chado Cvterm: Name */
+$handler->display->display_options['fields']['name']['id'] = 'name';
+$handler->display->display_options['fields']['name']['table'] = 'cvterm';
+$handler->display->display_options['fields']['name']['field'] = 'name';
+/* Field: Chado Cvterm: Definition */
+$handler->display->display_options['fields']['definition']['id'] = 'definition';
+$handler->display->display_options['fields']['definition']['table'] = 'cvterm';
+$handler->display->display_options['fields']['definition']['field'] = 'definition';
+$handler->display->display_options['fields']['definition']['element_class'] = 'wide-column';
+$handler->display->display_options['fields']['definition']['element_label_class'] = 'wide-column';
+/* Field: Chado Cvterm: Is Obsolete */
+$handler->display->display_options['fields']['is_obsolete']['id'] = 'is_obsolete';
+$handler->display->display_options['fields']['is_obsolete']['table'] = 'cvterm';
+$handler->display->display_options['fields']['is_obsolete']['field'] = 'is_obsolete';
+$handler->display->display_options['fields']['is_obsolete']['label'] = 'Obsolete?';
+$handler->display->display_options['fields']['is_obsolete']['alter']['alter_text'] = TRUE;
+$handler->display->display_options['fields']['is_obsolete']['alter']['text'] = 'Yes';
+$handler->display->display_options['fields']['is_obsolete']['element_class'] = 'short-column';
+$handler->display->display_options['fields']['is_obsolete']['element_label_class'] = 'short-column';
+$handler->display->display_options['fields']['is_obsolete']['empty'] = 'No';
+$handler->display->display_options['fields']['is_obsolete']['empty_zero'] = TRUE;
+$handler->display->display_options['fields']['is_obsolete']['separator'] = '';
+/* Field: Chado Cvterm: Is Relationshiptype */
+$handler->display->display_options['fields']['is_relationshiptype']['id'] = 'is_relationshiptype';
+$handler->display->display_options['fields']['is_relationshiptype']['table'] = 'cvterm';
+$handler->display->display_options['fields']['is_relationshiptype']['field'] = 'is_relationshiptype';
+$handler->display->display_options['fields']['is_relationshiptype']['label'] = 'Relation-ship?';
+$handler->display->display_options['fields']['is_relationshiptype']['alter']['alter_text'] = TRUE;
+$handler->display->display_options['fields']['is_relationshiptype']['alter']['text'] = 'Yes';
+$handler->display->display_options['fields']['is_relationshiptype']['element_class'] = 'short-column';
+$handler->display->display_options['fields']['is_relationshiptype']['element_label_class'] = 'short-column';
+$handler->display->display_options['fields']['is_relationshiptype']['empty'] = 'No';
+$handler->display->display_options['fields']['is_relationshiptype']['empty_zero'] = TRUE;
+$handler->display->display_options['fields']['is_relationshiptype']['separator'] = '';
+/* Field: Global: Custom text */
+$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+$handler->display->display_options['fields']['nothing']['table'] = 'views';
+$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+$handler->display->display_options['fields']['nothing']['label'] = 'Edit Link';
+$handler->display->display_options['fields']['nothing']['exclude'] = TRUE;
+$handler->display->display_options['fields']['nothing']['alter']['text'] = 'edit';
+$handler->display->display_options['fields']['nothing']['alter']['make_link'] = TRUE;
+$handler->display->display_options['fields']['nothing']['alter']['path'] = 'admin/tripal/chado/tripal_cv/cv/[cv_id]/cvterm/edit/[cvterm_id]';
+/* Field: Global: Custom text */
+$handler->display->display_options['fields']['nothing_1']['id'] = 'nothing_1';
+$handler->display->display_options['fields']['nothing_1']['table'] = 'views';
+$handler->display->display_options['fields']['nothing_1']['field'] = 'nothing';
+$handler->display->display_options['fields']['nothing_1']['label'] = '';
+$handler->display->display_options['fields']['nothing_1']['alter']['text'] = '[nothing]';
+$handler->display->display_options['fields']['nothing_1']['element_class'] = 'short-column';
+$handler->display->display_options['fields']['nothing_1']['element_label_class'] = 'short-column';
+$handler->display->display_options['fields']['nothing_1']['element_label_colon'] = FALSE;
+/* Sort criterion: Chado Cv: Name */
+$handler->display->display_options['sorts']['name']['id'] = 'name';
+$handler->display->display_options['sorts']['name']['table'] = 'cv';
+$handler->display->display_options['sorts']['name']['field'] = 'name';
+/* Sort criterion: Chado Cvterm: Name */
+$handler->display->display_options['sorts']['name_1']['id'] = 'name_1';
+$handler->display->display_options['sorts']['name_1']['table'] = 'cvterm';
+$handler->display->display_options['sorts']['name_1']['field'] = 'name';
+/* Filter criterion: Chado Cv: Name */
+$handler->display->display_options['filters']['name']['id'] = 'name';
+$handler->display->display_options['filters']['name']['table'] = 'cv';
+$handler->display->display_options['filters']['name']['field'] = 'name';
+$handler->display->display_options['filters']['name']['value'] = 'All';
+$handler->display->display_options['filters']['name']['group'] = '0';
+$handler->display->display_options['filters']['name']['exposed'] = TRUE;
+$handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
+$handler->display->display_options['filters']['name']['expose']['label'] = 'Vocabulary';
+$handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
+$handler->display->display_options['filters']['name']['expose']['identifier'] = 'cv';
+$handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
+  2 => '2',
+  1 => 0,
+  3 => 0,
+);
+/* Filter criterion: Chado Cvterm: Name */
+$handler->display->display_options['filters']['name_1']['id'] = 'name_1';
+$handler->display->display_options['filters']['name_1']['table'] = 'cvterm';
+$handler->display->display_options['filters']['name_1']['field'] = 'name';
+$handler->display->display_options['filters']['name_1']['operator'] = 'contains';
+$handler->display->display_options['filters']['name_1']['group'] = '0';
+$handler->display->display_options['filters']['name_1']['exposed'] = TRUE;
+$handler->display->display_options['filters']['name_1']['expose']['operator_id'] = '';
+$handler->display->display_options['filters']['name_1']['expose']['label'] = 'Name Contains';
+$handler->display->display_options['filters']['name_1']['expose']['identifier'] = 'name';
+$handler->display->display_options['filters']['name_1']['expose']['remember_roles'] = array(
+  2 => '2',
+  1 => 0,
+  3 => 0,
+);
+/* Filter criterion: Chado Cvterm: Definition */
+$handler->display->display_options['filters']['definition']['id'] = 'definition';
+$handler->display->display_options['filters']['definition']['table'] = 'cvterm';
+$handler->display->display_options['filters']['definition']['field'] = 'definition';
+$handler->display->display_options['filters']['definition']['operator'] = 'contains';
+$handler->display->display_options['filters']['definition']['group'] = '0';
+$handler->display->display_options['filters']['definition']['exposed'] = TRUE;
+$handler->display->display_options['filters']['definition']['expose']['operator_id'] = 'definition_op';
+$handler->display->display_options['filters']['definition']['expose']['label'] = 'Definition Contains';
+$handler->display->display_options['filters']['definition']['expose']['operator'] = 'definition_op';
+$handler->display->display_options['filters']['definition']['expose']['identifier'] = 'definition';
+$handler->display->display_options['filters']['definition']['expose']['remember_roles'] = array(
+  2 => '2',
+  1 => 0,
+  3 => 0,
+);
+
+/** MANUALLY ADDED since filter handler no exporting correctly */
   $handler->display->display_options['filters']['name']['expose']['values_form_type'] = 'select';
   $handler->display->display_options['filters']['name']['expose']['values_form_type'] = 'select';
   $handler->display->display_options['filters']['name']['expose']['select_multiple'] = FALSE;
   $handler->display->display_options['filters']['name']['expose']['select_multiple'] = FALSE;
   $handler->display->display_options['filters']['name']['expose']['select_optional'] = TRUE;
   $handler->display->display_options['filters']['name']['expose']['select_optional'] = TRUE;
   $handler->display->display_options['filters']['name']['expose']['max_length'] = 40;
   $handler->display->display_options['filters']['name']['expose']['max_length'] = 40;
-  $handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
-    2 => '2',
-    1 => 0,
-    3 => 0,
-  );
-  /* Filter criterion: Chado Cvterm: Name */
-  $handler->display->display_options['filters']['name_1']['id'] = 'name_1';
-  $handler->display->display_options['filters']['name_1']['table'] = 'cvterm';
-  $handler->display->display_options['filters']['name_1']['field'] = 'name';
-  $handler->display->display_options['filters']['name_1']['operator'] = 'contains';
-  $handler->display->display_options['filters']['name_1']['group'] = '0';
-  $handler->display->display_options['filters']['name_1']['exposed'] = TRUE;
-  $handler->display->display_options['filters']['name_1']['expose']['operator_id'] = '';
-  $handler->display->display_options['filters']['name_1']['expose']['label'] = 'Name Contains';
-  $handler->display->display_options['filters']['name_1']['expose']['identifier'] = 'name';
-  $handler->display->display_options['filters']['name']['expose']['values_form_type'] = 'textfield';
+
+  $handler->display->display_options['filters']['name_1']['expose']['values_form_type'] = 'textfield';
+  $handler->display->display_options['filters']['name_1']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['name_1']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['name_1']['expose']['max_length'] = 40;
+
+/* Display: Page */
+$handler = $view->new_display('page', 'Page', 'page_1');
+$handler->display->display_options['path'] = 'admin/tripal/chado/tripal_cv/cvterms';
+$handler->display->display_options['menu']['type'] = 'tab';
+$handler->display->display_options['menu']['title'] = 'Terms';
+$handler->display->display_options['menu']['description'] = 'A listing of a controlled vocabulary terms for a given vocabulary';
+$handler->display->display_options['menu']['weight'] = '-8';
+$handler->display->display_options['menu']['name'] = 'management';
+$handler->display->display_options['menu']['context'] = 0;
+$handler->display->display_options['menu']['context_only_inline'] = 0;
+
+  /** MANUALLY ADD since filter handler no exporting correctly
+  $handler->display->display_options['filters']['name']['expose']['values_form_type'] = 'select';
   $handler->display->display_options['filters']['name']['expose']['select_multiple'] = FALSE;
   $handler->display->display_options['filters']['name']['expose']['select_multiple'] = FALSE;
-  $handler->display->display_options['filters']['name']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['name']['expose']['select_optional'] = TRUE;
   $handler->display->display_options['filters']['name']['expose']['max_length'] = 40;
   $handler->display->display_options['filters']['name']['expose']['max_length'] = 40;
-  $handler->display->display_options['filters']['name_1']['expose']['remember_roles'] = array(
-    2 => '2',
-    1 => 0,
-    3 => 0,
-  );
-  /* Filter criterion: Chado Cvterm: Definition */
-  $handler->display->display_options['filters']['definition']['id'] = 'definition';
-  $handler->display->display_options['filters']['definition']['table'] = 'cvterm';
-  $handler->display->display_options['filters']['definition']['field'] = 'definition';
-  $handler->display->display_options['filters']['definition']['operator'] = 'contains';
-  $handler->display->display_options['filters']['definition']['group'] = '0';
-  $handler->display->display_options['filters']['definition']['exposed'] = TRUE;
-  $handler->display->display_options['filters']['definition']['expose']['operator_id'] = 'definition_op';
-  $handler->display->display_options['filters']['definition']['expose']['label'] = 'Definition Contains';
-  $handler->display->display_options['filters']['definition']['expose']['operator'] = 'definition_op';
-  $handler->display->display_options['filters']['definition']['expose']['identifier'] = 'definition';
-  $handler->display->display_options['filters']['definition']['expose']['remember_roles'] = array(
-    2 => '2',
-    1 => 0,
-    3 => 0,
-  );
 
 
-  /* Display: Page */
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_cv/cvterms';
-  $handler->display->display_options['menu']['type'] = 'tab';
-  $handler->display->display_options['menu']['title'] = 'Terms';
-  $handler->display->display_options['menu']['description'] = 'A listing of a controlled vocabulary terms for a given vocabulary';
-  $handler->display->display_options['menu']['weight'] = '-8';
-  $handler->display->display_options['menu']['name'] = 'management';
-  $handler->display->display_options['menu']['context'] = 0;
-  $handler->display->display_options['menu']['context_only_inline'] = 0;
+  $handler->display->display_options['filters']['name_1']['expose']['values_form_type'] = 'textfield';
+  $handler->display->display_options['filters']['name_1']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['name_1']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['name_1']['expose']['max_length'] = 40;
+  */
 
 
   return $view;
   return $view;
 }
 }

+ 1 - 0
tripal_db/tripal_db.info

@@ -7,3 +7,4 @@ version = 7.x-2.0-beta1
 configure = admin/tripal/chado/tripal_db
 configure = admin/tripal/chado/tripal_db
 
 
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views

+ 14 - 0
tripal_db/tripal_db.install

@@ -5,6 +5,20 @@
  * Contains functions related to the installation of this module
  * Contains functions related to the installation of this module
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_db_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_db.views_default.inc");
+  $views = tripal_db_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  */
  */

+ 3 - 3
tripal_db/tripal_db.module

@@ -37,7 +37,7 @@ function tripal_db_menu() {
     'title' => 'Help',
     'title' => 'Help',
     'description' => "A description of the Tripal Database module including a short description of it's usage.",
     'description' => "A description of the Tripal Database module including a short description of it's usage.",
     'page callback' => 'theme',
     'page callback' => 'theme',
-    'page arguments' => array('tripal_db_help'),
+    'page arguments' => array('tripal_db_admin'),
     'access arguments' => array('administer db cross-references'),
     'access arguments' => array('administer db cross-references'),
     'type' => MENU_LOCAL_TASK,
     'type' => MENU_LOCAL_TASK,
     'weight' => 10
     'weight' => 10
@@ -131,8 +131,8 @@ function tripal_db_views_api() {
 function tripal_db_theme() {
 function tripal_db_theme() {
   $theme_path = drupal_get_path('module', 'tripal_db') . '/theme';
   $theme_path = drupal_get_path('module', 'tripal_db') . '/theme';
   $items = array(
   $items = array(
-    'tripal_db_help' => array(
-      'template' => 'tripal_db_help',
+    'tripal_db_admin' => array(
+      'template' => 'tripal_db_admin',
       'arguments' =>  array(NULL),
       'arguments' =>  array(NULL),
       'path' => $theme_path,
       'path' => $theme_path,
     ),
     ),

+ 12 - 11
tripal_db/tripal_db.views_default.inc

@@ -23,7 +23,7 @@ function tripal_db_defaultview_admin_db_listing() {
 
 
   $view = new view();
   $view = new view();
   $view->name = 'tripal_db_admin_dbs';
   $view->name = 'tripal_db_admin_dbs';
-  $view->description = 'A listing of all databases.';
+  $view->description = 'DO NOT DISABLE';
   $view->tag = 'tripal admin';
   $view->tag = 'tripal admin';
   $view->base_table = 'db';
   $view->base_table = 'db';
   $view->human_name = 'DB Admin';
   $view->human_name = 'DB Admin';
@@ -72,15 +72,16 @@ function tripal_db_defaultview_admin_db_listing() {
       'separator' => '',
       'separator' => '',
     ),
     ),
   );
   );
-  /* Header: Global: Text area */
-  $handler->display->display_options['header']['text']['id'] = 'text';
-  $handler->display->display_options['header']['text']['table'] = 'views';
-  $handler->display->display_options['header']['text']['field'] = 'area';
-  $handler->display->display_options['header']['text']['label'] = 'Add DB';
-  $handler->display->display_options['header']['text']['content'] = '<ul class="action-links">
-        <li><a href="tripal_db/add">Add Database</a></li>
-    </ul>';
-  $handler->display->display_options['header']['text']['format'] = 'full_html';
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Database',
+    'path-1' => 'admin/tripal/chado/tripal_db/add',
+  );
   /* No results behavior: Global: Text area */
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['text']['id'] = 'area';
   $handler->display->display_options['empty']['text']['id'] = 'area';
   $handler->display->display_options['empty']['text']['table'] = 'views';
   $handler->display->display_options['empty']['text']['table'] = 'views';
@@ -201,7 +202,7 @@ function tripal_db_defaultview_admin_dbxref_listing() {
 
 
   $view = new view();
   $view = new view();
   $view->name = 'tripal_db_admin_dbxrefs';
   $view->name = 'tripal_db_admin_dbxrefs';
-  $view->description = '';
+  $view->description = 'DO NOT DISABLE';
   $view->tag = 'tripal admin';
   $view->tag = 'tripal admin';
   $view->base_table = 'dbxref';
   $view->base_table = 'dbxref';
   $view->human_name = 'DB Reference Admin';
   $view->human_name = 'DB Reference Admin';

+ 1 - 0
tripal_feature/tripal_feature.info

@@ -8,6 +8,7 @@ version = 7.x-2.0-beta1
 dependencies[] = search
 dependencies[] = search
 dependencies[] = path
 dependencies[] = path
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_db
 dependencies[] = tripal_db
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv
 dependencies[] = tripal_organism
 dependencies[] = tripal_organism

+ 32 - 15
tripal_feature/tripal_feature.install

@@ -4,6 +4,20 @@
  * @todo Add file header description
  * @todo Add file header description
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_feature_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_feature.views_default.inc");
+  $views = tripal_feature_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  */
  */
@@ -33,7 +47,7 @@ function tripal_feature_install() {
 
 
   // add the materialized view
   // add the materialized view
   tripal_feature_add_organism_count_mview();
   tripal_feature_add_organism_count_mview();
-  
+
   // add a job to the job queue so this view gets updated automatically next
   // add a job to the job queue so this view gets updated automatically next
   // time the job facility is run
   // time the job facility is run
   if ($mview_id = tripal_mviews_get_mview_id('organism_feature_count')) {
   if ($mview_id = tripal_mviews_get_mview_id('organism_feature_count')) {
@@ -48,40 +62,43 @@ function tripal_feature_install() {
  */
  */
 function tripal_feature_uninstall() {
 function tripal_feature_uninstall() {
   // Drop the MView table if it exists
   // Drop the MView table if it exists
+  // D7 @todo Fix tripal_mviews_get_mview_id()
+  /**
   if ($mview_id = tripal_mviews_get_mview_id('organism_feature_count')) {
   if ($mview_id = tripal_mviews_get_mview_id('organism_feature_count')) {
     tripal_mviews_action("delete", $mview_id);
     tripal_mviews_action("delete", $mview_id);
   }
   }
+  */
 }
 }
- 
+
 /**
 /**
  * Implementation of hook_schema().
  * Implementation of hook_schema().
  *
  *
  * @ingroup tripal_feature
  * @ingroup tripal_feature
  */
  */
 function tripal_feature_schema() {
 function tripal_feature_schema() {
-  
+
   $schema['chado_feature'] = array(
   $schema['chado_feature'] = array(
     'fields' => array(
     'fields' => array(
       'vid' => array(
       'vid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
         'default' => 0
         'default' => 0
        ),
        ),
       'nid' => array(
       'nid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
         'default' => 0
         'default' => 0
        ),
        ),
       'feature_id' => array(
       'feature_id' => array(
-        'type' => 'int', 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'not null' => TRUE,
         'default' => 0
         'default' => 0
       ),
       ),
       'sync_date' => array(
       'sync_date' => array(
-        'type' => 'int', 
-        'not null' => FALSE, 
+        'type' => 'int',
+        'not null' => FALSE,
         'description' => 'UNIX integer sync date/time'
         'description' => 'UNIX integer sync date/time'
       ),
       ),
     ),
     ),
@@ -94,7 +111,7 @@ function tripal_feature_schema() {
     ),
     ),
     'primary key' => array('nid'),
     'primary key' => array('nid'),
   );
   );
-  
+
   return $schema;
   return $schema;
 };
 };
 
 
@@ -142,7 +159,7 @@ function tripal_feature_add_organism_count_mview() {
         'length' => '255',
         'length' => '255',
         'not null' => TRUE,
         'not null' => TRUE,
       ),
       ),
-    ),      
+    ),
     'indexes' => array(
     'indexes' => array(
       'organism_feature_count_idx1' => array('organism_id'),
       'organism_feature_count_idx1' => array('organism_id'),
       'organism_feature_count_idx2' => array('cvterm_id'),
       'organism_feature_count_idx2' => array('cvterm_id'),

+ 0 - 547
tripal_feature/tripal_feature.views.inc

@@ -38,550 +38,3 @@ function tripal_feature_views_handlers() {
     ),
     ),
   );
   );
 }
 }
-/**
- *
- * @ingroup tripal_feature_views
- */
-function tripal_feature_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // Main default view
-  $view = new view;
-  $view->name = 'feature_listing';
-  $view->description = 'A listing of chado sequence features.';
-  $view->tag = 'chado default';
-  $view->base_table = 'feature';
-  $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', 'features_all', 'default');
-  $handler->override_option('fields', array(
-    'uniquename' => array(
-      'label' => 'Unique Name',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => 'node/[nid]',
-        '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' => 'uniquename',
-      'table' => 'feature',
-      'field' => 'uniquename',
-      'relationship' => 'none',
-      'override' => array(
-        'button' => 'Override',
-      ),
-    ),
-    'name' => 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',
-      'table' => 'feature',
-      'field' => 'name',
-      'relationship' => 'none',
-      'override' => array(
-        'button' => 'Override',
-      ),
-    ),
-    'name_1' => 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_1',
-      'table' => 'cvterm',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-    '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',
-      'override' => array(
-        'button' => 'Override',
-      ),
-    ),
-    'seqlen' => array(
-      'label' => 'Sequence Length',
-      '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,
-      'set_precision' => FALSE,
-      'precision' => 0,
-      'decimal' => '.',
-      'separator' => ',',
-      'prefix' => '',
-      'suffix' => '',
-      'exclude' => 0,
-      'id' => 'seqlen',
-      'table' => 'feature',
-      'field' => 'seqlen',
-      'relationship' => 'none',
-    ),
-    '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' => '',
-        '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',
-      'not' => 0,
-      'separator' => ', ',
-      'exclude' => 0,
-      'id' => 'is_obsolete',
-      'table' => 'feature',
-      'field' => 'is_obsolete',
-      'relationship' => 'none',
-    ),
-    'timeaccessioned' => array(
-      'label' => 'Accessioned On',
-      '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,
-      'date_format' => 'large',
-      'custom_date_format' => '',
-      'type' => 'separator',
-      'separator' => ', ',
-      'exclude' => 0,
-      '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',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'common_name' => array(
-      'operator' => '=',
-      'value' => array(),
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'common_name_op',
-        'identifier' => 'organism',
-        'label' => 'Organism Common Name',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'common_name',
-      '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,
-      ),
-    ),
-    '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' => 'feature',
-      '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' => '~',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'name_1_op',
-        'identifier' => 'name',
-        'label' => 'Name Contains',
-        'bef_filter_description' => '',
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'name_1',
-      'table' => 'feature',
-      '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 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(
-    'type' => 'perm',
-    'perm' => 'access chado_feature content',
-  ));
-  $handler->override_option('cache', array(
-    'type' => 'none',
-  ));
-  $handler->override_option('title', 'Sequence Features');
-  $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', 'No features matched 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',
-    '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',
-  ));
-  $default_handler = $handler;
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/features');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Features',
-    'description' => 'A feature is a biological sequence or a section of a biological sequence, or a collection of such sections. Examples include genes, exons, transcripts, regulatory regions, polypeptides, protein domains, chromosome sequences, sequence variations, cross-genome match regions such as hits and HSPs and so on.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        '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,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Adds feature => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Feature to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_feature',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Change analysis.name to have a link to the node
-    $fields['name']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Only show records with published nodes
-    /**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-    */
-  }
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 549 - 0
tripal_feature/tripal_feature.views_default.inc

@@ -0,0 +1,549 @@
+<?php
+
+/**
+ *
+ * @ingroup tripal_feature_views
+ */
+function tripal_feature_views_default_views() {
+  $views = array();
+
+  if (!module_exists('tripal_views')) {
+    return $views;
+  }
+
+  // Main default view
+  $view = new view;
+  $view->name = 'feature_listing';
+  $view->description = 'A listing of chado sequence features.';
+  $view->tag = 'chado default';
+  $view->base_table = 'feature';
+  $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', 'features_all', 'default');
+  $handler->override_option('fields', array(
+    'uniquename' => array(
+      'label' => 'Unique Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => 'node/[nid]',
+        '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' => 'uniquename',
+      'table' => 'feature',
+      'field' => 'uniquename',
+      'relationship' => 'none',
+      'override' => array(
+        'button' => 'Override',
+      ),
+    ),
+    'name' => 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',
+      'table' => 'feature',
+      'field' => 'name',
+      'relationship' => 'none',
+      'override' => array(
+        'button' => 'Override',
+      ),
+    ),
+    'name_1' => 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_1',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    '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',
+      'override' => array(
+        'button' => 'Override',
+      ),
+    ),
+    'seqlen' => array(
+      'label' => 'Sequence Length',
+      '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,
+      'set_precision' => FALSE,
+      'precision' => 0,
+      'decimal' => '.',
+      'separator' => ',',
+      'prefix' => '',
+      'suffix' => '',
+      'exclude' => 0,
+      'id' => 'seqlen',
+      'table' => 'feature',
+      'field' => 'seqlen',
+      'relationship' => 'none',
+    ),
+    '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' => '',
+        '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',
+      'not' => 0,
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'is_obsolete',
+      'table' => 'feature',
+      'field' => 'is_obsolete',
+      'relationship' => 'none',
+    ),
+    'timeaccessioned' => array(
+      'label' => 'Accessioned On',
+      '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,
+      'date_format' => 'large',
+      'custom_date_format' => '',
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      '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',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'common_name' => array(
+      'operator' => '=',
+      'value' => array(),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'common_name_op',
+        'identifier' => 'organism',
+        'label' => 'Organism Common Name',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'common_name',
+      '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,
+      ),
+    ),
+    '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' => 'feature',
+      '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' => '~',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'name_1_op',
+        'identifier' => 'name',
+        'label' => 'Name Contains',
+        'bef_filter_description' => '',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'name_1',
+      'table' => 'feature',
+      '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 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(
+    'type' => 'perm',
+    'perm' => 'access chado_feature content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Sequence Features');
+  $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', 'No features matched 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',
+    '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',
+  ));
+  $default_handler = $handler;
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'chado/features');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Features',
+    'description' => 'A feature is a biological sequence or a section of a biological sequence, or a collection of such sections. Examples include genes, exons, transcripts, regulatory regions, polypeptides, protein domains, chromosome sequences, sequence variations, cross-genome match regions such as hits and HSPs and so on.',
+    'weight' => '10',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'link_to_node' => 0,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Adds feature => Node relationship
+    $default_handler->override_option('relationships', array(
+      'nid' => array(
+        'label' => 'Feature to Node',
+        'required' => 0,
+        'id' => 'nid',
+        'table' => 'chado_feature',
+        'field' => 'nid',
+        'relationship' => 'none',
+      ),
+    ));
+    // Change analysis.name to have a link to the node
+    $fields['name']['alter']['link_to_node'] = 1;
+    $default_handler->override_option('fields', $fields);
+    // Only show records with published nodes
+    /**
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+    */
+  }
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 2 - 0
tripal_featuremap/tripal_featuremap.info

@@ -4,7 +4,9 @@ core = 7.x
 project = tripal_featuremap
 project = tripal_featuremap
 package = Tripal
 package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
+
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_organism
 dependencies[] = tripal_organism
 dependencies[] = tripal_feature
 dependencies[] = tripal_feature
 dependencies[] = search
 dependencies[] = search

+ 39 - 25
tripal_featuremap/tripal_featuremap.install

@@ -4,6 +4,20 @@
  * @todo Add file header description
  * @todo Add file header description
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_featuremap_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_featuremap.views_default.inc");
+  $views = tripal_featuremap_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  */
  */
@@ -33,7 +47,7 @@ function tripal_featuremap_install() {
 
 
   // add the featuremapprop table to Chado
   // add the featuremapprop table to Chado
   tripal_featuremap_add_custom_tables();
   tripal_featuremap_add_custom_tables();
-  
+
   // Add cvterms
   // Add cvterms
   tripal_featuremap_add_cvterms();
   tripal_featuremap_add_cvterms();
 
 
@@ -89,49 +103,49 @@ function tripal_featuremap_schema() {
 
 
 
 
 /*
 /*
- * 
+ *
  */
  */
 function tripal_featuremap_add_cvterms() {
 function tripal_featuremap_add_cvterms() {
-  
+
    // add cvterms for the map unit types
    // add cvterms for the map unit types
-   tripal_cv_add_cvterm(array('name' => 'cM','def' => 'Centimorgan units'), 
+   tripal_cv_add_cvterm(array('name' => 'cM','def' => 'Centimorgan units'),
+     'featuremap_units', 0, 1, 'tripal');
+   tripal_cv_add_cvterm(array('name' => 'bp','def' => 'Base pairs units'),
      'featuremap_units', 0, 1, 'tripal');
      'featuremap_units', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'bp','def' => 'Base pairs units'), 
+   tripal_cv_add_cvterm(array('name' => 'bin_unit','def' => 'The bin unit'),
      'featuremap_units', 0, 1, 'tripal');
      'featuremap_units', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'bin_unit','def' => 'The bin unit'), 
-     'featuremap_units', 0, 1, 'tripal');   
-   tripal_cv_add_cvterm(array('name' => 'marker_order','def' => 'Units simply to define marker order.'), 
+   tripal_cv_add_cvterm(array('name' => 'marker_order','def' => 'Units simply to define marker order.'),
      'featuremap_units', 0, 1, 'tripal');
      'featuremap_units', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'undefined','def' => 'A catch-all for an undefined unit type'), 
+   tripal_cv_add_cvterm(array('name' => 'undefined','def' => 'A catch-all for an undefined unit type'),
      'featuremap_units', 0, 1, 'tripal');
      'featuremap_units', 0, 1, 'tripal');
-   
-   tripal_cv_add_cvterm(array('name' => 'start','def' => 'The start coordinate for a map feature.'), 
+
+   tripal_cv_add_cvterm(array('name' => 'start','def' => 'The start coordinate for a map feature.'),
      'featurepos_property', 0, 1, 'tripal');
      'featurepos_property', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'stop','def' => 'The end coordinate for a map feature'), 
+   tripal_cv_add_cvterm(array('name' => 'stop','def' => 'The end coordinate for a map feature'),
      'featurepos_property', 0, 1, 'tripal');
      'featurepos_property', 0, 1, 'tripal');
-   
+
    // add cvterms for map properties
    // add cvterms for map properties
-   tripal_cv_add_cvterm(array('name' => 'Map Dbxref','def' => 'A unique identifer for the map in a remote database.  The format is a database abbreviation and a unique accession separated by a colon.  (e.g. Gramene:tsh1996a)'), 
+   tripal_cv_add_cvterm(array('name' => 'Map Dbxref','def' => 'A unique identifer for the map in a remote database.  The format is a database abbreviation and a unique accession separated by a colon.  (e.g. Gramene:tsh1996a)'),
      'featuremap_property', 0, 1, 'tripal');
      'featuremap_property', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'Map Type','def' => 'The type of Map (e.g. QTL, Physical, etc.)'), 
+   tripal_cv_add_cvterm(array('name' => 'Map Type','def' => 'The type of Map (e.g. QTL, Physical, etc.)'),
      'featuremap_property', 0, 1, 'tripal');
      'featuremap_property', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'Genome Group','def' => ''), 
+   tripal_cv_add_cvterm(array('name' => 'Genome Group','def' => ''),
      'featuremap_property', 0, 1, 'tripal');
      'featuremap_property', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'URL','def' => 'A univeral resource locator (URL) reference where the publication can be found.  For maps found online, this would be the web address for the map.'), 
+   tripal_cv_add_cvterm(array('name' => 'URL','def' => 'A univeral resource locator (URL) reference where the publication can be found.  For maps found online, this would be the web address for the map.'),
      'featuremap_property', 0, 1, 'tripal');
      'featuremap_property', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'Population Type','def' => 'A brief descriptoin of the population type used to generate the map (e.g. RIL, F2, BC1, etc).'), 
+   tripal_cv_add_cvterm(array('name' => 'Population Type','def' => 'A brief descriptoin of the population type used to generate the map (e.g. RIL, F2, BC1, etc).'),
      'featuremap_property', 0, 1, 'tripal');
      'featuremap_property', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'Population Size','def' => 'The size of the population used to construct the map.'), 
+   tripal_cv_add_cvterm(array('name' => 'Population Size','def' => 'The size of the population used to construct the map.'),
      'featuremap_property', 0, 1, 'tripal');
      'featuremap_property', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'Methods','def' => 'A brief description of the methods used to construct the map.'), 
+   tripal_cv_add_cvterm(array('name' => 'Methods','def' => 'A brief description of the methods used to construct the map.'),
      'featuremap_property', 0, 1, 'tripal');
      'featuremap_property', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'Software','def' => 'The software used to construct the map.'), 
+   tripal_cv_add_cvterm(array('name' => 'Software','def' => 'The software used to construct the map.'),
      'featuremap_property', 0, 1, 'tripal');
      'featuremap_property', 0, 1, 'tripal');
 
 
 }
 }
 
 
 /*
 /*
- * 
+ *
  */
  */
 function tripal_featuremap_add_custom_tables(){
 function tripal_featuremap_add_custom_tables(){
   // add the featuremaprop table to Chado
   // add the featuremaprop table to Chado
@@ -192,9 +206,9 @@ function tripal_featuremap_add_custom_tables(){
         ),
         ),
       ),
       ),
     ),
     ),
-  );  
+  );
   tripal_core_create_custom_table('featuremapprop', $schema, TRUE);
   tripal_core_create_custom_table('featuremapprop', $schema, TRUE);
-  
+
   // add the featuremap_dbxref table to Chado
   // add the featuremap_dbxref table to Chado
   $schema = array (
   $schema = array (
     'table' => 'featuremap_dbxref',
     'table' => 'featuremap_dbxref',
@@ -246,7 +260,7 @@ function tripal_featuremap_add_custom_tables(){
     'referring_tables' => NULL,
     'referring_tables' => NULL,
   );
   );
   tripal_core_create_custom_table('featuremap_dbxref', $schema, TRUE);
   tripal_core_create_custom_table('featuremap_dbxref', $schema, TRUE);
-  
+
   $schema = array (
   $schema = array (
     'table' => 'featureposprop',
     'table' => 'featureposprop',
     'fields' => array (
     'fields' => array (

+ 1 - 372
tripal_featuremap/tripal_featuremap.views.inc

@@ -13,375 +13,4 @@
 /**
 /**
  * @defgroup tripal_featuremap_views Map Views Integration
  * @defgroup tripal_featuremap_views Map Views Integration
  * @ingroup views
  * @ingroup views
- */
-
-/**
- *
- *
- * @ingroup tripal_featuremap_views
- */
-function tripal_featuremap_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // Main default view
-  $view = new view;
-  $view->name = 'featuremap_listing';
-  $view->description = 'A listing of all chado feature maps';
-  $view->tag = 'chado default';
-  $view->base_table = 'featuremap';
-  $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' => 'node/[nid]',
-        '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,
-      'link_to_node' => 1,
-      'hide_alter_empty' => 1,
-      'type' => 'separator',
-      'separator' => ', ',
-      'exclude' => 0,
-      'id' => 'name',
-      'table' => 'featuremap',
-      '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,
-      'link_to_node' => 0,
-      'empty_zero' => 0,
-      'hide_alter_empty' => 1,
-      'type' => 'separator',
-      'separator' => ', ',
-      'exclude' => 0,
-      'id' => 'description',
-      'table' => 'featuremap',
-      'field' => 'description',
-      'relationship' => 'none',
-    ),
-    'name_1' => array(
-      'label' => 'Map Units',
-      '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,
-      'link_to_node' => 0,
-      'empty_zero' => 0,
-      'hide_alter_empty' => 1,
-      'type' => 'separator',
-      'separator' => ', ',
-      'exclude' => 0,
-      'id' => 'name_1',
-      'table' => 'cvterm',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('sorts', array(
-    'name' => array(
-      'order' => 'ASC',
-      'id' => 'name',
-      'table' => 'featuremap',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'unittype_id' => array(
-      'operator' => '=',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'unittype_id_op',
-        'identifier' => 'unittype_id',
-        'label' => 'Map Units',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'unittype_id',
-      'table' => 'featuremap',
-      'field' => 'unittype_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' => '~',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'name_1_op',
-        'identifier' => 'name_1',
-        'label' => 'Name',
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'name_1',
-      'table' => 'featuremap',
-      'field' => 'name',
-      'relationship' => 'none',
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 1,
-      ),
-    ),
-    'description' => array(
-      'operator' => '~',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'description_op',
-        'identifier' => 'description',
-        'label' => 'Description',
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'description',
-      'table' => 'featuremap',
-      '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 feature maps matching the entered criteria. If you leave a any of the criteria blank then the maps will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all maps will be listed.',
-    ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_featuremap content',
-  ));
-  $handler->override_option('cache', array(
-    'type' => 'none',
-  ));
-  $handler->override_option('title', 'Maps');
-  $handler->override_option('header', 'Click "Show" to see a list of all feature maps matching the entered criteria. If you leave a any of the criteria blank then the maps will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all maps will be listed.');
-  $handler->override_option('header_format', '1');
-  $handler->override_option('header_empty', 1);
-  $handler->override_option('empty', 'No feature maps match the current criteria.');
-  $handler->override_option('empty_format', '1');
-  $handler->override_option('items_per_page', 25);
-  $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',
-      'name_1' => 'name_1',
-      'nid' => 'nid',
-    ),
-    'info' => array(
-      'name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'description' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'name_1' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'nid' => array(
-        'separator' => '',
-      ),
-    ),
-    'default' => '-1',
-  ));
-  $default_handler = $handler;
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/featuremaps');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Maps',
-    'description' => 'A listing of chado feature maps.',
-    'weight' => '0',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        '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,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Adds feature => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Map to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_featuremap',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Change analysis.name to have a link to the node
-    $fields['name']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Only show records with published nodes
-    /**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-    */
-  }
-  $views[$view->name] = $view;
-
-  return $views;
-}
+ */

+ 372 - 0
tripal_featuremap/tripal_featuremap.views_default.inc

@@ -0,0 +1,372 @@
+<?php
+
+/**
+ *
+ *
+ * @ingroup tripal_featuremap_views
+ */
+function tripal_featuremap_views_default_views() {
+  $views = array();
+
+  if (!module_exists('tripal_views')) {
+    return $views;
+  }
+
+  // Main default view
+  $view = new view;
+  $view->name = 'featuremap_listing';
+  $view->description = 'A listing of all chado feature maps';
+  $view->tag = 'chado default';
+  $view->base_table = 'featuremap';
+  $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' => 'node/[nid]',
+        '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,
+      'link_to_node' => 1,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'featuremap',
+      '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,
+      'link_to_node' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'description',
+      'table' => 'featuremap',
+      'field' => 'description',
+      'relationship' => 'none',
+    ),
+    'name_1' => array(
+      'label' => 'Map Units',
+      '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,
+      'link_to_node' => 0,
+      'empty_zero' => 0,
+      'hide_alter_empty' => 1,
+      'type' => 'separator',
+      'separator' => ', ',
+      'exclude' => 0,
+      'id' => 'name_1',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('sorts', array(
+    'name' => array(
+      'order' => 'ASC',
+      'id' => 'name',
+      'table' => 'featuremap',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'unittype_id' => array(
+      'operator' => '=',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'unittype_id_op',
+        'identifier' => 'unittype_id',
+        'label' => 'Map Units',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'unittype_id',
+      'table' => 'featuremap',
+      'field' => 'unittype_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' => '~',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'name_1_op',
+        'identifier' => 'name_1',
+        'label' => 'Name',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'name_1',
+      'table' => 'featuremap',
+      'field' => 'name',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'description' => array(
+      'operator' => '~',
+      'value' => '',
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'description_op',
+        'identifier' => 'description',
+        'label' => 'Description',
+        'remember' => 0,
+      ),
+      'case' => 0,
+      'id' => 'description',
+      'table' => 'featuremap',
+      '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 feature maps matching the entered criteria. If you leave a any of the criteria blank then the maps will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all maps will be listed.',
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access chado_featuremap content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Maps');
+  $handler->override_option('header', 'Click "Show" to see a list of all feature maps matching the entered criteria. If you leave a any of the criteria blank then the maps will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all maps will be listed.');
+  $handler->override_option('header_format', '1');
+  $handler->override_option('header_empty', 1);
+  $handler->override_option('empty', 'No feature maps match the current criteria.');
+  $handler->override_option('empty_format', '1');
+  $handler->override_option('items_per_page', 25);
+  $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',
+      'name_1' => 'name_1',
+      'nid' => 'nid',
+    ),
+    'info' => array(
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'description' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name_1' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'nid' => array(
+        'separator' => '',
+      ),
+    ),
+    'default' => '-1',
+  ));
+  $default_handler = $handler;
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'chado/featuremaps');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Maps',
+    'description' => 'A listing of chado feature maps.',
+    'weight' => '0',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'link_to_node' => 0,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Adds feature => Node relationship
+    $default_handler->override_option('relationships', array(
+      'nid' => array(
+        'label' => 'Map to Node',
+        'required' => 0,
+        'id' => 'nid',
+        'table' => 'chado_featuremap',
+        'field' => 'nid',
+        'relationship' => 'none',
+      ),
+    ));
+    // Change analysis.name to have a link to the node
+    $fields['name']['alter']['link_to_node'] = 1;
+    $default_handler->override_option('fields', $fields);
+    // Only show records with published nodes
+    /**
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+    */
+  }
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 2 - 0
tripal_genetic/tripal_genetic.info

@@ -4,7 +4,9 @@ core = 7.x
 project = tripal_genetic
 project = tripal_genetic
 package = Tripal
 package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
+
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv
 dependencies[] = tripal_feature
 dependencies[] = tripal_feature
 dependencies[] = tripal_phenotype
 dependencies[] = tripal_phenotype

+ 15 - 0
tripal_genetic/tripal_genetic.install

@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_genetic_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_genetic.views_default.inc");
+  $views = tripal_genetic_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}

+ 1 - 253
tripal_genetic/tripal_genetic.views.inc

@@ -13,256 +13,4 @@
 /**
 /**
  * @defgroup tripal_genetic_views Genetic Views Integration
  * @defgroup tripal_genetic_views Genetic Views Integration
  * @ingroup views
  * @ingroup views
- */
-
-/**
- * Implements hook_views_default_views().
- *
- * @ingroup tripal_genetic
- */
-function tripal_genetic_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // 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' => '~',
-      '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' => '~',
-      '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', 'chado/genotypes');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Genotypes',
-    'description' => 'A genotype is defined by a collection of features, mutations, balancers, deficiencies, haplotype blocks, or engineered constructs.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  $views[$view->name] = $view;
-
-  return $views;
-}
+ */

+ 253 - 0
tripal_genetic/tripal_genetic.views_default.inc

@@ -0,0 +1,253 @@
+<?php
+
+/**
+ * Implements hook_views_default_views().
+ *
+ * @ingroup tripal_genetic
+ */
+function tripal_genetic_views_default_views() {
+  $views = array();
+
+  if (!module_exists('tripal_views')) {
+    return $views;
+  }
+
+  // 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' => '~',
+      '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' => '~',
+      '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', 'chado/genotypes');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Genotypes',
+    'description' => 'A genotype is defined by a collection of features, mutations, balancers, deficiencies, haplotype blocks, or engineered constructs.',
+    'weight' => '10',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 59 - 30
tripal_library/includes/tripal_library.admin.inc

@@ -1,5 +1,34 @@
-<?php 
+<?php
+
+function tripal_library_admin_libraries_listing() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado', 'admin/tripal/chado');
+  $breadcrumb[] = l('Libraries', 'admin/tripal/chado/tripal_library');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_library_admin_libraries','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Tripal Library Module uses primarily views to provide an '
+      . 'administrative interface. Currently one or more views needed for this '
+      . 'administrative interface are disabled. <strong>Click each of the following links to '
+      . 'enable the pertinent views</strong>:</p>';
+    $output .= '<ul>';
+      $output .= '<li>'.l('Library Admin', 'admin/tripal/chado/tripal_library/views/libraries/enable').'</li>';
+    $output .= '</ul>';
+  }
 
 
+  return $output;
+}
 
 
 /**
 /**
  * Administrative settings form
  * Administrative settings form
@@ -311,14 +340,14 @@ function tripal_library_add_taxonomy($node, $library_id) {
   // do this because Drupal 6 fails to do this globally for us and
   // do this because Drupal 6 fails to do this globally for us and
   // the drupal_execute function below won't work
   // the drupal_execute function below won't work
   module_load_include('inc', 'taxonomy', 'taxonomy.admin');
   module_load_include('inc', 'taxonomy', 'taxonomy.admin');
-    
+
    // add the vocabulary
    // add the vocabulary
   $vocab_form['values']['name'] = 'DNA Libraries';
   $vocab_form['values']['name'] = 'DNA Libraries';
   $vocab_form['values']['description'] = 'Allows for associating/searching of library features by library name';
   $vocab_form['values']['description'] = 'Allows for associating/searching of library features by library name';
   $vocab_form['values']['help'] = '';
   $vocab_form['values']['help'] = '';
   $vocab_form['values']['module'] = 'taxonomy';
   $vocab_form['values']['module'] = 'taxonomy';
   drupal_form_submit('taxonomy_form_vocabulary', $vocab_form);
   drupal_form_submit('taxonomy_form_vocabulary', $vocab_form);
-  return;   
+  return;
 
 
    // make sure this term doesn't already exist.  If it doesn't then add it
    // make sure this term doesn't already exist.  If it doesn't then add it
   if ($vid) {
   if ($vid) {
@@ -428,10 +457,10 @@ function tripal_library_feature_set_taxonomy($library_id = NULL) {
   if ($library_id) {
   if ($library_id) {
     print "Finding features for library with ID: $library_id\n";
     print "Finding features for library with ID: $library_id\n";
     $sql = "
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
-      WHERE L.library_id = :library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
+      WHERE L.library_id = :library_id
       ORDER BY LF.feature_id
       ORDER BY LF.feature_id
     ";
     ";
     $features = chado_query($sql, array(':library_id' => $library_id));
     $features = chado_query($sql, array(':library_id' => $library_id));
@@ -439,18 +468,18 @@ function tripal_library_feature_set_taxonomy($library_id = NULL) {
   else {
   else {
     print "Finding features for all libraries\n";
     print "Finding features for all libraries\n";
     $sql = "
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
       ORDER BY LF.feature_id
       ORDER BY LF.feature_id
     ";
     ";
     $features = chado_query($sql);
     $features = chado_query($sql);
   }
   }
 
 
   $node_sql = "
   $node_sql = "
-    SELECT * 
-    FROM {chado_feature} CF 
-      INNER JOIN {node} N ON CF.nid = N.nid 
+    SELECT *
+    FROM {chado_feature} CF
+      INNER JOIN {node} N ON CF.nid = N.nid
     WHERE feature_id = :feature_id
     WHERE feature_id = :feature_id
   ";
   ";
   // iterate through the features and add the taxonomy
   // iterate through the features and add the taxonomy
@@ -474,19 +503,19 @@ function tripal_library_reindex_features($library_id = NULL, $job_id = NULL) {
   // with all libraries.
   // with all libraries.
   if ($library_id) {
   if ($library_id) {
     $sql = "
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
         INNER JOIN {library} L ON LF.library_id = L.library_id
         INNER JOIN {library} L ON LF.library_id = L.library_id
-      WHERE L.library_id = :library_id 
+      WHERE L.library_id = :library_id
       ORDER BY LF.feature_id
       ORDER BY LF.feature_id
     ";
     ";
     $results = chado_query($sql, array(':library_id' => $library_id));
     $results = chado_query($sql, array(':library_id' => $library_id));
   }
   }
   else {
   else {
     $sql = "
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
       ORDER BY LF.feature_id
       ORDER BY LF.feature_id
     ";
     ";
     $results = chado_query($sql);
     $results = chado_query($sql);
@@ -521,19 +550,19 @@ function tripal_library_taxonify_features($library_id = NULL, $job_id = NULL) {
   // with all libraries.
   // with all libraries.
   if ($library_id) {
   if ($library_id) {
     $sql = "
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
-      WHERE L.library_id = :library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
+      WHERE L.library_id = :library_id
       ORDER BY LF.feature_id
       ORDER BY LF.feature_id
     ";
     ";
     $results = chado_query($sql, array(':library_id' => $library_id));
     $results = chado_query($sql, array(':library_id' => $library_id));
   }
   }
   else {
   else {
     $sql = "
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
       ORDER BY LF.feature_id
       ORDER BY LF.feature_id
     ";
     ";
     $results = chado_query($sql);
     $results = chado_query($sql);
@@ -552,9 +581,9 @@ function tripal_library_taxonify_features($library_id = NULL, $job_id = NULL) {
 
 
   // use this SQL for getting the nodes
   // use this SQL for getting the nodes
   $nsql =  "
   $nsql =  "
-    SELECT * 
-    FROM {chado_feature} CF 
-      INNER JOIN {node} N ON N.nid = CF.nid 
+    SELECT *
+    FROM {chado_feature} CF
+      INNER JOIN {node} N ON N.nid = CF.nid
     WHERE feature_id = :feature_id
     WHERE feature_id = :feature_id
   ";
   ";
    // iterate through the features and set the taxonomy
    // iterate through the features and set the taxonomy
@@ -584,6 +613,6 @@ function tripal_library_taxonify_features($library_id = NULL, $job_id = NULL) {
 function tripal_library_cleanup($dummy = NULL, $job_id = NULL) {
 function tripal_library_cleanup($dummy = NULL, $job_id = NULL) {
 
 
   return tripal_core_clean_orphaned_nodes('library', $job_id);
   return tripal_core_clean_orphaned_nodes('library', $job_id);
-  
+
 }
 }
 
 

+ 2 - 0
tripal_library/tripal_library.info

@@ -4,9 +4,11 @@ core = 7.x
 project = tripal_library
 project = tripal_library
 package = Tripal
 package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
+
 dependencies[] = search
 dependencies[] = search
 dependencies[] = path
 dependencies[] = path
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_organism
 dependencies[] = tripal_organism
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv
 
 

+ 40 - 23
tripal_library/tripal_library.install

@@ -4,6 +4,20 @@
  * @todo Add file header description
  * @todo Add file header description
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_library_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_library.views_default.inc");
+  $views = tripal_library_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  */
  */
@@ -27,13 +41,13 @@ function tripal_library_requirements($phase) {
  * @ingroup tripal_library
  * @ingroup tripal_library
  */
  */
 function tripal_library_install() {
 function tripal_library_install() {
-  
+
   // create the module's data directory
   // create the module's data directory
   tripal_create_moddir('tripal_library');
   tripal_create_moddir('tripal_library');
 
 
   // add the materialized view
   // add the materialized view
   tripal_library_add_mview_library_feature_count();
   tripal_library_add_mview_library_feature_count();
-  
+
   // add cvterms
   // add cvterms
   tripal_library_add_cvterms();
   tripal_library_add_cvterms();
 }
 }
@@ -45,9 +59,12 @@ function tripal_library_install() {
  */
  */
 function tripal_library_uninstall() {
 function tripal_library_uninstall() {
   // Drop the MView table if it exists
   // Drop the MView table if it exists
+  // D7 @todo Fix tripal_mviews_get_mview_id()
+  /**
   if ($mview_id = tripal_mviews_get_mview_id('library_feature_count')) {
   if ($mview_id = tripal_mviews_get_mview_id('library_feature_count')) {
     tripal_mviews_action("delete", $mview_id);
     tripal_mviews_action("delete", $mview_id);
   }
   }
+  */
 }
 }
 
 
 /**
 /**
@@ -94,7 +111,7 @@ function tripal_library_schema() {
 function tripal_library_add_mview_library_feature_count(){
 function tripal_library_add_mview_library_feature_count(){
   $view_name = 'library_feature_count';
   $view_name = 'library_feature_count';
   $comment = 'Provides count of feature by type that are associated with all libraries';
   $comment = 'Provides count of feature by type that are associated with all libraries';
-  
+
   $schema = array(
   $schema = array(
     'table' => $view_name,
     'table' => $view_name,
     'description' => $comment,
     'description' => $comment,
@@ -122,19 +139,19 @@ function tripal_library_add_mview_library_feature_count(){
       'library_feature_count_idx1' => array('library_id'),
       'library_feature_count_idx1' => array('library_id'),
     ),
     ),
   );
   );
-  
+
   $sql = "
   $sql = "
-    SELECT 
-      L.library_id, L.name, 
-      count(F.feature_id) as num_features, 
-      CVT.name as feature_type 
-    FROM library L 
-      INNER JOIN library_feature LF  ON LF.library_id = L.library_id 
-      INNER JOIN feature F           ON LF.feature_id = F.feature_id 
-      INNER JOIN cvterm CVT          ON F.type_id     = CVT.cvterm_id 
+    SELECT
+      L.library_id, L.name,
+      count(F.feature_id) as num_features,
+      CVT.name as feature_type
+    FROM library L
+      INNER JOIN library_feature LF  ON LF.library_id = L.library_id
+      INNER JOIN feature F           ON LF.feature_id = F.feature_id
+      INNER JOIN cvterm CVT          ON F.type_id     = CVT.cvterm_id
     GROUP BY L.library_id, L.name, CVT.name
     GROUP BY L.library_id, L.name, CVT.name
   ";
   ";
-  
+
   tripal_add_mview($view_name, 'tripal_library', $schema, $sql, $comment);
   tripal_add_mview($view_name, 'tripal_library', $schema, $sql, $comment);
 }
 }
 
 
@@ -142,24 +159,24 @@ function tripal_library_add_mview_library_feature_count(){
  * @ingroup tripal_library
  * @ingroup tripal_library
  */
  */
 function tripal_library_add_cvterms() {
 function tripal_library_add_cvterms() {
-  
+
   // Insert cvterm 'library_description' into cvterm table of chado
   // Insert cvterm 'library_description' into cvterm table of chado
   // database. This CV term is used to keep track of the library
   // database. This CV term is used to keep track of the library
   // description in the libraryprop table.
   // description in the libraryprop table.
-  tripal_cv_add_cvterm(array('name' => 'library_description', 'def' => 'Description of a library'), 
+  tripal_cv_add_cvterm(array('name' => 'library_description', 'def' => 'Description of a library'),
     'tripal', 0, 1, 'tripal');
     'tripal', 0, 1, 'tripal');
-  
+
   // add cvterms for the map unit types
   // add cvterms for the map unit types
-  tripal_cv_add_cvterm(array('name' => 'cdna_library','def' => 'cDNA library'), 
+  tripal_cv_add_cvterm(array('name' => 'cdna_library','def' => 'cDNA library'),
+    'tripal_library_types', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'bac_library','def' => 'Bacterial Artifical Chromsome (BAC) library'),
     'tripal_library_types', 0, 1, 'tripal');
     'tripal_library_types', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'bac_library','def' => 'Bacterial Artifical Chromsome (BAC) library'), 
+  tripal_cv_add_cvterm(array('name' => 'fosmid_library','def' => 'Fosmid library'),
     'tripal_library_types', 0, 1, 'tripal');
     'tripal_library_types', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'fosmid_library','def' => 'Fosmid library'), 
-    'tripal_library_types', 0, 1, 'tripal');   
-  tripal_cv_add_cvterm(array('name' => 'cosmid_library','def' => 'Cosmid library'), 
+  tripal_cv_add_cvterm(array('name' => 'cosmid_library','def' => 'Cosmid library'),
     'tripal_library_types', 0, 1, 'tripal');
     'tripal_library_types', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'yac_library','def' => 'Yeast Artificial Chromosome (YAC) library'), 
+  tripal_cv_add_cvterm(array('name' => 'yac_library','def' => 'Yeast Artificial Chromosome (YAC) library'),
     'tripal_library_types', 0, 1, 'tripal');
     'tripal_library_types', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'genomic_library','def' => 'Genomic Library'), 
+  tripal_cv_add_cvterm(array('name' => 'genomic_library','def' => 'Genomic Library'),
     'tripal_library_types', 0, 1, 'tripal');
     'tripal_library_types', 0, 1, 'tripal');
 }
 }

+ 20 - 9
tripal_library/tripal_library.module

@@ -119,22 +119,33 @@ function chado_library_node_access($node, $op, $account) {
 function tripal_library_menu() {
 function tripal_library_menu() {
   $items = array();
   $items = array();
   // The administative settings menu
   // The administative settings menu
-  $items['admin/tripal/tripal_library'] = array(
+  $items['admin/tripal/chado/tripal_library'] = array(
     'title' => 'Libraries',
     'title' => 'Libraries',
+    'description' => 'A grouping of genetic data',
+    'page callback' => 'tripal_library_admin_libraries_listing',
+    'access arguments' => array('administer tripal libraries'),
+    'type' => MENU_NORMAL_ITEM,
+    'weight' => 0
+  );
+
+  $items['admin/tripal/chado/tripal_library/help'] = array(
+    'title' => 'Help',
     'description' => 'Basic Description of Tripal Library Module Functionality',
     'description' => 'Basic Description of Tripal Library Module Functionality',
     'page callback' => 'theme',
     'page callback' => 'theme',
-    'page arguments' => array('tripal_library_help'),
+    'page arguments' => array('tripal_library_admin'),
     'access arguments' => array('administer tripal libraries'),
     'access arguments' => array('administer tripal libraries'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 4
   );
   );
 
 
-  $items['admin/tripal/tripal_library/configuration'] = array(
-    'title' => 'Configuration',
+  $items['admin/tripal/chado/tripal_library/configuration'] = array(
+    'title' => 'Settings',
     'description' => 'Configure the Tripal Library module',
     'description' => 'Configure the Tripal Library module',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_library_help'),
+    'page arguments' => array('tripal_library_admin'),
     'access arguments' => array('administer tripal libraries'),
     'access arguments' => array('administer tripal libraries'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 2
   );
   );
 
 
   // Synchronizing libraries from Chado to Drupal
   // Synchronizing libraries from Chado to Drupal
@@ -242,8 +253,8 @@ function tripal_library_theme() {
       'path' => "$theme_path/tripal_library",
       'path' => "$theme_path/tripal_library",
     ),
     ),
     // help template
     // help template
-    'tripal_library_help' => array(
-      'template' => 'tripal_library_help',
+    'tripal_library_admin' => array(
+      'template' => 'tripal_library_admin',
       'arguments' =>  array(NULL),
       'arguments' =>  array(NULL),
       'path' => $theme_path,
       'path' => $theme_path,
     ),
     ),

+ 0 - 383
tripal_library/tripal_library.views.inc

@@ -15,386 +15,3 @@
  * @ingroup views
  * @ingroup views
  */
  */
 
 
-/**
- *
- *
- * @ingroup tripal_library_views
- */
-function tripal_library_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // Main default view
-  $view = new view;
-  $view->name = 'library_listing';
-  $view->description = 'A listing of all libraries';
-  $view->tag = 'chado default';
-  $view->base_table = 'library';
-  $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(
-    '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',
-    ),
-  ));
-  $handler->override_option('sorts', array(
-    'name' => array(
-      'id' => 'name',
-      'table' => 'library',
-      'field' => 'name',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'common_name' => array(
-      'operator' => '=',
-      'value' => array(),
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'common_name_op',
-        'identifier' => 'organism_common_name',
-        'label' => 'Organism',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'common_name',
-      '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(
-    'type' => 'perm',
-    'perm' => 'access chado_library content',
-  ));
-  $handler->override_option('cache', array(
-    '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', 'No libraries match the supplied criteria.');
-  $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(
-    'grouping' => '',
-    'override' => 1,
-    'sticky' => 0,
-    'order' => 'asc',
-    'summary' => '',
-    'columns' => array(
-      'uniquename' => 'uniquename',
-      'name_1' => 'name_1',
-      'common_name' => 'common_name',
-      'name' => 'name',
-      'is_obsolete' => 'is_obsolete',
-    ),
-    'info' => array(
-      'uniquename' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'name_1' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'common_name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'is_obsolete' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-    ),
-    'default' => 'uniquename',
-  ));
-  $default_handler = $handler;
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/libraries');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Libraries',
-    'description' => 'A library is a collection of features of a given type. For example, a cDNA or BAC clone library.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        '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,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Adds library => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Library to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_library',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Change analysis.name to have a link to the node
-    $fields['name_1']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Only show records with published nodes
-    /**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-    */
-  }
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 219 - 0
tripal_library/tripal_library.views_default.inc

@@ -0,0 +1,219 @@
+<?php
+
+/**
+ *
+ *
+ * @ingroup tripal_library_views
+ */
+function tripal_library_views_default_views() {
+  $views = array();
+
+  $view = tripal_library_admin_defaultviews_library();
+  $views[$view->name] = $view;
+
+  return $views;
+}
+
+function tripal_library_admin_defaultviews_library() {
+
+  $view = new view();
+  $view->name = 'tripal_library_admin_libraries';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
+  $view->base_table = 'library';
+  $view->human_name = 'Library Admin';
+  $view->core = 0;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Defaults */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->display->display_options['title'] = 'Libraries';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'perm';
+  $handler->display->display_options['access']['perm'] = 'access chado_library content';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'none';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['grouping'] = '';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'uniquename' => 'uniquename',
+    'name_1' => 'name_1',
+    'common_name' => 'common_name',
+    'name' => 'name',
+    'is_obsolete' => 'is_obsolete',
+  );
+  $handler->display->display_options['style_options']['default'] = 'uniquename';
+  $handler->display->display_options['style_options']['info'] = array(
+    'uniquename' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'name_1' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'common_name' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'name' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'is_obsolete' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+  );
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Library',
+    'path-1' => 'node/add/tripal-library',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => '',
+    'path-2' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+    'label-3' => '',
+    'path-3' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+    'label-4' => '',
+    'path-4' => '',
+  );
+  /* No results behavior: Global: Text area */
+  $handler->display->display_options['empty']['text']['id'] = 'area';
+  $handler->display->display_options['empty']['text']['table'] = 'views';
+  $handler->display->display_options['empty']['text']['field'] = 'area';
+  $handler->display->display_options['empty']['text']['content'] = 'No libraries match the supplied criteria.';
+  $handler->display->display_options['empty']['text']['format'] = '1';
+  /* Relationship: Library: Library => Node */
+  $handler->display->display_options['relationships']['library_id']['id'] = 'library_id';
+  $handler->display->display_options['relationships']['library_id']['table'] = 'chado_library';
+  $handler->display->display_options['relationships']['library_id']['field'] = 'library_id';
+  /* Field: Content: Nid */
+  $handler->display->display_options['fields']['nid']['id'] = 'nid';
+  $handler->display->display_options['fields']['nid']['table'] = 'node';
+  $handler->display->display_options['fields']['nid']['field'] = 'nid';
+  $handler->display->display_options['fields']['nid']['relationship'] = 'library_id';
+  $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
+  /* Field: Chado Library: Uniquename */
+  $handler->display->display_options['fields']['uniquename']['id'] = 'uniquename';
+  $handler->display->display_options['fields']['uniquename']['table'] = 'library';
+  $handler->display->display_options['fields']['uniquename']['field'] = 'uniquename';
+  $handler->display->display_options['fields']['uniquename']['label'] = 'Unique Name';
+  /* Field: Chado Library: Name */
+  $handler->display->display_options['fields']['name_1']['id'] = 'name_1';
+  $handler->display->display_options['fields']['name_1']['table'] = 'library';
+  $handler->display->display_options['fields']['name_1']['field'] = 'name';
+  /* Field: Chado Organism: Common Name */
+  $handler->display->display_options['fields']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['fields']['common_name']['table'] = 'organism';
+  $handler->display->display_options['fields']['common_name']['field'] = 'common_name';
+  $handler->display->display_options['fields']['common_name']['label'] = 'Organism';
+  /* Field: Chado Cvterm: Name */
+  $handler->display->display_options['fields']['name']['id'] = 'name';
+  $handler->display->display_options['fields']['name']['table'] = 'cvterm';
+  $handler->display->display_options['fields']['name']['field'] = 'name';
+  $handler->display->display_options['fields']['name']['label'] = 'Type';
+  /* Field: Chado Library: Is Obsolete */
+  $handler->display->display_options['fields']['is_obsolete']['id'] = 'is_obsolete';
+  $handler->display->display_options['fields']['is_obsolete']['table'] = 'library';
+  $handler->display->display_options['fields']['is_obsolete']['field'] = 'is_obsolete';
+  $handler->display->display_options['fields']['is_obsolete']['label'] = 'Obsolete?';
+  $handler->display->display_options['fields']['is_obsolete']['alter']['alter_text'] = TRUE;
+  $handler->display->display_options['fields']['is_obsolete']['alter']['text'] = 'Yes';
+  $handler->display->display_options['fields']['is_obsolete']['empty'] = 'No';
+  $handler->display->display_options['fields']['is_obsolete']['empty_zero'] = TRUE;
+  $handler->display->display_options['fields']['is_obsolete']['separator'] = '';
+  /* Field: Content: Delete link */
+  $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['relationship'] = 'library_id';
+  $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
+  /* Field: Content: Edit link */
+  $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['relationship'] = 'library_id';
+  $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['label'] = '';
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node]   [delete_node]';
+  $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
+  /* Sort criterion: Chado Library: Name */
+  $handler->display->display_options['sorts']['name']['id'] = 'name';
+  $handler->display->display_options['sorts']['name']['table'] = 'library';
+  $handler->display->display_options['sorts']['name']['field'] = 'name';
+  /* Filter criterion: Chado Organism: Common Name */
+  $handler->display->display_options['filters']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['table'] = 'organism';
+  $handler->display->display_options['filters']['common_name']['field'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['value'] = 'All';
+  $handler->display->display_options['filters']['common_name']['group'] = '0';
+  $handler->display->display_options['filters']['common_name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['operator_id'] = 'common_name_op';
+  $handler->display->display_options['filters']['common_name']['expose']['label'] = 'Organism';
+  $handler->display->display_options['filters']['common_name']['expose']['operator'] = 'common_name_op';
+  $handler->display->display_options['filters']['common_name']['expose']['identifier'] = 'organism_common_name';
+  $handler->display->display_options['filters']['common_name']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Library: Type Id */
+  $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['table'] = 'library';
+  $handler->display->display_options['filters']['type_id']['field'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['group'] = '0';
+  $handler->display->display_options['filters']['type_id']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['operator_id'] = 'type_id_op';
+  $handler->display->display_options['filters']['type_id']['expose']['label'] = 'Type';
+  $handler->display->display_options['filters']['type_id']['expose']['operator'] = 'type_id_op';
+  $handler->display->display_options['filters']['type_id']['expose']['identifier'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+
+  /** MANUALLY ADD since filter handler no exporting correctly */
+  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+
+  /* Display: Page */
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_library/libraries';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Libraries';
+  $handler->display->display_options['menu']['description'] = 'A library is a collection of features of a given type. For example, a cDNA or BAC clone library.';
+  $handler->display->display_options['menu']['weight'] = '0';
+  $handler->display->display_options['menu']['name'] = 'management';
+  $handler->display->display_options['menu']['context'] = 0;
+  $handler->display->display_options['menu']['context_only_inline'] = 0;
+  $handler->display->display_options['tab_options']['weight'] = '0';
+
+  /** MANUALLY ADD since filter handler no exporting correctly
+  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+  */
+
+  return $view;
+}

+ 2 - 0
tripal_natural_diversity/tripal_natural_diversity.info

@@ -4,7 +4,9 @@ core = 7.x
 project = tripal_natural_diversity
 project = tripal_natural_diversity
 package = Tripal
 package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
+
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv
 dependencies[] = tripal_db
 dependencies[] = tripal_db
 dependencies[] = tripal_genetic
 dependencies[] = tripal_genetic

+ 21 - 9
tripal_natural_diversity/tripal_natural_diversity.install

@@ -4,7 +4,19 @@
  * Implements hooks from the Schema API
  * Implements hooks from the Schema API
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_natural_diversity_disable() {
 
 
+  // Disable all default views provided by this module
+  require_once("tripal_natural_diversity.views_default.inc");
+  $views = tripal_natural_diversity_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
 
 
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
@@ -31,10 +43,10 @@ function tripal_natural_diversity_install() {
 
 
   // create the module's data directory
   // create the module's data directory
   tripal_create_moddir('tripal_natural_diversity');
   tripal_create_moddir('tripal_natural_diversity');
-  
+
   // add cvterms
   // add cvterms
   tripal_natural_diversity_add_cvterms();
   tripal_natural_diversity_add_cvterms();
-  
+
 }
 }
 
 
 /**
 /**
@@ -45,16 +57,16 @@ function tripal_natural_diversity_uninstall() {
 }
 }
 
 
 /*
 /*
- * 
+ *
  */
  */
 function tripal_natural_diversity_add_cvterms(){
 function tripal_natural_diversity_add_cvterms(){
-   
-  // add cvterms for the nd_experiment_types 
-  tripal_cv_add_cvterm(array('name' => 'Genotyping','def' => 'An experiment where genotypes of individuals are identified.'), 
+
+  // add cvterms for the nd_experiment_types
+  tripal_cv_add_cvterm(array('name' => 'Genotyping','def' => 'An experiment where genotypes of individuals are identified.'),
     'nd_experiment_types', 0, 1, 'tripal');
     'nd_experiment_types', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'Phenotyping','def' => 'An experiment where phenotypes of individuals are identified.'), 
+  tripal_cv_add_cvterm(array('name' => 'Phenotyping','def' => 'An experiment where phenotypes of individuals are identified.'),
     'nd_experiment_types', 0, 1, 'tripal');
     'nd_experiment_types', 0, 1, 'tripal');
-  
-  tripal_cv_add_cvterm(array('name' => 'Location','def' => 'The name of the location.'), 
+
+  tripal_cv_add_cvterm(array('name' => 'Location','def' => 'The name of the location.'),
     'nd_geolocation_property', 0, 1, 'tripal');
     'nd_geolocation_property', 0, 1, 'tripal');
 }
 }

+ 1 - 952
tripal_natural_diversity/tripal_natural_diversity.views.inc

@@ -12,955 +12,4 @@
 /**
 /**
  * @defgroup tripal_natural_diversity_views Natural Diversity Views Integration
  * @defgroup tripal_natural_diversity_views Natural Diversity Views Integration
  * @ingroup views
  * @ingroup views
- */
-
-
-
-/**
- * Created Default views related to the tables integrated by this module
- *
- * @ingroup tripal_natural_diversity_views
- */
-
-
-/* -- SPF Jun 13, 2013 removed as a search by ND experiment 
- * results in a huge return list.  As in the case of a genotyping
- * GWAS experiment where tens of thousands of SNP genotypes are
- * present.  --
-function tripal_natural_diversity_views_default_views() {
-  $views = array();
-
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-
-  // 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; 
-  $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' => array(),
-      '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', 'chado/natdiv_experiments');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Natural Diversity Experiments',
-    'description' => 'A single assay resulting in a single genotype or phenotype. Multiple assays resulting in an entire experiment should be grouped together as a project.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $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; 
-  $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' => '~',
-      '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', 'chado/natdiv_geolocations');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Locations',
-    'description' => 'Geographical locations in which natural diversity experiments might be performed.',
-    'weight' => '10',
-    '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; 
-  $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' => '~',
-      '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', 'chado/natdiv_protocols');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Protocols',
-    'description' => 'The protcols used for natural diversity experiments',
-    'weight' => '10',
-    '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; 
-  $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',
-    ),
-  ));
-  $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' => '~',
-      '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', 'chado/natdiv_reagents');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Reagents',
-    'description' => 'Reagents used in natural diversity experiments',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  $views[$view->name] = $view;
-
-  return $views;
-}
-*/
-
+ */

+ 942 - 0
tripal_natural_diversity/tripal_natural_diversity.views_default.inc

@@ -0,0 +1,942 @@
+<?php
+
+/* -- SPF Jun 13, 2013 removed as a search by ND experiment
+ * results in a huge return list.  As in the case of a genotyping
+ * GWAS experiment where tens of thousands of SNP genotypes are
+ * present.  --
+ */
+function tripal_natural_diversity_views_default_views() {
+  $views = array();
+
+
+  if (!module_exists('tripal_views')) {
+    return $views;
+  }
+
+
+  // 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;
+  $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' => array(),
+      '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', 'chado/natdiv_experiments');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Natural Diversity Experiments',
+    'description' => 'A single assay resulting in a single genotype or phenotype. Multiple assays resulting in an entire experiment should be grouped together as a project.',
+    'weight' => '10',
+    'name' => 'navigation',
+  ));
+  $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;
+  $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' => '~',
+      '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', 'chado/natdiv_geolocations');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Locations',
+    'description' => 'Geographical locations in which natural diversity experiments might be performed.',
+    'weight' => '10',
+    '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;
+  $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' => '~',
+      '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', 'chado/natdiv_protocols');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Protocols',
+    'description' => 'The protcols used for natural diversity experiments',
+    'weight' => '10',
+    '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;
+  $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',
+    ),
+  ));
+  $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' => '~',
+      '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', 'chado/natdiv_reagents');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Reagents',
+    'description' => 'Reagents used in natural diversity experiments',
+    'weight' => '10',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 41 - 8
tripal_organism/includes/tripal_organism.admin.inc

@@ -1,5 +1,38 @@
 <?php
 <?php
 
 
+/**
+ *
+ */
+function tripal_organism_admin_organism_view() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado', 'admin/tripal/chado');
+  $breadcrumb[] = l('Organisms', 'admin/tripal/chado/tripal_organism');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_organism_admin_organisms','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Organism module uses primarily views to provide an '
+      . 'administrative interface. Currently one or more views needed for this '
+      . 'administrative interface are disabled. <strong>Click each of the following links to '
+      . 'enable the pertinent views</strong>:</p>';
+    $output .= '<ul>';
+      $output .= '<li>'.l('Organisms View', 'admin/tripal/chado/tripal_organism/views/organisms/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
+
 /**
 /**
  * Administrative settings for chado_orgnism
  * Administrative settings for chado_orgnism
  *
  *
@@ -10,7 +43,7 @@ function tripal_organism_admin() {
   $form = array();
   $form = array();
 
 
   get_tripal_organism_admin_form_reindex_set($form);
   get_tripal_organism_admin_form_reindex_set($form);
-  get_tripal_organism_admin_form_taxonomy_set($form);  
+  get_tripal_organism_admin_form_taxonomy_set($form);
 
 
   return system_settings_form($form);
   return system_settings_form($form);
 }
 }
@@ -41,7 +74,7 @@ function get_tripal_organism_admin_form_taxonomy_set(&$form) {
     '#value' => t(
     '#value' => t(
       "Drupal allows for assignment of \"taxonomy\" or catagorical terms to " .
       "Drupal allows for assignment of \"taxonomy\" or catagorical terms to " .
       "nodes. These terms allow for advanced filtering during searching. This option allows " .
       "nodes. These terms allow for advanced filtering during searching. This option allows " .
-      "for setting taxonomy only for features that belong to the selected organisms below.  All " . 
+      "for setting taxonomy only for features that belong to the selected organisms below.  All " .
       "other features will be unaffected.  To set taxonomy for all features in the site see the Feature Administration page."),
       "other features will be unaffected.  To set taxonomy for all features in the site see the Feature Administration page."),
     '#weight' => 1,
     '#weight' => 1,
   );
   );
@@ -161,9 +194,9 @@ function tripal_organism_reindex_features($organism_id = NULL, $job_id = NULL) {
   }
   }
 
 
   $sql = "
   $sql = "
-    SELECT * 
-    FROM {feature} 
-    WHERE organism_id = :organism_id 
+    SELECT *
+    FROM {feature}
+    WHERE organism_id = :organism_id
     ORDER BY feature_id";
     ORDER BY feature_id";
   $results = chado_query($sql, array(':organism_id' => $organism_id));
   $results = chado_query($sql, array(':organism_id' => $organism_id));
 
 
@@ -196,9 +229,9 @@ function tripal_organism_taxonify_features($organism_id = NULL, $job_id = NULL)
   }
   }
 
 
   $sql = "
   $sql = "
-    SELECT * 
-    FROM {feature} 
-    WHERE organism_id = :organism_id 
+    SELECT *
+    FROM {feature}
+    WHERE organism_id = :organism_id
     ORDER BY feature_id
     ORDER BY feature_id
   ";
   ";
   $results = chado_query($sql, array(':organism_id' => $organism_id));
   $results = chado_query($sql, array(':organism_id' => $organism_id));

+ 1 - 0
tripal_organism/tripal_organism.info

@@ -7,5 +7,6 @@ version = 7.x-2.0-beta1
 configure = admin/tripal/chado/tripal_organism
 configure = admin/tripal/chado/tripal_organism
 
 
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = search
 dependencies[] = search
 dependencies[] = path
 dependencies[] = path

+ 18 - 4
tripal_organism/tripal_organism.install

@@ -5,6 +5,20 @@
  * Functions pertaining to the install/uninstall of this module
  * Functions pertaining to the install/uninstall of this module
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_organism_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_organism.views_default.inc");
+  $views = tripal_organism_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_install().
  * Implementation of hook_install().
  *
  *
@@ -54,7 +68,7 @@ function tripal_organism_schema() {
       ),
       ),
       'primary key' => array('nid'),
       'primary key' => array('nid'),
   );
   );
-  return $schema;  
+  return $schema;
 }
 }
 
 
 /**
 /**
@@ -66,8 +80,8 @@ function tripal_organism_uninstall() {
 
 
   // Get the list of nodes to remove
   // Get the list of nodes to remove
   $sql_lib_id = "
   $sql_lib_id = "
-    SELECT nid, vid 
-    FROM {node} 
+    SELECT nid, vid
+    FROM {node}
     WHERE type='chado_organism'
     WHERE type='chado_organism'
   ";
   ";
   $result = db_query($sql_lib_id);
   $result = db_query($sql_lib_id);
@@ -77,7 +91,7 @@ function tripal_organism_uninstall() {
 }
 }
 
 
 /**
 /**
- * Implementation of hook_requirements(). 
+ * Implementation of hook_requirements().
  *
  *
  */
  */
 function tripal_organism_requirements($phase) {
 function tripal_organism_requirements($phase) {

+ 25 - 16
tripal_organism/tripal_organism.module

@@ -100,7 +100,8 @@ function tripal_organism_menu() {
   // the administative settings menu
   // the administative settings menu
   $items['admin/tripal/chado/tripal_organism'] = array(
   $items['admin/tripal/chado/tripal_organism'] = array(
    'title' => 'Organisms',
    'title' => 'Organisms',
-   'description' => 'Basic Description of Tripal Organism Module Functionality',
+   'description' => 'Any living biological entity, such as an animal, plant, fungus, or bacterium.',
+   'page callback' => 'tripal_organism_admin_organism_view',
    'access arguments' => array('adminster tripal organism'),
    'access arguments' => array('adminster tripal organism'),
    'type' => MENU_NORMAL_ITEM,
    'type' => MENU_NORMAL_ITEM,
   );
   );
@@ -111,25 +112,33 @@ function tripal_organism_menu() {
    'page callback' => 'theme',
    'page callback' => 'theme',
    'page arguments' => array('tripal_organism_help'),
    'page arguments' => array('tripal_organism_help'),
    'access arguments' => array('adminster tripal organism'),
    'access arguments' => array('adminster tripal organism'),
-   'type' => MENU_NORMAL_ITEM,
+   'type' => MENU_LOCAL_TASK,
   );
   );
 
 
   $items['admin/tripal/chado/tripal_organism/configuration'] = array(
   $items['admin/tripal/chado/tripal_organism/configuration'] = array(
-   'title' => 'Configuration',
+   'title' => 'Settings',
    'description' => 'Manage integration of Chado organisms including associated features',
    'description' => 'Manage integration of Chado organisms including associated features',
    'page callback' => 'drupal_get_form',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('tripal_organism_admin'),
    'page arguments' => array('tripal_organism_admin'),
    'access arguments' => array('adminster tripal organism'),
    'access arguments' => array('adminster tripal organism'),
-   'type' => MENU_NORMAL_ITEM,
+   'type' => MENU_LOCAL_TASK,
   );
   );
 
 
   $items['admin/tripal/chado/tripal_organism/sync'] = array(
   $items['admin/tripal/chado/tripal_organism/sync'] = array(
-    'title' => 'Sync Organisms',
+    'title' => 'Sync',
     'description' => 'Sync Chado organisms with Drupal',
     'description' => 'Sync Chado organisms with Drupal',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_organism_sync'),
     'page arguments' => array('tripal_organism_sync'),
     'access arguments' => array('adminster tripal organism'),
     'access arguments' => array('adminster tripal organism'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+  );
+
+  $items['admin/tripal/chado/tripal_organism/views/organisms/enable'] = array(
+    'title' => 'Enable Organism Administrative View',
+    'page callback' => 'tripal_views_admin_enable_view',
+    'page arguments' => array('tripal_organism_admin_organisms', 'admin/tripal/chado/tripal_organism'),
+    'access arguments' => array('administer tripal_bulk_loader'),
+    'type' => MENU_CALLBACK,
   );
   );
 
 
   return $items;
   return $items;
@@ -154,7 +163,7 @@ function tripal_organism_help ($path, $arg) {
  */
  */
 function tripal_organism_theme($existing, $type, $theme, $path) {
 function tripal_organism_theme($existing, $type, $theme, $path) {
   $core_path = drupal_get_path('module', 'tripal_core');
   $core_path = drupal_get_path('module', 'tripal_core');
-  
+
   $items = array(
   $items = array(
     'node__chado_organism' => array(
     'node__chado_organism' => array(
       'template' => 'node--chado-generic',
       'template' => 'node--chado-generic',
@@ -329,7 +338,7 @@ function chado_organism_validate($node, $form, &$form_state) {
   $node->abbreviation = trim($node->abbreviation);
   $node->abbreviation = trim($node->abbreviation);
   $node->common_name  = trim($node->common_name);
   $node->common_name  = trim($node->common_name);
   $node->description  = trim($node->description);
   $node->description  = trim($node->description);
-  
+
   // if this is an update, we want to make sure that a different organism doesn't
   // if this is an update, we want to make sure that a different organism doesn't
   // already have this genus and speces
   // already have this genus and speces
   if (property_exists($node, 'organism_id')) {
   if (property_exists($node, 'organism_id')) {
@@ -383,7 +392,7 @@ function chado_organism_insert($node) {
   $node->abbreviation = trim($node->abbreviation);
   $node->abbreviation = trim($node->abbreviation);
   $node->common_name  = trim($node->common_name);
   $node->common_name  = trim($node->common_name);
   $node->description  = trim($node->description);
   $node->description  = trim($node->description);
-  
+
   // if there is an organism_id in the $node object then this must be a sync so
   // if there is an organism_id in the $node object then this must be a sync so
   // we can skip adding the organism as it is already there, although
   // we can skip adding the organism as it is already there, although
   // we do need to proceed with the rest of the insert
   // we do need to proceed with the rest of the insert
@@ -410,7 +419,7 @@ function chado_organism_insert($node) {
 
 
   // Make sure the entry for this organism doesn't already exist in the
   // Make sure the entry for this organism doesn't already exist in the
   // chado_organism table if it doesn't exist then we want to add it.
   // chado_organism table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('organism', $node->nid);  
+  $check_org_id = chado_get_id_for_node('organism', $node->nid);
   if (!$check_org_id) {
   if (!$check_org_id) {
     $record = new stdClass();
     $record = new stdClass();
     $record->nid = $node->nid;
     $record->nid = $node->nid;
@@ -441,7 +450,7 @@ function chado_organism_update($node) {
   $node->abbreviation = trim($node->abbreviation);
   $node->abbreviation = trim($node->abbreviation);
   $node->common_name  = trim($node->common_name);
   $node->common_name  = trim($node->common_name);
   $node->description  = trim($node->description);
   $node->description  = trim($node->description);
-  
+
   if ($node->revision) {
   if ($node->revision) {
     // there is no way to handle revisions in Chado but leave
     // there is no way to handle revisions in Chado but leave
     // this here just to make not we've addressed it.
     // this here just to make not we've addressed it.
@@ -546,17 +555,17 @@ function chado_organism_add_image($node) {
  */
  */
 function chado_organism_form($node, $form_state) {
 function chado_organism_form($node, $form_state) {
   $form = array();
   $form = array();
-  
+
   // we have a file upload element on the form soe we need the multipart encoding type
   // we have a file upload element on the form soe we need the multipart encoding type
   $form['#attributes']['enctype'] = 'multipart/form-data';
   $form['#attributes']['enctype'] = 'multipart/form-data';
-  
+
   // if the organism is part of the node object then we are editing. If not we are inserting
   // if the organism is part of the node object then we are editing. If not we are inserting
   if (property_exists($node, 'organism')) {
   if (property_exists($node, 'organism')) {
     $organism = $node->organism;
     $organism = $node->organism;
 
 
     // add in the comment since it is a text field and may not be included if too big
     // add in the comment since it is a text field and may not be included if too big
     $organism = tripal_core_expand_chado_vars($organism, 'field', 'organism.comment');
     $organism = tripal_core_expand_chado_vars($organism, 'field', 'organism.comment');
-    
+
     // get form defaults
     // get form defaults
     $abbreviation   = property_exists($node, 'abbreviation')   ? property_exists($node, 'abbreviation')   : $organism->abbreviation;
     $abbreviation   = property_exists($node, 'abbreviation')   ? property_exists($node, 'abbreviation')   : $organism->abbreviation;
     $genus          = property_exists($node, 'genus')          ? property_exists($node, 'genus')          : $organism->genus;
     $genus          = property_exists($node, 'genus')          ? property_exists($node, 'genus')          : $organism->genus;
@@ -564,7 +573,7 @@ function chado_organism_form($node, $form_state) {
     $common_name    = property_exists($node, 'common_name')    ? property_exists($node, 'common_name')    : $organism->common_name;
     $common_name    = property_exists($node, 'common_name')    ? property_exists($node, 'common_name')    : $organism->common_name;
     $description    = property_exists($node, 'description')    ? property_exists($node, 'description')    : $organism->comment;
     $description    = property_exists($node, 'description')    ? property_exists($node, 'description')    : $organism->comment;
     $organism_image = property_exists($node, 'organism_image') ? property_exists($node, 'organism_image') : '';
     $organism_image = property_exists($node, 'organism_image') ? property_exists($node, 'organism_image') : '';
-    
+
     // set the organism_id in the form
     // set the organism_id in the form
     $form['organism_id'] = array(
     $form['organism_id'] = array(
       '#type' => 'value',
       '#type' => 'value',
@@ -635,7 +644,7 @@ function chado_organism_load($nodes) {
     // build the organism variable
     // build the organism variable
     $values = array('organism_id' => $organism_id);
     $values = array('organism_id' => $organism_id);
     $organism = tripal_core_generate_chado_var('organism', $values);
     $organism = tripal_core_generate_chado_var('organism', $values);
-    
+
 
 
     // add in the description field
     // add in the description field
     $organism = tripal_core_expand_chado_vars($organism, 'field', 'organism.comment');
     $organism = tripal_core_expand_chado_vars($organism, 'field', 'organism.comment');

+ 0 - 298
tripal_organism/tripal_organism.views.inc

@@ -14,301 +14,3 @@
  * @defgroup tripal_organism_views Organism Views Integration
  * @defgroup tripal_organism_views Organism Views Integration
  * @ingroup views
  * @ingroup views
  */
  */
-
-/**
- *
- * @ingroup tripal_organism_views
- */
-function tripal_organism_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // Main default view
-  $view = new view;
-  $view->name = 'organism_listing';
-  $view->description = 'A listing of all organism in chado';
-  $view->tag = 'chado default';
-  $view->base_table = 'organism';
-  $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(
-    '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',
-    ),
-    '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',
-    ),
-    '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',
-    ),
-  ));
-  $handler->override_option('sorts', array(
-    'genus' => array(
-      'order' => 'ASC',
-      'id' => 'genus',
-      'table' => 'organism',
-      'field' => 'genus',
-      'relationship' => 'none',
-    ),
-    'species' => array(
-      'order' => 'ASC',
-      'id' => 'species',
-      'table' => 'organism',
-      'field' => 'species',
-      '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 organisms matched the supplied criteria.');
-  $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',
-    'summary' => '',
-    'columns' => array(
-      'common_name' => 'common_name',
-      'genus' => 'genus',
-      'species' => 'species',
-      'abbreviation' => 'abbreviation',
-    ),
-    'info' => array(
-      'common_name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'genus' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'species' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'abbreviation' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-    ),
-    'default' => '-1',
-  ));
-  $default_handler = $handler;
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/organisms');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Organisms',
-    'description' => 'A biological organism.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        '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,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Adds organism => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Organism to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_organism',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Change analysis.name to have a link to the node
-    $fields['common_name']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Only show records with published nodes
-    /**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-    */
-  }
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 209 - 0
tripal_organism/tripal_organism.views_default.inc

@@ -0,0 +1,209 @@
+<?php
+
+/**
+ *
+ * @ingroup tripal_organism_views
+ */
+function tripal_organism_views_default_views() {
+  $views = array();
+
+  $view = tripal_organism_admin_defaultview_organisms();
+  $views[$view->name] = $view;
+
+  return $views;
+}
+
+function tripal_organism_admin_defaultview_organisms() {
+
+  $view = new view();
+  $view->name = 'tripal_organism_admin_organisms';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
+  $view->base_table = 'organism';
+  $view->human_name = 'Organism Admin';
+  $view->core = 0;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Defaults */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->display->display_options['title'] = 'Organisms';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'perm';
+  $handler->display->display_options['access']['perm'] = 'adminster tripal organism';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['exposed_form']['options']['submit_button'] = 'Filter';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
+  $handler->display->display_options['pager']['options']['offset'] = '0';
+  $handler->display->display_options['pager']['options']['id'] = '0';
+  $handler->display->display_options['pager']['options']['quantity'] = '9';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['grouping'] = '';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'common_name' => 'common_name',
+    'genus' => 'genus',
+    'species' => 'species',
+    'abbreviation' => 'abbreviation',
+  );
+  $handler->display->display_options['style_options']['default'] = '-1';
+  $handler->display->display_options['style_options']['info'] = array(
+    'common_name' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'genus' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'species' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'abbreviation' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+  );
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Organism',
+    'path-1' => 'node/add/tripal_organism',
+  );
+  /* No results behavior: Global: Text area */
+  $handler->display->display_options['empty']['text']['id'] = 'area';
+  $handler->display->display_options['empty']['text']['table'] = 'views';
+  $handler->display->display_options['empty']['text']['field'] = 'area';
+  $handler->display->display_options['empty']['text']['content'] = 'No organisms matched the supplied criteria.';
+  $handler->display->display_options['empty']['text']['format'] = '1';
+  /* Relationship: Organism: Organism => Node */
+  $handler->display->display_options['relationships']['organism_id']['id'] = 'organism_id';
+  $handler->display->display_options['relationships']['organism_id']['table'] = 'chado_organism';
+  $handler->display->display_options['relationships']['organism_id']['field'] = 'organism_id';
+  /* Field: Content: Nid */
+  $handler->display->display_options['fields']['nid']['id'] = 'nid';
+  $handler->display->display_options['fields']['nid']['table'] = 'node';
+  $handler->display->display_options['fields']['nid']['field'] = 'nid';
+  $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
+  /* Field: Chado Organism: Common Name */
+  $handler->display->display_options['fields']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['fields']['common_name']['table'] = 'organism';
+  $handler->display->display_options['fields']['common_name']['field'] = 'common_name';
+  $handler->display->display_options['fields']['common_name']['alter']['make_link'] = TRUE;
+  $handler->display->display_options['fields']['common_name']['alter']['path'] = 'node/[nid]';
+  /* Field: Chado Organism: Genus */
+  $handler->display->display_options['fields']['genus']['id'] = 'genus';
+  $handler->display->display_options['fields']['genus']['table'] = 'organism';
+  $handler->display->display_options['fields']['genus']['field'] = 'genus';
+  /* Field: Chado Organism: Species */
+  $handler->display->display_options['fields']['species']['id'] = 'species';
+  $handler->display->display_options['fields']['species']['table'] = 'organism';
+  $handler->display->display_options['fields']['species']['field'] = 'species';
+  /* Field: Chado Organism: Abbreviation */
+  $handler->display->display_options['fields']['abbreviation']['id'] = 'abbreviation';
+  $handler->display->display_options['fields']['abbreviation']['table'] = 'organism';
+  $handler->display->display_options['fields']['abbreviation']['field'] = 'abbreviation';
+  /* Field: Content: Delete link */
+  $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['relationship'] = 'organism_id';
+  $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
+  /* Field: Content: Edit link */
+  $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['relationship'] = 'organism_id';
+  $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['label'] = '';
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node]   [delete_node]';
+  $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
+  /* Sort criterion: Chado Organism: Genus */
+  $handler->display->display_options['sorts']['genus']['id'] = 'genus';
+  $handler->display->display_options['sorts']['genus']['table'] = 'organism';
+  $handler->display->display_options['sorts']['genus']['field'] = 'genus';
+  /* Sort criterion: Chado Organism: Species */
+  $handler->display->display_options['sorts']['species']['id'] = 'species';
+  $handler->display->display_options['sorts']['species']['table'] = 'organism';
+  $handler->display->display_options['sorts']['species']['field'] = 'species';
+  /* Filter criterion: Chado Organism: Common Name */
+  $handler->display->display_options['filters']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['table'] = 'organism';
+  $handler->display->display_options['filters']['common_name']['field'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['operator'] = 'contains';
+  $handler->display->display_options['filters']['common_name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['operator_id'] = '';
+  $handler->display->display_options['filters']['common_name']['expose']['label'] = 'Common Name Contains';
+  $handler->display->display_options['filters']['common_name']['expose']['identifier'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Organism: Genus */
+  $handler->display->display_options['filters']['genus']['id'] = 'genus';
+  $handler->display->display_options['filters']['genus']['table'] = 'organism';
+  $handler->display->display_options['filters']['genus']['field'] = 'genus';
+  $handler->display->display_options['filters']['genus']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['genus']['expose']['operator_id'] = 'genus_op';
+  $handler->display->display_options['filters']['genus']['expose']['label'] = 'Genus';
+  $handler->display->display_options['filters']['genus']['expose']['operator'] = 'genus_op';
+  $handler->display->display_options['filters']['genus']['expose']['identifier'] = 'genus';
+  $handler->display->display_options['filters']['genus']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Organism: Species */
+  $handler->display->display_options['filters']['species']['id'] = 'species';
+  $handler->display->display_options['filters']['species']['table'] = 'organism';
+  $handler->display->display_options['filters']['species']['field'] = 'species';
+  $handler->display->display_options['filters']['species']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['species']['expose']['operator_id'] = 'species_op';
+  $handler->display->display_options['filters']['species']['expose']['label'] = 'Species';
+  $handler->display->display_options['filters']['species']['expose']['operator'] = 'species_op';
+  $handler->display->display_options['filters']['species']['expose']['identifier'] = 'species';
+  $handler->display->display_options['filters']['species']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+
+  /** MANUALLY ADD since filter handler no exporting correctly */
+  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'textfield';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+
+  /* Display: Page */
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_organism/organisms';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Organisms';
+  $handler->display->display_options['menu']['description'] = 'A biological organism.';
+  $handler->display->display_options['menu']['weight'] = '-10';
+  $handler->display->display_options['menu']['name'] = 'management';
+  $handler->display->display_options['menu']['context'] = 0;
+  $handler->display->display_options['menu']['context_only_inline'] = 0;
+  $handler->display->display_options['tab_options']['weight'] = '0';
+
+  /** MANUALLY ADD since filter handler no exporting correctly
+  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'textfield';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+  */
+
+  return $view;
+}

+ 2 - 0
tripal_phenotype/tripal_phenotype.info

@@ -4,6 +4,8 @@ core = 7.x
 project = tripal_phenotype
 project = tripal_phenotype
 package = Tripal
 package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
+
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv
 dependencies[] = tripal_feature
 dependencies[] = tripal_feature

+ 15 - 0
tripal_phenotype/tripal_phenotype.install

@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_phenotype_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_phenotype.views_default.inc");
+  $views = tripal_phenotype_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}

+ 0 - 487
tripal_phenotype/tripal_phenotype.views.inc

@@ -15,490 +15,3 @@
  * @ingroup views
  * @ingroup views
  */
  */
 
 
-/**
- *
- *
- * @ingroup tripal_phenotype_views
- */
-function tripal_phenotype_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // 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' => '~',
-      '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' => '~',
-      '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 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(
-      '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', 'chado/phenotypes');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Phenotypes',
-    'description' => 'A phenotypic statement, or a single atomic phenotypic observation, is a controlled sentence describing observable effects of non-wild type function.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  $views[$view->name] = $view;
-
-  return $views;
-}
-

+ 488 - 0
tripal_phenotype/tripal_phenotype.views_default.inc

@@ -0,0 +1,488 @@
+<?php
+
+/**
+ *
+ *
+ * @ingroup tripal_phenotype_views
+ */
+function tripal_phenotype_views_default_views() {
+  $views = array();
+
+  if (!module_exists('tripal_views')) {
+    return $views;
+  }
+
+  // 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' => '~',
+      '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' => '~',
+      '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 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(
+      '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', 'chado/phenotypes');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Phenotypes',
+    'description' => 'A phenotypic statement, or a single atomic phenotypic observation, is a controlled sentence describing observable effects of non-wild type function.',
+    'weight' => '10',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 37 - 3
tripal_project/includes/tripal_project.admin.inc

@@ -4,6 +4,40 @@
  * @todo Add file header description
  * @todo Add file header description
  */
  */
 
 
+/**
+ *
+ */
+function tripal_project_admin_project_view() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado', 'admin/tripal/chado');
+  $breadcrumb[] = l('Projects', 'admin/tripal/chado/tripal_project');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_project_admin_projects','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Project module uses primarily views to provide an '
+      . 'administrative interface. Currently one or more views needed for this '
+      . 'administrative interface are disabled. <strong>Click each of the following links to '
+      . 'enable the pertinent views</strong>:</p>';
+    $output .= '<ul>';
+      $output .= '<li>'.l('Projects View', 'admin/tripal/chado/tripal_project/views/projects/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
+
+
 function tripal_project_admin($form_state = NULL) {
 function tripal_project_admin($form_state = NULL) {
   $form = array();
   $form = array();
 
 
@@ -94,7 +128,7 @@ function get_tripal_project_admin_form_sync_set(&$form) {
       // check to see if the project is already present as a node in drupal.
       // check to see if the project is already present as a node in drupal.
       // if so, then skip it.
       // if so, then skip it.
       $sql = "SELECT * FROM {chado_project} WHERE project_id = :project_id";
       $sql = "SELECT * FROM {chado_project} WHERE project_id = :project_id";
-      if (!db_query($sql, array(':project_id' => $project->project_id))->fetchObject()) { 
+      if (!db_query($sql, array(':project_id' => $project->project_id))->fetchObject()) {
         $proj_boxes[$project->project_id] = $project->name;
         $proj_boxes[$project->project_id] = $project->name;
         $added++;
         $added++;
       }
       }
@@ -270,7 +304,7 @@ function tripal_project_sync_projects($project_id = NULL, $job_id = NULL) {
   return $page_content;
   return $page_content;
 }
 }
 /*
 /*
- * 
+ *
  */
  */
 function tripal_project_sync_projects_form_submit($form, &$form_state) {
 function tripal_project_sync_projects_form_submit($form, &$form_state) {
   global $user;
   global $user;
@@ -282,7 +316,7 @@ function tripal_project_sync_projects_form_submit($form, &$form_state) {
 }
 }
 
 
 /*
 /*
- * 
+ *
  */
  */
 function tripal_project_sync_all_projects() {
 function tripal_project_sync_all_projects() {
 
 

+ 0 - 0
tripal_project/theme/tripal_project_admin.tpl.php → tripal_project/theme/tripal_project_help.tpl.php


+ 1 - 0
tripal_project/tripal_project.info

@@ -7,4 +7,5 @@ version = 7.x-2.0-beta1
 configure = admin/tripal/chado/tripal_project
 configure = admin/tripal/chado/tripal_project
 
 
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv

+ 20 - 6
tripal_project/tripal_project.install

@@ -10,6 +10,20 @@
  * multiple project/mysql instances as well as manage and create such project instances
  * multiple project/mysql instances as well as manage and create such project instances
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_project_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_project.views_default.inc");
+  $views = tripal_project_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  *
  *
@@ -32,10 +46,10 @@ function tripal_project_requirements($phase) {
  * Implementation of hook_install().
  * Implementation of hook_install().
  */
  */
 function tripal_project_install() {
 function tripal_project_install() {
-  
+
   // create the module's data directory
   // create the module's data directory
   tripal_create_moddir('tripal_project');
   tripal_create_moddir('tripal_project');
-  
+
   tripal_project_add_cvterms();
   tripal_project_add_cvterms();
 }
 }
 
 
@@ -73,13 +87,13 @@ function tripal_project_schema() {
 }
 }
 
 
 /*
 /*
- * 
+ *
  */
  */
 function tripal_project_add_cvterms() {
 function tripal_project_add_cvterms() {
-  
+
   // Insert cvterm 'library_description' into cvterm table of chado
   // Insert cvterm 'library_description' into cvterm table of chado
   // database. This CV term is used to keep track of the library
   // database. This CV term is used to keep track of the library
   // description in the libraryprop table.
   // description in the libraryprop table.
-  tripal_cv_add_cvterm(array('name' => 'project_description', 'def' => 'Description of a project'), 
-    'tripal', 0, 1, 'tripal'); 
+  tripal_cv_add_cvterm(array('name' => 'project_description', 'def' => 'Description of a project'),
+    'tripal', 0, 1, 'tripal');
 }
 }

+ 17 - 6
tripal_project/tripal_project.module

@@ -63,7 +63,8 @@ function tripal_project_views_api() {
 function tripal_project_menu() {
 function tripal_project_menu() {
   $items[ 'admin/tripal/chado/tripal_project' ]= array(
   $items[ 'admin/tripal/chado/tripal_project' ]= array(
     'title' => 'Projects',
     'title' => 'Projects',
-    'description' => ('A module for interfacing the GMOD chado database with Drupal, providing viewing of projects'),
+    'description' => ('A grouping of a variety of data (ie: group natural diversity experiment).'),
+    'page callback' => 'tripal_project_admin_project_view',
     'access arguments' => array('adminster tripal projects'),
     'access arguments' => array('adminster tripal projects'),
     'type' => MENU_NORMAL_ITEM
     'type' => MENU_NORMAL_ITEM
   );
   );
@@ -74,15 +75,25 @@ function tripal_project_menu() {
     'page callback' => 'theme',
     'page callback' => 'theme',
     'page arguments' => array('tripal_project_help'),
     'page arguments' => array('tripal_project_help'),
     'access arguments' => array('adminster tripal projects'),
     'access arguments' => array('adminster tripal projects'),
-    'type' => MENU_NORMAL_ITEM
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 6
   );
   );
 
 
   $items[ 'admin/tripal/chado/tripal_project/configuration' ]= array(
   $items[ 'admin/tripal/chado/tripal_project/configuration' ]= array(
-    'title' => 'Configuration',
+    'title' => 'Settings',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_project_help'),
+    'page arguments' => array('tripal_project_admin'),
     'access arguments' => array('adminster tripal projects'),
     'access arguments' => array('adminster tripal projects'),
-    'type' => MENU_NORMAL_ITEM
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 4
+  );
+
+  $items['admin/tripal/chado/tripal_project/views/projects/enable'] = array(
+    'title' => 'Enable Project Administrative View',
+    'page callback' => 'tripal_views_admin_enable_view',
+    'page arguments' => array('tripal_project_admin_projects', 'admin/tripal/chado/tripal_project'),
+    'access arguments' => array('administer tripal_bulk_loader'),
+    'type' => MENU_CALLBACK,
   );
   );
 
 
   return $items;
   return $items;
@@ -191,7 +202,7 @@ function chado_project_node_access($node, $op, $account) {
  */
  */
 function tripal_project_theme() {
 function tripal_project_theme() {
   $theme_path = drupal_get_path('module', 'tripal_project') . '/theme';
   $theme_path = drupal_get_path('module', 'tripal_project') . '/theme';
-  
+
   $items = array(
   $items = array(
     'tripal_project_base' => array(
     'tripal_project_base' => array(
       'arguments' => array('node' => NULL),
       'arguments' => array('node' => NULL),

+ 1 - 309
tripal_project/tripal_project.views.inc

@@ -13,312 +13,4 @@
 /**
 /**
  * @defgroup tripal_project_views Project Views Integration
  * @defgroup tripal_project_views Project Views Integration
  * @ingroup views
  * @ingroup views
- */
-
-/**
- *
- *
- * @ingroup tripal_project_views
- */
-function tripal_project_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  $values = array('name' => 'project_description');
-  $description_type_id = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
-  $description_type_id = $description_type_id[0]->cvterm_id;
-
-  // 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;
-  $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',
-    ),
-    'value' => 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' => 'value',
-      'table' => 'projectprop',
-      'field' => 'value',
-      'override' => array(
-        'button' => 'Override',
-      ),
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'name' => array(
-      'operator' => '~',
-      '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,
-      ),
-    ),
-    'type_id' => array(
-      'operator' => '=',
-      'value' => $description_type_id,
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-        'optional' => FALSE,
-      ),
-      'case' => 1,
-      'id' => 'type_id',
-      'table' => 'projectprop',
-      'field' => 'type_id',
-      'override' => array(
-        'button' => 'Override',
-      ),
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 0,
-      'optional' => 0,
-      'show_all' => 0,
-      'agg' => array(
-        'records_with' => 0,
-        'aggregates_with' => 1,
-      ),
-    ),
-    'value' => array(
-      'operator' => '~',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'value_op',
-        'identifier' => 'description',
-        'label' => 'Description Contains',
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'value',
-      'table' => 'projectprop',
-      'field' => 'value',
-      'override' => array(
-        'button' => 'Override',
-      ),
-      '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', 'No projects 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',
-      'description' => 'description',
-    ),
-    'info' => array(
-      'name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'description' => array(
-        'sortable' => 0,
-        'separator' => '',
-      ),
-    ),
-    'default' => 'name',
-  ));
-  $default_handler = $handler;
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/projects');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Projects',
-    'description' => 'A project is a collection of data resulting from a biological experiment.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        '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,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Adds project => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Project to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_project',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Change project.name to have a link to the node
-    $fields['name']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Only show records with published nodes
-/**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-*/
-  }
-  $views[$view->name] = $view;
-
-  return $views;
-}
+ */

+ 192 - 0
tripal_project/tripal_project.views_default.inc

@@ -0,0 +1,192 @@
+<?php
+
+/**
+ *
+ *
+ * @ingroup tripal_project_views
+ */
+function tripal_project_views_default_views() {
+  $views = array();
+
+  $view = tripal_project_defaultview_admin_projects();
+  $views[$view->name] = $view;
+
+  return $views;
+}
+
+function tripal_project_defaultview_admin_projects() {
+
+  $view = new view();
+  $view->name = 'tripal_project_admin_projects';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
+  $view->base_table = 'project';
+  $view->human_name = 'Project Admin';
+  $view->core = 7;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Master */
+  $handler = $view->new_display('default', 'Master', 'default');
+  $handler->display->display_options['title'] = 'Projects';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'none';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'nid' => 'nid',
+    'name' => 'name',
+    'description' => 'description',
+    'delete_node' => 'delete_node',
+    'edit_node' => 'edit_node',
+    'nothing' => 'nothing',
+  );
+  $handler->display->display_options['style_options']['default'] = 'name';
+  $handler->display->display_options['style_options']['info'] = array(
+    'nid' => array(
+      'sortable' => 0,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'name' => array(
+      'sortable' => 1,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'description' => array(
+      'sortable' => 0,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'delete_node' => array(
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'edit_node' => array(
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'nothing' => array(
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+  );
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Project',
+    'path-1' => 'node/add/tripal-project',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => '',
+    'path-2' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+    'label-3' => '',
+    'path-3' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+    'label-4' => '',
+    'path-4' => '',
+  );
+  /* Relationship: Project: Project => Node */
+  $handler->display->display_options['relationships']['project_id']['id'] = 'project_id';
+  $handler->display->display_options['relationships']['project_id']['table'] = 'chado_project';
+  $handler->display->display_options['relationships']['project_id']['field'] = 'project_id';
+  /* Field: Content: Nid */
+  $handler->display->display_options['fields']['nid']['id'] = 'nid';
+  $handler->display->display_options['fields']['nid']['table'] = 'node';
+  $handler->display->display_options['fields']['nid']['field'] = 'nid';
+  $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
+  /* Field: Chado Project: Name */
+  $handler->display->display_options['fields']['name']['id'] = 'name';
+  $handler->display->display_options['fields']['name']['table'] = 'project';
+  $handler->display->display_options['fields']['name']['field'] = 'name';
+  /* Field: Chado Project: Description */
+  $handler->display->display_options['fields']['description']['id'] = 'description';
+  $handler->display->display_options['fields']['description']['table'] = 'project';
+  $handler->display->display_options['fields']['description']['field'] = 'description';
+  $handler->display->display_options['fields']['description']['element_class'] = 'wide-column';
+  $handler->display->display_options['fields']['description']['element_label_class'] = 'wide-column';
+  /* Field: Content: Delete link */
+  $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['relationship'] = 'project_id';
+  $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
+  /* Field: Content: Edit link */
+  $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['relationship'] = 'project_id';
+  $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['label'] = '';
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node]   [delete_node]';
+  $handler->display->display_options['fields']['nothing']['element_class'] = 'short-column';
+  $handler->display->display_options['fields']['nothing']['element_label_class'] = 'short-column';
+  $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
+  /* Filter criterion: Chado Project: Name */
+  $handler->display->display_options['filters']['name']['id'] = 'name';
+  $handler->display->display_options['filters']['name']['table'] = 'project';
+  $handler->display->display_options['filters']['name']['field'] = 'name';
+  $handler->display->display_options['filters']['name']['operator'] = 'contains';
+  $handler->display->display_options['filters']['name']['group'] = 1;
+  $handler->display->display_options['filters']['name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['name']['expose']['operator_id'] = '';
+  $handler->display->display_options['filters']['name']['expose']['label'] = 'Name Contains';
+  $handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
+  $handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Project: Description */
+  $handler->display->display_options['filters']['description']['id'] = 'description';
+  $handler->display->display_options['filters']['description']['table'] = 'project';
+  $handler->display->display_options['filters']['description']['field'] = 'description';
+  $handler->display->display_options['filters']['description']['operator'] = 'contains';
+  $handler->display->display_options['filters']['description']['group'] = 1;
+  $handler->display->display_options['filters']['description']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['description']['expose']['operator_id'] = 'description_op';
+  $handler->display->display_options['filters']['description']['expose']['label'] = 'Description Contains';
+  $handler->display->display_options['filters']['description']['expose']['operator'] = 'description_op';
+  $handler->display->display_options['filters']['description']['expose']['identifier'] = 'description';
+  $handler->display->display_options['filters']['description']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+
+  /* Display: Page */
+  $handler = $view->new_display('page', 'Page', 'page');
+  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_project/projects';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Projects';
+  $handler->display->display_options['menu']['weight'] = '0';
+  $handler->display->display_options['menu']['name'] = 'management';
+  $handler->display->display_options['menu']['context'] = 0;
+  $handler->display->display_options['menu']['context_only_inline'] = 0;
+  $handler->display->display_options['tab_options']['weight'] = '0';
+
+  return $view;
+}

+ 2 - 0
tripal_pub/tripal_pub.info

@@ -4,7 +4,9 @@ core = 7.x
 project = tripal_pub
 project = tripal_pub
 package = Tripal
 package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
+
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_cv
 dependencies[] = tripal_cv
 dependencies[] = tripal_db
 dependencies[] = tripal_db
 dependencies[] = tripal_contact
 dependencies[] = tripal_contact

+ 39 - 25
tripal_pub/tripal_pub.install

@@ -10,6 +10,20 @@
  * multiple project/mysql instances as well as manage and create such project instances
  * multiple project/mysql instances as well as manage and create such project instances
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_pub_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_pub.views_default.inc");
+  $views = tripal_pub_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  */
  */
@@ -55,7 +69,7 @@ function tripal_pub_uninstall() {
 }
 }
 
 
 /**
 /**
- * 
+ *
  */
  */
 function tripal_pub_enable() {
 function tripal_pub_enable() {
   // make sure we have our supported databases
   // make sure we have our supported databases
@@ -74,24 +88,24 @@ function tripal_pub_schema() {
   $schema['chado_pub'] = array(
   $schema['chado_pub'] = array(
     'fields' => array(
     'fields' => array(
       'vid' => array(
       'vid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
         'not null' => TRUE, 'default' => 0
         'not null' => TRUE, 'default' => 0
       ),
       ),
       'nid' => array(
       'nid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
         'default' => 0
         'default' => 0
       ),
       ),
       'pub_id' => array(
       'pub_id' => array(
-        'type' => 'int', 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'not null' => TRUE,
         'default' => 0
         'default' => 0
       ),
       ),
       'sync_date' => array(
       'sync_date' => array(
-        'type' => 'int', 
-        'not null' => FALSE, 
+        'type' => 'int',
+        'not null' => FALSE,
         'description' => 'UNIX integer sync date/time'
         'description' => 'UNIX integer sync date/time'
       ),
       ),
     ),
     ),
@@ -104,34 +118,34 @@ function tripal_pub_schema() {
     ),
     ),
     'primary key' => array('nid'),
     'primary key' => array('nid'),
   );
   );
-  
+
   $schema['tripal_pub_import'] = array(
   $schema['tripal_pub_import'] = array(
     'fields' => array(
     'fields' => array(
       'pub_import_id' => array(
       'pub_import_id' => array(
-        'type' => 'serial', 
+        'type' => 'serial',
         'not null' => TRUE
         'not null' => TRUE
       ),
       ),
       'name' => array(
       'name' => array(
-        'type' => 'varchar', 
-        'length' => 255, 
+        'type' => 'varchar',
+        'length' => 255,
         'not null' => TRUE
         'not null' => TRUE
       ),
       ),
       'criteria' => array(
       'criteria' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
-        'not null' => TRUE, 
+        'type' => 'text',
+        'size' => 'normal',
+        'not null' => TRUE,
         'description' => 'Contains a serialized PHP array containing the search criteria'
         'description' => 'Contains a serialized PHP array containing the search criteria'
       ),
       ),
       'disabled'  => array(
       'disabled'  => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => TRUE,
         'default' => 0
         'default' => 0
-      ),      
+      ),
       'do_contact'  => array(
       'do_contact'  => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => TRUE,
         'default' => 0
         'default' => 0
       ),
       ),
     ),
     ),
@@ -140,7 +154,7 @@ function tripal_pub_schema() {
       'name' => array('name')
       'name' => array('name')
     ),
     ),
   );
   );
-   
+
   return $schema;
   return $schema;
 }
 }
 
 

+ 0 - 373
tripal_pub/tripal_pub.views.inc

@@ -9,376 +9,3 @@
  *  Documentation on views integration can be found at
  *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  *  http://views2.logrus.com/doc/html/index.html.
  */
  */
-
-/**
- *
- * @ingroup tripal_pub_views
- */
-function tripal_pub_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // Main default view
-  $view = new view;
-  $view->name = 'pub_listing';
-  $view->description = 'This view lists all pubs by default.';
-  $view->tag = 'chado default';
-  $view->base_table = 'pub';
-  $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(
-    'title' => array(
-      'label' => 'Title',
-      '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' => 'title',
-      'table' => 'pub',
-      'field' => 'title',
-      'relationship' => 'none',
-    ),
-    'pyear' => array(
-      'label' => 'Year',
-      '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' => 'pub',
-      'field' => 'pyear',
-      'relationship' => 'none',
-    ),
-    'type' => 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' => 'type',
-      'table' => 'cvterm',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('sorts', array(
-    'pyear' => array(
-      'order' => 'ASC',
-      'id' => 'year',
-      'table' => 'pub',
-      'field' => 'pyear',
-      'relationship' => 'none',
-    ),
-    'title' => array(
-      'order' => 'ASC',
-      'id' => 'title',
-      'table' => 'pub',
-      'field' => 'title',
-      'relationship' => 'none',
-    ),
-    'type' => array(
-      'order' => 'ASC',
-      'id' => 'type',
-      'table' => 'cvterm',
-      'field' => 'name',
-      '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 pubs matching the entered criteria. If you leave a any of the criteria blank then the pubs will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all pubs will be listed.',
-    ),
-    'title' => array(
-      'operator' => '=',
-      'value' => array(),
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'title_op',
-        'identifier' => 'pub_title',
-        'label' => 'Title',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'title',
-      'table' => 'pub',
-      'field' => 'title',
-      'relationship' => 'none',
-    ),
-    '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' => 'pub',
-      'field' => 'type_id',
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 1,
-      'optional' => 0,
-      'show_all' => 0,
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 1,
-      ),
-    ),
-    'year' => array(
-      'operator' => '=',
-      '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' => 'pub',
-      'field' => 'name',
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 1,
-      'optional' => 0,
-      'show_all' => 0,
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 1,
-      ),
-    ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_pub content',
-  ));
-  $handler->override_option('cache', array(
-    'type' => 'none',
-  ));
-  $handler->override_option('title', 'Publications');
-  $handler->override_option('header', 'Click "Show" to see a list of all publications matching the entered criteria. If you leave a any of the criteria blank then the pubs will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all publications will be listed.');
-  $handler->override_option('header_format', '2');
-  $handler->override_option('header_empty', 0);
-  $handler->override_option('empty', 'No publications match the supplied criteria.');
-  $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(
-    'grouping' => '',
-    'override' => 1,
-    'sticky' => 0,
-    'order' => 'asc',
-    'columns' => array(
-      'title' => 'title',
-      'pyear' => 'pyear',
-      'type' => 'type',
-      'all_dbxref' => 'all_dbxref',
-      'all_properties' => 'all_properties',
-      'all_relationships' => 'all_relationships',
-    ),
-    'info' => array(
-      'title' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'type' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'pyear' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'all_dbxref' => array(
-        'separator' => '',
-      ),
-      'all_properties' => array(
-        'separator' => '',
-      ),
-      'all_relationships' => array(
-        'separator' => '',
-      ),
-    ),
-    'default' => '-1',
-  ));
-  $default_handler = $handler;
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/pubs');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Publications',
-    'description' => 'A published article, book, conference proceeding, etc.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        '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,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Change analysis.name to have a link to the node
-    $fields['name_2']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Adds pub => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Publication to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_pub',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Only show records with published nodes
-    /**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-    */
-  }
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 374 - 0
tripal_pub/tripal_pub.views_default.inc

@@ -0,0 +1,374 @@
+<?php
+
+/**
+ *
+ * @ingroup tripal_pub_views
+ */
+function tripal_pub_views_default_views() {
+  $views = array();
+
+  if (!module_exists('tripal_views')) {
+    return $views;
+  }
+
+  // Main default view
+  $view = new view;
+  $view->name = 'pub_listing';
+  $view->description = 'This view lists all pubs by default.';
+  $view->tag = 'chado default';
+  $view->base_table = 'pub';
+  $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(
+    'title' => array(
+      'label' => 'Title',
+      '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' => 'title',
+      'table' => 'pub',
+      'field' => 'title',
+      'relationship' => 'none',
+    ),
+    'pyear' => array(
+      'label' => 'Year',
+      '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' => 'pub',
+      'field' => 'pyear',
+      'relationship' => 'none',
+    ),
+    'type' => 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' => 'type',
+      'table' => 'cvterm',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('sorts', array(
+    'pyear' => array(
+      'order' => 'ASC',
+      'id' => 'year',
+      'table' => 'pub',
+      'field' => 'pyear',
+      'relationship' => 'none',
+    ),
+    'title' => array(
+      'order' => 'ASC',
+      'id' => 'title',
+      'table' => 'pub',
+      'field' => 'title',
+      'relationship' => 'none',
+    ),
+    'type' => array(
+      'order' => 'ASC',
+      'id' => 'type',
+      'table' => 'cvterm',
+      'field' => 'name',
+      '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 pubs matching the entered criteria. If you leave a any of the criteria blank then the pubs will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all pubs will be listed.',
+    ),
+    'title' => array(
+      'operator' => '=',
+      'value' => array(),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'title_op',
+        'identifier' => 'pub_title',
+        'label' => 'Title',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'title',
+      'table' => 'pub',
+      'field' => 'title',
+      'relationship' => 'none',
+    ),
+    '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' => 'pub',
+      'field' => 'type_id',
+      'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+    'year' => array(
+      'operator' => '=',
+      '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' => 'pub',
+      'field' => 'name',
+      'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 0,
+      'show_all' => 0,
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access chado_pub content',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('title', 'Publications');
+  $handler->override_option('header', 'Click "Show" to see a list of all publications matching the entered criteria. If you leave a any of the criteria blank then the pubs will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all publications will be listed.');
+  $handler->override_option('header_format', '2');
+  $handler->override_option('header_empty', 0);
+  $handler->override_option('empty', 'No publications match the supplied criteria.');
+  $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(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'columns' => array(
+      'title' => 'title',
+      'pyear' => 'pyear',
+      'type' => 'type',
+      'all_dbxref' => 'all_dbxref',
+      'all_properties' => 'all_properties',
+      'all_relationships' => 'all_relationships',
+    ),
+    'info' => array(
+      'title' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'type' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'pyear' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'all_dbxref' => array(
+        'separator' => '',
+      ),
+      'all_properties' => array(
+        'separator' => '',
+      ),
+      'all_relationships' => array(
+        'separator' => '',
+      ),
+    ),
+    'default' => '-1',
+  ));
+  $default_handler = $handler;
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'chado/pubs');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Publications',
+    'description' => 'A published article, book, conference proceeding, etc.',
+    'weight' => '10',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'link_to_node' => 0,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Change analysis.name to have a link to the node
+    $fields['name_2']['alter']['link_to_node'] = 1;
+    $default_handler->override_option('fields', $fields);
+    // Adds pub => Node relationship
+    $default_handler->override_option('relationships', array(
+      'nid' => array(
+        'label' => 'Publication to Node',
+        'required' => 0,
+        'id' => 'nid',
+        'table' => 'chado_pub',
+        'field' => 'nid',
+        'relationship' => 'none',
+      ),
+    ));
+    // Only show records with published nodes
+    /**
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+    */
+  }
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 2 - 0
tripal_stock/tripal_stock.info

@@ -4,5 +4,7 @@ core = 7.x
 project = tripal_stock
 project = tripal_stock
 package = Tripal
 package = Tripal
 version = 7.x-2.0-beta1
 version = 7.x-2.0-beta1
+
 dependencies[] = tripal_core
 dependencies[] = tripal_core
+dependencies[] = tripal_views
 dependencies[] = tripal_organism
 dependencies[] = tripal_organism

+ 14 - 0
tripal_stock/tripal_stock.install

@@ -6,6 +6,20 @@
  * @file
  * @file
  */
  */
 
 
+/**
+ * Disable default views when module is disabled
+ */
+function tripal_stock_disable() {
+
+  // Disable all default views provided by this module
+  require_once("tripal_stock.views_default.inc");
+  $views = tripal_stock_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
 /**
 /**
  * Implementation of hook_requirements().
  * Implementation of hook_requirements().
  *
  *

+ 0 - 405
tripal_stock/tripal_stock.views.inc

@@ -14,408 +14,3 @@
  * @defgroup tripal_stock_views Stock Views Integration
  * @defgroup tripal_stock_views Stock Views Integration
  * @ingroup views
  * @ingroup views
  */
  */
-
-/**
- *
- * @ingroup tripal_stock_views
- */
-function tripal_stock_views_default_views() {
-  $views = array();
-
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
-  // Main default view
-  $view = new view;
-  $view->name = 'stock_listing';
-  $view->description = 'This view lists all stocks by default.';
-  $view->tag = 'chado default';
-  $view->base_table = 'stock';
-  $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(
-    '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' => 'stock',
-      'field' => 'uniquename',
-      'relationship' => 'none',
-    ),
-    'name_2' => 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_2',
-      'table' => 'stock',
-      'field' => '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',
-    ),
-    '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',
-    ),
-  ));
-  $handler->override_option('sorts', array(
-    'common_name' => array(
-      'order' => 'ASC',
-      'id' => 'common_name',
-      'table' => 'organism',
-      'field' => 'common_name',
-      'relationship' => 'none',
-    ),
-    'uniquename' => array(
-      'order' => 'ASC',
-      'id' => 'uniquename',
-      'table' => 'stock',
-      'field' => 'uniquename',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'common_name' => array(
-      'operator' => '=',
-      'value' => array(),
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'common_name_op',
-        'identifier' => 'organism_common_name',
-        'label' => 'Organism',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'common_name',
-      'table' => 'organism',
-      'field' => 'common_name',
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 1,
-      'optional' => 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 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' => '',
-      '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' => '~',
-      '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' => 'stock',
-      'field' => 'name',
-      'relationship' => 'none',
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 1,
-      ),
-    ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_stock content',
-  ));
-  $handler->override_option('cache', array(
-    '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', 'No stocks match the supplied criteria.');
-  $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(
-    'grouping' => '',
-    'override' => 1,
-    'sticky' => 0,
-    'order' => 'asc',
-    'columns' => array(
-      'uniquename' => 'uniquename',
-      'name_2' => 'name_2',
-      'name' => 'name',
-      'common_name' => 'common_name',
-      'all_dbxref' => 'all_dbxref',
-      'all_properties' => 'all_properties',
-      'all_relationships' => 'all_relationships',
-    ),
-    'info' => array(
-      'uniquename' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'name_2' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'common_name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'all_dbxref' => array(
-        'separator' => '',
-      ),
-      'all_properties' => array(
-        'separator' => '',
-      ),
-      'all_relationships' => array(
-        'separator' => '',
-      ),
-    ),
-    'default' => '-1',
-  ));
-  $default_handler = $handler;
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/stocks');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Stocks',
-    'description' => 'A stock is the physical entities, either living or preserved, held by collections and can be globally identified by the combination of organism, uniquename and stock type.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        '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,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Change analysis.name to have a link to the node
-    $fields['name_2']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Adds stock => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Stock to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_stock',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Only show records with published nodes
-    /**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-    */
-  }
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 406 - 0
tripal_stock/tripal_stock.views_default.inc

@@ -0,0 +1,406 @@
+<?php
+
+/**
+ *
+ * @ingroup tripal_stock_views
+ */
+function tripal_stock_views_default_views() {
+  $views = array();
+
+  if (!module_exists('tripal_views')) {
+    return $views;
+  }
+
+  // Main default view
+  $view = new view;
+  $view->name = 'stock_listing';
+  $view->description = 'This view lists all stocks by default.';
+  $view->tag = 'chado default';
+  $view->base_table = 'stock';
+  $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(
+    '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' => 'stock',
+      'field' => 'uniquename',
+      'relationship' => 'none',
+    ),
+    'name_2' => 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_2',
+      'table' => 'stock',
+      'field' => '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',
+    ),
+    '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',
+    ),
+  ));
+  $handler->override_option('sorts', array(
+    'common_name' => array(
+      'order' => 'ASC',
+      'id' => 'common_name',
+      'table' => 'organism',
+      'field' => 'common_name',
+      'relationship' => 'none',
+    ),
+    'uniquename' => array(
+      'order' => 'ASC',
+      'id' => 'uniquename',
+      'table' => 'stock',
+      'field' => 'uniquename',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('filters', array(
+    'common_name' => array(
+      'operator' => '=',
+      'value' => array(),
+      'group' => '0',
+      'exposed' => TRUE,
+      'expose' => array(
+        'use_operator' => 0,
+        'operator' => 'common_name_op',
+        'identifier' => 'organism_common_name',
+        'label' => 'Organism',
+        'remember' => 0,
+      ),
+      'case' => 1,
+      'id' => 'common_name',
+      'table' => 'organism',
+      'field' => 'common_name',
+      'relationship' => 'none',
+      'values_form_type' => 'select',
+      'multiple' => 1,
+      'optional' => 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 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' => '',
+      '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' => '~',
+      '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' => 'stock',
+      'field' => 'name',
+      'relationship' => 'none',
+      'agg' => array(
+        'records_with' => 1,
+        'aggregates_with' => 1,
+      ),
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'access chado_stock content',
+  ));
+  $handler->override_option('cache', array(
+    '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', 'No stocks match the supplied criteria.');
+  $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(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 0,
+    'order' => 'asc',
+    'columns' => array(
+      'uniquename' => 'uniquename',
+      'name_2' => 'name_2',
+      'name' => 'name',
+      'common_name' => 'common_name',
+      'all_dbxref' => 'all_dbxref',
+      'all_properties' => 'all_properties',
+      'all_relationships' => 'all_relationships',
+    ),
+    'info' => array(
+      'uniquename' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name_2' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'common_name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'all_dbxref' => array(
+        'separator' => '',
+      ),
+      'all_properties' => array(
+        'separator' => '',
+      ),
+      'all_relationships' => array(
+        'separator' => '',
+      ),
+    ),
+    'default' => '-1',
+  ));
+  $default_handler = $handler;
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->override_option('path', 'chado/stocks');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => 'Stocks',
+    'description' => 'A stock is the physical entities, either living or preserved, held by collections and can be globally identified by the combination of organism, uniquename and stock type.',
+    'weight' => '10',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'description' => '',
+    'weight' => 0,
+    'name' => 'navigation',
+  ));
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'link_to_node' => 0,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Change analysis.name to have a link to the node
+    $fields['name_2']['alter']['link_to_node'] = 1;
+    $default_handler->override_option('fields', $fields);
+    // Adds stock => Node relationship
+    $default_handler->override_option('relationships', array(
+      'nid' => array(
+        'label' => 'Stock to Node',
+        'required' => 0,
+        'id' => 'nid',
+        'table' => 'chado_stock',
+        'field' => 'nid',
+        'relationship' => 'none',
+      ),
+    ));
+    // Only show records with published nodes
+    /**
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+    */
+  }
+  $views[$view->name] = $view;
+
+  return $views;
+}

+ 14 - 1
tripal_views/tripal_views.views.inc

@@ -1,7 +1,7 @@
 <?php
 <?php
 
 
 include('api/tripal_views.api.inc');
 include('api/tripal_views.api.inc');
-
+include('views/handlers/tripal_views_handler_area_action_links.inc');
 
 
 /**
 /**
  * @file
  * @file
@@ -71,6 +71,11 @@ function tripal_views_views_handlers() {
       ),
       ),
       */
       */
 
 
+      // Custom area handler
+      'tripal_views_handler_area_action_links' => array(
+        'parent' => 'views_handler_area',
+      ),
+
       // Custom Tripal Filter Handlers
       // Custom Tripal Filter Handlers
       'tripal_views_handler_filter_no_results' => array(
       'tripal_views_handler_filter_no_results' => array(
         'parent' => 'views_handler_filter'
         'parent' => 'views_handler_filter'
@@ -156,6 +161,14 @@ function tripal_views_views_data() {
     ),
     ),
   );
   );
 
 
+  $data['views']['action_links_area'] = array(
+    'title' => t('Action Links'),
+    'help' => t('Add action links to the view.'),
+    'area' => array(
+      'handler' => 'tripal_views_handler_area_action_links',
+    ),
+  );
+
   $tvi_query = db_query('SELECT * FROM {tripal_views}');
   $tvi_query = db_query('SELECT * FROM {tripal_views}');
 
 
   // INTEGRATE THE LIGHTEST SETUP FOR EACH TABLE
   // INTEGRATE THE LIGHTEST SETUP FOR EACH TABLE

+ 151 - 0
tripal_views/views/handlers/tripal_views_handler_area_action_links.inc

@@ -0,0 +1,151 @@
+<?php
+
+class tripal_views_handler_area_action_links extends views_handler_area {
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['link-1']['label-1'] = array('default' => '');
+    $options['link-1']['path-1'] = array('default' => '');
+
+    $options['link-2']['label-2'] = array('default' => '');
+    $options['link-2']['path-2'] = array('default' => '');
+
+    $options['link-3']['label-3'] = array('default' => '');
+    $options['link-3']['path-3'] = array('default' => '');
+
+    $options['link-4']['label-4'] = array('default' => '');
+    $options['link-4']['path-4'] = array('default' => '');
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['label']['#default_value'] = 'Action Links';
+
+    $form['link-1'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Link #1')
+    );
+
+    $form['link-1']['label-1'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Label'),
+      '#description' => t('The text that will be displayed as the link'),
+      '#default_value' => $this->options['link-1']['label-1'],
+    );
+
+    $form['link-1']['path-1'] = array(
+      '#type' => 'textfield',
+      '#title' => t('URL'),
+      '#description' => t('The path that the link will link to'),
+      '#default_value' => $this->options['link-1']['path-1']
+    );
+
+    $form['link-2'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Link #2')
+    );
+
+    $form['link-2']['label-2'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Label'),
+      '#description' => t('The text that will be displayed as the link'),
+      '#default_value' => $this->options['link-2']['label-2'],
+    );
+
+    $form['link-2']['path-2'] = array(
+      '#type' => 'textfield',
+      '#title' => t('URL'),
+      '#description' => t('The path that the link will link to'),
+      '#default_value' => $this->options['link-2']['path-2']
+    );
+
+    $form['link-3'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Link #3')
+    );
+
+    $form['link-3']['label-3'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Label'),
+      '#description' => t('The text that will be displayed as the link'),
+      '#default_value' => $this->options['link-3']['label-3'],
+    );
+
+    $form['link-3']['path-3'] = array(
+      '#type' => 'textfield',
+      '#title' => t('URL'),
+      '#description' => t('The path that the link will link to'),
+      '#default_value' => $this->options['link-3']['path-3']
+    );
+
+    $form['link-4'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Link #4')
+    );
+
+    $form['link-4']['label-4'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Label'),
+      '#description' => t('The text that will be displayed as the link'),
+      '#default_value' => $this->options['link-4']['label-4'],
+    );
+
+    $form['link-4']['path-4'] = array(
+      '#type' => 'textfield',
+      '#title' => t('URL'),
+      '#description' => t('The path that the link will link to'),
+      '#default_value' => $this->options['link-4']['path-4']
+    );
+
+  }
+
+  function options_submit(&$form, &$form_state) {
+    parent::options_submit($form, $form_state);
+    ddl($form_state, 'form state in submit');
+    $this->options['link-1']['label-1'] = $form_state['values']['options']['link-1']['label-1'];
+    $this->options['link-1']['path-1'] = $form_state['values']['options']['link-1']['path-1'];
+
+    $this->options['link-2']['label-2'] = $form_state['values']['options']['link-2']['label-2'];
+    $this->options['link-2']['path-2'] = $form_state['values']['options']['link-2']['path-2'];
+
+    $this->options['link-3']['label-3'] = $form_state['values']['options']['link-3']['label-3'];
+    $this->options['link-3']['path-3'] = $form_state['values']['options']['link-3']['path-3'];
+
+    $this->options['link-4']['label-4'] = $form_state['values']['options']['link-4']['label-4'];
+    $this->options['link-4']['path-4'] = $form_state['values']['options']['link-4']['path-4'];
+  }
+
+  function render($empty = FALSE) {
+    if (!$empty || !empty($this->options['empty'])) {
+      $output = '<ul class="action-links">';
+
+      // First link
+      if (!empty($this->options['link-1']['label-1']) AND !empty($this->options['link-1']['path-1'])) {
+        $output .= '<li>' . l($this->options['link-1']['label-1'], $this->options['link-1']['path-1']) . '</li>';
+      }
+
+      // Second link
+      if (!empty($this->options['link-2']['label-2']) AND !empty($this->options['link-2']['path-2'])) {
+        $output .= '<li>' . l($this->options['link-2']['label-2'], $this->options['link-2']['path-2']) . '</li>';
+      }
+
+      // Third link
+      if (!empty($this->options['link-3']['label-3']) AND !empty($this->options['link-3']['path-3'])) {
+        $output .= '<li>' . l($this->options['link-3']['label-3'], $this->options['link-3']['path-3']) . '</li>';
+      }
+
+      // Fourth link
+      if (!empty($this->options['link-4']['label-4']) AND !empty($this->options['link-4']['path-4'])) {
+        $output .= '<li>' . l($this->options['link-4']['label-4'], $this->options['link-4']['path-4']) . '</li>';
+      }
+      $output .= '</ul>';
+      return $output;
+    }
+    return '';
+  }
+
+}

+ 10 - 6
tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc

@@ -35,13 +35,13 @@ class tripal_views_handler_filter_select_cvterm extends tripal_views_handler_fil
       else {
       else {
         //get a list of cvs currently used
         //get a list of cvs currently used
         if ($this->view->base_table == 'cvterm') {
         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';
+          $sql = 'SELECT distinct(cv.cv_id) FROM chado.' . $this->view->base_table
+            .' LEFT JOIN chado.cv cv ON cv.cv_id=cvterm.cv_id';
         }
         }
         else {
         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';
+          $sql = 'SELECT distinct(cv.cv_id) FROM chado.' . $this->view->base_table
+            .' LEFT JOIN chado.cvterm cvterm ON cvterm.cvterm_id=' . $this->view->base_table . '.type_id '
+            .'LEFT JOIN chado.cv cv ON cv.cv_id=cvterm.cv_id';
         }
         }
         // D7 TODO: Check DBTNG changes work
         // D7 TODO: Check DBTNG changes work
         $resource = chado_query($sql);
         $resource = chado_query($sql);
@@ -71,7 +71,11 @@ 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);
 
 
-    return $cvterms;
+    if ($this->options['expose']['select_optional']) {
+      $options['All'] = '--Any--';
+    }
+
+    return $options + $cvterms;
 
 
   }
   }