Pārlūkot izejas kodu

Merge branch '7.x-3.x' into 926-tv3-GFF_ontology_import

Stephen Ficklin 5 gadi atpakaļ
vecāks
revīzija
898be665f8

+ 1 - 0
docs/user_guide.rst

@@ -15,6 +15,7 @@ User's Guide
    user_guide/example_genomics
    user_guide/file_management
    user_guide/mviews
+   user_guide/custom_tables
    user_guide/searching
    user_guide/job_management
    user_guide/web_services

BIN
docs/user_guide/custom_tables.1.png


BIN
docs/user_guide/custom_tables.2.png


+ 27 - 0
docs/user_guide/custom_tables.rst

@@ -0,0 +1,27 @@
+Custom Tables
+=============
+
+Chado has a large number of tables that can be used for storing a variety of biological and ancillary data.  All effort should be made to use the existing tables for storing data. However, there are times when the current set of tables is not adequate for storing some data. Tripal allows you to create custom tables in Chado using the Tripal web interface.  The interface for managing custom tables can be found on the **Tripal → Data Storage → Chado -> Custom Tables** page.
+
+.. image:: ./custom_tables.1.png
+
+This page contains a link to add a new custom table (at the top), a search interface to find tables by name, and a listing of existing tables.  You can use this interface to add, edit and remove custom tables.  By default, several custom tables have been created automatically by Tripal modules.  These tables hold data managed by the modules.  Also, tables used as materialized views appear in this list as well. They are identified with the `Is Mview` column.
+
+.. warning::
+
+  You should not remove or edit custom tables that were created programmatically by tripal modules as it may cause problems with the proper function of the modules that created them.
+
+If you need to create a new table you should follow the following procedure.
+
+1.  Plan and design your table. It is best if you follow Chado design style so that your table would easily fit into Chado.
+2.  Reach out to the Chado community on the `Chado mailing list <https://sourceforge.net/projects/gmod/lists/gmod-schema>`_ and ask for advice on your design.
+3.  If you think your new table would benefit others, consider requesting it be added to a future version of Chado by adding an issue in the `Chado GitHub issue queue <https://github.com/gmod/chado/issues>`_.
+4.  Write your table in the `Drupal Schema API <https://www.drupal.org/docs/7/api/schema-api/introduction-to-schema-api>`_ array format.
+5.  Navigate to the  **Tripal → Data Storage → Chado -> Custom Tables** page on your site. Click the `Add Custom Table` link at the top and cut-and-paste the schema array and click the `Add` button.
+
+.. image:: ./custom_tables.2.png
+
+One your table is created, you will want to add data to it.  You can do so without any programming by using the :doc:`./bulk_loader`.  The bulk loader expects that your data is housed in a tab-delimited text file and allows you to map columns from your file to columns in your new custom table. Each row of your file becomes a new record in your table.  
+
+Alternatively, if you can write custom loaders using the Tripal API as described in the 
+:doc:`../dev_guide`

+ 0 - 8
tripal/includes/TripalFields/TripalField.inc

@@ -208,14 +208,6 @@ class TripalField {
     return $this->instance;
   }
 
-  /**
-   * When constructing a pager for use by a field, all pagers must have
-   * a unique ID
-   */
-  protected function getPagerElementID() {
-    return $this->field['id'];
-  }
-
   public function getFieldTerm() {
     return $this->term;
   }

+ 0 - 8
tripal/includes/TripalFields/TripalFieldFormatter.inc

@@ -167,14 +167,6 @@ class TripalFieldFormatter {
 
   }
 
-  /**
-   * When constructing a pager for use by a field, all pagers must have
-   * a unique ID
-   */
-  protected function getPagerElementID() {
-    return $this->field['id'];
-  }
-
   /**
    * Updates a pager generated by theme('pager') for use with AJAX.
    *

+ 2 - 5
tripal/theme/js/tripal.js

@@ -208,18 +208,15 @@
 
 // Used for ajax update of fields by links in a pager.
 function tripal_navigate_field_pager(id, page) {
-  jQuery(document).ajaxStart(function () {
-    jQuery('#' + id + '-spinner').show();
-  }).ajaxComplete(function () {
-    jQuery('#' + id + '-spinner').hide();
-  });
 
+  jQuery('#' + id + '-spinner').show();
   jQuery.ajax({
     type   : 'GET',
     url    : Drupal.settings['basePath'] + 'bio_data/ajax/field_attach/' + id,
     data   : {'page': page},
     success: function (response) {
       jQuery('#' + id + ' .field-items').replaceWith(response['content']);
+      jQuery('#' + id + '-spinner').hide();
     }
   });
 }

+ 1 - 1
tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship_formatter.inc

@@ -119,7 +119,7 @@ class sbo__relationship_formatter extends ChadoFieldFormatter {
     $items_per_page = array_key_exists('items_per_page', $this->instance['settings']) ? $this->instance['settings']['items_per_page'] : 10;
     $total_records = count($rows);
     $total_pages = (int) ($total_records / $items_per_page) + 1;
-    $pelement = 0; //$this->getPagerElementID();
+    $pelement = 0;
     $current_page = pager_default_initialize($total_records, $items_per_page, $pelement);
     $pager = theme('pager', [
       'tags' => [],