Browse Source

Fixed a few bugs in the APIs and added a new CSS class to theme tripal code

Lacey Sanderson 11 years ago
parent
commit
24f9b2066b

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

@@ -113,9 +113,9 @@ 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,
@@ -142,7 +142,7 @@ function tripal_add_mview($name, $modulename, $schema_arr, $query, $comment = NU
       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 {

+ 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',