Browse Source

Merge branch '7.x-2.x' of git.drupal.org:sandbox/spficklin/1337878 into 7.x-2.x

Stephen Ficklin 11 years ago
parent
commit
6fb7430c22

+ 10 - 10
tripal_core/api/tripal_core.mviews.api.inc

@@ -113,21 +113,21 @@ function tripal_add_legacy_mview($name, $modulename, $mv_table, $mv_specs, $inde
  *
  * @ingroup tripal_mviews_api
  */
-function tripal_add_mview($name, $modulename, $schema_arr, $query, $comment = NULL) {
+function tripal_add_mview($name, $modulename, $mv_schema, $query, $comment = NULL) {
 
-  $mv_table = $schema_arr['table'];
+  $mv_table = $mv_schema['table'];
 
   if (!$mv_table) {
      tripal_report_error('tripal_core', TRIPAL_ERROR,
        'Must have a table name when creating an mview.', array());
      return NULL;
   }
-  
+
   // see if the mv_table name already exsists
   $mview_id = db_query(
-    'SELECT mview_id FROM {tripal_mviews} WHERE name = :name', 
+    'SELECT mview_id FROM {tripal_mviews} WHERE name = :name',
     array(':name' => $name))->fetchField();
-  
+
   if(!$mview_id) {
 
     // Create a new record
@@ -138,18 +138,18 @@ function tripal_add_mview($name, $modulename, $schema_arr, $query, $comment = NU
     $record->query = $query;
     $record->comment = $comment;
     $record->mv_schema = $mv_schema;
-  
+
     // add the record to the tripal_mviews table and if successful
     // create the new materialized view in the chado schema
     if (drupal_write_record('tripal_mviews', $record)) {
-  
+
       // drop the table from chado if it exists
       if (chado_table_exists($mv_table)) {
         $sql = 'DROP TABLE {' . $mv_table . '}';
         chado_query($sql);
       }
       // create the table
-      if (!chado_create_custom_table ($mv_table, $schema_arr, 0)) {
+      if (!chado_create_custom_table ($mv_table, $mv_schema, 0)) {
         drupal_set_message(t("Could not create the materialized view. Check Drupal error report logs."), 'error');
       }
       else {
@@ -158,8 +158,8 @@ function tripal_add_mview($name, $modulename, $schema_arr, $query, $comment = NU
     }
   }
   else {
-    tripal_report_error('tripal_cv', TRIPAL_WARNING, 
-      "Materialized view, %vname, already exists. Cannot create.", 
+    tripal_report_error('tripal_cv', TRIPAL_WARNING,
+      "Materialized view, %vname, already exists. Cannot create.",
       array('%vname' => $name));
     drupal_set_message(t("Materialized view, $name, already exists. Cannot create.", array('%name' => $name)));
   }

+ 8 - 0
tripal_core/theme/css/tripal.css

@@ -208,6 +208,14 @@ div.messages.tripal-site-admin-only{
   color: #FF0000;
 }
 
+.tripal-code {
+  font-family: "Courier New", Courier, monospace;
+  word-wrap: break-word;
+  display: block;
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
+
 .tripal-serverity-string.warning {
   color: #FF8000;
 }

+ 7 - 7
tripal_cv/api/tripal_cv.api.inc

@@ -469,7 +469,7 @@ function tripal_insert_cvterm($term, $options) {
   }
 
   // get the term properties
-  $id = $term['id'];
+  $id = (isset($term['id'])) ? $term['id'] : '';
   $name = '';
   $cvname = '';
   $definition = '';
@@ -1060,8 +1060,8 @@ function tripal_get_default_cv($table, $field) {
  * tripal_get_cvterm_select_option, this function retreives the cvterms using
  * the default vocabulary set for a given table and field.  It will also
  * notify the administrative user if a default vocabulary is missing for the
- * field and if the vocabulary is empty.  
- *   
+ * field and if the vocabulary is empty.
+ *
  * @param $table
  *   The name of the table that contains the field with a foreign key
  *   relationship to the cvterm table
@@ -1070,21 +1070,21 @@ function tripal_get_default_cv($table, $field) {
  *   cvterm table for which the default vocabulary will be set
  * @param $field_desc
  *   A human readable descriptive name for the field
- *   
+ *
  * @return
  *   An array(cvterm_id => name)
  *   for each cvterm in the chado cvterm table where cv_id=that supplied
  */
 function tripal_get_cvterm_default_select_options($table, $field, $field_desc) {
-  
+
   $default_cv = tripal_get_default_cv($table, $field);
   $options = array();
-  
+
   if ($default_cv) {
     $options = tripal_get_cvterm_select_options($default_cv->cv_id);
   }
   else {
-    tripal_set_message('There is not a default vocabulary set for ' . $field_desc . '. '. 
+    tripal_set_message('There is not a default vocabulary set for ' . $field_desc . '. '.
       'Please set one using the ' .
       l('vocabulary defaults configuration page',
         'admin/tripal/chado/tripal_cv/defaults',

+ 17 - 17
tripal_stock/theme/tripal_organism/tripal_organism_stocks.tpl.php

@@ -3,19 +3,19 @@ $organism = $variables['node']->organism;
 
 // expand the featuremap object to include the records from the featurepos table
 // specify the number of features to show by default and the unique pager ID
-$num_results_per_page = 25; 
+$num_results_per_page = 25;
 $pager_id = 3;
 
 // get the features aligned on this map
-$options = array(  
+$options = array(
   'return_array' => 1,
   'order_by' => array('name' => 'ASC'),
   'pager' => array(
-    'limit' => $num_results_per_page, 
+    'limit' => $num_results_per_page,
     'element' => $pager_id
   ),
   'include_fk' => array(
-    'type_id' => 1    
+    'type_id' => 1
   ),
 );
 
@@ -25,30 +25,30 @@ $stocks = $organism->stock;
 // get the total number of records
 $total_records = chado_pager_get_count($pager_id);
 
- 
+
 if (count($stocks) > 0) { ?>
-  <div class="tripal_organism-data-block-desc tripal-data-block-desc">This organism is associated with <?php print number_format($total_records) ?> stock(s):</div> <?php 
-  
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
+  <div class="tripal_organism-data-block-desc tripal-data-block-desc">This organism is associated with <?php print number_format($total_records) ?> stock(s):</div> <?php
+
+  // 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
   // This table for the analysis has a vertical header (down the first column)
   // so we do not provide headers here, but specify them in the $rows array below.
   $headers = array('Name', 'Type');
-  
+
   // 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 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
   $rows = array();
-  
+
   foreach ($stocks as $stock){
     $name = $stock->name;
     if (!$name) {
       $name = $stock->uniquename;
     }
-    if ($stock->nid) {    
-      $name = l($name, "node/$stock->nid", array('attributes' => array('target' => '_blank')));
+    if ($node->nid) {
+      $name = l($name, "node/$node->nid", array('attributes' => array('target' => '_blank')));
     }
 
     $rows[] = array(
@@ -74,7 +74,7 @@ if (count($stocks) > 0) { ?>
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
   print theme_table($table);
-  
+
   // the $pager array values that control the behavior of the pager.  For
   // documentation on the values allows in this array see:
   // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
@@ -89,8 +89,8 @@ if (count($stocks) > 0) { ?>
     ),
     'quantity' => $num_results_per_page,
   );
-  print theme_pager($pager);  
-} 
+  print theme_pager($pager);
+}