Browse Source

Bug fixes from testing

Stephen Ficklin 10 years ago
parent
commit
c38bb86e4d

+ 0 - 2
tripal_core/api/tripal_core.chado_nodes.title_and_path.inc

@@ -289,7 +289,6 @@ function chado_add_admin_form_set_title(&$form, &$form_state, $details) {
     '#collapsed' => FALSE,
     '#prefix' => "<div id='set_titles-fieldset'>",
     '#suffix' => '</div>',
-    '#weight'      => 8
   );
 
   $form['set_titles']['content_type'] = array(
@@ -802,7 +801,6 @@ function chado_add_admin_form_set_url(&$form, &$form_state, $details) {
     '#collapsed' => FALSE,
     '#prefix' => "<div id='set_url-fieldset'>",
     '#suffix' => '</div>',
-    '#weight'      => 8
   );
 
   $form['set_url']['content_type'] = array(

+ 2 - 1
tripal_cv/api/tripal_cv.api.inc

@@ -419,10 +419,11 @@ function tripal_insert_cv($name, $definition) {
  *        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
+ *    - 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>).
  * @param $options
+ *   An associative array with the following keys:
  *    - update_existing: By default this is TRUE.  If the term exists it is automatically updated.
  *
  * @return

+ 4 - 4
tripal_feature/includes/tripal_feature.admin.inc

@@ -87,8 +87,8 @@ function tripal_feature_admin() {
   $form['browser'] = array(
      '#type' => 'fieldset',
      '#title' => t('Feature Browser'),
-     '#collapsible' => FALSE,
-     '#collapsed' => FALSE,
+     '#collapsible' => TRUE,
+     '#collapsed' => TRUE,
   );
   $form['browser']['browser_desc'] = array(
      '#markup' => t('A feature browser can be added to an organism page to allow users to quickly ' .
@@ -116,8 +116,8 @@ function tripal_feature_admin() {
   $form['summary'] = array(
      '#type' => 'fieldset',
      '#title' => t('Feature Summary Report'),
-     '#collapsible' => FALSE,
-     '#collapsed' => FALSE,
+     '#collapsible' => TRUE,
+     '#collapsed' => TRUE,
   );
   $form['summary']['feature_mapping'] = array(
      '#title' => 'Map feature types',

+ 51 - 54
tripal_feature/theme/templates/tripal_organism_feature_counts.tpl.php

@@ -1,70 +1,67 @@
 <?php
 
 $organism = $variables['node']->organism;
-$enabled = 1;
 $types = array();
 
 if(property_exists($organism, 'feature_counts')) {
   $types    = $organism->feature_counts['types'];
   $names    = $organism->feature_counts['names'];
-}
+} ?>
 
+<div class="tripal_organism-data-block-desc tripal-data-block-desc">The following features are currently present for this organism</div> <?php
 
-if (count($types) > 0){ ?>
-  <div class="tripal_organism-data-block-desc tripal-data-block-desc">The following features are currently present for this organism</div> <?php
-  
-  // let admins know they can customize the terms that appear in the list
-  print tripal_set_message("
-    Administrators, you can customize the types of terms that appear in this report by navigating to the " . 
-    l('Tripal feature configuration page', 'admin/tripal/chado/tripal_feature/configuration', array('attributes' => array('target' => '_blank'))) . "
-    opening the section \"Feature Summary Report\" and adding the list of
-    terms you want to appear in the list. You can rename terms as well. To refresh the data,re-populate the " .
-    l('organism_feature_count', 'admin/tripal/schema/mviews', array('attributes' => array('target' => '_blank'))) . " 
-    materialized view.",
-    TRIPAL_INFO,
-    array('return_html' => 1)
-  ); 
-  
-  // the $headers array is an array of fields to use as the colum headers.
-  // additional documentation can be found here
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Feature Type' ,'Count');
-  
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+// let admins know they can customize the terms that appear in the list
+print tripal_set_message("
+  Administrators, you can customize the types of terms that appear in this report by navigating to the " . 
+  l('Tripal feature configuration page', 'admin/tripal/chado/tripal_feature/configuration', array('attributes' => array('target' => '_blank'))) . "
+  opening the section \"Feature Summary Report\" and adding the list of
+  terms you want to appear in the list. You can rename terms as well. To refresh the data,re-populate the " .
+  l('organism_feature_count', 'admin/tripal/schema/mviews', array('attributes' => array('target' => '_blank'))) . " 
+  materialized view.",
+  TRIPAL_INFO,
+  array('return_html' => 1)
+); 
+
+// the $headers array is an array of fields to use as the colum headers.
+// additional documentation can be found here
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$headers = array('Feature Type' ,'Count');
+
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$rows = array();
+
+for ($j = 0; $j < count($types); $j++) {
+  $type = $types[$j];
+  $name = $names[$j];
   
-  for ($j = 0; $j < count($types); $j++) {
-    $type = $types[$j];
-    $name = $names[$j];
-    
-    $rows[] = array(
-      "<span title=\"" . $type->definition . "\">$name</span>",
-      number_format($type->num_features),
-    );
-  } 
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_organism-table-features',
-      'class' => 'tripal-data-table'
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
+  $rows[] = array(
+    "<span title=\"" . $type->definition . "\">$name</span>",
+    number_format($type->num_features),
   );
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table);
 } 
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers,
+  'rows' => $rows,
+  'attributes' => array(
+    'id' => 'tripal_organism-table-features',
+    'class' => 'tripal-data-table'
+  ),
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(),
+  'empty' => 'There are no feature counts to report.  If you have loaded features for this
+    organism then re-populate the organism_feature_count materialized view.',
+);
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table);
 
 
 

+ 2 - 3
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -303,11 +303,10 @@ function chado_pub_form($node, $form_state) {
     'relationship_table' => 'pub_relationship', // the name of the _relationship table
     'base_table' => 'pub',                      // the name of your chado base table
     'base_foreign_key' => 'pub_id',             // the name of the key in your base chado table
-    'base_key_value' => $pub_id,                // the value of example_id for this record
+    'base_key_value' => $pub_id,                // the value of pub_id for this record
     'nodetype' => 'pub',                        // the human-readable name of your node type
-    'cv_id' => $cv_id,                          // the cv.cv_id of the cv containing the properties
+    'cv_id' => $cv_id,                          // the cv.cv_id of the cv containing the relationships
     'base_name_field' => 'uniquename',          // the base table field you want to be used as the name
-    'select_options' => $select_options
   );
   // Adds the form elements to your current form
   chado_add_node_form_relationships($form, $form_state, $details);

+ 64 - 8
tripal_pub/tripal_pub.drush.inc

@@ -14,8 +14,10 @@
  */
 function tripal_pub_drush_help($command) {
   switch ($command) {
-    case 'drush:tripal-pub-import':
+    case 'drush:tripal-import-pubs':
       return dt('Imports publications from remote databases using saved configuration settings.');
+    case 'drush:tripal-update-pubs':
+      return dt('Updates publication information for publications with a supported database cross-reference.');
   }
 }
 
@@ -29,13 +31,44 @@ function tripal_pub_drush_help($command) {
  */
 function tripal_pub_drush_command() {
   $items = array();
-  $items['tripal-pubs-import'] = array(
+  
+  $items['trp-import-pubs'] = array(
     'description' => dt('Imports publications from remote databases using saved configuration settings.'),
     'options' => array(
       'create_contacts' => dt('provide this option to create or update contacts for authors. By default contacts are not created or updated.'),
       'dbxref' => dt('An accession number for a publication from a remote database (e.g. PMID:23582642).'),
       'report' => dt("Set to the email address of the recipient who should receive an HTML report of the publications that have been added."),
       'update' => dt("Set to 'Y' to update existing pubs.  By default only new pubs are inserted."),
+    ),
+    'examples' => array(
+      'Standard example' => 'drush tripal-pubs-import',
+      'Standard example' => 'drush -l http://[site url] tripal-pubs-import --report=[email]. Where [site url] is the URL of the website and [email] is the email address of the recipient to receive the HTML report',
+      'Import single publication' => 'drush tripal-pub-import --dbxref=PMID:23582642',
+    ),
+  );
+  $items['trp-update-pubs'] = array(
+    'description' => dt('Updates publication information for publications with a supported database cross-reference.'),
+    'options' => array(
+      'create_contacts' => dt('provide this option to create or update contacts for authors. By default contacts are not created or updated.'),
+      'dbxref' => dt('An accession number for a publication from a remote database (e.g. PMID:23582642)'),
+      'db' => dt('The database name (e.g. PMID or AGL)'),
+    ),
+    'examples' => array(
+      'Standard example' => 'drush tripal-pubs-update',
+      'Create contacts during update' => 'drush tripal-pubs-update --create_contacts=1',
+      'Update a single record' => 'drush tripal-pubs-update --dbxref=PMID:23582642',
+      'Update all records for a single database' => 'drush tripal-pubs-update --db=PMID'
+    ),
+  );
+  
+  // Deprecated commands
+  $items['tripal-pubs-import'] = array(
+    'description' => dt('DEPRECATED. Please see: trp-import-pubs.'),
+    'options' => array(
+      'create_contacts' => dt('provide this option to create or update contacts for authors. By default contacts are not created or updated.'),
+      'dbxref' => dt('An accession number for a publication from a remote database (e.g. PMID:23582642).'),
+      'report' => dt("Set to the email address of the recipient who should receive an HTML report of the publications that have been added."),
+      'update' => dt("Set to 'Y' to update existing pubs.  By default only new pubs are inserted."),
   ),
     'examples' => array(
       'Standard example' => 'drush tripal-pubs-import',
@@ -45,12 +78,12 @@ function tripal_pub_drush_command() {
     'aliases' => array('tpubs-import'),
   );
   $items['tripal-pubs-update'] = array(
-    'description' => dt('Updates publication information for publications with a supported database cross-reference.'),
+    'description' => dt('DEPRECATED. Please see: trp-update-pubs.'),
     'options' => array(
       'create_contacts' => dt('provide this option to create or update contacts for authors. By default contacts are not created or updated.'),
       'dbxref' => dt('An accession number for a publication from a remote database (e.g. PMID:23582642)'),
       'db' => dt('The database name (e.g. PMID or AGL)'),
-  ),
+    ),
     'examples' => array(
       'Standard example' => 'drush tripal-pubs-update',
       'Create contacts during update' => 'drush tripal-pubs-update --create_contacts=1',
@@ -58,9 +91,9 @@ function tripal_pub_drush_command() {
       'Update all records for a single database' => 'drush tripal-pubs-update --db=PMID'
       ),
     'aliases' => array('tpubs-update'),
-      );
+  );
 
-      return $items;
+  return $items;
 }
 
 /**
@@ -68,7 +101,7 @@ function tripal_pub_drush_command() {
  *
  * @ingroup tripal_drush
  */
-function drush_tripal_pub_tripal_pubs_import() {
+function drush_tripal_pub_trp_import_pubs() {
   $create_contacts = drush_get_option('create_contacts');
   $dbxref = drush_get_option('dbxref');
   $do_report = drush_get_option('report');
@@ -88,16 +121,39 @@ function drush_tripal_pub_tripal_pubs_import() {
     tripal_execute_active_pub_importers($do_report, $update);
   }
 }
+/**
+ * DEPRECATED. Imports publications into Chado
+ *
+ * @ingroup tripal_drush
+ */
+function drush_tripal_pub_tripal_pubs_import() {
+  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
+      "continue to work but please consider using the 'trp-import-pubs' command.\n\n");
+
+  drush_tripal_pub_trp_import_pubs();
+}
 
 /**
  * Imports publications into Chado
  *
  * @ingroup tripal_drush
  */
-function drush_tripal_pub_tripal_pubs_update() {
+function drush_tripal_pub_trp_update_pubs() {
   $create_contacts = drush_get_option('create_contacts');
   $dbxref = drush_get_option('dbxref');
   $db = drush_get_option('db');
 
   tripal_reimport_publications($create_contacts, $dbxref, $db);
 }
+
+/**
+ * DEPRECATED. Imports publications into Chado
+ *
+ * @ingroup tripal_drush
+ */
+function drush_tripal_pub_tripal_pubs_update() {
+  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
+      "continue to work but please consider using the 'trp-update-pubs' command.\n\n");
+  
+  drush_tripal_pub_trp_update_pubs();
+}