浏览代码

slight adjustments to semweb forms

Stephen Ficklin 8 年之前
父节点
当前提交
739fdf0dc4

+ 50 - 7
tripal/includes/tripal.term_lookup.inc

@@ -45,46 +45,89 @@ function tripal_vocabulary_lookup_term_page($vocabulary, $accession) {
   $headers = array();
   $rows = array();
   $term_name = $term['name'];
+  $accession = $term['vocabulary']['short_name'] . ':' . $term['accession'];
   if ($term['url']) {
     $term_name = l($term['name'], $term['url'], array('attributes' => array('target' => '_blank')));
   }
+  $rows[] = array(
+    array(
+      'data' => 'Term',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $accession,
+  );
+  $rows[] = array(
+    array(
+      'data' => 'Name',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $term_name,
+  );
+  $rows[] = array(
+    array(
+      'data' => 'Definition',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $term['definition'],
+  );
+
+
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(),
+    'sticky' => FALSE,
+    'caption' => 'Term Details',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  $content = theme_table($table);
+
+
+  $rows = array();
   $vocab_name = $term['vocabulary']['name'];
   if ($term['vocabulary']['url']) {
     $vocab_name = l($term['vocabulary']['name'], $term['vocabulary']['url'], array('attributes' => array('target' => '_blank')));
   }
+  $short_name = $term['vocabulary']['short_name'];
+  $vocab_desc = $term['vocabulary']['description'];
   $rows[] = array(
     array(
       'data' => 'Name',
       'header' => TRUE,
       'width' => '20%',
     ),
-    $term_name,
+    $vocab_name,
   );
   $rows[] = array(
     array(
-      'data' => 'Vocabulary',
+      'data' => 'Short Name',
       'header' => TRUE,
       'width' => '20%',
     ),
-    $vocab_name . ': ' . $term['vocabulary']['description']. '',
+    $short_name,
   );
   $rows[] = array(
     array(
-      'data' => 'Definition',
+      'data' => 'Description',
       'header' => TRUE,
       'width' => '20%',
     ),
-    $term['definition'],
+    $vocab_desc,
   );
+
   $table = array(
     'header' => $headers,
     'rows' => $rows,
     'attributes' => array(),
     'sticky' => FALSE,
-    'caption' => '',
+    'caption' => 'Term Vocabulary details',
     'colgroups' => array(),
     'empty' => '',
   );
-  $content = theme_table($table);
+  $content .=  theme_table($table);
   return $content;
 }

+ 21 - 3
tripal_chado/includes/tripal_chado.semweb.inc

@@ -465,7 +465,17 @@ function tripal_chado_semweb_form($form, &$form_state, $chado_table = NULL) {
       ->execute()
       ->fetchField();
     $columns = $schema['fields'];
-    $headers = array('Field Name', 'Vocabulary', 'Term Name', 'Term Description', 'Action');
+    $headers = array(
+      'Field Name',
+      'Vocabulary',
+      array(
+        'data' => 'Name',
+        'nowrap' => TRUE,
+      ),
+      'Term',
+      'Term Description',
+      'Action'
+    );
     $rows = array();
     foreach ($columns AS $column => $detail) {
       // Do not show column if it's the primary key or default cv
@@ -480,21 +490,29 @@ function tripal_chado_semweb_form($form, &$form_state, $chado_table = NULL) {
         $sw_voc = '';
         $sw_term = '';
         $sw_desc = '';
+        $sw_accession = '';
         if($cvterm_id) {
           $term = tripal_get_cvterm(array(
             'cvterm_id' => $cvterm_id
           ));
           $sw_voc = $term->cv_id->name;
           $sw_term = $term->name;
+          $sw_accession = l($term->dbxref_id->db_id->name . ':' . $term->dbxref_id->accession,
+              'cv/lookup/' . $term->dbxref_id->db_id->name . '/' . $term->dbxref_id->accession,
+              array('attributes' => array('target' => '_blank')));
           $sw_desc = $term->definition;
         }
         $rows[] = array(
           $column,
           $sw_voc,
           $sw_term,
+          $sw_accession,
           $sw_desc,
-          l('Edit', '/admin/tripal/storage/chado/semweb/edit/' . $chado_table . '/' . $column) . ' | ' .
-          l('Reset', '/admin/tripal/storage/chado/semweb/reset/' . $chado_table . '/' . $column)
+          array(
+            'data' => l('Edit', '/admin/tripal/storage/chado/semweb/edit/' . $chado_table . '/' . $column) . ' | ' .
+                      l('Reset', '/admin/tripal/storage/chado/semweb/reset/' . $chado_table . '/' . $column),
+            'nowrap' => TRUE,
+          ),
         );
       }
     }

+ 2 - 5
tripal_chado/includes/tripal_chado.vocab_storage.inc

@@ -45,7 +45,8 @@ function tripal_chado_vocab_get_term($vocabulary, $accession) {
   $cvterm = chado_expand_var($cvterm, 'field', 'cvterm.definition');
   $term = array(
     'vocabulary' => array(
-      'name' => $cvterm->dbxref_id->db_id->name,
+      'name' => $cvterm->cv_id->name,
+      'short_name' => $cvterm->dbxref_id->db_id->name,
       'description' =>  $cvterm->dbxref_id->db_id->description,
       'url' => $cvterm->dbxref_id->db_id->url
     ),
@@ -53,10 +54,6 @@ function tripal_chado_vocab_get_term($vocabulary, $accession) {
     'name'       => $cvterm->name,
     'url'        => tripal_get_dbxref_url($cvterm->dbxref_id),
     'definition' => (isset($cvterm->definition)) ? $cvterm->definition : '',
-    // The following are not required for the returned array but we'll
-    // add these for convenience later when we look at the TripalTerm
-    // objects and these will be there.
-    'cvterm'     => $cvterm,
   );
   return $term;
 }