Browse Source

Chado node api: changed description text to be more helpful

Lacey Sanderson 10 years ago
parent
commit
4ccb7210dd

+ 17 - 9
tripal_core/api/tripal_core.chado_nodes.dbxrefs.api.inc

@@ -142,6 +142,9 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
       $db_options[$db->db_id] = $db->name;
     }
   }
+  
+  // Determine the node type using the name of the foreign key.
+  $details['nodetype'] = str_replace('_id', '', $details['base_foreign_key']);
 
   // Tell tripal administrators how to add terms to the property types drop down.
   $importance = (empty($db_options)) ? TRIPAL_WARNING : TRIPAL_INFO;
@@ -167,13 +170,19 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
   );
 
   // the fieldset of the dbxref elements
+  $instructions = 'To add an external reference, select the database you want to reference from the 
+    drop-down below. Then enter the name/accession (as it is shown in the external database) of this 
+    particular %nodetype into the text box before clicking "Add". The version can be used to 
+    indicate the version of the external database or the version of the reference 
+    depending upon what is available. To remove incorrect references, click the 
+    "Remove" button. Note: you cannot edit previously added references but instead 
+    need to remove and re-add them.';
   $form['addtl_dbxrefs'] = array(
     '#type' => 'fieldset',
     '#title' => t($details['fieldset_title']),
-    '#description' => t('You may add additional database references by
-      selecting a database reference type from the dropdown and adding text.  You may add
-      as many database references as desired by clicking the add button on the right.  To
-      remove a database reference, click the remove button. ' . $details['additional_instructions']),
+    '#description' => t('<p><strong>Indicate that this %nodetype either originates from 
+      or is present in another database.</strong></p><p>'. $instructions . $details['additional_instructions'] . '</p>', 
+      array('%nodetype' => $details['nodetype'])),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
     '#group' => 'chado_node_api',
@@ -186,11 +195,6 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
     ),
   );
 
-  $form['addtl_dbxrefs']['admin_message'] = array(
-    '#type' => 'markup',
-    '#markup' => $tripal_message
-  );
-
   // this form element is a tree, so that we don't puke all of the values into then node variable
   // it is set as a tree, and keeps them in the $form_state['values']['dbxref_table'] heading.
   $form['addtl_dbxrefs']['dbxref_table'] = array(
@@ -409,6 +413,10 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
     )
   );
 
+  $form['addtl_dbxrefs']['admin_message'] = array(
+    '#type' => 'markup',
+    '#markup' => $tripal_message
+  );
 }
 
 /**

+ 16 - 8
tripal_core/api/tripal_core.chado_nodes.properties.api.inc

@@ -172,8 +172,12 @@ function chado_add_node_form_properties(&$form, &$form_state, $details) {
   if (!array_key_exists('chado_id_field', $details)) {
     $chado_id_table = preg_replace('/prop$/', '', $details['property_table']);
     $chado_id_field = $chado_id_table . '_id';
+    $details['nodetype'] = $chado_id_table;
     $details['chado_id_field'] = $chado_id_field;
   }
+  else {
+    $details['nodetype'] = str_replace('_id', '', $details['chado_id_field']);
+  }
 
   // make sure the specified cv exists
   if (isset($details['cv_name'])) {
@@ -321,12 +325,16 @@ function chado_add_node_form_properties(&$form, &$form_state, $details) {
   );
 
   // the fieldset of the property elements
+  $instructions = 'To add properties of the current %nodetype, select the type of 
+      information from the drop-down below and enter the information in the text box before 
+      clicking "Add". To remove incorrect information, click the "Remove" button. 
+      Note: you cannot edit previously added information but instead need to 
+      remove and re-add it.';
   $form['properties'] = array(
     '#type' => 'fieldset',
     '#title' => t($details['fieldset_title']),
-    '#description' => t('Add properties by selecting a type
-      from the dropdown, enter a value and click the "Add" button. To
-      remove a property, click the remove button.' . $details['additional_instructions']),
+    '#description' => t('<p><strong>Additional information about a 
+      %nodetype.</strong></p><p>'. $instructions . $details['additional_instructions'] . '</p>', array('%nodetype' => $details['nodetype'])) ,
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
     '#group' => 'chado_node_api',
@@ -339,11 +347,6 @@ function chado_add_node_form_properties(&$form, &$form_state, $details) {
     ),
   );
 
-  $form['properties']['admin_message'] = array(
-    '#type' => 'markup',
-    '#markup' => $tripal_message
-  );
-
   // this form element is a tree, so that we don't puke all of the values into then node variable
   // it is set as a tree, and keeps them in the $form_state['values']['property_table'] heading.
   $form['properties']['property_table'] = array(
@@ -616,6 +619,11 @@ function chado_add_node_form_properties(&$form, &$form_state, $details) {
       array('property_table')  // Validate all fields within $form_state['values']['property_table']
     )
   );
+
+  $form['properties']['admin_message'] = array(
+    '#type' => 'markup',
+    '#markup' => $tripal_message
+  );
 }
 
 /**

+ 14 - 10
tripal_core/api/tripal_core.chado_nodes.relationships.api.inc

@@ -300,18 +300,18 @@ function chado_add_node_form_relationships(&$form, &$form_state, $details) {
     ),
   );
 
+  $instructions = 'Relationships should be read like a sentence ([subject] [type] 
+    [object]) in order to determine their direction and thus their meaning. When 
+    adding a relationship, it is easiest to first select the type of relationship you would 
+    like to enter and then select whether the current %nodetype is the subject
+    or object (based on which "sentence" makes sense). Finally enter the other 
+    %nodetype in the remaining text box (making sure to select from the 
+    autocomplete drop-down) before clicking "Add". To remove incorrect relationships, click the 
+    "Remove" button. Note: you cannot edit previously added relationships 
+    but instead need to remove and re-add them.';
   $form['relationships']['descrip'] = array(
     '#type' => 'item',
-    '#markup' => t('You may add relationships between this %nodetype and other
-      %nodetype_plural by entering the details below.  You may add
-      as many relationships as desired by clicking the add button on the right.  To
-      remove a relationship, click the remove button. ' . $details['additional_instructions'],
-      array('%nodetype' => $details['nodetype'], '%nodetype_plural' => $details['nodetype_plural'])),
-  );
-
-  $form['relationships']['admin_message'] = array(
-    '#type' => 'markup',
-    '#markup' => $tripal_message
+    '#markup' => t('<p><strong>Relate the current %nodetype with others that already exist.</strong></p><p>'. $instructions . $details['additional_instructions'] . '</p>', array('%nodetype' => $details['nodetype'])),
   );
 
   // this form element is a tree, so that we don't puke all of the values into then node variable
@@ -560,6 +560,10 @@ function chado_add_node_form_relationships(&$form, &$form_state, $details) {
     )
   );
 
+  $form['relationships']['admin_message'] = array(
+    '#type' => 'markup',
+    '#markup' => $tripal_message
+  );
 }
 
 /**