Bläddra i källkod

Fixed support for AHAH. Fixed issue #1879354 by adding an 'accession' field to the add CV term form. Also fixed support for AHAH forms and altered the cv term add/edit to use the Tripal API

spficklin 12 år sedan
förälder
incheckning
e5d5b7c0ca

+ 8 - 0
tripal_core/api/tripal_core.ahah.inc

@@ -7,6 +7,14 @@
  * Provides support for dynamic forms through AHAH
  */
 
+function tripal_core_ahah_init_form() {
+  // If form elements have autocomplete elements returned in
+  // an ahah call they won't work because the following JS file
+  // doesn't get included. If we include it first before any 
+  // ahah calls it will be there when we need it.
+  drupal_add_js('misc/autocomplete.js');
+}
+
 /*
  * This function simply gets the posted form ID, builds the form
  * and retrieves the specified element

+ 19 - 18
tripal_core/api/tripal_core.api.inc

@@ -1387,27 +1387,28 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
         }
       }
       $i++;
-    }
+    } // end foreach item in where clause
     $sql = drupal_substr($sql, 0, -4);  // get rid of the trailing 'AND '
-    $psql = drupal_substr($psql, 0, -4);  // get rid of the trailing 'AND '
-
-    // finally add any ordering of the results to the SQL statement
-    if (count($options['order_by']) > 0) {
-      $sql .= " ORDER BY ";
-      $psql .= " ORDER BY ";
-      foreach ($options['order_by'] as $field => $dir) {
-        $sql .= "$field $dir, ";
-        $psql .= "$field $dir, ";
-      }
-      $sql = drupal_substr($sql, 0, -2);  // get rid of the trailing ', '
-      $psql = drupal_substr($psql, 0, -2);  // get rid of the trailing ', '
-    }
-    // finish constructing the prepared SQL statement
-    if ($options['statement_name']) {
-    	$psql =  "PREPARE " . $options['statement_name'] . " (" . implode(', ', $idatatypes) . ") AS " . $psql;
-    }
+    $psql = drupal_substr($psql, 0, -4);  // get rid of the trailing 'AND '    
     
   } // end if(empty($where)){ } else {
+      
+  // finally add any ordering of the results to the SQL statement
+  if (count($options['order_by']) > 0) {
+    $sql .= " ORDER BY ";
+    $psql .= " ORDER BY ";
+    foreach ($options['order_by'] as $field => $dir) {
+      $sql .= "$field $dir, ";
+      $psql .= "$field $dir, ";
+    }
+    $sql = drupal_substr($sql, 0, -2);  // get rid of the trailing ', '
+    $psql = drupal_substr($psql, 0, -2);  // get rid of the trailing ', '
+  }  
+
+  // finish constructing the prepared SQL statement
+  if ($options['statement_name']) {
+    $psql =  "PREPARE " . $options['statement_name'] . " (" . implode(', ', $idatatypes) . ") AS " . $psql;
+  }
 
   // if the caller has requested the SQL rather than the results...
   // which happens in the case of wanting to use the Drupal pager, then do so

+ 3 - 0
tripal_core/tripal_core.module

@@ -5,6 +5,7 @@ require_once "includes/mviews.php";
 require_once "includes/custom_tables.php";
 require_once "includes/chado_install.php";
 require_once "api/tripal_core.api.inc";
+require_once "api/tripal_core.ahah.inc";
 
 /**
  * @defgroup tripal_modules Tripal Modules
@@ -25,6 +26,8 @@ require_once "api/tripal_core.api.inc";
 function tripal_core_init() {
   global $base_url;  
   
+  drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/tripal.ahah.js');
+  
   // create the 'tripal' controlled volcabulary in chado but only if it doesn't already exist, and
   // only if the chado database is present.
   if (tripal_core_is_chado_installed()) {

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

@@ -363,8 +363,8 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   else {
     $definition = '';
   }
-  $is_obsolete = 0;  
-  if (isset($term['is_obsolete']) and strcmp($term['is_obsolete'], 'true') == 0) {
+  $is_obsolete = $term['is_obsolete'] ? $term['is_obsolete'] : 0;
+  if (strcmp($is_obsolete, 'true') == 0) {
     $is_obsolete = 1;
   }  
   if (!$name and !$id) {

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 64 - 930
tripal_cv/tripal_cv.module


Vissa filer visades inte eftersom för många filer har ändrats