瀏覽代碼

Merge branch '7.x-3.x' of https://github.com/tripal/tripal into 7.x-3.x

Lacey Sanderson 9 年之前
父節點
當前提交
d11ff53429
共有 35 個文件被更改,包括 306 次插入153 次删除
  1. 1 1
      legacy/tripal_analysis/tripal_analysis.info
  2. 1 1
      legacy/tripal_contact/tripal_contact.info
  3. 1 1
      legacy/tripal_core/tripal_core.info
  4. 1 1
      legacy/tripal_cv/tripal_cv.info
  5. 1 1
      legacy/tripal_db/tripal_db.info
  6. 1 1
      legacy/tripal_example/tripal_example.info
  7. 1 1
      legacy/tripal_feature/tripal_feature.info
  8. 1 1
      legacy/tripal_featuremap/tripal_featuremap.info
  9. 1 1
      legacy/tripal_genetic/tripal_genetic.info
  10. 1 1
      legacy/tripal_library/tripal_library.info
  11. 1 1
      legacy/tripal_natural_diversity/tripal_natural_diversity.info
  12. 1 1
      legacy/tripal_organism/tripal_organism.info
  13. 27 27
      legacy/tripal_organism/tripal_organism.install
  14. 1 1
      legacy/tripal_phenotype/tripal_phenotype.info
  15. 1 1
      legacy/tripal_project/tripal_project.info
  16. 1 1
      legacy/tripal_pub/tripal_pub.info
  17. 1 1
      legacy/tripal_stock/tripal_stock.info
  18. 1 1
      legacy/tripal_views/tripal_views.info
  19. 18 10
      tripal/includes/tripal.extensions.inc
  20. 1 1
      tripal/tripal.info
  21. 64 9
      tripal/tripal.module
  22. 1 1
      tripal_bulk_loader/tripal_bulk_loader.info
  23. 45 40
      tripal_chado/api/modules/tripal_chado.cv.api.inc
  24. 43 0
      tripal_chado/includes/fields/organism_id.inc
  25. 1 1
      tripal_chado/includes/loaders/tripal_chado.obo_loader.inc
  26. 1 1
      tripal_chado/tripal_chado.info
  27. 7 6
      tripal_chado/tripal_chado.module
  28. 5 0
      tripal_panes/theme/css/tripal_panes.css
  29. 二進制
      tripal_panes/theme/images/close_btn.png
  30. 45 0
      tripal_panes/theme/js/tripal_panes.admin.js
  31. 4 7
      tripal_panes/theme/js/tripal_panes.js
  32. 1 1
      tripal_panes/theme/templates/tripal_panes_generic.tpl.php
  33. 3 3
      tripal_panes/tripal_panes.info
  34. 22 28
      tripal_panes/tripal_panes.module
  35. 1 1
      tripal_ws/tripal_ws.info

+ 1 - 1
legacy/tripal_analysis/tripal_analysis.info

@@ -3,7 +3,7 @@ description = Supports the companalyses tables of Chado by providing pages for v
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal/chado/tripal_analysis/configuration
 
 dependencies[] = tripal_core

+ 1 - 1
legacy/tripal_contact/tripal_contact.info

@@ -3,7 +3,7 @@ description = Supports the contact tables of Chado by providing pages for viewin
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal_core
 dependencies[] = tripal_views

+ 1 - 1
legacy/tripal_core/tripal_core.info

@@ -3,7 +3,7 @@ description = Provides support for all Tripal modules and includes the Tripal AP
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal
 
 stylesheets[all][] = theme/css/tripal.css

+ 1 - 1
legacy/tripal_cv/tripal_cv.info

@@ -3,7 +3,7 @@ description = Supports the Controlled Vocabulary (CV) tables of Chado by providi
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal/vocab
 
 dependencies[] = tripal_core

+ 1 - 1
legacy/tripal_db/tripal_db.info

@@ -3,7 +3,7 @@ description = Supports the database cross-reference tables of Chado by providing
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal/chado/tripal_db
 
 dependencies[] = tripal_core

+ 1 - 1
legacy/tripal_example/tripal_example.info

@@ -26,7 +26,7 @@ package = Tripal v2 Legacy Extensions
 ; Follow these instructions when specifying the version:
 ; https://drupal.org/node/1015226
 ;
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 ;
 ; Style-sheets containing CSS that should always be available for the

+ 1 - 1
legacy/tripal_feature/tripal_feature.info

@@ -3,7 +3,7 @@ description = Supports the sequence (feature) tables of Chado by providing pages
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 stylesheets[all][] = theme/css/tripal_feature.css
 scripts[]          = theme/js/tripal_feature.js

+ 1 - 1
legacy/tripal_featuremap/tripal_featuremap.info

@@ -3,7 +3,7 @@ description = Supports the map tables of Chado by providing pages for viewing an
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal_core
 dependencies[] = tripal_views

+ 1 - 1
legacy/tripal_genetic/tripal_genetic.info

@@ -3,7 +3,7 @@ description = Supports the genetic tables of Chado by providing pages for viewin
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal_core
 dependencies[] = tripal_views

+ 1 - 1
legacy/tripal_library/tripal_library.info

@@ -3,7 +3,7 @@ description = Supports the library tables of Chado by providing pages for viewin
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal_core
 dependencies[] = tripal_views

+ 1 - 1
legacy/tripal_natural_diversity/tripal_natural_diversity.info

@@ -3,7 +3,7 @@ description = Supports the natural diversity (ND) tables of Chado by providing p
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal_core
 dependencies[] = tripal_views

+ 1 - 1
legacy/tripal_organism/tripal_organism.info

@@ -3,7 +3,7 @@ description = Supports the organism tables of Chado by providing pages for viewi
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal/chado/tripal_organism
 
 stylesheets[all][] = theme/css/tripal_organism.css

+ 27 - 27
legacy/tripal_organism/tripal_organism.install

@@ -43,33 +43,33 @@ function tripal_organism_install() {
  */
 function tripal_organism_schema() {
  $schema['chado_organism'] = array(
-      'fields' => array(
-         'vid' => array(
-            'type' => 'int',
-            'unsigned' => TRUE,
-            'not null' => TRUE,
-            'default' => 0
-          ),
-         'nid' => array(
-            'type' => 'int',
-            'unsigned' => TRUE,
-            'not null' => TRUE,
-            'default' => 0
-          ),
-         'organism_id' => array(
-            'type' => 'int',
-            'not null' => TRUE,
-            'default' => 0
-          )
-      ),
-      'indexes' => array(
-         'organism_id' => array('organism_id')
-      ),
-      'unique keys' => array(
-         'nid_vid' => array('nid', 'vid'),
-         'vid' => array('vid')
-      ),
-      'primary key' => array('nid'),
+    'fields' => array(
+       'vid' => array(
+          'type' => 'int',
+          'unsigned' => TRUE,
+          'not null' => TRUE,
+          'default' => 0
+        ),
+       'nid' => array(
+          'type' => 'int',
+          'unsigned' => TRUE,
+          'not null' => TRUE,
+          'default' => 0
+        ),
+       'organism_id' => array(
+          'type' => 'int',
+          'not null' => TRUE,
+          'default' => 0
+        )
+    ),
+    'indexes' => array(
+       'organism_id' => array('organism_id')
+    ),
+    'unique keys' => array(
+       'nid_vid' => array('nid', 'vid'),
+       'vid' => array('vid')
+    ),
+    'primary key' => array('nid'),
   );
   return $schema;
 }

+ 1 - 1
legacy/tripal_phenotype/tripal_phenotype.info

@@ -3,7 +3,7 @@ description = Supports the phenotype tables of Chado by providing pages for view
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal_core
 dependencies[] = tripal_views

+ 1 - 1
legacy/tripal_project/tripal_project.info

@@ -3,7 +3,7 @@ description = Supports the project tables of Chado by providing pages for viewin
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal/chado/tripal_project
 
 dependencies[] = tripal_core

+ 1 - 1
legacy/tripal_pub/tripal_pub.info

@@ -3,7 +3,7 @@ description = Supports the pub (publication) tables of Chado by providing pages
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 stylesheets[all][] = theme/css/tripal_pub.css
 

+ 1 - 1
legacy/tripal_stock/tripal_stock.info

@@ -3,7 +3,7 @@ description = Supports the stock tables of Chado by providing pages for viewing,
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal_core
 dependencies[] = tripal_views

+ 1 - 1
legacy/tripal_views/tripal_views.info

@@ -3,7 +3,7 @@ description = Integrates all Chado tables with Drupal Views and provides basic s
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal/views-integration
 
 files[] = views/handlers/tripal_views_handler_filter_textarea.inc

+ 18 - 10
tripal/includes/tripal.extensions.inc

@@ -1,10 +1,11 @@
 <?php
 
 function tripal_extensions_form($form, &$form_state = NULL) {
-  // Get the RSS feed XML from the tripa.info website and save it to
+
+  // Get the RSS feed XML from the tripal.info website and save it to
   // a temp file so that we don't have to keep pulling the XML
   // everythime the page is loaded. If the temp file is older than 1 hours
-  // then we'll pull it again. The number of seconds in an hour is 3600
+  // then we'll pull it again. The number of seconds in an hour is 3600.
   $tmp_file = sys_get_temp_dir() . '/tripal_rss_extensions.xml';
   if (!file_exists($tmp_file) or time() - filemtime($tmp_file) > 3600) {
     $content = file_get_contents("http://tripal.info/rss/extensions.xml");
@@ -229,8 +230,13 @@ function tripal_extensions_form($form, &$form_state = NULL) {
   }
 
   // Iterate through all of the extensions and add them to the form.
+  $compatible_extensions = array();
+  if (array_key_exists($tripal_version, $extensions) and
+      array_key_exists($chado_version, $extensions[$tripal_version])) {
+    $compatible_extensions = $extensions[$tripal_version][$chado_version];
+  }
   tripal_extension_form_add_extensions($form, $form_state,
-    $extensions[$tripal_version][$chado_version], $categories, $tripal_version,
+    $compatible_extensions, $categories, $tripal_version,
     $chado_version, $my_tripal_version, $my_chado_version, $type_ids,
     $namespace, $filters);
 
@@ -343,13 +349,15 @@ function tripal_extension_form_add_extensions(&$form, $form_state, $extensions,
       $is_installed = '';
       switch ($type) {
         case 'Bulk Loader Template':
-          $blk_id = db_select('tripal_bulk_loader_template' ,'tblt')
-            ->fields('tblt', array('template_id'))
-            ->condition('name', $extension['title'])
-            ->execute()
-            ->fetchField();
-          if ($blk_id) {
-            $is_installed = '<li>A bulk loader template with this name is already installed.</li>';
+          if (module_exists('tripal_bulk_loader')) {
+            $blk_id = db_select('tripal_bulk_loader_template' ,'tblt')
+              ->fields('tblt', array('template_id'))
+              ->condition('name', $extension['title'])
+              ->execute()
+              ->fetchField();
+            if ($blk_id) {
+              $is_installed = '<li>A bulk loader template with this name is already installed.</li>';
+            }
           }
           break;
         case 'Materialized View':

+ 1 - 1
tripal/tripal.info

@@ -3,7 +3,7 @@ description = Tripal is an toolkit to facilitate construction of online genomic,
 core = 7.x
 project = tripal
 package = Tripal
-version = 7.x-3.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal
 
 stylesheets[all][] = theme/css/tripal.css

+ 64 - 9
tripal/tripal.module

@@ -54,12 +54,10 @@ function tripal_init() {
   global $base_url;
 
   // add some variables for all javasript to use for building URLs
-  $theme_dir = drupal_get_path('theme', 'tripal');
   $clean_urls = variable_get('clean_url', 0);
   drupal_add_js(
-    " var baseurl  = '$base_url';
-      var themedir = '$theme_dir';
-      var isClean  =  $clean_urls;",
+    "var baseurl  = '$base_url';" .
+    "var isClean  =  $clean_urls;",
     'inline', 'header');
 
   // make sure the date time settings are the way Tripal will insert them
@@ -91,7 +89,13 @@ function tripal_menu() {
   );
   $items['admin/tripal/tripal_jobs'] = array(
     'title' => 'Jobs',
-    'description' => t('Jobs managed by Tripal'),
+    'description' => t('Provides tools for managing jobs submitted to Tripal.  In some
+        cases, long-running tasks are too slow to complete within a single
+        browser session.  The Tripal jobs system allows long-running tasks
+        to be submitted to a queue that can be executed manually by the
+        site admin or automatically using a module such as the ') .
+        l('Tripal Daemon', 'https://www.drupal.org/project/tripal_daemon', array('attributes' => array('target' => '_blank'))) .
+        ' extension module.',
     'page callback' => 'tripal_jobs_admin_view',
     'access arguments' => array('administer tripal'),
     'type' => MENU_NORMAL_ITEM,
@@ -102,9 +106,11 @@ function tripal_menu() {
 
   $items['admin/tripal/storage'] = array(
     'title' => 'Storage Backend',
-    'description' => t("Tripal is designed so that it can store biological
-        data in any data storage back-end.  Tripal provides by default a
-        module for storing data in Chado.  All available storage backends
+    'description' => t("Tripal is designed to access biological
+        data in any data storage back-end.  A storage back-end must have a
+        module that can be installed that interfaces with Tripal.  By default
+        the base Tripal package provides The Tripal Chado module for storing
+        data in the GMOD Chado database schema.  All available storage backends
         and their administrative tools are found here."),
     'weight' => 8,
     'access arguments' => array('administer tripal'),
@@ -134,8 +140,15 @@ function tripal_menu() {
   // Menu items for facilitating import of extension modules.
   $items['admin/tripal/extension'] = array(
     'title' => 'Extensions',
-    'description' => t('Configuration for Tripal extensions.'),
+    'description' => t('Look for extensions to add new functionality to this
+        site. Tripal can be extended with new functionality developed
+        by other Tripal site developers. These include modules with new or
+        different functionality, bulk loading templates, or materialized
+        views.  Anyone can create new extensions and share those for
+        others to use.  Once shared they will appear in this list.'),
     'access arguments' => array('administer tripal'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tripal_extensions_form'),
     'type' => MENU_NORMAL_ITEM,
     'file' => 'includes/tripal.extensions.inc',
     'file path' => drupal_get_path('module', 'tripal'),
@@ -722,3 +735,45 @@ function TripalEntity_load($id, $reset = FALSE) {
   $entity = entity_load('TripalEntity', array($id), array(), $reset);
   return reset($entity);
 }
+
+/**
+ *
+ * Implements hook_form_FORM_ID_alter().
+ *
+ * The field_ui_field_edit_form is used for customizing the settings of
+ * a field attached to an entity.
+ */
+function tripal_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
+
+  // For entity fields added by Tripal Entities we don't want the
+  // the end-user to change the cardinality and the required fields
+  // such that record can't be saved in Chado.
+
+  // TODO: this shouldn't be hardcoded here.  These settings
+  // should be part of the field and handled by the tripal_entity module.
+  if ($form['#instance']['entity_type'] == 'TripalEntity') {
+    $form['field']['cardinality']['#access'] = FALSE;
+    $form['instance']['required']['#access'] = FALSE;
+  }
+
+  // TODO: don't the the maximum length be larger than the field size.
+}
+
+/**
+ * Implements hook_menu_alter().
+ */
+function tripal_menu_alter(&$items) {
+  // We don't want to allow deletion of fields added by the storage backend.
+  // TODO: this shouldn't be hardcoded here.  These settings
+  // should be part of the field and handled by the tripal_entity module.
+  $items['admin/structure/bio-data/manage/%TripalBundle/fields/%field_ui_menu/delete']['page callback'] = 'tripal_field_no_delete';
+  $items['admin/structure/bio-data/manage/%TripalBundle/fields/%field_ui_menu/delete']['page arguments'] = array();
+}
+
+/**
+ * Simple provides a message indicating that the field cannot be deleted.
+ */
+function tripal_field_no_delete() {
+  drupal_set_message('This field is currently managed by the biological data store and cannot be removed.', 'warning');
+  return '';
+}

+ 1 - 1
tripal_bulk_loader/tripal_bulk_loader.info

@@ -3,7 +3,7 @@ description = Supports the construction of templates for customizable uploading
 core = 7.x
 project = tripal
 package = Tripal
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal_core
 dependencies[] = tripal_views

+ 45 - 40
tripal_chado/api/modules/tripal_chado.cv.api.inc

@@ -396,28 +396,28 @@ function tripal_insert_cv($name, $definition) {
 }
 
 /**
- *  Add's a controlled vocabulary term to the cvterm table.
+ *  Add's a controlled vocabulary term to Chado.
  *
- *  If the parent CV does not exist then
- *  that too is added to the CV table.  If the cvterm is a relationship term
- *  then the $is_relationship argument should be set.  The function will try
+ *  This function will add a cvterm record (and a dbxref record if appropriate
+ *  values are provided). If the parent vocabulary does not exist then
+ *  that also is added to the cv table.  If the cvterm is a relationship term
+ *  then the 'is_relationship' value should be set.  The function will try
  *  to first find the relationship in the relationship ontology for updating and
- *  if it can't be found will add the relationship to the "local" CV.  All terms
- *  must also have a corresponding database.  This is specified in the term's
- *  ID just before the colon (e.g. GO:003824).  If the database does not exist
- *  in the DB table then it will be added automatically.  The accession (the
- *  value just after the colon in the term's ID) will be added to the dbxref
- *  table.  If the CVterm already exists and $update is set (default) then the
- *  cvterm is updated.  If the CVTerm already exists and $update is not set, then
- *  no changes are made and the CVTerm object is returned.
+ *  if it can not be found it will add the relationship to the "local" CV.  All
+ *  terms must also have a corresponding database.  This is specified in the
+ *  term's ID just before the colon (e.g. GO:003824).  If the database does not
+ *  exist in the DB table then it will be added automatically.  The accession
+ *  (the value just after the colon in the term's ID) will be added to the
+ *  dbxref table.  If the CVterm already exists and $update is set (default)
+ *  then the cvterm is updated.  If the CVTerm already exists and $update is
+ *  not set, then no changes are made and the CVTerm object is returned.
  *
  * @param $term
  *   An associative array with the following keys:
- *    - id: the term accession. must be of the form <DB>:<ACCESSION>, where <DB> is the
- *        name of the database to which the cvterm belongs and the <ACCESSION> is the
- *        term's accession number in the database.
+ *    - id: the term accession. must be of the form <DB>:<ACCESSION>, where
+ *      <DB> is the name of the database to which the cvterm belongs and the
+ *      <ACCESSION> is the term's accession number in the database.
  *    - name: the name of the term. usually meant to be human-readable.
- *    - namespace: the CV name for the term. DEPRECATED. Please use cv_name instead.
  *    - is_obsolete: is present and set to 1 if the term is defunct
  *    - definition: the definition of the term
  *    - cv_name: The CV name to which the term belongs.  If this arugment is
@@ -425,27 +425,45 @@ function tripal_insert_cv($name, $definition) {
  *        CV table with the same name provided in the $term[namespace].  If
  *        this field is provided then it overrides what the value in
  *        $term[namespace]
- *    - is_relationship: If this term is a relationship term then this value should be 1.
- *    - db_name: In some cases the database name will not be part of the $term['id'] and it
- *        needs to be explicitly set.  Use this argument only if the database name
- *        cannot be specififed in the term ID (e.g. <DB>:<ACCESSION>).
+ *    - is_relationship: If this term is a relationship term then this value
+ *        should be 1.
+ *    - db_name: In some cases the database name will not be part of the
+ *        $term['id'] and it needs to be explicitly set.  Use this argument
+ *        only if the database name cannot be specififed in the term ID
+ *        (e.g. <DB>:<ACCESSION>).
+ *    - namespace: the CV name for the term. DEPRECATED. Please use cv_name
+ *       instead.
  * @param $options
  *   An associative array with the following keys:
- *    - update_existing: By default this is TRUE.  If the term exists it is automatically updated.
+ *    - update_existing: By default this is TRUE.  If the term exists it is
+ *      automatically updated.
  *
  * @return
- *   A CVTerm object
+ *   A cvterm object
  *
  * @ingroup tripal_chado_api
  */
 function tripal_insert_cvterm($term, $options = array()) {
 
+  // get the term properties
+  $id = (isset($term['id'])) ? $term['id'] : '';
+  $name = '';
+  $cvname = '';
+  $definition = '';
+  $is_obsolete = 0;
+  $accession = '';
+
   // Set Defaults
   if (isset($term['cv_name'])) {
-    $defaultcv = $term['cv_name'];
+    $cvname = $term['cv_name'];
   }
   else {
-    $defaultcv = 'local';
+    $cvname = 'local';
+  }
+  // Namespace is deprecated but must be supported for backwards
+  // compatability
+  if (array_key_exists('namespace', $term)) {
+    $cvname = $term['namespace'];
   }
 
   if (isset($term['is_relationship'])) {
@@ -469,14 +487,6 @@ function tripal_insert_cvterm($term, $options = array()) {
     $update = 1;
   }
 
-  // get the term properties
-  $id = (isset($term['id'])) ? $term['id'] : '';
-  $name = '';
-  $cvname = '';
-  $definition = '';
-  $is_obsolete = 0;
-  $accession = '';
-
   if (array_key_exists('name', $term)) {
     $name = $term['name'];
   }
@@ -484,12 +494,7 @@ function tripal_insert_cvterm($term, $options = array()) {
     $name = $id;
   }
 
-  if (array_key_exists('namespace', $term)) {
-    $cvname = $term['namespace'];
-  }
-  else {
-    $cvname = $defaultcv;
-  }
+
   if (array_key_exists('definition', $term)) {
     $definition = preg_replace('/^\"(.*)\"/', '\1', $term['definition']);
   }
@@ -540,10 +545,10 @@ function tripal_insert_cvterm($term, $options = array()) {
     return 0;
   }
 
-  // this SQL statement will be used a lot to find a cvterm so just set it
+  // This SQL statement will be used a lot to find a cvterm so just set it
   // here for easy reference below.  Because CV terms can change their names
   // but accessions don't change, the following SQL finds cvterms based on
-  // their accession rather than the name
+  // their accession rather than the name.
   $cvtermsql = "
     SELECT CVT.name, CVT.cvterm_id, CV.cv_id, CV.name as cvname,
       DB.name as dbname, DB.db_id, DBX.accession

+ 43 - 0
tripal_chado/includes/fields/organism_id.inc

@@ -72,4 +72,47 @@ function tripal_chado_organism_select_widget_validate($element, &$form_state) {
   }
 }
 
+function organism_id_field_formatter_settings_summary($field, $instance, $view_mode) {
+  $display = $instance['display'][$view_mode];
+  $settings = $display['settings'];
+  dpm('yo');
+
+  $summary = '';
+
+  if ($display['type'] == 'text_trimmed' || $display['type'] == 'text_summary_or_trimmed') {
+    $summary = t('Length: @chars chars', array('@chars' => $settings['trim_length']));
+  }
+
+  return $summary;
+}
+/**
+ * Implements hook_field_formatter_settings_form()
+ *
+ * @param $field
+ * @param $instance
+ * @param $view_mode
+ * @param $form
+ * @param $form_state
+ */
+function organism_id_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
+  $display = $instance['display'][$view_mode];
+  $settings = $display['settings'];
+  dpm('hi');
+  $element = array();
+
+  if ($display['type'] == 'text_trimmed' || $display['type'] == 'text_summary_or_trimmed') {
+    $element['trim_length'] = array(
+      '#title' => t('Length'),
+      '#type' => 'textfield',
+      '#size' => 20,
+      '#default_value' => $settings['trim_length'],
+      '#element_validate' => array('element_validate_integer_positive'),
+      '#required' => TRUE,
+    );
+  }
+
+  return $element;
+
+}
+
 

+ 1 - 1
tripal_chado/includes/loaders/tripal_chado.obo_loader.inc

@@ -145,7 +145,7 @@ function tripal_cv_obo_form($form, &$form_state) {
     );
     $form['obo_existing']['update_load_obo'] = array(
       '#type' => 'submit',
-      '#value' => 'Load Vocabulary',
+      '#value' => 'Import Vocabulary',
       '#name' => 'update_load_obo'
     );
   }

+ 1 - 1
tripal_chado/tripal_chado.info

@@ -3,7 +3,7 @@ description = Provides a set of Chado-based fields for the Tripal Entities.
 core = 7.x
 project = tripal
 package = Tripal
-version = 7.x-2.0
+version = 7.x-3.0-alpha1
 
 files[] = includes/chado_views_handler_field.inc
 files[] = includes/chado_views_handler_filter.inc

+ 7 - 6
tripal_chado/tripal_chado.module

@@ -174,7 +174,7 @@ function tripal_chado_menu() {
     'title' => 'Materialized View',
     'description' => t('Materialized views are used to improve speed of large or complex queries. These are database views as compared to Drupal views.'),
     'page callback' => 'tripal_mview_report',
-    'page arguments' => array(5),
+    'page arguments' => array(6),
     'access arguments' => array('administer tripal'),
     'type' => MENU_CALLBACK,
     'file' => 'includes/tripal_chado.mviews.inc',
@@ -193,7 +193,7 @@ function tripal_chado_menu() {
   $items['admin/tripal/storage/chado/mviews/edit/%'] = array(
     'title' => 'Edit Materialized View',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_mviews_form', 5),
+    'page arguments' => array('tripal_mviews_form', 6),
     'access arguments' => array('administer tripal'),
     'type' => MENU_CALLBACK,
     'file' => 'includes/tripal_chado.mviews.inc',
@@ -203,7 +203,7 @@ function tripal_chado_menu() {
     'title' => 'Create Materialized View',
     'description' => t('Materialized views are used to improve speed of large or complex queries.'),
     'page callback' => 'tripal_mviews_add_populate_job',
-    'page arguments' => array(5),
+    'page arguments' => array(6),
     'access arguments' => array('administer tripal'),
     'type' => MENU_CALLBACK,
     'file' => 'includes/tripal_chado.mviews.inc',
@@ -270,7 +270,7 @@ function tripal_chado_menu() {
     'title' => 'Custom Tables',
     'description' => t('Custom tables are added to Chado.'),
     'page callback' => 'tripal_custom_table_view',
-    'page arguments' => array(5),
+    'page arguments' => array(6),
     'access arguments' => array('administer tripal'),
     'file' => 'includes/tripal_chado.custom_tables.inc',
     'file path' => drupal_get_path('module', 'tripal_chado'),
@@ -288,7 +288,7 @@ function tripal_chado_menu() {
   $items['admin/tripal/storage/chado/custom_tables/edit/%'] = array(
     'title' => 'Edit Custom Table',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_custom_tables_form', 5),
+    'page arguments' => array('tripal_custom_tables_form', 6),
     'access arguments' => array('administer tripal'),
     'file' => 'includes/tripal_chado.custom_tables.inc',
     'file path' => drupal_get_path('module', 'tripal_chado'),
@@ -298,7 +298,7 @@ function tripal_chado_menu() {
     'title' => 'Create Custom Table',
     'description' => t('Custom tables are added to Chado.'),
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_custom_tables_delete_form', 5),
+    'page arguments' => array('tripal_custom_tables_delete_form', 6),
     'access arguments' => array('administer tripal'),
     'file' => 'includes/tripal_chado.custom_tables.inc',
     'file path' => drupal_get_path('module', 'tripal_chado'),
@@ -615,6 +615,7 @@ function tripal_chado_field_widget_form_alter(&$element, &$form_state, $context)
   }
 }
 
+
 /**
  * Implements hook_field_formatter_view().
  */

+ 5 - 0
tripal_panes/theme/css/tripal_panes.css

@@ -107,3 +107,8 @@
   margin: 2px 0 2px 0 !important;
 }
 
+.tripal-panes-button {
+  height: 15px;
+  width: 15px;
+  vertical-align: text-top;
+}

二進制
tripal_panes/theme/images/close_btn.png


+ 45 - 0
tripal_panes/theme/js/tripal_panes.admin.js

@@ -0,0 +1,45 @@
+/**
+ * Override the field UI's default behavior
+ * @param $
+ */
+(function($) {
+
+  Drupal.behaviors.tripalPane = {
+    attach: function (context, settings) {
+      Drupal.behaviors.fieldUIDisplayOverview = {};
+      rearrangeRegion ();
+    }
+  };
+  
+  function rearrangeRegion () {
+    // For each field, make sure the selected value matches the region where it resides
+    $('#field-display-overview tr.tabledrag-leaf').each(function () {
+      // ID
+      var id = $(this).attr('id');
+      // Get the region
+      var region = getRegion (this).attr('class');
+      var regex = /region-title region-(.+)-title/;
+      var match = regex.exec(region);
+      var region_id = match[1].replace('-', '_');
+      var select = $(this).find('div.form-item-fields-' + id + '-region select');
+      $(select).children().each(function() {
+        if ($(this).val() == region_id) {
+          $(this).attr('selected', 'true');
+        } else {
+          $(this).attr('selected', null);
+        }
+      });
+    });
+  }
+  
+  function getRegion (field) {
+    var previous = $(field).prev();
+    var region = null;
+    if ($(previous).hasClass('region-title')) {
+      region =  previous;
+    } else {
+      region = getRegion (previous);
+    }
+    return region;
+  }
+})(jQuery);

+ 4 - 7
tripal_panes/theme/js/tripal_panes.js

@@ -5,7 +5,7 @@
     
       // Add a close button for each pane
       $('.tripal_pane-fieldset .fieldset-legend').each(function (i) {
-        $(this).append('<div class="tripal_pane-fieldset-close_button">[X]</div>');
+        $(this).append('<div class="tripal_pane-fieldset-close_button"><img src="' + panes_theme_dir + '/images/close_btn.png" id="tripal-panes-close-button" class="tripal-panes-button"></div>');
       });
       
       // Hide the pane when the close button is clicked
@@ -32,12 +32,9 @@
           
           // Highlight the pane if it's already at the top
           if (prevObj.indexOf('tripal_pane-base_pane') == 0 && $(id).css('display') == 'block') {
-            var color = $(id).css('background-color') ? $(id).css('background-color') : '#FFFFFF';
-            if (jQuery.ui) {
-              $(id).fadeTo(10, 0.5, function() {});
-              $(id).fadeTo(100, 1, function() {});
-              //$(id).effect('highlight', {color: '#DDDEEE'});
-            }
+            $(id).fadeTo(10, 0.5, function() {});
+            $(id).fadeTo(100, 1, function() {});
+            
           }
           // Move the pane
           else {

+ 1 - 1
tripal_panes/theme/templates/tripal_panes_generic.tpl.php

@@ -138,7 +138,7 @@ function tripal_panes_generic_render_table($fields) {
         'width' => '20%',
         'nowrap' => 'nowrap'
       ),
-      $field[0]['#markup']
+      '<span class="field field-name-' . preg_replace('/_/', '-', $field['#field_name']) . '">' . $field[0]['#markup'] . '</span>'
     );
   }
   // Theme the table.

+ 3 - 3
tripal_panes/tripal_panes.info

@@ -1,8 +1,8 @@
-name = Tripal Pane
-description = Provides a layout for Tripal.
+name = Tripal Panes
+description = Provides display options for Tripal Entities.  It includes a template that includes a sidebar with links to removable panes.
 core = 7.x
 project = tripal
 package = Tripal
-version = 7.x-3.0
+version = 7.x-3.0-alpha1
 
 dependencies[] = tripal

+ 22 - 28
tripal_panes/tripal_panes.module

@@ -1,25 +1,14 @@
 <?php
 
+
 /**
- *
- * Implements hook_form_FORM_ID_alter().
- *
- * The field_ui_field_edit_form is used for customizing the settings of
- * a field attached to an entity.
+ * Implements hook_form_init();
  */
-function tripal_panes_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
-  // For entity fields added by Tripal Entities we don't want the
-  // the end-user to change the cardinality and the required fields
-  // such that record can't be saved in Chado.
-  // TODO: this shouldn't be hardcoded here.  These settings
-  // should be part of the field and handled by the tripal_entity module.
-  if (in_array($form['#instance']['entity_type'], $dbs)) {
-    $form['field']['cardinality']['#access'] = FALSE;
-    $form['instance']['required']['#access'] = FALSE;
-  }
-
-  // TODO: don't the the maximum length be larger than the field size.
+function tripal_panes_init() {
+  $theme_dir = url(drupal_get_path('module', 'tripal_panes') . '/theme');
+  drupal_add_js("var panes_theme_dir  = '$theme_dir';", 'inline', 'header');
 }
+
 /**
  * Implements hook_form_FORM_ID_alter().
  *
@@ -27,7 +16,11 @@ function tripal_panes_form_field_ui_field_edit_form_alter(&$form, &$form_state,
  * or layout of fields attached to an entity.
  */
 function tripal_panes_form_field_ui_display_overview_form_alter(&$form, &$form_state, $form_id) {
-
+  // Only modify the form for Tripal Content Type
+  if ($form['#entity_type'] != 'TripalEntity') {
+    return;
+  }
+  drupal_add_js(drupal_get_path('module','tripal_panes') . '/theme/js/tripal_panes.admin.js');
   drupal_add_css(drupal_get_path('module','tripal_panes') . '/theme/css/tripal_panes.css');
 
   $entity_type = $form['#entity_type'];
@@ -45,7 +38,7 @@ function tripal_panes_form_field_ui_display_overview_form_alter(&$form, &$form_s
         module. If you would like to use Tripal-style panes for the layout
         of your pages please disable the Display Suite module. If you
         prefer to use the Display Suite module then disable the Tripal
-        Fields Layout (tripal_panes) module.', 'warning');
+        Panes (tripal_panes) module.', 'warning');
   }
 
   // Add a vertical tab fieldset at the bottom of the
@@ -63,15 +56,15 @@ function tripal_panes_form_field_ui_display_overview_form_alter(&$form, &$form_s
   );
 
   // Make sure our default pane are in the database.
-  _tripal_panes_check_default_field_panes($bundle);
+  tripal_panes_check_default_field_panes($bundle);
 
-  // Add a pane
+  // Adds form elments as a vertical tab for adding a pane.
   tripal_panes_form_field_ui_display_overview_form_pane_add($form, $form_state);
 
-  // Arrange panes
+  // Adds form elments as a vertical tab for arranging panes.
   tripal_panes_form_field_ui_display_overview_form_pane_arrange($form, $form_state, $bundle);
 
-  // Configure panes
+  // Adds form elments as a vertical tab for configuring panes.
   tripal_panes_form_field_ui_display_overview_form_pane_configure($form, $form_state, $bundle);
 
   // Now add each pane as a region.
@@ -83,6 +76,7 @@ function tripal_panes_form_field_ui_display_overview_form_alter(&$form, &$form_s
     ->orderBy('label', 'ASC')
     ->execute();
   $pane_options = array();
+
   while ($pane = $panes->fetchObject()) {
     $settings = unserialize($pane->settings);
     $form['fields']['#regions'][$pane->name] = array(
@@ -367,7 +361,7 @@ function tripal_panes_form_field_ui_display_overview_form_pane_configure (&$form
 /**
  * A helper function for checking if the default panes are in the database.
  */
-function _tripal_panes_check_default_field_panes($bundle) {
+function tripal_panes_check_default_field_panes($bundle) {
   // Make sure we have records for our default regions: te_base and te_hidden.
   // First check if the base region is in the database. If not, add it.
   $te_base = db_select('tripal_panes', 'tp')
@@ -659,8 +653,8 @@ function tripal_panes_action_order_panes (&$form, &$form_state) {
 /**
  *  Theme the Arrange panes as a draggable table
  *
- * @param unknown $variables
- * @return unknown
+ * @param $variables
+ * @return
  */
 function theme_tripal_panes_form_arrange_panes ($variables) {
   $element = $variables['element'];
@@ -831,7 +825,7 @@ function tripal_panes_entity_view($entity, $type, $view_mode, $langcode) {
           ->execute()
           ->fetchObject();
 
-        _tripal_panes_check_default_field_panes($bundle);
+        tripal_panes_check_default_field_panes($bundle);
 
         $results = db_select('tripal_panes', 'tp')
           ->fields('tp', array('pane_id','name', 'label', 'settings'))
@@ -889,7 +883,7 @@ function tripal_panes_entity_view($entity, $type, $view_mode, $langcode) {
 }
 
 /**
- * Implements hook_entity_view.
+ * Ajax callback to return pane's form elements when configuring pane
  */
 function tripal_panes_ajax_get_pane_setting_fieldset($form, &$form_state) {
   $pane_id = $form_state['values']['pane_select'];

+ 1 - 1
tripal_ws/tripal_ws.info

@@ -3,7 +3,7 @@ description = Exposes Tripal Entites as RESTful web services.
 core = 7.x
 project = tripal
 package = Tripal
-version = 7.x-3.0
+version = 7.x-3.0-alpha1
 configure = admin/tripal/chado/tripal_ws
 
 dependencies[] = tripal