Просмотр исходного кода

Merge remote-tracking branch 'origin/7.x-3.x' into 7.x-2.x-ds

Shawna Spoor 8 лет назад
Родитель
Сommit
18e4ba894c
29 измененных файлов с 127 добавлено и 40 удалено
  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. 1 1
      legacy/tripal_phenotype/tripal_phenotype.info
  14. 1 1
      legacy/tripal_phylogeny/tripal_phylogeny.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. 87 12
      tripal/api/tripal.jobs.api.inc
  20. 1 1
      tripal/tripal.info
  21. 1 1
      tripal_bulk_loader/tripal_bulk_loader.info
  22. 1 1
      tripal_chado/api/modules/tripal_chado.db.api.inc
  23. 13 1
      tripal_chado/includes/tripal_chado.db.inc
  24. 1 1
      tripal_chado/includes/tripal_chado.semweb.inc
  25. 1 1
      tripal_chado/tripal_chado.info
  26. 1 1
      tripal_chado_views/tripal_chado_views.info
  27. 1 1
      tripal_ds/theme/js/tripal_ds.js
  28. 1 1
      tripal_ds/tripal_ds.info
  29. 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-3.0-beta1
+version = 7.x-3.0-beta3
 configure = admin/tripal/legacy/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-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal_core
 dependencies[] = tripal_chado_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-3.0-beta1
+version = 7.x-3.0-beta3
 configure = admin/tripal
 
 stylesheets[all][] = theme/css/tripal_core.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-3.0-beta1
+version = 7.x-3.0-beta3
 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-3.0-beta1
+version = 7.x-3.0-beta3
 configure = admin/tripal/legacy/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-3.0-beta1
+version = 7.x-3.0-beta3
 
 ;
 ; 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-3.0-beta1
+version = 7.x-3.0-beta3
 
 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-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal_core
 dependencies[] = tripal_chado_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-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal_core
 dependencies[] = tripal_chado_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-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal_core
 dependencies[] = tripal_chado_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-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal_core
 dependencies[] = tripal_chado_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-3.0-beta1
+version = 7.x-3.0-beta3
 configure = admin/tripal/legacy/tripal_organism
 
 stylesheets[all][] = theme/css/tripal_organism.css

+ 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-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal_core
 dependencies[] = tripal_chado_views

+ 1 - 1
legacy/tripal_phylogeny/tripal_phylogeny.info

@@ -3,7 +3,7 @@ description = Supports the phylogeny tables of Chado by providing pages for view
 core = 7.x
 project = tripal_phylogeny
 package = Tripal Extensions
-version = 7.x-3.0-beta1
+version = 7.x-3.0-beta3
 dependencies[] = tripal_core
 dependencies[] = tripal_cv
 dependencies[] = tripal_db

+ 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-3.0-beta1
+version = 7.x-3.0-beta3
 configure = admin/tripal/legacy/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-3.0-beta1
+version = 7.x-3.0-beta3
 
 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-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal_core
 dependencies[] = tripal_chado_views

+ 1 - 1
legacy/tripal_views/tripal_views.info

@@ -3,4 +3,4 @@ description = Deprecated-- no longer provides any functionality. See Tripal Chad
 core = 7.x
 project = tripal
 package = Tripal v2 Legacy
-version = 7.x-3.0-beta1
+version = 7.x-3.0-beta3

+ 87 - 12
tripal/api/tripal.jobs.api.inc

@@ -53,7 +53,7 @@
  *    the job. Use the module_load_include function to get a path for a given
  *    file.
  * @return
- *    The job_id of the registered job
+ *    The job_id of the registered job, or FALSE on failure.
  *
  * Example usage:
  *
@@ -80,7 +80,39 @@
 function tripal_add_job($job_name, $modulename, $callback, $arguments, $uid,
     $priority = 10, $includes = array()) {
 
-  global $user;
+  if (!$job_name) {
+    watchdog('tripal', "Must provide a \$job_name argument to the tripal_add_job() function.");
+    return FALSE;
+  }
+  if (!$modulename) {
+    watchdog('tripal', "Must provide a \$modulename argument to the tripal_add_job() function.");
+    return FALSE;
+  }
+  if (!$callback) {
+    watchdog('tripal', "Must provide a \$callback argument to the tripal_add_job() function.");
+    return FALSE;
+  }
+  foreach ($includes as $include) {
+    require_once($include);
+  }
+  if (!function_exists($callback)) {
+    watchdog('tripal', "Must provide a valid callback function to the tripal_add_job() function.");
+    return FALSE;
+  }
+  if (!is_numeric($uid)) {
+    watchdog('tripal', "Must provide a numeric \$uid argument to the tripal_add_job() function.");
+    return FALSE;
+  }
+  if (!$priority or !is_numeric($priority) or $priority < 1 or $priority > 10) {
+    watchdog('tripal', "Must provide a numeric \$priority argument between 1 and 10 to the tripal_add_job() function.");
+    return FALSE;
+  }
+  if (!is_array($arguments)) {
+    watchdog('tripal', "Must provide an array as the \$arguments argument to the tripal_add_job() function.");
+    return FALSE;
+  }
+
+  $user = user_load($uid);
 
   // convert the arguments into a string for storage in the database
   $args = array();
@@ -115,7 +147,7 @@ function tripal_add_job($job_name, $modulename, $callback, $arguments, $uid,
     }
   }
   else {
-    drupal_set_message(t("Failed to add job %job_name.", array('%job_name' => $job_name)), 'error');
+    drupal_set_message(t("Failed to add job %job_name.", array('%job_name' => $job_name)));
   }
 
   return $job_id;
@@ -250,11 +282,12 @@ function tripal_rerun_job($job_id, $goto_jobs_page = TRUE) {
   // separating them.  But as of Tripal v2.0 the arguments are stored as
   // a serialized array.  To be backwards compatible, we should check for serialization
   // and if not then we will use the old style
+  $includes = unserialize($job->includes);
   $args = unserialize($job->arguments);
   if (!$args) {
     $args = explode("::", $job->arguments);
   }
-  $job_id = tripal_add_job($job->job_name, $job->modulename, $job->callback, $args, $user_id, $job->priority);
+  $job_id = tripal_add_job($job->job_name, $job->modulename, $job->callback, $args, $user_id, $job->priority, $includes);
 
   if ($goto_jobs_page) {
     drupal_goto("admin/tripal/tripal_jobs");
@@ -268,9 +301,19 @@ function tripal_rerun_job($job_id, $goto_jobs_page = TRUE) {
  * @param $job_id
  *   The job_id of the job to be cancelled
  *
+ * @return
+ *   FALSE if the an error occured or the job could not be canceled, TRUE
+ *   otherwise.
+ *
  * @ingroup tripal_jobs_api
  */
 function tripal_cancel_job($job_id, $redirect = TRUE) {
+
+  if (!$job_id or !is_numeric($job_id)) {
+    watchdog('tripal', "Must provide a numeric \$job_id to the tripal_cancel_job() function.");
+    return FALSE;
+  }
+
   $sql = "SELECT * FROM {tripal_jobs} WHERE job_id = :job_id";
   $results = db_query($sql, array(':job_id' => $job_id));
   $job = $results->fetchObject();
@@ -287,10 +330,12 @@ function tripal_cancel_job($job_id, $redirect = TRUE) {
   }
   else {
     drupal_set_message(t("Job %job_id cannot be cancelled. It is in progress or has finished.", array('%job_id' => $job_id)));
+    return FALSE;
   }
   if ($redirect) {
     drupal_goto("admin/tripal/tripal_jobs");
   }
+  return TRUE;
 }
 
 /**
@@ -418,21 +463,51 @@ function tripal_set_job_progress($job_id, $percentage) {
   return FALSE;
 }
 /**
- * Returns a list of jobs associated with the given module
+ * Returns a list of jobs that are active.
  *
  * @param $modulename
- *    The module to return a list of jobs for
+ *   Limit the list returned to those that were added by a specific module. If
+ *   no module name is provided then all active jobs are returned.
  *
  * @return
- *    An array of objects where each object describes a tripal job
+ *    An array of objects where each object describes a tripal job. If no
+ *    jobs were found then an empty array is returned.  Each object will have
+ *    the following members:
+ *    - job_id: The unique ID number for the job.
+ *    - uid: The ID of the user that submitted the job.
+ *    - job_name:  The human-readable name of the job.
+ *    - modulename: The name of the module that submitted the job.
+ *    - callback:  The callback function to be called when the job is run.
+ *    - arguments: An array of arguments to be passed to the callback function.
+ *    - progress: The percent progress of completion if the job is running.
+ *    - status: The status of the job: Waiting, Completed, Running or Cancelled.
+ *    - submit_date:  The UNIX timestamp when the job was submitted.
+ *    - start_time: The UNIX timestamp for when the job started running.
+ *    - end_time: The UNIX timestampe when the job completed running.
+ *    - error_msg: Any error message that occured during execution of the job.
+ *    - prirotiy: The execution priority of the job (value between 1 and 10)
  *
  * @ingroup tripal_jobs_api
  */
-function tripal_get_active_jobs($modulename) {
-  $sql =  "SELECT * FROM {tripal_jobs} TJ " .
-           "WHERE TJ.end_time IS NULL and TJ.modulename = :modulename ";
-  $results = db_query($sql, array(':modulename' => $modulename));
-  return $results->fetchObject();
+function tripal_get_active_jobs($modulename = NULL) {
+  $query = db_select('tripal_jobs', 'TJ')
+    ->fields('TJ', array('job_id', 'uid', 'job_name', 'modulename', 'callback',
+      'arguments', 'progress', 'status', 'submit_date', 'start_time',
+      'end_time', 'error_msg', 'priority'));
+  if ($modulename) {
+    $query->where(
+      "TJ.modulename = :modulename and NOT (TJ.status = 'Completed' or TJ.status = 'Cancelled')",
+      array(':modulename' => $modulename)
+    );
+  }
+  $results = $query->execute();
+
+  $jobs = array();
+  while($job = $results->fetchobject()) {
+    $jobs->arguments = unserialize($job->arguments);
+    $jobs[] = $job;
+  }
+  return $jobs;
 }
 
 /**

+ 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-beta1
+version = 7.x-3.0-beta3
 configure = admin/tripal
 
 stylesheets[all][] = theme/css/tripal.css

+ 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-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal_core
 dependencies[] = tripal_chado_views

+ 1 - 1
tripal_chado/api/modules/tripal_chado.db.api.inc

@@ -302,7 +302,7 @@ function tripal_get_dbxref_url($dbxref) {
     // If no replacements were made above then tokens weren't used and we can
     // default to just appending the db name and accession to the end.
     if (!$db_count and !$acc_count) {
-      $final_url .= $dbxref->db_id->name . ':' . $dbxref->accession;
+      $final_url = $dbxref->db_id->urlprefix . $dbxref->db_id->name . ':' . $dbxref->accession;
     }
 
     // If the URL prefix is relative then convert it to a full URL.

+ 13 - 1
tripal_chado/includes/tripal_chado.db.inc

@@ -186,7 +186,18 @@ function tripal_chado_add_db_form_fields(&$form, $form_state, $dbid = NULL) {
   $form['fields']['urlprefix']= array(
     '#type'          => 'textfield',
     '#title'         => t('URL prefix'),
-    '#description'   => t('Tripal can provide links to external databases when accession numbers or unique identifiers are known.  Typically, a database will provide a unique web address for each accession and the accession usually is the last component of the page address.  Please enter the web address, minus the accession number for this database.  When an accession number is present, Tripal will combine this web address with the accession and provide a link to the external site.'),
+    '#description'   => t('Tripal can provide links to external databases
+        when accession numbers or unique identifiers are known.  Typically,
+        a database will provide a unique web address for each accession and
+        the accession usually is the last component of the page address.
+        Please enter the web address, minus the accession number for this
+        database.  By default, Tripal will
+        combine this "URL prefix" with the database short name and
+        accession to create a link to the external site. But, you can
+        also use the tokens {db} and {accession} within the URL prefix
+        to specify exactly where the database short name and the accession
+        should be added.  Tripal will substitute the actual values in
+        place of these tokens to create the link. (e.g. URL prefix: https://phytozome.jgi.doe.gov/phytomine/portal.do?externalid=PAC:{accession}).'),
     '#default_value' => $default_urlprefix,
     '#maxlength'     => 255,
   );
@@ -251,6 +262,7 @@ function tripal_chado_db_add_form_submit($form, &$form_state) {
   $success = chado_insert_record('db', $values);
   if ($success) {
     drupal_set_message(t("External database added"));
+    drupal_goto('admin/tripal/storage/chado/db');
   }
   else {
     drupal_set_message(t("Failed to add external database."));

+ 1 - 1
tripal_chado/includes/tripal_chado.semweb.inc

@@ -1194,7 +1194,7 @@ function tripal_chado_populate_vocab_TPUB() {
         'name' => 'PMID',
         'description' => 'PubMed',
         'url' => 'http://www.ncbi.nlm.nih.gov/pubmed',
-        'urlprefix' => 'http://www.ncbi.nlm.nih.gov/pubmed/'
+        'urlprefix' => 'http://www.ncbi.nlm.nih.gov/pubmed/{accession}'
       ),
       array('update_existing' => TRUE)
   );

+ 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-3.0-beta1
+version = 7.x-3.0-beta3
 
 files[] = views_handlers/chado_views_handler_field.inc
 files[] = views_handlers/chado_views_handler_filter.inc

+ 1 - 1
tripal_chado_views/tripal_chado_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
-version = 7.x-3.0-beta1
+version = 7.x-3.0-beta3
 configure = admin/tripal/storage/chado/views-integration
 
 files[] = views/handlers/tripal_views_handler_filter_textarea.inc

+ 1 - 1
tripal_ds/theme/js/tripal_ds.js

@@ -5,7 +5,7 @@
 
       // Add a close button for each pane except for the te_base
       $('.field-group-fieldset .fieldset-legend').each(function (i) {
-        $(this).append('<div class="tripal_pane-fieldset-close_button"><div id="tripal-pane-close-button" class="tripal-pane-button">CLOSE</div></div>');
+        $(this).append('<div class="tripal_pane-fieldset-close_button"><div id="tripal-pane-close-button" class="tripal-pane-button">[x]</div></div>');
         var id = '.tripal_pane-fieldset-' + $(this).attr('id');
       });
       // Hide the pane when the close button is clicked

+ 1 - 1
tripal_ds/tripal_ds.info

@@ -3,7 +3,7 @@ description = Provides display options for Tripal Entities through extending Dis
 core = 7.x
 project = tripal
 package = Tripal
-version = 7.x-3.0-beta1
+version = 7.x-3.0-beta3
 
 stylesheets[all][] = theme/css/tripaldsfeature.css
 

+ 1 - 1
tripal_ws/tripal_ws.info

@@ -3,6 +3,6 @@ description = Exposes Tripal Entites as RESTful web services.
 core = 7.x
 project = tripal
 package = Tripal
-version = 7.x-3.0-beta1
+version = 7.x-3.0-beta3
 
 dependencies[] = tripal