Browse Source

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

Stephen Ficklin 11 years ago
parent
commit
5d583eb593

+ 66 - 32
tripal_feature/includes/tripal_feature.admin.inc

@@ -5,6 +5,40 @@
  * @todo Add file header description
  */
 
+/**
+ *
+ */
+function tripal_feature_admin_feature_view() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado', 'admin/tripal/chado');
+  $breadcrumb[] = l('Features', 'admin/tripal/chado/tripal_feature');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_feature_admin_features','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Feature module uses primarily views to provide an '
+      . 'administrative interface. Currently one or more views needed for this '
+      . 'administrative interface are disabled. <strong>Click each of the following links to '
+      . 'enable the pertinent views</strong>:</p>';
+    $output .= '<ul>';
+      $output .= '<li>'.l('Features View', 'admin/tripal/chado/tripal_feature/views/features/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
+
+
 /**
  *
  *
@@ -194,7 +228,7 @@ function tripal_feature_admin_validate($form, &$form_state) {
         'tripal_feature_set_urls', $job_args, $user->uid);
       break;
   }
-    
+
 }
 /**
  *
@@ -304,7 +338,7 @@ function get_tripal_feature_admin_form_taxonomy_set(&$form) {
 }
 
 /**
- * 
+ *
  * @param $form
  */
 function get_tripal_feature_admin_form_title_set(&$form) {
@@ -319,7 +353,7 @@ function get_tripal_feature_admin_form_title_set(&$form) {
     '#type'        => 'markup',
     '#value' => t('Each synced feature must have a unique page title, however, features
                    may have the same name if they are of different types or from
-                   different organisms.  Therefore, we must be sure that the 
+                   different organisms.  Therefore, we must be sure that the
                    page titles can uniquely identify the feature being viewed.  Select
                    an option below that will uniquely identify all features on your site.'),
   );
@@ -331,9 +365,9 @@ function get_tripal_feature_admin_form_title_set(&$form) {
   $form['title']['chado_feature_title'] = array(
     '#title'         => t('Feature Page Titles'),
     '#type'          => 'radios',
-    '#description'   => t('Choose a title type  from the list above that is 
-      guaranteed to be unique for all features.  If in doubt it is safest to 
-      choose the last option as that guarantees uniqueness. Click the 
+    '#description'   => t('Choose a title type  from the list above that is
+      guaranteed to be unique for all features.  If in doubt it is safest to
+      choose the last option as that guarantees uniqueness. Click the
       \'Save Configuration\' button at the bottom to save your selection.'),
     '#required'      => FALSE,
     '#options'       => $options,
@@ -341,12 +375,12 @@ function get_tripal_feature_admin_form_title_set(&$form) {
   );
 }
 /**
- * 
+ *
  * @param $form
  */
 function get_tripal_feature_admin_form_url_set(&$form) {
 
- 
+
   $form['url'] = array(
     '#type' => 'fieldset',
     '#title' => t('Feature URL Path'),
@@ -364,7 +398,7 @@ function get_tripal_feature_admin_form_url_set(&$form) {
     '[name]'       => '[name]:' . t('The feature name'),
     'reset'        => t('Reset'),
   );
-  
+
 
   $form['url']['chado_feature_url_string'] = array(
     '#title' => 'URL Syntax',
@@ -372,15 +406,15 @@ function get_tripal_feature_admin_form_url_set(&$form) {
     '#description' => t('You may rearrange elements in this text box to
       customize the URLs.  The available tags include: [id],
       [uniquename]. [name], [species], [genus], [type]. You can separate or
-      include any text between the tags. Click the "Set Feature URLs" button to 
+      include any text between the tags. Click the "Set Feature URLs" button to
       reset the URLs for all feature pages.  Click the "Save Configuration" button to
       simply save this setup. <b>Important</b>: be sure that whatever you choose will always be unique even considering
-      future data that may be added.  If you include the Chado table name, genus, species, type 
+      future data that may be added.  If you include the Chado table name, genus, species, type
       and uniquename you are guaranteed to have a unique URL. For example feature/[genus]/[species]/[type]/[uniquename]'),
     '#size' => 150,
-    '#default_value' => variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]'), 
+    '#default_value' => variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]'),
   );
-  
+
   $form['url']['chado_feature_url'] = array(
     '#title'         => t('URL components'),
     '#type'          => 'checkboxes',
@@ -393,14 +427,14 @@ function get_tripal_feature_admin_form_url_set(&$form) {
         if (this.value == \'reset\') {
           box.val(\'\');
         }
-        else {        
-          box.val(box.val() + "/" + this.value);          
+        else {
+          box.val(box.val() + "/" + this.value);
         }
         this.checked = false;
       ',
     ),
-  );  
-  
+  );
+
   $form['url']['button'] = array(
     '#type' => 'submit',
     '#value' => t('Set Feature URLs'),
@@ -421,7 +455,7 @@ function tripal_features_set_taxonomy($max_sync = 0, $job_id = NULL) {
   // iterate through all drupal feature nodes and set the taxonomy
   $results = db_query("SELECT * FROM {chado_feature}");
   $nsql =  "
-    SELECT * FROM {node} 
+    SELECT * FROM {node}
     WHERE nid = :nid
   ";
   $i = 0;
@@ -503,11 +537,11 @@ function tripal_feature_set_taxonomy($node, $feature_id) {
 
   // get the cvterm and the organism for this feature
   $sql = "
-    SELECT CVT.name AS cvname, O.genus, O.species 
-    FROM {CVTerm} CVT 
-      INNER JOIN {Feature} F on F.type_id = CVT.cvterm_id 
-      INNER JOIN {Organism} O ON F.organism_id = O.organism_id 
-    WHERE F.feature_id = :feature_id 
+    SELECT CVT.name AS cvname, O.genus, O.species
+    FROM {CVTerm} CVT
+      INNER JOIN {Feature} F on F.type_id = CVT.cvterm_id
+      INNER JOIN {Organism} O ON F.organism_id = O.organism_id
+    WHERE F.feature_id = :feature_id
   ";
   $feature = chado_query($sql, array(':feature_id' => $feature_id))->fetchObject();
 
@@ -523,10 +557,10 @@ function tripal_feature_set_taxonomy($node, $feature_id) {
   // get the library that this feature may belong to and add it as taxonomy
   if ($do_lb && $lb_vid) {
     $sql = "
-      SELECT L.name 
-      FROM {Library} L 
-        INNER JOIN {Library_feature} LF ON LF.library_id = L.library_id 
-      WHERE LF.feature_id = :feature_id 
+      SELECT L.name
+      FROM {Library} L
+        INNER JOIN {Library_feature} LF ON LF.library_id = L.library_id
+      WHERE LF.feature_id = :feature_id
     ";
     $library = chado_query($sql, array(':feature_id' => $feature_id))->fetchObject();
     $tags["$lb_vid"] = "$library->name";
@@ -541,10 +575,10 @@ function tripal_feature_set_taxonomy($node, $feature_id) {
   // We'll add each one individually since there may be more than one analysis
   if ($do_an && $an_vid) {
     $sql = "
-      SELECT A.name 
-      FROM {Analysis} A 
-        INNER JOIN {analysisfeature} AF ON AF.analysis_id = A.analysis_id 
-      WHERE AF.feature_id = :feature_id 
+      SELECT A.name
+      FROM {Analysis} A
+        INNER JOIN {analysisfeature} AF ON AF.analysis_id = A.analysis_id
+      WHERE AF.feature_id = :feature_id
     ";
     $results = chado_query($sql, array(':feature_id' => $feature_id));
     $analysis_terms = array();
@@ -571,7 +605,7 @@ function tripal_feature_set_taxonomy($node, $feature_id) {
 function tripal_features_cleanup($dummy = NULL, $job_id = NULL) {
 
   return tripal_core_clean_orphaned_nodes('feature', $job_id);
- 
+
 }
 /**
  *  This function is an extension of the chado_feature_view by providing

+ 0 - 0
tripal_feature/theme/tripal_feature_admin.tpl.php → tripal_feature/theme/tripal_feature_help.tpl.php


+ 182 - 161
tripal_feature/tripal_feature.module

@@ -131,7 +131,7 @@ function tripal_feature_permissions() {
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
- *  
+ *
  *  @param $op
  *  The operation to be performed
  *
@@ -141,9 +141,9 @@ function tripal_feature_permissions() {
  *  @return
  *  If the permission for the specified operation is not set then return FALSE. If the
  *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always 
+ *  access.  The only exception is when the $op == 'create'.  We will always
  *  return TRUE if the permission is set.
- *  
+ *
  * @ingroup tripal_feature
  */
 function chado_feature_node_access($node, $op, $account) {
@@ -189,62 +189,74 @@ function tripal_feature_menu() {
     'access arguments' => array('access chado_feature content'),
     'type' => MENU_CALLBACK,
   );
-  
+
   $items['find/sequences/ajax'] = array(
     'title' => 'Sequence Retrieval',
     'page callback' => 'tripal_feature_seq_extract_form_ahah_update',
     'access arguments' => array('access chado_feature content'),
     'type' => MENU_CALLBACK,
   );
-  
+
   // the administative settings menu
   $items['admin/tripal/chado/tripal_feature'] = array(
     'title' => 'Features',
-    'description' => 'Basic Description of Tripal Organism Module Functionality',
-    'page callback' => 'theme',
-    'page arguments' => array('tripal_feature_admin'),
+    'description' => 'A biological sequence or a section of a biological sequence, or a collection of such sections.',
+    'page callback' => 'tripal_feature_admin_feature_view',
     'access arguments' => array('administer tripal features'),
     'type' => MENU_NORMAL_ITEM,
   );
-  $items['admin/tripal/chado/tripal_feature/configuration'] = array(
-    'title' => 'Configuration',
-    'description' => 'Configure the Tripal Feature module.',
+  $items['admin/tripal/chado/tripal_feature/sync'] = array(
+    'title' => ' Sync',
+    'description' => 'Sync features from Chado with Drupal',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_feature_admin'),
+    'page arguments' => array('tripal_feature_sync_form'),
     'access arguments' => array('administer tripal features'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 0
   );
-  $items['admin/tripal/chado/tripal_feature/fasta_loader'] = array(
-    'title' => 'Import a multi-FASTA file',
-    'description' => 'Load sequences from a multi-FASTA file into Chado',
+  $items['admin/tripal/chado/tripal_feature/delete'] = array(
+    'title' => ' Delete',
+    'description' => 'Delete multiple features from Chado',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_feature_fasta_load_form'),
+    'page arguments' => array('tripal_feature_delete_form'),
     'access arguments' => array('administer tripal features'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 2
   );
-  $items['admin/tripal/chado/tripal_feature/gff3_load'] = array(
-    'title' => 'Import a GFF3 file',
-    'description' => 'Import a GFF3 file into Chado',
+  $items['admin/tripal/chado/tripal_feature/configuration'] = array(
+    'title' => 'Settings',
+    'description' => 'Configure the Tripal Feature module.',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_feature_gff3_load_form'),
+    'page arguments' => array('tripal_feature_admin'),
     'access arguments' => array('administer tripal features'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 5
+  );
+  $items['admin/tripal/chado/tripal_feature/help'] = array(
+    'title' => 'Help',
+    'description' => 'Help with the Tripal Feature module.',
+    'page callback' => 'theme',
+    'page arguments' => array('tripal_feature_help'),
+    'access arguments' => array('administer tripal features'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' =>  10
   );
 
-  $items['admin/tripal/chado/tripal_feature/delete'] = array(
-    'title' => ' Delete Features',
-    'description' => 'Delete multiple features from Chado',
+
+  /** Loaders */
+  $items['admin/tripal/loaders/fasta_loader'] = array(
+    'title' => 'Multi-FASTA file Loader',
+    'description' => 'Load sequences from a multi-FASTA file into Chado',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_feature_delete_form'),
+    'page arguments' => array('tripal_feature_fasta_load_form'),
     'access arguments' => array('administer tripal features'),
     'type' => MENU_NORMAL_ITEM,
   );
-
-  $items['admin/tripal/chado/tripal_feature/sync'] = array(
-    'title' => ' Sync Features',
-    'description' => 'Sync features from Chado with Drupal',
+  $items['admin/tripal/loaders/gff3_load'] = array(
+    'title' => 'GFF3 file Loader',
+    'description' => 'Import a GFF3 file into Chado',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_feature_sync_form'),
+    'page arguments' => array('tripal_feature_gff3_load_form'),
     'access arguments' => array('administer tripal features'),
     'type' => MENU_NORMAL_ITEM,
   );
@@ -257,6 +269,15 @@ function tripal_feature_menu() {
     'type' => MENU_LOCAL_TASK,
   );
 
+  // Enable admin view
+  $items['admin/tripal/chado/tripal_feature/views/features/enable'] = array(
+    'title' => 'Enable feature Administrative View',
+    'page callback' => 'tripal_views_admin_enable_view',
+    'page arguments' => array('tripal_feature_admin_features', 'admin/tripal/chado/tripal_feature'),
+    'access arguments' => array('administer tripal_bulk_loader'),
+    'type' => MENU_CALLBACK,
+  );
+
   return $items;
 }
 /**
@@ -336,12 +357,12 @@ function tripal_feature_theme($existing, $type, $theme, $path) {
       'arguments' => array('form' => NULL),
       'function' => 'theme_tripal_feature_edit_ALL_properties_form',
     ),
-    'tripal_feature_admin' => array(
-      'template' => 'tripal_feature_admin',
+    'tripal_feature_help' => array(
+      'template' => 'tripal_feature_help',
       'variables' =>  array(NULL),
       'path' => drupal_get_path('module', 'tripal_feature') . '/theme'
     ),
-    
+
     // themed forms
     'tripal_feature_seq_extract_form' => array(
        'arguments' => array('form'),
@@ -396,11 +417,11 @@ function tripal_feature_block_info() {
  * @ingroup tripal_feature
  */
 function tripal_feature_block_view($delta = '') {
-  
+
   if (user_access('access chado_feature content') and arg(0) == 'node' and is_numeric(arg(1))) {
     $nid = arg(1);
     $node = node_load($nid);
-  
+
     $block = array();
     switch ($delta) {
       case 'references':
@@ -513,24 +534,24 @@ function chado_feature_insert($node) {
     'type_id' => $type[0]->cvterm_id,
   );
   $feature = tripal_core_chado_select('feature', array('feature_id'), $values);
-    
+
   // add the genbank accession and synonyms
   chado_feature_add_synonyms($node->synonyms, $feature[0]->feature_id);
 
   // make sure the entry for this feature doesn't already exist in the chado_feature table
   // if it doesn't exist then we want to add it.
   $node_check_sql = "
-    SELECT * FROM {chado_feature} 
+    SELECT * FROM {chado_feature}
     WHERE feature_id = :feature_id
   ";
   $node_check = db_query($node_check_sql, array(':feature_id' => $feature[0]->feature_id))->fetchObject();
   if (!$node_check) {
     // next add the item to the drupal table
     $sql = "
-      INSERT INTO {chado_feature} (nid, vid, feature_id, sync_date) 
+      INSERT INTO {chado_feature} (nid, vid, feature_id, sync_date)
       VALUES (:nid, :vid, :feature_id, :time)
     ";
-    db_query($sql, array(':nid' => $node->nid, ':vid' => $node->vid, 
+    db_query($sql, array(':nid' => $node->nid, ':vid' => $node->vid,
       ':feature_id' => $feature[0]->feature_id, ':time' => REQUEST_TIME));
   }
 }
@@ -579,7 +600,7 @@ function chado_feature_update($node) {
     );
     $options = array('return_record' => TRUE);
     $status = tripal_core_chado_update('feature', $match, $values, $options);
-    
+
     // add the genbank synonyms
     chado_feature_add_synonyms($node->synonyms, $feature_id);
   }
@@ -591,7 +612,7 @@ function chado_feature_update($node) {
     WATCHDOG_WARNING
     );
   }
-  
+
 
 }
 /**
@@ -664,11 +685,11 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
     $synonym = chado_query($synonym_sql, array(':name' => $syn))->fetchObject();
     if (!$synonym) {
       $synonym_isql = "
-        INSERT INTO {synonym} (name, synonym_sgml, type_id) 
-        VALUES (:name, :synonym_sgml, 
-          (SELECT cvterm_id 
-           FROM {CVTerm} CVT 
-             INNER JOIN CV ON CVT.cv_id = CV.cv_id 
+        INSERT INTO {synonym} (name, synonym_sgml, type_id)
+        VALUES (:name, :synonym_sgml,
+          (SELECT cvterm_id
+           FROM {CVTerm} CVT
+             INNER JOIN CV ON CVT.cv_id = CV.cv_id
            WHERE CV.name = 'feature_property' and CVT.name = 'synonym')
           )
       ";
@@ -682,7 +703,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
 
     // now add in our new sysnonym
     $feature_syn_isql = "
-      INSERT INTO {feature_synonym} (synonym_id,feature_id,pub_id) 
+      INSERT INTO {feature_synonym} (synonym_id,feature_id,pub_id)
       VALUES (:synonym_id, :feature_id, :pub_id)";
     $args = array(':synonym_id' => $synonym->synonym_id, ':feature_id' => $feature_id, ':pub_id'=> 1);
     if (!chado_query($feature_syn_isql, $args)) {
@@ -705,12 +726,12 @@ function chado_feature_add_gbaccession($accession, $feature_id) {
 
   // remove any old accession from genbank dbEST
   $fdbxref_dsql = "
-    DELETE FROM {feature_dbxref} 
-    WHERE feature_id = :feature_id and dbxref_id IN 
-      (SELECT DBX.dbxref_id 
-       FROM {dbxref} DBX 
-         INNER JOIN DB  ON DB.db_id = DBX.db_id 
-         INNER JOIN feature_dbxref FDBX ON DBX.dbxref_id = FDBX.dbxref_id 
+    DELETE FROM {feature_dbxref}
+    WHERE feature_id = :feature_id and dbxref_id IN
+      (SELECT DBX.dbxref_id
+       FROM {dbxref} DBX
+         INNER JOIN DB  ON DB.db_id = DBX.db_id
+         INNER JOIN feature_dbxref FDBX ON DBX.dbxref_id = FDBX.dbxref_id
        WHERE DB.name = 'DB:Genbank' and FDBX.feature_id = :feature_id
       )
   ";
@@ -843,8 +864,8 @@ function chado_feature_form($node, $param) {
 
   // get the sequence ontology CV ID
   $values = array('name' => 'sequence');
-  $cv = tripal_core_chado_select('cv', array('cv_id'), $values); 
-  $cv_id = $cv[0]->cv_id; 
+  $cv = tripal_core_chado_select('cv', array('cv_id'), $values);
+  $cv_id = $cv[0]->cv_id;
 
   $form['feature_type'] = array(
    '#title'       => t('Feature Type'),
@@ -919,7 +940,7 @@ function chado_feature_form($node, $param) {
  */
 function chado_feature_validate($node) {
   $result = 0;
-  
+
   // make sure the feature type is a real sequence ontology term
   $type = tripal_cv_get_cvterm_by_name($node->feature_type, NULL, 'sequence');
   if (!$type) {
@@ -934,13 +955,13 @@ function chado_feature_validate($node) {
       SELECT *
       FROM {feature} F
         INNER JOIN {cvterm} CVT ON F.type_id = CVT.cvterm_id
-      WHERE 
-        F.uniquename     = :uname AND 
-        F.organism_id    = :orgnism_id AND 
-        CVT.name         = :cvtname AND 
+      WHERE
+        F.uniquename     = :uname AND
+        F.organism_id    = :orgnism_id AND
+        CVT.name         = :cvtname AND
         NOT f.feature_id = :feature_id
     ";
-    $args = array(':uname' => $node->uniquename, ':organism_id' => $node->organism_id, 
+    $args = array(':uname' => $node->uniquename, ':organism_id' => $node->organism_id,
       ':cvtname' => $node->feature_type, ':feature_id' => $node->feature_id);
     $result = chado_query($sql, $args)->fetchObject();
     if ($result) {
@@ -955,9 +976,9 @@ function chado_feature_validate($node) {
       SELECT *
       FROM {feature} F
         INNER JOIN {cvterm} CVT ON F.type_id = CVT.cvterm_id
-      WHERE 
-        F.uniquename  = :name AND 
-        F.organism_id = :organism_id AND 
+      WHERE
+        F.uniquename  = :name AND
+        F.organism_id = :organism_id AND
         CVT.name      = :cvtname
     ";
     $args = array(':name' => $node->uniquename, ':organism_id' => $node->organism_id, ':cvtname' => $node->feature_type);
@@ -994,10 +1015,10 @@ function chado_feature_load($node) {
     if (strcmp($feature->name, $feature->uniquename)==0) {
       $node->title = $feature->name . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
     }
-    // in previous version of Tripal, the feature title was simply the unique name. 
+    // in previous version of Tripal, the feature title was simply the unique name.
     // so, we recreate the title just to be sure all of our feature pages are consistent
     else {
-      $node->title = $feature->name . ", " . $feature->uniquename . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;  
+      $node->title = $feature->name . ", " . $feature->uniquename . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
     }
   }
   // set the title to be the feature name or uniquename as configured
@@ -1005,7 +1026,7 @@ function chado_feature_load($node) {
     $node->title = $feature->name;
   }
   if ($title_type == 'feature_unique_name') {
-    $node->title = $feature->uniquename;  
+    $node->title = $feature->uniquename;
   }
 
   $additions = new stdClass();
@@ -1031,11 +1052,11 @@ function tripal_feature_load_organism($organism_id) {
 function tripal_feature_load_synonyms($feature_id) {
 
   $sql = "
-    SELECT S.name 
-    FROM {feature_synonym} FS 
-      INNER JOIN {synonym} S  ON FS.synonym_id = S.Synonym_id 
+    SELECT S.name
+    FROM {feature_synonym} FS
+      INNER JOIN {synonym} S  ON FS.synonym_id = S.Synonym_id
     WHERE FS.feature_id = :feature_id
-    ORDER BY S.name 
+    ORDER BY S.name
    ";
   $results = chado_query($sql, array(':feature_id' => $feature_id));
   $synonyms = array();
@@ -1053,16 +1074,16 @@ function tripal_feature_load_synonyms($feature_id) {
 function tripal_feature_load_properties($feature_id) {
 
   $sql = "
-    SELECT 
-      CVT.name as cvname, CVT.definition, CVT.is_obsolete, 
-      FS.type_id, FS.value, FS.rank,      
+    SELECT
+      CVT.name as cvname, CVT.definition, CVT.is_obsolete,
+      FS.type_id, FS.value, FS.rank,
       DBX.dbxref_id,DBX.accession,DB.name as dbname,
       DB.urlprefix, DB.description as db_description, DB.url
     FROM {featureprop} FS
       INNER JOIN {cvterm} CVT ON FS.type_id    = CVT.cvterm_id
       INNER JOIN {dbxref} DBX ON CVT.dbxref_id = DBX.dbxref_id
       INNER JOIN {db} DB      ON DB.db_id      = DBX.db_id
-    WHERE 
+    WHERE
       FS.feature_id = :feature_id
     ORDER BY FS.rank ASC
   ";
@@ -1082,17 +1103,17 @@ function tripal_feature_load_properties($feature_id) {
 function tripal_feature_load_references($feature_id) {
 
   $sql = "
-    SELECT 
+    SELECT
        F.uniquename, F.Feature_id,
        DB.description as dbdesc, DB.db_id, DB.name as db_name, DB.urlprefix,
-       DBX.accession, DBX.dbxref_id 
-    FROM {feature} F 
-      INNER JOIN {feature_dbxref} FDBX ON F.feature_id  = FDBX.feature_id 
-      INNER JOIN {dbxref} DBX          ON DBX.dbxref_id = FDBX.dbxref_id 
-      INNER JOIN {db}                  ON DB.db_id      = DBX.db_id 
-    WHERE 
+       DBX.accession, DBX.dbxref_id
+    FROM {feature} F
+      INNER JOIN {feature_dbxref} FDBX ON F.feature_id  = FDBX.feature_id
+      INNER JOIN {dbxref} DBX          ON DBX.dbxref_id = FDBX.dbxref_id
+      INNER JOIN {db}                  ON DB.db_id      = DBX.db_id
+    WHERE
       F.feature_id = :feature_id
-    ORDER BY DB.name 
+    ORDER BY DB.name
   ";
   $results = chado_query($sql, array(':feature_id' => $feature_id));
   $references = array();
@@ -1128,7 +1149,7 @@ function tripal_feature_load_featurelocs($feature_id, $side = 'as_parent', $aggr
   if (strcmp($side, 'as_child')==0) {
     $sql .= "WHERE FL.feature_id = :feature_id ";
   }
-  
+
   $flresults = chado_query($sql, array(':feature_id' => $feature_id));
 
   // copy the results into an array
@@ -1187,7 +1208,7 @@ function tripal_feature_load_relationships($feature_id, $side = 'as_subject') {
       FR.subject_id, FR.type_id as relationship_type_id, FR.object_id, FR.rank,
       CVT.name as rel_type,
       FO.name as object_name, FO.uniquename as object_uniquename,
-      CVTO.name as object_type, CVTO.cvterm_id as object_type_id      
+      CVTO.name as object_type, CVTO.cvterm_id as object_type_id
     FROM {feature_relationship} FR
      INNER JOIN {cvterm} CVT  ON FR.type_id    = CVT.cvterm_id
      INNER JOIN {feature} FS  ON FS.feature_id = FR.subject_id
@@ -1300,8 +1321,8 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
   // location and then annotate it with the parts found from the relationships
   // locations determiend above.
   $sql = "
-    SELECT substring(residues from :start for :size) as residues 
-    FROM {feature} 
+    SELECT substring(residues from :start for :size) as residues
+    FROM {feature}
     WHERE feature_id = :feature_id
   ";
   $floc_sequences = array();
@@ -1397,37 +1418,37 @@ function tripal_feature_get_matched_alignments($feature) {
   // match, or %_match
   //
    $sql = "
-     SELECT  
-       FL1.featureloc_id    as left_featureloc_id, 
-       FL1.srcfeature_id    as left_srcfeature_id, 
-       FL1.feature_id       as left_feature_id, 
-       FL1.fmin             as left_fmin, 
-       FL1.is_fmin_partial  as left_is_fmin_partial, 
-       FL1.fmax             as left_fmax, 
-       FL1.is_fmax_partial  as left_is_fmax_partial, 
-       FL1.strand           as left_strand,  
-       FL1.phase            as left_phase, 
-       FL1.locgroup         as left_locgroup, 
-       FL1.rank             as left_rank, 
-       FL2.featureloc_id    as right_featureloc_id, 
-       FL2.srcfeature_id    as right_srcfeature_id, 
-       FL2.feature_id       as right_feature_id, 
-       FL2.fmin             as right_fmin, 
-       FL2.is_fmin_partial  as right_is_fmin_partial, 
-       FL2.fmax             as right_fmax, 
-       FL2.is_fmax_partial  as right_is_fmax_partial, 
-       FL2.strand           as right_strand,  
-       FL2.phase            as right_phase, 
-       FL2.locgroup         as right_locgroup, 
-       FL2.rank             as right_rank 
-     FROM {feature} F1 
-       INNER JOIN {featureloc} FL1 on FL1.srcfeature_id = F1.feature_id 
-       INNER JOIN {feature} F2 on FL1.feature_id = F2.feature_id 
-       INNER JOIN {featureloc} FL2 on FL2.feature_id = F2.feature_id 
-       INNER JOIN {cvterm} CVT2 on F2.type_id = CVT2.cvterm_id 
-     WHERE 
-       F1.feature_id = :feature_id  AND 
-       (CVT2.name = 'match' or CVT2.name like '%_match') 
+     SELECT
+       FL1.featureloc_id    as left_featureloc_id,
+       FL1.srcfeature_id    as left_srcfeature_id,
+       FL1.feature_id       as left_feature_id,
+       FL1.fmin             as left_fmin,
+       FL1.is_fmin_partial  as left_is_fmin_partial,
+       FL1.fmax             as left_fmax,
+       FL1.is_fmax_partial  as left_is_fmax_partial,
+       FL1.strand           as left_strand,
+       FL1.phase            as left_phase,
+       FL1.locgroup         as left_locgroup,
+       FL1.rank             as left_rank,
+       FL2.featureloc_id    as right_featureloc_id,
+       FL2.srcfeature_id    as right_srcfeature_id,
+       FL2.feature_id       as right_feature_id,
+       FL2.fmin             as right_fmin,
+       FL2.is_fmin_partial  as right_is_fmin_partial,
+       FL2.fmax             as right_fmax,
+       FL2.is_fmax_partial  as right_is_fmax_partial,
+       FL2.strand           as right_strand,
+       FL2.phase            as right_phase,
+       FL2.locgroup         as right_locgroup,
+       FL2.rank             as right_rank
+     FROM {feature} F1
+       INNER JOIN {featureloc} FL1 on FL1.srcfeature_id = F1.feature_id
+       INNER JOIN {feature} F2 on FL1.feature_id = F2.feature_id
+       INNER JOIN {featureloc} FL2 on FL2.feature_id = F2.feature_id
+       INNER JOIN {cvterm} CVT2 on F2.type_id = CVT2.cvterm_id
+     WHERE
+       F1.feature_id = :feature_id  AND
+       (CVT2.name = 'match' or CVT2.name like '%_match')
      ORDER BY FL1.fmin
    ";
 
@@ -1610,24 +1631,24 @@ function tripal_feature_load_library_feature_browser($library) {
 
   // get the features for this library
   $sql  = "
-    SELECT F.name, F.feature_id, F.uniquename, CVT.name as cvname 
-    FROM {feature} F 
-      INNER JOIN {cvterm} CVT         ON F.type_id = CVT.cvterm_id 
-      INNER JOIN {library_feature} LF ON F.feature_id = LF.feature_id 
-      INNER JOIN {library} L          ON LF.library_id = L.library_id 
-    WHERE LF.library_id = :library_id and ($where_cvt) 
+    SELECT F.name, F.feature_id, F.uniquename, CVT.name as cvname
+    FROM {feature} F
+      INNER JOIN {cvterm} CVT         ON F.type_id = CVT.cvterm_id
+      INNER JOIN {library_feature} LF ON F.feature_id = LF.feature_id
+      INNER JOIN {library} L          ON LF.library_id = L.library_id
+    WHERE LF.library_id = :library_id and ($where_cvt)
     ORDER BY feature_id ASC
   ";
   $args[':library_id'] = $library->libary_id;
-  
+
   // the counting SQL
   $csql  = "
-    SELECT count(*) 
+    SELECT count(*)
     FROM {feature} F
-      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id 
-      INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id 
-      INNER JOIN {library} L on LF.library_id = L.library_id 
-    WHERE LF.library_id = :library_id and ($where_cvt) 
+      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
+      INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id
+      INNER JOIN {library} L on LF.library_id = L.library_id
+    WHERE LF.library_id = :library_id and ($where_cvt)
       GROUP BY L.library_id ";
 
   $org_features = chado_pager_query($sql, 10, 0, $csql, $args);
@@ -1677,25 +1698,25 @@ function tripal_feature_load_analysis_feature_browser($analysis) {
 
   // get the features for this library
   $sql  = "
-    SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname 
-    FROM {feature} F 
-      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id 
-      INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id 
-      INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id 
-    WHERE A.analysis_id = :analysis_id and ($where_cvt) 
+    SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname
+    FROM {feature} F
+      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
+      INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id
+      INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id
+    WHERE A.analysis_id = :analysis_id and ($where_cvt)
     ORDER BY feature_id ASC
   ";
   $args[':analysis_id'] = $analysis->analysis_id;
 
   // the counting SQL
   $csql  = "
-    SELECT count(*) 
+    SELECT count(*)
     FROM {feature} F
-      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id 
-      INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id 
-      INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id 
-    WHERE A.analysis_id = %d and ($where_cvt) 
-    GROUP BY A.analysis_id 
+      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
+      INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id
+      INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id
+    WHERE A.analysis_id = %d and ($where_cvt)
+    GROUP BY A.analysis_id
   ";
 
   $org_features = chado_pager_query($sql, 10, 0, $csql, $args);
@@ -1845,11 +1866,11 @@ function tripal_feature_color_sequence($sequence, $parts, $defline) {
  * @ingroup tripal_feature
  */
 function tripal_feature_node_presave($node) {
-  
+
   // set the title to ensure it is always unique
   switch ($node->type) {
     case 'chado_feature':
-      
+
       $values = array('organism_id' => $node->organism_id);
       $organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
       $node->title = $node->fname . ', ' . $node->uniquename . ' (' . $node->feature_type . ') ' . $organism[0]->genus . ' ' . $organism[0]->species;
@@ -1862,9 +1883,9 @@ function tripal_feature_node_presave($node) {
  * @ingroup tripal_feature
  */
 function tripal_feature_node_insert($node) {
-  
-  // set the URL path after inserting.  We do it here because we do not 
-  // know the feature_id in the presave 
+
+  // set the URL path after inserting.  We do it here because we do not
+  // know the feature_id in the presave
   switch ($node->type) {
     case 'chado_feature':
       if (!$node->feature_id) {
@@ -1872,10 +1893,10 @@ function tripal_feature_node_insert($node) {
         $chado_feature = db_query($sql, array(':nid' => $node->nid))->fetchObject();
         $node->feature_id = $chado_feature->feature_id;
       }
-      
+
       // remove any previous alias
       db_query("DELETE FROM {url_alias} WHERE src = :src", array(':src' => "node/$node->nid"));
-      
+
       // set the URL for this feature page
       $url_alias = tripal_feature_get_feature_url($node);
       path_set_alias("node/$node->nid", $url_alias);
@@ -1912,14 +1933,14 @@ function tripal_feature_node_view($node, $view_mode, $langcode) {
  *
  * @ingroup tripal_feature
  */
-function tripal_feature_node_update($node) { 
-  
+function tripal_feature_node_update($node) {
+
   // add items to other nodes, build index and search results
   switch ($node->type) {
     case 'chado_feature':
       // remove any previous alias
       db_query("DELETE FROM {url_alias} WHERE src = :src", array(':src' => "node/$node->nid"));
-      
+
       // set the URL for this feature page
       $url_alias = tripal_feature_get_feature_url($node);
       path_set_alias("node/$node->nid", $url_alias);
@@ -2317,15 +2338,15 @@ function tripal_feature_coder_ignore() {
  * features is shown.
  */
 function tripal_feature_match_features_page($id) {
-  
+
   // if the URL alias configuration is set such that the URL
   // always begins with 'feature' then we want to use the ID as it is and
   // forward it on. Otherwise, try to find the matching feature.
-  $url_alias = variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]'); 
+  $url_alias = variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]');
   if (!$url_alias) {
     $url_alias = '/feature/[genus]/[species]/[type]/[uniquename]';
-  } 
-  $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash  
+  }
+  $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash
   if (preg_match('/^feature\//', $url_alias)) {
     drupal_goto($id);
   }
@@ -2390,16 +2411,16 @@ function tripal_feature_match_features_page($id) {
 }
 
 /**
- * 
+ *
  * @param unknown_type $form
  * @param unknown_type $form_state
  * @param unknown_type $form_id
  */
 function tripal_feature_form_alter(&$form, &$form_state, $form_id) {
-  if ($form_id == "tripal_feature_seq_extract_form") {    
+  if ($form_id == "tripal_feature_seq_extract_form") {
     // updating the form through the ahah callback sets the action of
     // the form to the ahah callback URL. We need to set it back
     // to the normal form URL
     $form['#action'] = url("find/sequences");
   }
-} 
+}

+ 256 - 519
tripal_feature/tripal_feature.views_default.inc

@@ -7,543 +7,280 @@
 function tripal_feature_views_default_views() {
   $views = array();
 
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
+  $view = tripal_feature_defaultview_admin_features();
+  $views[$view->name] = $view;
+
+  return $views;
+}
 
-  // Main default view
-  $view = new view;
-  $view->name = 'feature_listing';
-  $view->description = 'A listing of chado sequence features.';
-  $view->tag = 'chado default';
+function tripal_feature_defaultview_admin_features() {
+
+  $view = new view();
+  $view->name = 'tripal_feature_admin_features';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
   $view->base_table = 'feature';
+  $view->human_name = 'Feature Admin';
   $view->core = 0;
-  $view->api_version = '2';
+  $view->api_version = '3.0';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: features_all */
   $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',
-      ),
+  $handler->display->display_options['title'] = 'Sequence Features';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'perm';
+  $handler->display->display_options['access']['perm'] = 'access chado_feature content';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
+  $handler->display->display_options['pager']['options']['offset'] = '0';
+  $handler->display->display_options['pager']['options']['id'] = '0';
+  $handler->display->display_options['pager']['options']['quantity'] = '9';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['grouping'] = '';
+  $handler->display->display_options['style_options']['columns'] = array(
+    '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',
+  );
+  $handler->display->display_options['style_options']['default'] = '-1';
+  $handler->display->display_options['style_options']['info'] = array(
+    'accession' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'accession_link' => array(
+      'sortable' => 1,
+      'separator' => '',
     ),
     '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',
-      ),
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'uniquename' => array(
+      'sortable' => 1,
+      'separator' => '',
     ),
     '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',
+      'sortable' => 1,
+      'separator' => '',
     ),
     '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',
-      ),
+      'sortable' => 1,
+      'separator' => '',
     ),
     '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',
+      'sortable' => 1,
+      'separator' => '',
     ),
     '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.',
+      'sortable' => 1,
+      'separator' => '',
     ),
-  ));
-  $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',
+    'is_analysis' => array(
+      'sortable' => 1,
+      'separator' => '',
     ),
-    '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' => '',
-      ),
+    'nid' => array(
+      'separator' => '',
     ),
-    'default' => '-1',
-  ));
-  $default_handler = $handler;
+  );
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Add/Import';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Feature',
+    'path-1' => 'node/add/tripal-feature',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => 'Import via FASTA file',
+    'path-2' => 'admin/tripal/loaders/fasta_loader',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+    'label-3' => 'Import via GFF3 file',
+    'path-3' => 'admin/tripal/loaders/gff3_load',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+    'label-4' => '',
+    'path-4' => '',
+  );
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area_1']['id'] = 'action_links_area_1';
+  $handler->display->display_options['header']['action_links_area_1']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area_1']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area_1']['label'] = 'Extract';
+  $handler->display->display_options['header']['action_links_area_1']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area_1']['link-1'] = array(
+    'label-1' => 'Retrieve Sequences',
+    'path-1' => 'find/sequences',
+  );
+  $handler->display->display_options['header']['action_links_area_1']['link-2'] = array(
+    'label-2' => '',
+    'path-2' => '',
+  );
+  $handler->display->display_options['header']['action_links_area_1']['link-3'] = array(
+    'label-3' => '',
+    'path-3' => '',
+  );
+  $handler->display->display_options['header']['action_links_area_1']['link-4'] = array(
+    'label-4' => '',
+    'path-4' => '',
+  );
+  /* No results behavior: Global: Text area */
+  $handler->display->display_options['empty']['text']['id'] = 'area';
+  $handler->display->display_options['empty']['text']['table'] = 'views';
+  $handler->display->display_options['empty']['text']['field'] = 'area';
+  $handler->display->display_options['empty']['text']['content'] = 'No features matched the supplied criteria.';
+  $handler->display->display_options['empty']['text']['format'] = '2';
+  /* Relationship: Feature: Feature => Node */
+  $handler->display->display_options['relationships']['feature_id']['id'] = 'feature_id';
+  $handler->display->display_options['relationships']['feature_id']['table'] = 'chado_feature';
+  $handler->display->display_options['relationships']['feature_id']['field'] = 'feature_id';
+  /* Field: Content: Nid */
+  $handler->display->display_options['fields']['nid']['id'] = 'nid';
+  $handler->display->display_options['fields']['nid']['table'] = 'node';
+  $handler->display->display_options['fields']['nid']['field'] = 'nid';
+  $handler->display->display_options['fields']['nid']['relationship'] = 'feature_id';
+  $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
+  /* Field: Chado Feature: Uniquename */
+  $handler->display->display_options['fields']['uniquename']['id'] = 'uniquename';
+  $handler->display->display_options['fields']['uniquename']['table'] = 'feature';
+  $handler->display->display_options['fields']['uniquename']['field'] = 'uniquename';
+  $handler->display->display_options['fields']['uniquename']['label'] = 'Unique Name';
+  $handler->display->display_options['fields']['uniquename']['alter']['path'] = 'node/[nid]';
+  /* Field: Chado Feature: Name */
+  $handler->display->display_options['fields']['name']['id'] = 'name';
+  $handler->display->display_options['fields']['name']['table'] = 'feature';
+  $handler->display->display_options['fields']['name']['field'] = 'name';
+  /* Field: Chado Cvterm: Name */
+  $handler->display->display_options['fields']['name_1']['id'] = 'name_1';
+  $handler->display->display_options['fields']['name_1']['table'] = 'cvterm';
+  $handler->display->display_options['fields']['name_1']['field'] = 'name';
+  $handler->display->display_options['fields']['name_1']['label'] = 'Type';
+  /* Field: Chado Organism: Common Name */
+  $handler->display->display_options['fields']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['fields']['common_name']['table'] = 'organism';
+  $handler->display->display_options['fields']['common_name']['field'] = 'common_name';
+  /* Field: Chado Feature: Seqlen */
+  $handler->display->display_options['fields']['seqlen']['id'] = 'seqlen';
+  $handler->display->display_options['fields']['seqlen']['table'] = 'feature';
+  $handler->display->display_options['fields']['seqlen']['field'] = 'seqlen';
+  $handler->display->display_options['fields']['seqlen']['label'] = 'Sequence Length';
+  /* Field: Chado Feature: Is Obsolete */
+  $handler->display->display_options['fields']['is_obsolete']['id'] = 'is_obsolete';
+  $handler->display->display_options['fields']['is_obsolete']['table'] = 'feature';
+  $handler->display->display_options['fields']['is_obsolete']['field'] = 'is_obsolete';
+  $handler->display->display_options['fields']['is_obsolete']['type'] = 'separator';
+  $handler->display->display_options['fields']['is_obsolete']['not'] = 0;
+  /* Field: Content: Delete link */
+  $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['relationship'] = 'feature_id';
+  $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
+  /* Field: Content: Edit link */
+  $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['relationship'] = 'feature_id';
+  $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['label'] = '';
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node]   [delete_node]';
+  $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
+  /* Sort criterion: Chado Organism: Common Name */
+  $handler->display->display_options['sorts']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['sorts']['common_name']['table'] = 'organism';
+  $handler->display->display_options['sorts']['common_name']['field'] = 'common_name';
+  /* Sort criterion: Chado Cvterm: Name */
+  $handler->display->display_options['sorts']['name']['id'] = 'name';
+  $handler->display->display_options['sorts']['name']['table'] = 'cvterm';
+  $handler->display->display_options['sorts']['name']['field'] = 'name';
+  /* Sort criterion: Chado Feature: Name */
+  $handler->display->display_options['sorts']['name_1']['id'] = 'name_1';
+  $handler->display->display_options['sorts']['name_1']['table'] = 'feature';
+  $handler->display->display_options['sorts']['name_1']['field'] = 'name';
+  /* Filter criterion: Chado Organism: Common Name */
+  $handler->display->display_options['filters']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['table'] = 'organism';
+  $handler->display->display_options['filters']['common_name']['field'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['value'] = array();
+  $handler->display->display_options['filters']['common_name']['group'] = '0';
+  $handler->display->display_options['filters']['common_name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['operator_id'] = 'common_name_op';
+  $handler->display->display_options['filters']['common_name']['expose']['label'] = 'Organism Common Name';
+  $handler->display->display_options['filters']['common_name']['expose']['operator'] = 'common_name_op';
+  $handler->display->display_options['filters']['common_name']['expose']['identifier'] = 'organism';
+  /* Filter criterion: Chado Feature: Type Id */
+  $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['table'] = 'feature';
+  $handler->display->display_options['filters']['type_id']['field'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['value'] = array();
+  $handler->display->display_options['filters']['type_id']['group'] = '0';
+  $handler->display->display_options['filters']['type_id']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['operator_id'] = 'type_id_op';
+  $handler->display->display_options['filters']['type_id']['expose']['label'] = 'Type';
+  $handler->display->display_options['filters']['type_id']['expose']['operator'] = 'type_id_op';
+  $handler->display->display_options['filters']['type_id']['expose']['identifier'] = 'type_id';
+  /* Filter criterion: Chado Feature: Name */
+  $handler->display->display_options['filters']['name_1']['id'] = 'name_1';
+  $handler->display->display_options['filters']['name_1']['table'] = 'feature';
+  $handler->display->display_options['filters']['name_1']['field'] = 'name';
+  $handler->display->display_options['filters']['name_1']['operator'] = '~';
+  $handler->display->display_options['filters']['name_1']['group'] = '0';
+  $handler->display->display_options['filters']['name_1']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['name_1']['expose']['operator_id'] = 'name_1_op';
+  $handler->display->display_options['filters']['name_1']['expose']['label'] = 'Name Contains';
+  $handler->display->display_options['filters']['name_1']['expose']['operator'] = 'name_1_op';
+  $handler->display->display_options['filters']['name_1']['expose']['identifier'] = 'name';
+
+  /** MANUALLY ADD since filter handler no exporting correctly */
+  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+  $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
+
+  /* Display: Page */
   $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->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;
+  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_feature/features';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Features';
+  $handler->display->display_options['menu']['description'] = 'A feature is a biological sequence or a section of a biological sequence, or a collection of such sections.';
+  $handler->display->display_options['menu']['weight'] = '-10';
+  $handler->display->display_options['menu']['context'] = 0;
+  $handler->display->display_options['menu']['context_only_inline'] = 0;
+  $handler->display->display_options['tab_options']['weight'] = '0';
 
-  return $views;
+  /** MANUALLY ADD since filter handler no exporting correctly
+  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+  $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
+  */
+
+  return $view;
 }