瀏覽代碼

Merged 6.x-1469474-views_file_upload_excel

stephen 13 年之前
父節點
當前提交
6908cfff6e
共有 21 個文件被更改,包括 541 次插入23 次删除
  1. 0 0
      base/tripal_core/patches/ahah_helper-submit-1231140-12.patch
  2. 41 0
      base/tripal_core/patches/views_data_export-postgresql-1293788-2.patch
  3. 1 0
      base/tripal_core/tripal_core.info
  4. 6 1
      base/tripal_core/tripal_core.module
  5. 131 4
      base/tripal_core/tripal_core.views.inc
  6. 39 15
      base/tripal_core/tripal_views_integration.inc
  7. 2 2
      base/tripal_core/views/handlers/views_handler_filter_chado_select_string.inc
  8. 115 0
      base/tripal_core/views/handlers/views_handler_filter_file_upload.inc
  9. 1 1
      base/tripal_core/views/handlers/views_handler_join_chado_through_linking.inc
  10. 二進制
      base/tripal_core/views_data_export/images/fasta.png
  11. 56 0
      base/tripal_core/views_data_export/plugins/tripal_core_plugin_style_export_fasta.inc
  12. 56 0
      base/tripal_core/views_data_export/plugins/tripal_core_plugin_style_export_fasta.inc~
  13. 17 0
      base/tripal_core/views_data_export/theme/tripal_core_views_data_export.theme.inc
  14. 17 0
      base/tripal_core/views_data_export/theme/tripal_core_views_data_export.theme.inc~
  15. 19 0
      base/tripal_core/views_data_export/theme/views-data-export-fasta-body.tpl.php
  16. 19 0
      base/tripal_core/views_data_export/theme/views-data-export-fasta-body.tpl.php~
  17. 5 0
      base/tripal_core/views_data_export/theme/views-data-export-fasta-footer.tpl.php
  18. 5 0
      base/tripal_core/views_data_export/theme/views-data-export-fasta-footer.tpl.php~
  19. 5 0
      base/tripal_core/views_data_export/theme/views-data-export-fasta-header.tpl.php
  20. 6 0
      base/tripal_core/views_data_export/theme/views-data-export-fasta-header.tpl.php~
  21. 0 0
      views_exports/feature_for_search.view_export.txt

+ 0 - 0
base/ahah_helper-submit-1231140-12.patch → base/tripal_core/patches/ahah_helper-submit-1231140-12.patch


+ 41 - 0
base/tripal_core/patches/views_data_export-postgresql-1293788-2.patch

@@ -0,0 +1,41 @@
+diff --git a/plugins/views_data_export_plugin_display_export.inc b/plugins/views_data_export_plugin_display_export.inc
+index 3356a8c..bf6761a 100644
+--- a/plugins/views_data_export_plugin_display_export.inc
++++ b/plugins/views_data_export_plugin_display_export.inc
+@@ -544,7 +544,16 @@ class views_data_export_plugin_display_export extends views_plugin_display_feed
+         $select_aliases[] = "cl.$alias AS $hash";
+       }
+ 
+-      $insert_query = 'CREATE TABLE {' . $this->index_tablename() . '} SELECT @row := @row + 1 AS ' . $this->batched_execution_state->sandbox['weight_field_alias'] . ', ' . implode(', ', $select_aliases) . ' FROM (' . $query . ') AS cl, (SELECT @row := 0) AS r';
++      if ($this->_get_database_driver() == 'pgsql') {
++        // Create temporary sequence
++        $seq_name = $this->index_tablename() . '_seq';
++        $create_seq_query = 'CREATE TEMP sequence ' . $seq_name;
++        // query uses sequence to create row number
++        $insert_query = 'CREATE TABLE {' . $this->index_tablename() . "} AS SELECT nextval('".$seq_name."') AS " . $this->batched_execution_state->sandbox['weight_field_alias'] . ', ' . implode(', ', $select_aliases) . ' FROM (' . $query . ') AS cl';
++      }
++      else {
++        $insert_query = 'CREATE TABLE {' . $this->index_tablename() . '} SELECT @row := @row + 1 AS ' . $this->batched_execution_state->sandbox['weight_field_alias'] . ', ' . implode(', ', $select_aliases) . ' FROM (' . $query . ') AS cl, (SELECT @row := 0) AS r';
++      }
+ 
+       // Allow for a view to query an external database.
+       if (isset($view->base_database)) {
+@@ -552,6 +561,9 @@ class views_data_export_plugin_display_export extends views_plugin_display_feed
+         $external = TRUE;
+       }
+ 
++      if ($this->_get_database_driver() == 'pgsql') {
++        db_query($create_seq_query);
++      }
+       db_query($insert_query, $args);
+ 
+       // Now create an index for the weight field, otherwise the queries on the
+@@ -778,7 +790,7 @@ class views_data_export_plugin_display_export extends views_plugin_display_feed
+    */
+   function is_compatible() {
+     $incompatible_drivers = array (
+-      'pgsql',
++      //'pgsql',
+     );
+     $db_driver = $this->_get_database_driver();
+     return !in_array($db_driver, $incompatible_drivers);

+ 1 - 0
base/tripal_core/tripal_core.info

@@ -8,3 +8,4 @@ version = 6.x-0.3.1b
 
 dependencies[] = views
 dependencies[] = ahah_helper
+dependencies[] = views_data_export

+ 6 - 1
base/tripal_core/tripal_core.module

@@ -287,10 +287,14 @@ function tripal_core_theme () {
          'arguments' => array('job_id'=> null),
          'template' => 'tripal_core_job_view',
       ),
-	  'tripal_core_views_integration_form' => array(
+	   'tripal_core_views_integration_form' => array(
          'arguments' => array('form' => NULL),
          'template'  => 'tripal_views_integration_fields_form',
 	   ),
+	   'tripal_core_views_data_export_download_form' => array(
+         'arguments' => array('form' => NULL),
+         'template'  => 'tripal_core_views_data_export_download_form',
+	   ),
    );
 }
 /**
@@ -316,4 +320,5 @@ function tripal_core_load_gff3($gff_file, $organism_id,$analysis_id,$add_only =0
    tripal_feature_load_gff3($gff_file, $organism_id,$analysis_id,$add_only,
       $update, $refresh, $remove, $job);
 }
+ 
 

+ 131 - 4
base/tripal_core/tripal_core.views.inc

@@ -147,6 +147,9 @@ function tripal_core_views_handlers() {
      'chado_views_handler_filter_numeric' => array(
       'parent' => 'views_handler_filter_numeric',
      ),
+     'views_handler_filter_file_upload' => array(
+      'parent' => 'views_handler_filter',
+     ),
      // Sort Handlers
      'chado_views_handler_sort' => array(
       'parent' => 'views_handler_sort'
@@ -417,13 +420,16 @@ function tripal_core_views_data(){
       }
       else {
          $type_prefix = 'Chado Table';
-         // TODO: get the chado table info and populate these variables
-         //  1) $base_table
-         //  2) $base_fields (an array of just the table field names)
+         $base_table = $tvi_row->table_name;
+         $table_desc = module_invoke_all('chado_'.$base_table.'_schema');
+         $fields = $table_desc['fields'];
+         foreach($fields as $column => $attrs){
+            $base_fields[] = $column;
+         }
       }
 
       // Setup the base table info in the data array
-      $data[$base_table]['table']['group'] = t($tvi_row->name);
+      $data[$base_table]['table']['group'] = t("$type_prefix: $tvi_row->name");
       $data[$base_table]['table']['base'] = array(
         'group' => "$type_prefix: $tvi_row->name",
         'title' => "$type_prefix: $tvi_row->name",
@@ -476,6 +482,7 @@ function tripal_core_views_data(){
         }
       }
     }
+//dpm($data);
     return $data;
 }
 /**
@@ -537,3 +544,123 @@ function tripal_core_views_data_alter(&$data) {
     }
     return $data;
 }
+/**
+ * Implementation of hook_views_plugins().
+ */
+function tripal_core_views_plugins() {
+  $tc_path = drupal_get_path('module', 'tripal_core');
+
+  $style_defaults = array(
+    'path' => $tc_path . '/views_data_export/plugins',
+    'parent' => 'views_data_export',
+    'theme' => 'views_data_export',
+    'theme path' => $tc_path . '/views_data_export/theme',
+    'theme file' => 'tripal_core_views_data_export.theme.inc',
+    'uses row plugin' => FALSE,
+    'uses fields' => TRUE,
+    'uses options' => TRUE,
+    'type' => 'data_export',
+  );
+
+  // add FASTA format as a new style for the existing views_export_data Display
+  return array( 
+    'style' => array(   
+      'views_data_export_fasta' => array(
+        'title' => t('FASTA file'),
+        'help' => t('Display results in FASTA format. All fields in results are on the definition line while the feature.residues field must be present .'),
+        'handler' => 'tripal_core_plugin_style_export_fasta',
+        // Views Data Export element that will be used to set additional headers when serving the feed.
+        'export headers' => array('Content-type: text/plain; charset=utf-8'),
+        // Views Data Export element mostly used for creating some additional classes and template names.
+        'export feed type' => 'fasta',
+        'export feed text' => 'FASTA',
+        'export feed file' => '%view.fna',
+        'export feed icon' => $tc_path . '/views_data_export/images/fasta.png',
+        'additional themes' => array(
+          'views_data_export_fasta_header' => 'style',
+          'views_data_export_fasta_body' => 'style',
+          'views_data_export_fasta_footer' => 'style',
+        ),
+        'additional themes base' => 'views_data_export_fasta',
+      ) + $style_defaults,      
+    ),
+  );
+}
+/**
+ * Implementation of hook_views_pre_view().
+ */
+function tripal_core_views_pre_view(&$view,&$display_id,&$args){
+   $form = drupal_get_form('tripal_core_views_data_export_download_form',$view,$display_id,$args);
+   $view->attachment_after = $form;
+}
+/**
+ * 
+ */
+function tripal_core_views_data_export_download_form(&$form_state, $view,$display_id,$args){
+   $form = array();
+   $urls = array();
+
+   // get any export_data_export displays
+   $displays = $view->display;
+   $options = array();
+   $default = '';
+   foreach($displays as $name => $display){
+      if(preg_match("/^views_data_export/",$name)){
+         // set the first item as default
+         if(!$default){
+            $default = $display->id;
+         }
+         // add the data export URL to the URLs array
+         $query = $view->get_exposed_input();
+         $path = $display->display_options['path'];
+         $urls[$display->id]['path'] = $path;
+         $urls[$display->id]['query'] = $query;
+         // add the new item to the options array
+         $options[$display->id] = $display->display_title;
+      }
+   }
+   // only generate the form if we have views_data_export displays attached
+   // to this view
+   if(count($options) > 0){
+
+      $form_state['storage']['urls'] = $urls;
+      $form['#cache'] = TRUE;
+
+      // we want the form to redirect to a new window
+      $form['#attributes']['target'] = "_blank";
+
+      // now build the form elements
+      $form['downloads'] = array(
+        '#type' => 'fieldset',
+        '#title' => 'Download Results',
+        '#collapsible' => TRUE,
+        '#collapsed' => FALSE
+      );
+      $form['downloads']['file_type'] = array(
+         '#title' => t('File format'),
+         '#type' => 'radios',
+         '#options' => $options,
+         '#required' => TRUE,
+         '#default_value' => $default,
+         '#description' => t('Please select a file format to download'),
+      );
+      $form['downloads']['submit'] = array(
+         '#value' => t('Download Results'),
+         '#type' => 'submit',
+      );
+   }
+   
+   return $form;
+}
+/**
+ * 
+ */
+function tripal_core_views_data_export_download_form_submit($form, &$form_state){
+   $urls = $form_state['storage']['urls'];
+   $display_id = $form_state['values']['file_type'];
+   drupal_goto($urls[$display_id]['path'],$urls[$display_id]['query']);
+}
+
+
+
+

+ 39 - 15
base/tripal_core/tripal_views_integration.inc

@@ -82,7 +82,14 @@ function tripal_core_views_integration_setup_list(){
             l('Delete',"admin/tripal/views/integration/delete/".$tview->setup_id),
          );
       } else {
-         // TODO: customize for Chado tables
+         $rows[] = array(
+            l('Edit',"admin/tripal/views/integration/edit/".$tview->setup_id) ,
+            $tview->name, 
+            $tview->table_name, 
+            'No', 
+            $tview->comment,
+            l('Delete',"admin/tripal/views/integration/delete/".$tview->setup_id),
+         );         
       }
    }
    $rows[] = array(
@@ -128,6 +135,7 @@ function tripal_core_views_integration_form(&$form_state, $setup_id = NULL){
       $mview_id = $setup_obj->mview_id;
       $table_name = $setup_obj->table_name;
       $form_state['storage']['mview_id'] = $mview_id;
+      $form_state['storage']['table_name'] = $table_name;
 
       // get the default join settings and handlers
       $sql = "SELECT * FROM {tripal_views_join} WHERE setup_id = %d";
@@ -261,12 +269,20 @@ function tripal_core_views_integration_form(&$form_state, $setup_id = NULL){
 
     // get the columns in this materialized view.  They are separated by commas
     // where the first word is the column name and the rest is the type
+    $columns = array();
     if($mview_id){
        $sql = "SELECT mv_specs FROM {tripal_mviews} WHERE mview_id = %d";
        $mview = db_fetch_object(db_query($sql,$mview_id));
        $columns = explode(",",$mview->mv_specs);
     } else {
-       // TODO: get chado table columns and add them to the $columns array
+       $table_desc = module_invoke_all('chado_'.$table_name.'_schema');
+       $fields = $table_desc['fields'];
+       // iterate through the columns and build the format
+       // compatible with the code below. The column name is first followed
+       // by the type with a separating space
+       foreach($fields as $column => $attrs){
+          $columns[] = "$column ".$attrs['type'];
+       }
     }
 
     $i=1;
@@ -583,24 +599,32 @@ function tripal_core_views_integration_form_submit($form, &$form_state){
        'name' => $name,
        'comment' => $form_state['values']['row_description'],
       );
-      if(!$setup_id){  // this is an insert
-         if(!drupal_write_record('tripal_views', $tripal_views_record)){
-            drupal_set_message("Failed to add record.");
-            return;
-         }
-      } else {  // this is an update
-         $tripal_views_record['setup_id'] = $setup_id;
-         if(!drupal_write_record('tripal_views', $tripal_views_record,array('setup_id'))){
-            drupal_set_message("Failed to update record.");
-            return;
-         }
-      }
    } 
    // if a chado table then...
    if($table_name){
-      // TODO: add code to update tables for Chado table
+            // build the record for insert/update
+      $tripal_views_record = array(
+       'table_name' => $table_name,
+       'name' => $name,
+       'comment' => $form_state['values']['row_description'],
+      );
    }
 
+   // perform the insert or update
+   if(!$setup_id){  // this is an insert
+      if(!drupal_write_record('tripal_views', $tripal_views_record)){
+         drupal_set_message("Failed to add record.");
+         return;
+      }
+   } else {  // this is an update
+      $tripal_views_record['setup_id'] = $setup_id;
+      if(!drupal_write_record('tripal_views', $tripal_views_record,array('setup_id'))){
+         drupal_set_message("Failed to update record.");
+         return;
+      }
+   }
+   
+
    
    // if this is an update then clean out the existing joins and handlers so we can add new ones
    if($setup_id){  

+ 2 - 2
base/tripal_core/views/handlers/views_handler_filter_chado_select_string.inc

@@ -125,7 +125,7 @@ class views_handler_filter_chado_select_string extends views_handler_filter_stri
     $this->ensure_my_table();
     $field = "$this->table_alias.$this->real_field";
     $upper = $this->case_transform();
-      
+
     if ($this->options['multiple']) {
       // Remove any if it's there
       unset($this->value['All']);
@@ -155,4 +155,4 @@ class views_handler_filter_chado_select_string extends views_handler_filter_stri
       }
     }
   }
-}
+}

+ 115 - 0
base/tripal_core/views/handlers/views_handler_filter_file_upload.inc

@@ -0,0 +1,115 @@
+<?php
+
+require_once "/var/www/sites/all/modules/views/handlers/views_handler_filter_string.inc";
+/**
+ * Purpose: This Handler provides a file upload field.
+ *
+ * @ingroup views_filter_handlers
+ * @ingroup tripal_core
+ */
+class views_handler_filter_file_upload extends views_handler_filter {
+
+  function init(&$view,$options){
+     parent::init($view,$options);
+
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+  }
+  
+  /**
+  * Defines the value field in both the views filter options form
+  *   and the exposed form
+  */
+  function value_form(&$form, &$form_state) {
+    parent::value_form($form, $form_state);
+    
+    // we'll provide a single text area for this field.
+    // in the exposed_form function we'll add in the file upload button
+    $form['value'] = array(
+       '#type' => 'textarea',
+       '#title' => $this->options['expose']['label'],
+       '#default_value' => $this->value,
+       '#multiple' => FALSE,
+       '#description' => t('Provide search values for ' . $this->options['expose']['label'] . 
+         '. Please place each search item on a separate line or separated by commas.'),
+    ); 
+  }
+
+  /** 
+   *  Validates the input form
+   */
+  function exposed_validate(&$form, &$form_state) {
+    //dpm($form_state);
+
+  }
+  /**
+  * Ensures the select list gets rendered when the filter is exposed
+  */
+  function exposed_form(&$form, &$form_state) {
+
+    if (empty($this->options['exposed'])) {
+      return;
+    }
+
+    // rebuild the form elements 
+    $value = $this->options['expose']['identifier'];
+    $this->value_form($form, $form_state);
+    $form[$value] = $form['value'];
+    unset($form[$value]['#title']);
+    $form[$this->options['field'] . '_upload'] = array(
+      '#type' => 'file',
+      '#title' => '',
+      '#description' => t('Upload a file to provide search values for ' . $this->options['expose']['label'] . 
+         '. Please place each search item on a separate line.'),
+    );
+    $form['#attributes']['enctype'] = 'multipart/form-data';
+    $form['#method'] = 'POST';
+    $this->exposed_translate($form[$value], 'value');
+  }
+
+ /**
+  *
+  */
+  function query() {
+     $field = "$this->table.$this->real_field";
+     $holders = array();
+     $values = array();
+
+     // get the file upload info if one has been provided
+     $file = file_save_upload($this->field.'_upload',array());
+     if($file){
+        $fh = fopen($file->filepath,'r');
+
+        while($line = fgets($fh)){
+          $line = trim($line);
+          $values[] = $line;
+        }
+     } 
+     // if a file upload has not been provided then use the value in the textarea
+     else {
+        $items = $this->value[0];
+        $items = preg_replace("/\s+,/",",",$items);
+        $items = preg_replace("/\s+\n/","\n",$items);
+        $items = preg_replace("/,\n/","\n",$items);
+        $values = preg_split("/[\n,]+/",$items);
+
+     }
+     for($i = 0 ; $i < count($values); $i++){
+        $values[$i] = trim($values[$i]);
+        if (preg_match('/^[\d\.]+$/',$values[$i])) {
+           $holders[] = '%d';
+        } else {
+           $holders[] = "'%s'";
+        }
+     }
+     // if we have any values supplied then update the where clause for
+     // the views query
+     if(count($holders) > 0){
+        $where = "$field IN (".implode(", ",$holders).")";
+        $this->query->add_where($this->options['group'], $where, $values);
+     }
+  }
+}

+ 1 - 1
base/tripal_core/views/handlers/views_handler_join_chado_through_linking.inc

@@ -112,4 +112,4 @@ class views_handler_join_chado_through_linking extends views_join {
     return $output;
   }
  
-}
+}

二進制
base/tripal_core/views_data_export/images/fasta.png


+ 56 - 0
base/tripal_core/views_data_export/plugins/tripal_core_plugin_style_export_fasta.inc

@@ -0,0 +1,56 @@
+<?php
+/**
+ * @file
+ * Plugin include file for export style plugin.
+ */
+
+/**
+ * Generalized style plugin for export plugins.
+ *
+ * @ingroup views_style_plugins
+ */
+class tripal_core_plugin_style_export_fasta extends views_data_export_plugin_style_export {
+
+  /**
+   * Set options fields and default values.
+   *
+   * @return
+   * An array of options information.
+   */
+  function option_definition() {
+    $options = parent::option_definition();
+
+  
+    return $options;
+  }
+
+  /**
+   * Options form mini callback.
+   *
+   * @param $form
+   * Form array to add additional fields to.
+   * @param $form_state
+   * State of the form.
+   * @return
+   * None.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['defline_fields'] = array(
+      '#prefix' => '<div><div id="edit-options-newline-replacement">',
+      '#suffix' => '</div></div>',
+      '#type' => 'textfield',
+      '#title' => t('Defenition line fields'),
+      '#default_value' => $this->options['defline_fields'],
+      '#description' => t("This field controls the information present in the definition ".
+         "line for each sequence. Any of the fields in the view can be used in the ".
+         "definition line.  To discover these fields, add the feature residues as the ".
+         "last field in the view.  Then edit the field and click the checkbox \"Rewrite ".
+         "the output of this field\".  In the replacement patterns section are the ".
+         "field replacement tokens that can be used in this field. You may include any ".
+         "additional text to separte or qualify these fields.  Only fields that have not ".
+         "been excluded from the display will appear."),
+    );
+  }
+}

+ 56 - 0
base/tripal_core/views_data_export/plugins/tripal_core_plugin_style_export_fasta.inc~

@@ -0,0 +1,56 @@
+<?php
+/**
+ * @file
+ * Plugin include file for export style plugin.
+ */
+
+/**
+ * Generalized style plugin for export plugins.
+ *
+ * @ingroup views_style_plugins
+ */
+class tripal_core_plugin_style_export_fasta extends views_data_export_plugin_style_export {
+
+  /**
+   * Set options fields and default values.
+   *
+   * @return
+   * An array of options information.
+   */
+  function option_definition() {
+    $options = parent::option_definition();
+
+  
+    return $options;
+  }
+
+  /**
+   * Options form mini callback.
+   *
+   * @param $form
+   * Form array to add additional fields to.
+   * @param $form_state
+   * State of the form.
+   * @return
+   * None.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['defline_fields'] = array(
+      '#prefix' => '<div><div id="edit-options-newline-replacement">',
+      '#suffix' => '</div></div>',
+      '#type' => 'textfield',
+      '#title' => t('Defenition line fields'),
+      '#default_value' => $this->options['defline_fields'],
+      '#description' => t("This field controls the information present in the definition ".
+         "line for each sequence. Any of the fields in the view can be used in the ".
+         "definition line.  To discover these fields, add the feature residues as the ".
+         "last field in the view.  Then edit the field and click the checkbox \"Rewrite ".
+         "the output of this field\".  In the replacement patterns section are the ".
+         "field replacement tokens that can be used in this field. You may include any ".
+         "additional text to separte or qualify these fields.  Only fields that have not ".
+         "been excluded from the display will appear"),
+    );
+  }
+}

+ 17 - 0
base/tripal_core/views_data_export/theme/tripal_core_views_data_export.theme.inc

@@ -0,0 +1,17 @@
+<?php
+
+function template_preprocess_views_data_export_fasta_body(&$vars) {
+   _views_data_export_header_shared_preprocess($vars);
+   _views_data_export_body_shared_preprocess($vars);
+   $defline_tpl = $vars['options']['defline_fields'];
+
+   // iterate through the rows and replace the field tokens with values
+   // to generate the definition line
+   foreach ($vars['themed_rows'] as $i => $fields) {
+      $defline = $defline_tpl;
+      foreach ($fields as $key => $value) {
+         $defline = preg_replace("/\[$key\]/",$value,$defline);
+      }
+      $vars['themed_rows'][$i]['defline'] = $defline;
+   }
+}

+ 17 - 0
base/tripal_core/views_data_export/theme/tripal_core_views_data_export.theme.inc~

@@ -0,0 +1,17 @@
+<?php
+
+function template_preprocess_views_data_export_fasta_body(&$vars) {
+   _views_data_export_header_shared_preprocess($vars);
+   _views_data_export_body_shared_preprocess($vars);
+   $defline_tpl = $vars['options']['defline_fields'];
+
+   // iterate through the rows and replace the field tokens with values
+   // to generate the definition line
+   foreach ($vars['themed_rows'] as $i => $fields) {
+      $defline = $defline_tpl;
+      foreach ($fields as $key => $value) {
+         $defline = preg_replace("/\[$key\]/",$value,$defline);
+      }
+      $vars['themed_rows'][$i]['defline'] = $defline;
+   }
+}

+ 19 - 0
base/tripal_core/views_data_export/theme/views-data-export-fasta-body.tpl.php

@@ -0,0 +1,19 @@
+<?php
+//print_r($themed_rows);
+print $defline;
+foreach ($themed_rows as $index => $fields){
+   $defline = array();
+   $residues = '';
+   foreach ($fields as $key => $value){
+     if(strcmp($key,'residues')==0){
+        $residues = wordwrap($value, 60, "\r\n", true);
+     } 
+     if(strcmp($key,'defline')==0){
+        $defline = $value;
+     }
+   }
+   print ">$defline\r\n";
+   print "$residues\r\n";
+}
+
+

+ 19 - 0
base/tripal_core/views_data_export/theme/views-data-export-fasta-body.tpl.php~

@@ -0,0 +1,19 @@
+<?php
+//print_r($themed_rows);
+print $defline;
+foreach ($themed_rows as $index => $fields){
+   $defline = array();
+   $residues = '';
+   foreach ($fields as $key => $value){
+     if(strcmp($key,'residues')==0){
+        $residues = wordwrap($value, 60, "\r\n", true);
+     } 
+     if($strcmp($key,'defline')==0){
+        $defline = $value;
+     }
+   }
+   print ">$defline\r\n";
+   print "$residues\r\n";
+}
+
+

+ 5 - 0
base/tripal_core/views_data_export/theme/views-data-export-fasta-footer.tpl.php

@@ -0,0 +1,5 @@
+<?php
+
+/**
+ * FASTA files don't have a footer.
+ */

+ 5 - 0
base/tripal_core/views_data_export/theme/views-data-export-fasta-footer.tpl.php~

@@ -0,0 +1,5 @@
+<?php
+
+/**
+ * CSV files don't really have a footer.
+ */

+ 5 - 0
base/tripal_core/views_data_export/theme/views-data-export-fasta-header.tpl.php

@@ -0,0 +1,5 @@
+<?php
+
+/**
+ * FASTA files don't have a header.
+ */

+ 6 - 0
base/tripal_core/views_data_export/theme/views-data-export-fasta-header.tpl.php~

@@ -0,0 +1,6 @@
+<?php
+
+// Print out header row, if option was selected.
+if ($options['header']) {
+  print implode($separator, $header) . "\r\n";
+}

File diff suppressed because it is too large
+ 0 - 0
views_exports/feature_for_search.view_export.txt


Some files were not shown because too many files changed in this diff