Browse Source

Added a hook_disable to all modules to disable default views; moved default views into module.views_default.inc files and made tripal_views a dependancy of tripal_core

Lacey Sanderson 11 years ago
parent
commit
c139651da8
40 changed files with 5449 additions and 5235 deletions
  1. 45 31
      tripal_analysis/tripal_analysis.install
  2. 0 421
      tripal_analysis/tripal_analysis.views.inc
  3. 422 0
      tripal_analysis/tripal_analysis.views_default.inc
  4. 14 0
      tripal_bulk_loader/tripal_bulk_loader.install
  5. 18 4
      tripal_contact/tripal_contact.install
  6. 1 280
      tripal_contact/tripal_contact.views.inc
  7. 278 0
      tripal_contact/tripal_contact.views_default.inc
  8. 3 1
      tripal_core/tripal_core.info
  9. 26 12
      tripal_cv/tripal_cv.install
  10. 14 0
      tripal_db/tripal_db.install
  11. 29 15
      tripal_feature/tripal_feature.install
  12. 0 547
      tripal_feature/tripal_feature.views.inc
  13. 549 0
      tripal_feature/tripal_feature.views_default.inc
  14. 39 25
      tripal_featuremap/tripal_featuremap.install
  15. 1 372
      tripal_featuremap/tripal_featuremap.views.inc
  16. 372 0
      tripal_featuremap/tripal_featuremap.views_default.inc
  17. 15 0
      tripal_genetic/tripal_genetic.install
  18. 1 253
      tripal_genetic/tripal_genetic.views.inc
  19. 253 0
      tripal_genetic/tripal_genetic.views_default.inc
  20. 37 23
      tripal_library/tripal_library.install
  21. 0 383
      tripal_library/tripal_library.views.inc
  22. 385 0
      tripal_library/tripal_library.views_default.inc
  23. 21 9
      tripal_natural_diversity/tripal_natural_diversity.install
  24. 1 952
      tripal_natural_diversity/tripal_natural_diversity.views.inc
  25. 942 0
      tripal_natural_diversity/tripal_natural_diversity.views_default.inc
  26. 18 4
      tripal_organism/tripal_organism.install
  27. 0 298
      tripal_organism/tripal_organism.views.inc
  28. 299 0
      tripal_organism/tripal_organism.views_default.inc
  29. 15 0
      tripal_phenotype/tripal_phenotype.install
  30. 0 487
      tripal_phenotype/tripal_phenotype.views.inc
  31. 488 0
      tripal_phenotype/tripal_phenotype.views_default.inc
  32. 20 6
      tripal_project/tripal_project.install
  33. 1 309
      tripal_project/tripal_project.views.inc
  34. 309 0
      tripal_project/tripal_project.views_default.inc
  35. 39 25
      tripal_pub/tripal_pub.install
  36. 0 373
      tripal_pub/tripal_pub.views.inc
  37. 374 0
      tripal_pub/tripal_pub.views_default.inc
  38. 14 0
      tripal_stock/tripal_stock.install
  39. 0 405
      tripal_stock/tripal_stock.views.inc
  40. 406 0
      tripal_stock/tripal_stock.views_default.inc

+ 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) {
   $requirements = array();
@@ -32,10 +46,10 @@ function tripal_analysis_install() {
 
   // we may need the analysisfeatureprop table if it doesn't already exist
   tripal_analysis_create_analysisfeatureprop();
-  
+
   // add cvterms
   tripal_analysis_add_cvterms();
-  
+
   // add materialized views
   tripal_analysis_add_mview_analysis_organism();
 }
@@ -57,52 +71,52 @@ function tripal_analysis_uninstall() {
   }
 }
 /*
- * 
+ *
  */
 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')) {
     $sql = "
       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)
       )
     ";
     chado_query($sql);
-  } 
+  }
 }
 /*
- * 
+ *
  */
 function tripal_analysis_add_cvterms() {
-  
+
   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
   // get rid of it in case it is used, so just keep it in the Tripal CV
   $term = array(
-    'name' => 'analysis_date', 
+    'name' => 'analysis_date',
     'def' => 'The date that an analysis was performed.'
   );
   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
   // get rid of it in case it is used, so just keep it in the Tripal CV
   $term = array(
-    'name' => 'analysis_short_name', 
+    'name' => 'analysis_short_name',
     '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.
-  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');
 }
 
@@ -116,7 +130,7 @@ function tripal_analysis_add_cvterms() {
  *     with this module.
  */
 function tripal_analysis_schema() {
-  
+
   // chado_analysis table
   $schema['chado_analysis'] = array(
     'fields' => array(
@@ -168,13 +182,13 @@ function tripal_analysis_schema() {
 }
 
 /*
- * 
+ *
  * @ingroup tripal_network
  */
 function tripal_analysis_add_mview_analysis_organism() {
   $view_name = 'analysis_organism';
   $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
   // has been used.  This is obtained though the analysisfeature -> feature -> organism
   // 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 organism O         ON O.organism_id = F.organism_id
   ";
-  
+
   // the schema array for describing this view
   $schema = array(
     'table' => $view_name,
     'description' => $comment,
-    'fields' => array(  
+    'fields' => array(
       'analysis_id' => array(
         'type' => 'int',
         'not null' => TRUE,
@@ -198,7 +212,7 @@ function tripal_analysis_add_mview_analysis_organism() {
       'organism_id' => array(
         'type' => 'int',
         'not null' => TRUE,
-      ),       
+      ),
     ),
     'indexes' => array(
       'networkmod_qtl_indx0' => array('analysis_id'),
@@ -216,10 +230,10 @@ function tripal_analysis_add_mview_analysis_organism() {
         'columns' => array(
           'organism_id' => 'organism_id',
         ),
-      ),      
+      ),
     ),
   );
-  
+
   // add the view
   tripal_add_mview($view_name, 'tripal_analysis', $schema, $sql, $comment);
 }

+ 0 - 421
tripal_analysis/tripal_analysis.views.inc

@@ -14,424 +14,3 @@
  * @defgroup tripal_analysis_views Analysis Views Integration
  * @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;
-}

+ 422 - 0
tripal_analysis/tripal_analysis.views_default.inc

@@ -0,0 +1,422 @@
+<?php
+
+/**
+ * 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;
+}

+ 14 - 0
tripal_bulk_loader/tripal_bulk_loader.install

@@ -4,6 +4,20 @@
  * @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
  *

+ 18 - 4
tripal_contact/tripal_contact.install

@@ -10,6 +10,20 @@
  * 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().
  *
@@ -33,13 +47,13 @@ function tripal_contact_requirements($phase) {
  * Implementation of hook_install().
  */
 function tripal_contact_install() {
-	
+
 	// create the module's data directory
   tripal_create_moddir('tripal_contact');
-  
+
   // add the contactprop table to Chado
   tripal_contact_add_custom_tables();
-  
+
   // 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_id = tripal_cv_add_obo_ref('Tripal Contacts', $obo_path);
@@ -91,7 +105,7 @@ function tripal_contact_schema() {
 
 
 /*
- * 
+ *
  */
 function tripal_contact_add_custom_tables(){
   $schema = array (

+ 1 - 280
tripal_contact/tripal_contact.views.inc

@@ -8,283 +8,4 @@
  *
  *  Documentation on views integration can be found at
  *  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;
-}
+ */

+ 278 - 0
tripal_contact/tripal_contact.views_default.inc

@@ -0,0 +1,278 @@
+<?php
+
+/**
+ *
+ * @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;
+}

+ 3 - 1
tripal_core/tripal_core.info

@@ -4,4 +4,6 @@ core = 7.x
 project = tripal_core
 package = Tripal
 version = 7.x-2.0-beta1
-configure = admin/tripal
+configure = admin/tripal
+
+dependencies[] = tripal_views

+ 26 - 12
tripal_cv/tripal_cv.install

@@ -5,6 +5,20 @@
  * 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().
  */
@@ -31,10 +45,10 @@ function tripal_cv_install() {
 
   // create the module's data directory
   tripal_create_moddir('tripal_cv');
-    
-  // add the cv_root_mview 
+
+  // add the cv_root_mview
   tripal_cv_add_cv_root_mview();
-  
+
   // create the tables that correlate OBO files/references with a chado CV
   tripal_cv_add_obo_defaults();
 }
@@ -56,20 +70,20 @@ function tripal_cv_uninstall() {
  * @ingroup tripal_cv
  */
 function tripal_cv_schema() {
-  
+
   $schema['tripal_cv_obo'] = array(
     'fields' => array(
       'obo_id' => array(
-        'type' => 'serial', 
-        'unsigned' => TRUE, 
+        'type' => 'serial',
+        'unsigned' => TRUE,
         'not null' => TRUE
       ),
       'name' => array(
-        'type' => 'varchar', 
+        'type' => 'varchar',
          'length' => 255
        ),
       'path'  => array(
-        'type' => 'varchar', 
+        'type' => 'varchar',
         'length' => 1024
       ),
     ),
@@ -83,7 +97,7 @@ function tripal_cv_schema() {
 }
 
 /**
- * 
+ *
  * @ingroup tripal_cv
  */
 function tripal_cv_add_cv_root_mview() {
@@ -104,7 +118,7 @@ function tripal_cv_add_cv_root_mview() {
       ),
       'cv_id' => array(
         'type' => 'int',
-        'not null' => TRUE, 
+        'not null' => TRUE,
       ),
       'cv_name' => array(
         'type' => 'varchar',
@@ -117,7 +131,7 @@ function tripal_cv_add_cv_root_mview() {
       'cv_root_mview_indx2' => array('cv_id'),
     ),
   );
-  
+
   $sql = "
     SELECT DISTINCT CVT.name,CVT.cvterm_id, CV.cv_id, CV.name
     FROM cvterm_relationship CVTR
@@ -126,7 +140,7 @@ function tripal_cv_add_cv_root_mview() {
     WHERE CVTR.object_id not in
       (SELECT subject_id FROM cvterm_relationship)
   ";
-  
+
   // Create the MView
   tripal_add_mview($mv_name, 'tripal_cv', $schema, $sql, $comment);
 }

+ 14 - 0
tripal_db/tripal_db.install

@@ -5,6 +5,20 @@
  * 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().
  */

+ 29 - 15
tripal_feature/tripal_feature.install

@@ -4,6 +4,20 @@
  * @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().
  */
@@ -33,7 +47,7 @@ function tripal_feature_install() {
 
   // add the materialized view
   tripal_feature_add_organism_count_mview();
-  
+
   // add a job to the job queue so this view gets updated automatically next
   // time the job facility is run
   if ($mview_id = tripal_mviews_get_mview_id('organism_feature_count')) {
@@ -52,36 +66,36 @@ function tripal_feature_uninstall() {
     tripal_mviews_action("delete", $mview_id);
   }
 }
- 
+
 /**
  * Implementation of hook_schema().
  *
  * @ingroup tripal_feature
  */
 function tripal_feature_schema() {
-  
+
   $schema['chado_feature'] = array(
     'fields' => array(
       'vid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
         'default' => 0
        ),
       'nid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
         'default' => 0
        ),
       'feature_id' => array(
-        'type' => 'int', 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'not null' => TRUE,
         'default' => 0
       ),
       'sync_date' => array(
-        'type' => 'int', 
-        'not null' => FALSE, 
+        'type' => 'int',
+        'not null' => FALSE,
         'description' => 'UNIX integer sync date/time'
       ),
     ),
@@ -94,7 +108,7 @@ function tripal_feature_schema() {
     ),
     'primary key' => array('nid'),
   );
-  
+
   return $schema;
 };
 
@@ -142,7 +156,7 @@ function tripal_feature_add_organism_count_mview() {
         'length' => '255',
         'not null' => TRUE,
       ),
-    ),      
+    ),
     'indexes' => array(
       'organism_feature_count_idx1' => array('organism_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;
+}

+ 39 - 25
tripal_featuremap/tripal_featuremap.install

@@ -4,6 +4,20 @@
  * @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().
  */
@@ -33,7 +47,7 @@ function tripal_featuremap_install() {
 
   // add the featuremapprop table to Chado
   tripal_featuremap_add_custom_tables();
-  
+
   // Add cvterms
   tripal_featuremap_add_cvterms();
 
@@ -89,49 +103,49 @@ function tripal_featuremap_schema() {
 
 
 /*
- * 
+ *
  */
 function tripal_featuremap_add_cvterms() {
-  
+
    // 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');
-   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');
-   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');
-   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');
-   
-   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');
-   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');
-   
+
    // 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');
-   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');
-   tripal_cv_add_cvterm(array('name' => 'Genome Group','def' => ''), 
+   tripal_cv_add_cvterm(array('name' => 'Genome Group','def' => ''),
      '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');
-   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');
-   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');
-   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');
-   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');
 
 }
 
 /*
- * 
+ *
  */
 function tripal_featuremap_add_custom_tables(){
   // add the featuremaprop table to Chado
@@ -192,9 +206,9 @@ function tripal_featuremap_add_custom_tables(){
         ),
       ),
     ),
-  );  
+  );
   tripal_core_create_custom_table('featuremapprop', $schema, TRUE);
-  
+
   // add the featuremap_dbxref table to Chado
   $schema = array (
     'table' => 'featuremap_dbxref',
@@ -246,7 +260,7 @@ function tripal_featuremap_add_custom_tables(){
     'referring_tables' => NULL,
   );
   tripal_core_create_custom_table('featuremap_dbxref', $schema, TRUE);
-  
+
   $schema = array (
     'table' => 'featureposprop',
     'fields' => array (

+ 1 - 372
tripal_featuremap/tripal_featuremap.views.inc

@@ -13,375 +13,4 @@
 /**
  * @defgroup tripal_featuremap_views Map Views Integration
  * @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;
+}

+ 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
  * @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;
+}

+ 37 - 23
tripal_library/tripal_library.install

@@ -4,6 +4,20 @@
  * @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().
  */
@@ -27,13 +41,13 @@ function tripal_library_requirements($phase) {
  * @ingroup tripal_library
  */
 function tripal_library_install() {
-  
+
   // create the module's data directory
   tripal_create_moddir('tripal_library');
 
   // add the materialized view
   tripal_library_add_mview_library_feature_count();
-  
+
   // add cvterms
   tripal_library_add_cvterms();
 }
@@ -94,7 +108,7 @@ function tripal_library_schema() {
 function tripal_library_add_mview_library_feature_count(){
   $view_name = 'library_feature_count';
   $comment = 'Provides count of feature by type that are associated with all libraries';
-  
+
   $schema = array(
     'table' => $view_name,
     'description' => $comment,
@@ -122,19 +136,19 @@ function tripal_library_add_mview_library_feature_count(){
       'library_feature_count_idx1' => array('library_id'),
     ),
   );
-  
+
   $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
   ";
-  
+
   tripal_add_mview($view_name, 'tripal_library', $schema, $sql, $comment);
 }
 
@@ -142,24 +156,24 @@ function tripal_library_add_mview_library_feature_count(){
  * @ingroup tripal_library
  */
 function tripal_library_add_cvterms() {
-  
+
   // Insert cvterm 'library_description' into cvterm table of chado
   // database. This CV term is used to keep track of the library
   // 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');
-  
+
   // 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_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_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_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_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');
 }

+ 0 - 383
tripal_library/tripal_library.views.inc

@@ -15,386 +15,3 @@
  * @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;
-}

+ 385 - 0
tripal_library/tripal_library.views_default.inc

@@ -0,0 +1,385 @@
+<?php
+
+/**
+ *
+ *
+ * @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;
+}

+ 21 - 9
tripal_natural_diversity/tripal_natural_diversity.install

@@ -4,7 +4,19 @@
  * 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().
@@ -31,10 +43,10 @@ function tripal_natural_diversity_install() {
 
   // create the module's data directory
   tripal_create_moddir('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(){
-   
-  // 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');
-  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');
-  
-  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');
 }

+ 1 - 952
tripal_natural_diversity/tripal_natural_diversity.views.inc

@@ -12,955 +12,4 @@
 /**
  * @defgroup tripal_natural_diversity_views Natural Diversity Views Integration
  * @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;
+}

+ 18 - 4
tripal_organism/tripal_organism.install

@@ -5,6 +5,20 @@
  * 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().
  *
@@ -54,7 +68,7 @@ function tripal_organism_schema() {
       ),
       'primary key' => array('nid'),
   );
-  return $schema;  
+  return $schema;
 }
 
 /**
@@ -66,8 +80,8 @@ function tripal_organism_uninstall() {
 
   // Get the list of nodes to remove
   $sql_lib_id = "
-    SELECT nid, vid 
-    FROM {node} 
+    SELECT nid, vid
+    FROM {node}
     WHERE type='chado_organism'
   ";
   $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) {

+ 0 - 298
tripal_organism/tripal_organism.views.inc

@@ -14,301 +14,3 @@
  * @defgroup tripal_organism_views Organism Views Integration
  * @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;
-}

+ 299 - 0
tripal_organism/tripal_organism.views_default.inc

@@ -0,0 +1,299 @@
+<?php
+
+/**
+ *
+ * @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;
+}

+ 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 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;
+}

+ 20 - 6
tripal_project/tripal_project.install

@@ -10,6 +10,20 @@
  * 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().
  *
@@ -32,10 +46,10 @@ function tripal_project_requirements($phase) {
  * Implementation of hook_install().
  */
 function tripal_project_install() {
-  
+
   // create the module's data directory
   tripal_create_moddir('tripal_project');
-  
+
   tripal_project_add_cvterms();
 }
 
@@ -73,13 +87,13 @@ function tripal_project_schema() {
 }
 
 /*
- * 
+ *
  */
 function tripal_project_add_cvterms() {
-  
+
   // Insert cvterm 'library_description' into cvterm table of chado
   // database. This CV term is used to keep track of the library
   // 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');
 }

+ 1 - 309
tripal_project/tripal_project.views.inc

@@ -13,312 +13,4 @@
 /**
  * @defgroup tripal_project_views Project Views Integration
  * @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;
-}
+ */

+ 309 - 0
tripal_project/tripal_project.views_default.inc

@@ -0,0 +1,309 @@
+<?php
+
+/**
+ *
+ *
+ * @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;
+}

+ 39 - 25
tripal_pub/tripal_pub.install

@@ -10,6 +10,20 @@
  * 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().
  */
@@ -55,7 +69,7 @@ function tripal_pub_uninstall() {
 }
 
 /**
- * 
+ *
  */
 function tripal_pub_enable() {
   // make sure we have our supported databases
@@ -74,24 +88,24 @@ function tripal_pub_schema() {
   $schema['chado_pub'] = array(
     'fields' => array(
       'vid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
         'not null' => TRUE, 'default' => 0
       ),
       'nid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
         'default' => 0
       ),
       'pub_id' => array(
-        'type' => 'int', 
-        'not null' => TRUE, 
+        'type' => 'int',
+        'not null' => TRUE,
         'default' => 0
       ),
       'sync_date' => array(
-        'type' => 'int', 
-        'not null' => FALSE, 
+        'type' => 'int',
+        'not null' => FALSE,
         'description' => 'UNIX integer sync date/time'
       ),
     ),
@@ -104,34 +118,34 @@ function tripal_pub_schema() {
     ),
     'primary key' => array('nid'),
   );
-  
+
   $schema['tripal_pub_import'] = array(
     'fields' => array(
       'pub_import_id' => array(
-        'type' => 'serial', 
+        'type' => 'serial',
         'not null' => TRUE
       ),
       'name' => array(
-        'type' => 'varchar', 
-        'length' => 255, 
+        'type' => 'varchar',
+        'length' => 255,
         'not null' => TRUE
       ),
       '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'
       ),
       'disabled'  => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => TRUE,
         'default' => 0
-      ),      
+      ),
       'do_contact'  => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => TRUE,
         'default' => 0
       ),
     ),
@@ -140,7 +154,7 @@ function tripal_pub_schema() {
       'name' => array('name')
     ),
   );
-   
+
   return $schema;
 }
 

+ 0 - 373
tripal_pub/tripal_pub.views.inc

@@ -9,376 +9,3 @@
  *  Documentation on views integration can be found at
  *  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;
+}

+ 14 - 0
tripal_stock/tripal_stock.install

@@ -6,6 +6,20 @@
  * @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().
  *

+ 0 - 405
tripal_stock/tripal_stock.views.inc

@@ -14,408 +14,3 @@
  * @defgroup tripal_stock_views Stock Views Integration
  * @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;
+}