Prechádzať zdrojové kódy

Fixed bugs in feature module

Stephen Ficklin 10 rokov pred
rodič
commit
8532182bd8

+ 1 - 1
tripal_feature/api/tripal_feature.api.inc

@@ -707,7 +707,7 @@ function tripal_get_location_string($featureloc) {
   $feature = $featureloc->feature_id;
   
   if ($featureloc->strand < 0) {
-    $residues = tripal_feature_reverse_complement($residues);
+    $residues = tripal_feature_reverse_complement($feature->residues);
   }
   $strand = '';
   if ($featureloc->strand == 1) {

+ 12 - 11
tripal_feature/tripal_feature.module

@@ -514,18 +514,19 @@ function tripal_feature_coder_ignore() {
  */
 function tripal_feature_match_features_page($id) {
 
-  // if the URL alias configuration is set such that the URL
-  // always begins with 'feature' then we want to use the ID as it is and
-  // forward it on. Otherwise, try to find the matching feature.
-  $url_alias = variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]');
-  if (!$url_alias) {
-    $url_alias = '/feature/[genus]/[species]/[type]/[uniquename]';
-  }
-  $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash
-  if (preg_match('/^feature\//', $url_alias)) {
-    drupal_goto($id);
+  // first check to see if the URL (e.g. /feature/$id) is already
+  // assigned to a node. If so, then just go there.  Otherwise, 
+  // try to find the feature.
+  $sql = "
+    SELECT source 
+    FROM {url_alias}
+    WHERE alias = :alias
+  ";
+  $match = db_query($sql, array(':alias' => "feature/$id"))->fetchObject();
+  if ($match) {
+    drupal_goto($match->source);
+    return;
   }
-
   $sql = "
     SELECT
       F.name, F.uniquename, F.feature_id,