Selaa lähdekoodia

Table of contents on node types is now built using the tripal_core_node_view_alter. Titles of blocks are now set using the same hook so that the table of contents and the block titles will always match. All templates have outer div container and title div removed

Stephen Ficklin 11 vuotta sitten
vanhempi
commit
6ef8317426
81 muutettua tiedostoa jossa 4425 lisäystä ja 4506 poistoa
  1. 4 0
      tripal_analysis/includes/tripal_analysis.chado_node.inc
  2. 97 99
      tripal_analysis/theme/tripal_analysis/tripal_analysis_base.tpl.php
  3. 36 38
      tripal_analysis/theme/tripal_analysis/tripal_analysis_properties.tpl.php
  4. 9 0
      tripal_contact/includes/tripal_contact.chado_node.inc
  5. 61 64
      tripal_contact/theme/tripal_contact/tripal_contact_base.tpl.php
  6. 38 41
      tripal_contact/theme/tripal_contact/tripal_contact_properties.tpl.php
  7. 64 67
      tripal_contact/theme/tripal_contact/tripal_contact_publications.tpl.php
  8. 99 102
      tripal_contact/theme/tripal_contact/tripal_contact_relationships.tpl.php
  9. 1 3
      tripal_core/theme/css/tripal.css
  10. 31 64
      tripal_core/theme/node--chado-generic.tpl.php
  11. 85 21
      tripal_core/tripal_core.module
  12. 8 0
      tripal_example/includes/tripal_example.chado_node.inc
  13. 31 4
      tripal_feature/includes/tripal_feature.chado_node.inc
  14. 64 66
      tripal_feature/theme/tripal_feature/tripal_feature_alignments.tpl.php
  15. 42 45
      tripal_feature/theme/tripal_feature/tripal_feature_analyses.tpl.php
  16. 89 92
      tripal_feature/theme/tripal_feature/tripal_feature_base.tpl.php
  17. 97 100
      tripal_feature/theme/tripal_feature/tripal_feature_featurepos.tpl.php
  18. 38 42
      tripal_feature/theme/tripal_feature/tripal_feature_properties.tpl.php
  19. 64 67
      tripal_feature/theme/tripal_feature/tripal_feature_publications.tpl.php
  20. 53 56
      tripal_feature/theme/tripal_feature/tripal_feature_references.tpl.php
  21. 118 120
      tripal_feature/theme/tripal_feature/tripal_feature_relationships.tpl.php
  22. 1 4
      tripal_feature/theme/tripal_feature/tripal_feature_sequence.tpl.php
  23. 38 41
      tripal_feature/theme/tripal_feature/tripal_feature_synonyms.tpl.php
  24. 49 52
      tripal_feature/theme/tripal_feature/tripal_feature_terms.tpl.php
  25. 86 92
      tripal_feature/theme/tripal_organism/tripal_organism_feature_browser.tpl.php
  26. 44 50
      tripal_feature/theme/tripal_organism/tripal_organism_feature_counts.tpl.php
  27. 11 0
      tripal_featuremap/includes/tripal_featuremap.chado_node.inc
  28. 63 67
      tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.base.tpl.php
  29. 109 112
      tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.featurepos.tpl.php
  30. 38 44
      tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.properties.tpl.php
  31. 64 67
      tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.publication.tpl.php
  32. 46 49
      tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.references.tpl.php
  33. 104 108
      tripal_genetic/theme/tripal_feature/tripal_feature.genotypes.tpl.php
  34. 104 107
      tripal_genetic/theme/tripal_stock/tripal_stock.genotypes.tpl.php
  35. 4 0
      tripal_genetic/tripal_genetic.module
  36. 17 0
      tripal_library/includes/tripal_library.chado_node.inc
  37. 50 53
      tripal_library/theme/tripal_feature/tripal_feature.libraries.tpl.php
  38. 87 92
      tripal_library/theme/tripal_library/tripal_library.base.tpl.php
  39. 38 42
      tripal_library/theme/tripal_library/tripal_library.properties.tpl.php
  40. 64 67
      tripal_library/theme/tripal_library/tripal_library.publications.tpl.php
  41. 47 50
      tripal_library/theme/tripal_library/tripal_library.references.tpl.php
  42. 38 41
      tripal_library/theme/tripal_library/tripal_library.synonyms.tpl.php
  43. 48 51
      tripal_library/theme/tripal_library/tripal_library.terms.tpl.php
  44. 50 53
      tripal_library/theme/tripal_organism/tripal_organism.libraries.tpl.php
  45. 125 128
      tripal_natural_diversity/theme/tripal_feature/tripal_feature.nd_genotypes.tpl.php
  46. 124 127
      tripal_natural_diversity/theme/tripal_stock/tripal_stock.nd_genotypes.tpl.php
  47. 81 84
      tripal_natural_diversity/theme/tripal_stock/tripal_stock.nd_phenotypes.tpl.php
  48. 9 3
      tripal_natural_diversity/tripal_natural_diversity.module
  49. 4 1
      tripal_organism/includes/tripal_organism.chado_node.inc
  50. 89 91
      tripal_organism/theme/tripal_organism/tripal_organism_base.tpl.php
  51. 0 11
      tripal_organism/theme/tripal_organism/tripal_organism_description.tpl.php
  52. 0 20
      tripal_organism/theme/tripal_organism/tripal_organism_image.tpl.php
  53. 0 24
      tripal_organism/tripal_organism.module
  54. 54 57
      tripal_phenotype/theme/tripal_feature/tripal_feature.phenotypes.tpl.php
  55. 2 0
      tripal_phenotype/tripal_phenotype.module
  56. 11 0
      tripal_project/includes/tripal_project.chado_node.inc
  57. 54 58
      tripal_project/theme/tripal_project/tripal_project.base.tpl.php
  58. 62 65
      tripal_project/theme/tripal_project/tripal_project.contact.tpl.php
  59. 39 41
      tripal_project/theme/tripal_project/tripal_project.properties.tpl.php
  60. 64 67
      tripal_project/theme/tripal_project/tripal_project.publications.tpl.php
  61. 54 57
      tripal_project/theme/tripal_project/tripal_project.relationships.tpl.php
  62. 61 40
      tripal_pub/includes/tripal_pub.chado_node.inc
  63. 69 72
      tripal_pub/theme/tripal_pub/tripal_pub_authors.tpl.php
  64. 153 156
      tripal_pub/theme/tripal_pub/tripal_pub_base.tpl.php
  65. 56 59
      tripal_pub/theme/tripal_pub/tripal_pub_featuremaps.tpl.php
  66. 59 62
      tripal_pub/theme/tripal_pub/tripal_pub_features.tpl.php
  67. 62 65
      tripal_pub/theme/tripal_pub/tripal_pub_libraries.tpl.php
  68. 61 64
      tripal_pub/theme/tripal_pub/tripal_pub_projects.tpl.php
  69. 51 54
      tripal_pub/theme/tripal_pub/tripal_pub_properties.tpl.php
  70. 48 51
      tripal_pub/theme/tripal_pub/tripal_pub_references.tpl.php
  71. 118 120
      tripal_pub/theme/tripal_pub/tripal_pub_relationships.tpl.php
  72. 59 62
      tripal_pub/theme/tripal_pub/tripal_pub_stocks.tpl.php
  73. 17 0
      tripal_stock/includes/tripal_stock.chado_node.inc
  74. 61 64
      tripal_stock/theme/tripal_organism/tripal_organism_stocks.tpl.php
  75. 64 67
      tripal_stock/theme/tripal_stock/tripal_stock.publications.tpl.php
  76. 90 93
      tripal_stock/theme/tripal_stock/tripal_stock_base.tpl.php
  77. 48 51
      tripal_stock/theme/tripal_stock/tripal_stock_collections.tpl.php
  78. 38 42
      tripal_stock/theme/tripal_stock/tripal_stock_properties.tpl.php
  79. 53 56
      tripal_stock/theme/tripal_stock/tripal_stock_references.tpl.php
  80. 118 120
      tripal_stock/theme/tripal_stock/tripal_stock_relationships.tpl.php
  81. 38 41
      tripal_stock/theme/tripal_stock/tripal_stock_synonyms.tpl.php

+ 4 - 0
tripal_analysis/includes/tripal_analysis.chado_node.inc

@@ -595,9 +595,13 @@ function tripal_analysis_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_analysis_base'] = array(
           '#value' => theme('tripal_analysis_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
         );
         $node->content['tripal_analysis_properties'] = array(
           '#value' => theme('tripal_analysis_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
         );
       }
       if ($view_mode == 'teaser') {

+ 97 - 99
tripal_analysis/theme/tripal_analysis/tripal_analysis_base.tpl.php

@@ -2,111 +2,109 @@
 $analysis = $variables['node']->analysis;
 $analysis = tripal_core_expand_chado_vars($analysis,'field','analysis.description'); ?>
 
-<div id="tripal_analysis-base-box" class="tripal_analysis-info-box tripal-info-box">
-  <div class="tripal_analysis-info-box-title tripal-info-box-title">Details</div>
-  <div class="tripal__analysis-info-box-desc tripal-info-box-desc"></div><?php 
-    
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  // This table for the analysis has a vertical header (down the first column)
-  // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array();
+<div class="tripal__analysis-info-box-desc tripal-info-box-desc"></div><?php 
   
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
+// the $headers array is an array of fields to use as the colum headers. 
+// additional documentation can be found here 
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+// This table for the analysis has a vertical header (down the first column)
+// so we do not provide headers here, but specify them in the $rows array below.
+$headers = array();
 
-  // Analysis Name row
-  $rows[] = array(
-    array(
-      'data' => 'Analysis Name',
-      'header' => TRUE
-    ),
-    $analysis->name
-  );
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+$rows = array();
 
-  // Implementation row
-  $software = $analysis->program;
-  if($analysis->programversion != 'n/a'){
-    $software .=  " (" . $analysis->programversion . ")";
-  }
-  if($analysis->algorithm){
-    $software .= ". " . $analysis->algorithm;
-  }
-  $rows[] = array(
-    array(
-      'data' => 'Method',
-      'header' => TRUE
-    ),
-    $software
-  );
- 
-  // Source row
-  $source = '';
-  if($analysis->sourceuri){
-    $source = "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>";
-  } 
-  else {
-    $source = $analysis->sourcename;
-  }
-  if($analysis->sourceversion){
-    $source = " (" . $analysis->sourceversion . ")";
-  }
+// Analysis Name row
+$rows[] = array(
+  array(
+    'data' => 'Analysis Name',
+    'header' => TRUE
+  ),
+  $analysis->name
+);
+
+// Implementation row
+$software = $analysis->program;
+if($analysis->programversion != 'n/a'){
+  $software .=  " (" . $analysis->programversion . ")";
+}
+if($analysis->algorithm){
+  $software .= ". " . $analysis->algorithm;
+}
+$rows[] = array(
+  array(
+    'data' => 'Method',
+    'header' => TRUE
+  ),
+  $software
+);
+
+// Source row
+$source = '';
+if($analysis->sourceuri){
+  $source = "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>";
+} 
+else {
+  $source = $analysis->sourcename;
+}
+if($analysis->sourceversion){
+  $source = " (" . $analysis->sourceversion . ")";
+}
+$rows[] = array(
+  array(
+    'data' => 'Source',
+    'header' => TRUE
+  ),
+  $source
+);
+
+// Date performed row
+$rows[] = array(
+  array(
+    'data' => 'Date performed',
+    'header' => TRUE
+  ),
+  preg_replace("/^(\d+-\d+-\d+) .*/","$1", $analysis->timeexecuted),
+); 
+
+// allow site admins to see the analysis ID
+if (user_access('access administration pages')) {
+  // Analysis ID
   $rows[] = array(
     array(
-      'data' => 'Source',
-      'header' => TRUE
+      'data' => 'Analysis ID',
+      'header' => TRUE,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $source
-  );
-  
-  // Date performed row
-  $rows[] = array(
     array(
-      'data' => 'Date performed',
-      'header' => TRUE
+      'data' => $analysis->analysis_id,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    preg_replace("/^(\d+-\d+-\d+) .*/","$1", $analysis->timeexecuted),
-  ); 
-  
-  // allow site admins to see the analysis ID
-  if (user_access('access administration pages')) {
-    // Analysis ID
-    $rows[] = array(
-      array(
-        'data' => 'Analysis ID',
-        'header' => TRUE,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-      array(
-        'data' => $analysis->analysis_id,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-    );
-  }
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_analysis-table-base',
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
   );
- 
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table); 
-  if (property_exists($analysis, 'description')) { ?>
-    <div style="text-align: justify"><?php print $analysis->description; ?></div> <?php  
-  } ?>
-</div>
+}
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers,
+  'rows' => $rows,
+  'attributes' => array(
+    'id' => 'tripal_analysis-table-base',
+  ),
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(),
+  'empty' => '',
+);
+
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table); 
+if (property_exists($analysis, 'description')) { ?>
+  <div style="text-align: justify"><?php print $analysis->description; ?></div> <?php  
+} ?>
+

+ 36 - 38
tripal_analysis/theme/tripal_analysis/tripal_analysis_properties.tpl.php

@@ -6,43 +6,41 @@ $analysis = tripal_core_expand_chado_vars($analysis,'table', 'analysisprop', arr
 $properties = $analysis->analysisprop;
 
 if (count($properties) > 0) { ?>
-  <div id="tripal_analysis-properties-box" class="tripal_analysis-info-box tripal-info-box">
-    <div class="tripal_analysis-info-box-title tripal-info-box-title">More Details</div>
-    <div class="tripal_analysis-info-box-desc tripal-info-box-desc">Additional information about this analysis:</div><?php
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Property Name', 'Value');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();      
-    foreach ($properties as $property) {
-      $rows[] = array(
-        ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-        $property->value
-      );
-    } 
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_analysis-table-properties',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  <div class="tripal_analysis-info-box-desc tripal-info-box-desc">Additional information about this analysis:</div><?php
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();      
+  foreach ($properties as $property) {
+    $rows[] = array(
+      ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
+      $property->value
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
+  } 
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_analysis-table-properties',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
 }

+ 9 - 0
tripal_contact/includes/tripal_contact.chado_node.inc

@@ -554,15 +554,24 @@ function tripal_contact_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_contact_base'] = array(
           '#value' => theme('tripal_contact_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
+          '#weight' => 0,
         );
         $node->content['tripal_contact_properties'] = array(
           '#value' => theme('tripal_contact_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
         );
         $node->content['tripal_contact_publications'] = array(
           '#value' => theme('tripal_contact_publications', array('node' => $node)),
+          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_title' => 'Publications',
         );
         $node->content['tripal_contact_relationships'] = array(
           '#value' => theme('tripal_contact_relationships', array('node' => $node)),
+          '#tripal_toc_id'    => 'relationships',
+          '#tripal_toc_title' => 'Relationships',
         );
       }
       if ($view_mode == 'teaser') {

+ 61 - 64
tripal_contact/theme/tripal_contact/tripal_contact_base.tpl.php

@@ -1,75 +1,72 @@
 <?php
 $contact = $variables['node']->contact; ?>
 
-<div id="tripal_contact-base-box" class="tripal_contact-info-box tripal-info-box">
-  <div class="tripal_contact-info-box-title tripal-info-box-title">Details</div>
-  <div class="tripal_contact-info-box-desc tripal-info-box-desc"></div> <?php
+<div class="tripal_contact-info-box-desc tripal-info-box-desc"></div> <?php
 
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  // This table for the contact has a vertical header (down the first column)
-  // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array();
-  
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
+// the $headers array is an array of fields to use as the colum headers. 
+// additional documentation can be found here 
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+// This table for the contact has a vertical header (down the first column)
+// so we do not provide headers here, but specify them in the $rows array below.
+$headers = array();
 
-  // Contact Name row
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+$rows = array();
+
+// Contact Name row
+$rows[] = array(
+  array(
+    'data' => 'Name',
+    'header' => TRUE
+  ),
+  $contact->name,
+);
+// Contact Type row
+$rows[] = array(
+  array(
+    'data' => 'Type',
+    'header' => TRUE
+  ),
+  $contact->type_id->name,
+);
+// allow site admins to see the contact ID
+if (user_access('access administration pages')) {
+  // Pub ID
   $rows[] = array(
     array(
-      'data' => 'Name',
-      'header' => TRUE
+      'data' => 'Contact ID',
+      'header' => TRUE,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $contact->name,
-  );
-  // Contact Type row
-  $rows[] = array(
     array(
-      'data' => 'Type',
-      'header' => TRUE
+      'data' => $contact->contact_id,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $contact->type_id->name,
   );
-  // allow site admins to see the contact ID
-  if (user_access('access administration pages')) {
-    // Pub ID
-    $rows[] = array(
-      array(
-        'data' => 'Contact ID',
-        'header' => TRUE,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-      array(
-        'data' => $contact->contact_id,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-    );
-  }
-  
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_contact-table-base',
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
-  );
-  
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table);
-  if (property_exists($contact, 'description')) { ?>
-    <div style="text-align: justify"><?php print $contact->description; ?></div> <?php 
-  } ?>
-</div>
+}
+
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers,
+  'rows' => $rows,
+  'attributes' => array(
+    'id' => 'tripal_contact-table-base',
+  ),
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(),
+  'empty' => '',
+);
+
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table);
+if (property_exists($contact, 'description')) { ?>
+  <div style="text-align: justify"><?php print $contact->description; ?></div> <?php 
+} ?>

+ 38 - 41
tripal_contact/theme/tripal_contact/tripal_contact_properties.tpl.php

@@ -20,46 +20,43 @@ if ($contactprops) {
 
 
 if (count($properties) > 0) { ?>
-  <div id="tripal_contact-properties-box" class="tripal_contact-info-box tripal-info-box">
-    <div class="tripal_contact-info-box-title tripal-info-box-title">More Details</div>
-    <div class="tripal_contact-info-box-desc tripal-info-box-desc">Additional information about this contact:</div><?php
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Property Name', 'Value');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    // add the properties as individual rows
-    foreach ($properties as $property) {
-      $rows[] = array(
-        ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-        $property->value
-      );
-    } 
-    
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_contact-table-properties',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  <div class="tripal_contact-info-box-desc tripal-info-box-desc">Additional information about this contact:</div><?php
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  // add the properties as individual rows
+  foreach ($properties as $property) {
+    $rows[] = array(
+      ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
+      $property->value
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_contact-table-properties',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 64 - 67
tripal_contact/theme/tripal_contact/tripal_contact_publications.tpl.php

@@ -8,78 +8,75 @@ $pubauthor_contacts = $contact->pubauthor_contact;
 
 
 if (count($pubauthor_contacts) > 0) { ?>
-  <div id="tripal_pubauthor_contact-pub-box" class="tripal_pubauthor_contact-info-box tripal-info-box">
-    <div class="tripal_pubauthor_contact-info-box-title tripal-info-box-title">Publications</div>
-    <div class="tripal_pubauthor_contact-info-box-desc tripal-info-box-desc"></div> <?php 
+  <div class="tripal_pubauthor_contact-info-box-desc tripal-info-box-desc"></div> <?php 
+
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Year', 'Publication');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
   
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Year', 'Publication');
+  foreach ($pubauthor_contacts as $pubauthor_contact) {
+    $pub = $pubauthor_contact->pubauthor_id->pub_id;
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
+    $citation = $pub->title;  // use the title as the default citation
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // get the citation for this pub if it exists
+    $values = array(
+      'pub_id' => $pub->pub_id, 
+      'type_id' => array(
+        'name' => 'Citation',
+      ),
+    );
+    $options = array('return_array' => 1);
+    $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
+    if (count($citation_prop) == 1) {
+      $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
+      $citation = $citation_prop[0]->value;
+    }
     
-    foreach ($pubauthor_contacts as $pubauthor_contact) {
-      $pub = $pubauthor_contact->pubauthor_id->pub_id;
-      $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-      $citation = $pub->title;  // use the title as the default citation
-      
-      // get the citation for this pub if it exists
-      $values = array(
-        'pub_id' => $pub->pub_id, 
-        'type_id' => array(
-          'name' => 'Citation',
-        ),
-      );
-      $options = array('return_array' => 1);
-      $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
-      if (count($citation_prop) == 1) {
-        $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
-        $citation = $citation_prop[0]->value;
-      }
-      
-      // if the publication is synced then link to it
-      if ($pub->nid) {
-        // replace the title with a link
-        $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-        $patterns = array(
-          '/(\()/', '/(\))/', 
-          '/(\])/', '/(\[)/',
-          '/(\{)/', '/(\})/',
-          '/(\+)/', '/(\.)/', '/(\?)/', 
-        );
-        $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
-        $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
-      }
-      
-      $rows[] = array(
-        $pub->pyear,
-        $citation,
+    // if the publication is synced then link to it
+    if ($pub->nid) {
+      // replace the title with a link
+      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
+      $patterns = array(
+        '/(\()/', '/(\))/', 
+        '/(\])/', '/(\[)/',
+        '/(\{)/', '/(\})/',
+        '/(\+)/', '/(\.)/', '/(\?)/', 
       );
+      $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
+      $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_contact-table-publications',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $pub->pyear,
+      $citation,
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php 
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_contact-table-publications',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 99 - 102
tripal_contact/theme/tripal_contact/tripal_contact_relationships.tpl.php

@@ -23,107 +23,104 @@ $object_rels = $all_relationships['object'];
 $subject_rels = $all_relationships['subject'];
 
 if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
-  <div id="tripal_contact-relationships-box" class="tripal_contact-info-box tripal-info-box">
-    <div class="tripal_contact-info-box-title tripal-info-box-title">Relationships</div>
-    <div class="tripal_contact-info-box-desc tripal-info-box-desc"></div> <?php
-    // first add in the subject relationships.  
-    foreach ($subject_rels as $rel_type => $rels){
-      foreach ($rels as $obj_type => $objects){ ?>
-        <p>This <?php print strtolower($contact->type_id->name);?>  <b><?php print $rel_type ?></b> with the following <?php print strtolower($obj_type) ?> contact(s): <?php
-         
-        // the $headers array is an array of fields to use as the colum headers.
-        // additional documentation can be found here
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $headers = array('Name');
-        
-        // the $rows array contains an array of rows where each row is an array
-        // of values for each column of the table in that row.  Additional documentation
-        // can be found here:
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $rows = array();
-        
-        foreach ($objects as $object){
-          // link the contact to it's node
-          $contact_name = $object->record->object_id->name;
-          if (property_exists($object->record, 'nid')) {
-            $contact_name = "<a href=\"" . url("node/" . $object->record->nid) . "\" target=\"_blank\">" . $object->record->object_id->name . "</a>";
-          }
+  <div class="tripal_contact-info-box-desc tripal-info-box-desc"></div> <?php
+  // first add in the subject relationships.  
+  foreach ($subject_rels as $rel_type => $rels){
+    foreach ($rels as $obj_type => $objects){ ?>
+      <p>This <?php print strtolower($contact->type_id->name);?>  <b><?php print $rel_type ?></b> with the following <?php print strtolower($obj_type) ?> contact(s): <?php
+       
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Name');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($objects as $object){
+        // link the contact to it's node
+        $contact_name = $object->record->object_id->name;
+        if (property_exists($object->record, 'nid')) {
+          $contact_name = "<a href=\"" . url("node/" . $object->record->nid) . "\" target=\"_blank\">" . $object->record->object_id->name . "</a>";
+        }
 
-          $rows[] = array(
-            $contact_name, 
-          ); 
-         } 
-         // the $table array contains the headers and rows array as well as other
-         // options for controlling the display of the table.  Additional
-         // documentation can be found here:
-         // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-         $table = array(
-           'header' => $headers,
-           'rows' => $rows,
-           'attributes' => array(
-             'id' => 'tripal_contact-table-relationship-object',
-           ),
-           'sticky' => FALSE,
-           'caption' => '',
-           'colgroups' => array(),
-           'empty' => '',
-         );
-         
-         // once we have our table array structure defined, we call Drupal's theme_table()
-         // function to generate the table.
-         print theme_table($table); ?>
-         </p>
-         <br><?php
-       }
-    }
-    
-    // second add in the object relationships.  
-    foreach ($object_rels as $rel_type => $rels){
-      foreach ($rels as $subject_type => $subjects){?>
-        <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> contact(s) are <?php print $rel_type ?> this <?php print $contact->type_id->name;?>: <?php 
-        // the $headers array is an array of fields to use as the colum headers.
-        // additional documentation can be found here
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $headers = array('Name');
-        
-        // the $rows array contains an array of rows where each row is an array
-        // of values for each column of the table in that row.  Additional documentation
-        // can be found here:
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $rows = array();
-        
-        foreach ($subjects as $subject){
-          // link the contact to it's node
-          $contact_name = $subject->record->subject_id->name;
-          if (property_exists($subject->record, 'nid')) {
-            $contact_name = "<a href=\"" . url("node/" . $subject->record->nid) . "\" target=\"_blank\">" . $subject->record->subject_id->name . "</a>";
-          }
-          $rows[] = array(
-            $contact_name, 
-          ); 
-         } 
-         // the $table array contains the headers and rows array as well as other
-         // options for controlling the display of the table.  Additional
-         // documentation can be found here:
-         // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-         $table = array(
-           'header' => $headers,
-           'rows' => $rows,
-           'attributes' => array(
-             'id' => 'tripal_contact-table-relationship-subject',
-           ),
-           'sticky' => FALSE,
-           'caption' => '',
-           'colgroups' => array(),
-           'empty' => '',
-         );
-         
-         // once we have our table array structure defined, we call Drupal's theme_table()
-         // function to generate the table.
-         print theme_table($table); ?>
-         </p>
-         <br><?php
-       }
-    }?>
-  </div> <?php
+        $rows[] = array(
+          $contact_name, 
+        ); 
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_contact-table-relationship-object',
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
+  
+  // second add in the object relationships.  
+  foreach ($object_rels as $rel_type => $rels){
+    foreach ($rels as $subject_type => $subjects){?>
+      <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> contact(s) are <?php print $rel_type ?> this <?php print $contact->type_id->name;?>: <?php 
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Name');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($subjects as $subject){
+        // link the contact to it's node
+        $contact_name = $subject->record->subject_id->name;
+        if (property_exists($subject->record, 'nid')) {
+          $contact_name = "<a href=\"" . url("node/" . $subject->record->nid) . "\" target=\"_blank\">" . $subject->record->subject_id->name . "</a>";
+        }
+        $rows[] = array(
+          $contact_name, 
+        ); 
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_contact-table-relationship-subject',
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
 }

+ 1 - 3
tripal_core/theme/css/tripal.css

@@ -114,12 +114,10 @@
 .tripal-data-block {
    padding: 0;
    margin:  0;
-}
-.tripal-info-box {
    width: 100%;
 }
 
-.tripal-info-box-title {
+.tripal-data-block-title {
   font-size: 1.5em;
   padding-bottom: 5px;
 }

+ 31 - 64
tripal_core/theme/node--chado-generic.tpl.php

@@ -2,92 +2,60 @@
 // Purpose: This template provides a generic layout for all Tripal nodes (page)
 
 // get the template type of node (e.g. if type == chado_organism then template type == organism)
-$ttype = $variables['type'];
-$ttype = preg_replace('/chado_/','', $ttype);
-
-if ($teaser) { 
-  print theme('tripal_' . $ttype . '_teaser', $variables); 
-} 
-else { ?>
-
+$node_type = $variables['type']; ?>
 
 <script type="text/javascript">
 (function ($) {
-  Drupal.behaviors.<?php print $ttype?>Behavior = {
+  Drupal.behaviors.<?php print $node_type?>Behavior = {
     attach: function (context, settings){ 
-      $(".tripal-data-block").hide();
+      // hide all but the first data block 
+      $(".tripal-data-block").hide().filter(":first-child").show();
  
-      // iterate through all of the info boxes and add their titles
-      // to the table of contents
-      $(".tripal-info-box-title").each(function(){
-        var parent = $(this).parent();
-        var id = $(parent).attr('id');
-        var title = $(this).text();
-        $('#tripal_<?php print $ttype?>_toc_list').append('<div class="tripal_toc_list_item"><a href="#'+id+'" class="tripal_<?php print $ttype?>_toc_item">'+title+'</a></div>');
-      });
-
-      // when a title in the table of contents is clicked, then
-      // show the corresponding item in the details box
-      $(".tripal_<?php print $ttype?>_toc_item").click(function(){
-        $(".tripal-data-block").hide();
-        href = $(this).attr('href');
-        if(href.match(/^#/)){
-           //alert("correct: " + href);
-        }
-        else{
-          tmp = href.replace(/^.*?#/, "#");
-          href = tmp;
-          //alert("fixed: " + href);
-        }
-        $(href).parent().fadeIn('slow');
-
+      // when a title in the table of contents is clicked, then 
+      // show the corresponding item in the details box 
+      $(".tripal_toc_list_item_link").click(function(){
+        var id = $(this).attr('id') + "-tripal-data-block";
+        $(".tripal-data-block").hide().filter("#"+ id).show();
         return false;
       }); 
 
-      // we want the base details to show up when the page is first shown 
-      // unless we're using the feature browser then we want that page to show
+      // if a ?block= is specified in the URL then we want to show the
+      // requested block
       var block = window.location.href.match(/[\?|\&]block=(.+?)\&/)
       if(block == null){
         block = window.location.href.match(/[\?|\&]block=(.+)/)
       }
       if(block != null){
-        var parent =  $("#tripal_<?php print $ttype?>-"+block[1]+"-box").parent();
-        parent.show();
-      }
-      else {
-        var parent = $("#tripal_<?php print $ttype?>-base-box").parent();
-        parent.show();
+        $(".tripal-data-block").hide().filter("#" + block[1] + "-tripal-data-block").show();
       }
     }
   };
 })(jQuery);
 </script>
 
-<div id="tripal_<?php print $ttype?>_content" class="tripal-contents"> 
+<div id="tripal_<?php print $node_type?>_content" class="tripal-contents"> 
   <table id="tripal-contents-table">
     <tr class="tripal-contents-table-tr">
-      <td nowrap class="tripal-contents-table-td tripal-contents-table-td-toc"  align="left">
-        <div id="tripal_<?php print $ttype?>_toc_list" class="tripal_toc_list">
-        
-         <!-- Resource Links CCK elements --><?php
-         if(property_exists($node, 'field_resource_links')) {
-           for($i = 0; $i < count($node->field_resource_links); $i++){
-             if($node->field_resource_links[$i]['value']){
-               $matches = preg_split("/\|/",$node->field_resource_links[$i]['value']);?>
-               <li><a href="<?php print $matches[1] ?>" target="_blank"><?php print $matches[0] ?></a></li><?php
-             }
-           }
-         }
-         ?> 
-          </div>
-        </td>
-        <td class="tripal-contents-table-td-data" align="left" width="100%">
+      <td nowrap class="tripal-contents-table-td tripal-contents-table-td-toc"  align="left"><?php
+        print $content['tripal_toc']['#value'] ?>
+          
+          <!-- Resource Links CCK elements --><?php
+          if(property_exists($node, 'field_resource_links')) {
+            for($i = 0; $i < count($node->field_resource_links); $i++){
+              if($node->field_resource_links[$i]['value']){
+                $matches = preg_split("/\|/",$node->field_resource_links[$i]['value']);?>
+                <li><a href="<?php print $matches[1] ?>" target="_blank"><?php print $matches[0] ?></a></li><?php
+              }
+            }
+          } ?> 
+      </td>
+      <td class="tripal-contents-table-td-data" align="left" width="100%">
          <!-- Resource Blocks CCK elements --> <?php
          if (property_exists($node, 'field_resource_titles')) {
            for ($i = 0; $i < count($node->field_resource_titles); $i++){
              if ($node->field_resource_titles[$i]['value']){ ?>
-               <div id="tripal_<?php print $ttype?>-resource_<?php print $i?>-box" class="tripal_<?php print $ttype?>-info-box tripal-info-box">
-                 <div class="tripal_<?php print $ttype?>-info-box-title tripal-info-box-title"><?php print $node->field_resource_titles[$i]['value'] ?></div>
+               <div id="tripal_<?php print $node_type?>-resource_<?php print $i?>-box" class="tripal_<?php print $node_type?>-info-box tripal-info-box">
+                 <div class="tripal_<?php print $node_type?>-info-box-title tripal-info-box-title"><?php print $node->field_resource_titles[$i]['value'] ?></div>
                  <?php print $node->field_resource_blocks[$i]['value']; ?>
                </div> <?php
              }
@@ -96,7 +64,7 @@ else { ?>
          <!-- Let modules add more content -->
          <?php
            foreach ($content as $key => $values) {
-             if (array_key_exists('#value', $values)) {
+             if (array_key_exists('#value', $values) and $key != 'tripal_toc') {
                print $content[$key]['#value'];
              }
            }
@@ -105,6 +73,5 @@ else { ?>
     </tr>
   </table>
 </div> 
-<?php 
-} ?>
+
 

+ 85 - 21
tripal_core/tripal_core.module

@@ -555,7 +555,11 @@ function tripal_core_node_view_alter(&$build) {
 
   $cache = cache_get("theme_registry:$theme", 'cache');
   $node = $build['#node'];
-
+  $toc = array();
+  $toc_html = '';
+  
+  //dpm($build);
+  
   // if we are looking at a Tripal node template then we want to
   // make some changes to each block of content so that we can associate
   // a table of contents and add administrator and curator messages
@@ -565,34 +569,94 @@ function tripal_core_node_view_alter(&$build) {
     // with a '#value' add some extra <div> tags
     foreach ($build as $key => $value) {
 
-      // only examine elements without a '#' prefix
-      if (!preg_match('/^#/', $key)) {
-
-        // get the template path
+      // only examine elements without a '#' prefix and that are not the
+      // tripal table of contents and that have a #value element
+      if (!preg_match('/^#/', $key) and $key != 'tripal_toc' and
+          array_key_exists('#value', $build[$key]) and trim($build[$key]['#value'])) {
+        
+        // intialize the item title, key and id
+        $toc_item_title = $key;
+        $toc_item_id    = $key;
+        $toc_item_link  = '';
+        
+        
+        // BUILD THE TEMPLATE PATH
+        // get the template path so we can put it in an admin message box
         $path = '';
         if (array_key_exists($key, $cache->data) and array_key_exists('path', $cache->data[$key])) {
-
+        
           $path = $cache->data[$key]['path'] . '/' . $key . '.tpl.php';
           $path = theme('tripal_admin_message', array('message' => "Administrators, you can
-            customize the way the content above is presented.  Tripal provides a template
-            file for each block of content.  To customize, copy the template file to your
-            site's default theme, edit then " . 
-            l('clear the Drupal cache', 'admin/config/development/performance', array('attributes' => array('target' => '_blank'))) . ".  
+          customize the way the content above is presented.  Tripal provides a template
+          file for each block of content.  To customize, copy the template file to your
+          site's default theme, edit then " .
+            l('clear the Drupal cache', 'admin/config/development/performance', array('attributes' => array('target' => '_blank'))) . ".
             Currently, the content above is provided by this template: <br><br>$path
-          "));
+            "));
         }
-
-        // if this element has a #value child then add our div box
-        if (array_key_exists('#value', $build[$key])) {
-          $build[$key]['#value'] = "
-            <div id=\"$key-tripal-data-block\" class=\"tripal-data-block\">" .
-              $build[$key]['#value'] .
-              $path .
-            "</div>";
-
-
+  
+        // BUILD THE TOC LINKS
+        // get the title for the table of contents.  Tripal templates should
+        // have a '#tripal_toc_title' element in the build array
+        if (array_key_exists('#tripal_toc_title', $build[$key])) {
+          $toc_item_title = $build[$key]['#tripal_toc_title'];
+        }
+        if (array_key_exists('#tripal_toc_id', $build[$key])) {
+          $toc_item_id = $build[$key]['#tripal_toc_id'];
+        }
+        $toc_item_link = "<div class=\"tripal_toc_list_item\"><a id=\"$toc_item_id\" class=\"tripal_toc_list_item_link\" href=\"?block=$toc_item_id\">$toc_item_title</a></div>";
+        
+        // next check the database. If the title has been overridden then 
+        // we want to use that value
+        $weight = 10;
+        if (array_key_exists('#weight', $build[$key])) {
+          $weight = $build[$key]['#weight'];
         }
+        $toc[$weight][] = $toc_item_link;
+        
+        
+        // CREATE THE DATA BLOCK
+        // add a surrounding <div> box around the content
+        $build[$key]['#value'] = "
+          <div id=\"$toc_item_id-tripal-data-block\" class=\"tripal-data-block\">
+            <div class=\"$toc_item_id-tripal-data-block-title tripal-data-block-title\">$toc_item_title</div> " .
+              $build[$key]['#value'] . "
+              $path 
+            </div>
+          </div>
+        ";
+      }
+    }
+    
+    // BUILD THE TABLE OF CONTENTS LINKS
+    $toc_html = '';
+    ksort($toc, SORT_NUMERIC);
+    foreach ($toc as $weight => $links) {
+      foreach ($links as $index => $toc_item_link) {
+        $toc_html .= $toc_item_link;
       }
     }
+    $build['tripal_toc']['#value'] = "<div id=\"$node->type-tripal-toc-block\" class=\"tripal-toc-block\">$toc_html</div>";
+  }
+  //dpm($cache);
+  //dpm($build);
+}
+
+/**
+ *
+ * @ingroup tripal_core
+ */
+function tripal_core_node_view($node, $view_mode, $langcode) {
+  
+  // if this node type is a chado-based node (i.e. Tripal node)
+  // the we want to add a table of contents to it's content list
+  // this table of contents will be an empty 
+  if (preg_match('/^chado_/', $node->type)) {
+    // Show feature browser and counts
+    if ($view_mode == 'full') {
+      $node->content['tripal_toc'] = array(
+        '#value' => "<div id=\"$node->type-tripal-toc-block\" class=\"tripal-toc-block\"></div>",
+      );
+    }
   }
 }

+ 8 - 0
tripal_example/includes/tripal_example.chado_node.inc

@@ -580,17 +580,25 @@ function tripal_example_node_view($node, $view_mode, $langcode) {
         // is first shown when the example node type is first displayed
         //$node->content['tripal_example_base'] = array(
         //  '#value' => theme('tripal_example_base', array('node' => $node)),
+        //  '#tripal_toc_id'    => 'base',
+        //  '#tripal_toc_title' => 'Details',
         //);
 
         // we can add other templates as well.
         //$node->content['tripal_example_properties'] = array(
         //  '#value' => theme('tripal_example_properties', array('node' => $node)),
+        //  '#tripal_toc_id'    => 'properties',
+        //  '#tripal_toc_title' => 'Properties',
         //);
         //$node->content['tripal_example_publications'] = array(
         //  '#value' => theme('tripal_example_publications', array('node' => $node)),
+        //  '#tripal_toc_id'    => 'publications',
+        //  '#tripal_toc_title' => 'Publications',
         //);
         //$node->content['tripal_example_references'] = array(
         //  '#value' => theme('tripal_example_references', array('node' => $node)),
+        //  '#tripal_toc_id'    => 'references',
+        //  '#tripal_toc_title' => 'Cross References',
         //);
       }
       // set the content for the teaser view

+ 31 - 4
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -761,38 +761,61 @@ function tripal_feature_node_view($node, $view_mode, $langcode) {
     case 'chado_feature':
       // Show feature browser and counts
       if ($view_mode == 'full') {
+        $node->content['tripal_feature_base'] = array(
+          '#value' => theme('tripal_feature_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
+          '#weight' => 0,
+        );
         $node->content['tripal_feature_alignments'] = array(
           '#value' => theme('tripal_feature_alignments', array('node' => $node)),
+          '#tripal_toc_id'    => 'alignments',
+          '#tripal_toc_title' => 'Alignments',
         );
         $node->content['tripal_feature_analyses'] = array(
           '#value' => theme('tripal_feature_analyses', array('node' => $node)),
-        );
-        $node->content['tripal_feature_base'] = array(
-          '#value' => theme('tripal_feature_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'analyses',
+          '#tripal_toc_title' => 'Analyses',
         );
         $node->content['tripal_feature_featurepos'] = array(
-          '#value' => theme('tripal_feature_featurepos', array('node' => $node)),
+          '#value' => theme('tripal_feature_featurepos', array('node' => $node)),          
+          '#tripal_toc_id'    => 'featurepos',
+          '#tripal_toc_title' => 'Maps',
         );
         $node->content['tripal_feature_properties'] = array(
           '#value' => theme('tripal_feature_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
         );
         $node->content['tripal_feature_publications'] = array(
           '#value' => theme('tripal_feature_publications', array('node' => $node)),
+          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_title' => 'Publications',
         );
         $node->content['tripal_feature_references'] = array(
           '#value' => theme('tripal_feature_references', array('node' => $node)),
+          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_title' => 'Cross References',
         );
         $node->content['tripal_feature_relationships'] = array(
           '#value' => theme('tripal_feature_relationships', array('node' => $node)),
+          '#tripal_toc_id'    => 'relationships',
+          '#tripal_toc_title' => 'Relationships',
         );
         $node->content['tripal_feature_seqence'] = array(
           '#value' => theme('tripal_feature_sequence', array('node' => $node)),
+          '#tripal_toc_id'    => 'sequence',
+          '#tripal_toc_title' => 'Sequence',
         );
         $node->content['tripal_feature_synonyms'] = array(
           '#value' => theme('tripal_feature_synonyms', array('node' => $node)),
+          '#tripal_toc_id'    => 'synonyms',
+          '#tripal_toc_title' => 'Synonyms',
         );
         $node->content['tripal_feature_terms'] = array(
           '#value' => theme('tripal_feature_terms', array('node' => $node)),
+          '#tripal_toc_id'    => 'terms',
+          '#tripal_toc_title' => 'Annotated Terms',
         );
       }
       if ($view_mode == 'teaser') {
@@ -806,9 +829,13 @@ function tripal_feature_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_organism_feature_counts'] = array(
           '#value' => theme('tripal_organism_feature_counts', array('node' => $node)),
+          '#tripal_toc_id'    => 'feature_counts',
+          '#tripal_toc_title' => 'Data Type Summary',
         );
         $node->content['tripal_organism_feature_browser'] = array(
           '#value' => theme('tripal_organism_feature_browser', array('node' => $node)),
+          '#tripal_toc_id'    => 'feature_browser',
+          '#tripal_toc_title' => 'Feature Browser',
         );
       }
       break;

+ 64 - 66
tripal_feature/theme/tripal_feature/tripal_feature_alignments.tpl.php

@@ -58,75 +58,73 @@ $feature = $variables['node']->feature;
 $alignments = $feature->all_featurelocs;
 
 if(count($alignments) > 0){ ?>
-  <div id="tripal_feature-alignments-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Alignments</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">The following features are aligned</div><?php
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Aligned Feature' ,'Feature Type', 'Alignment Location');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($alignments as $alignment){
-      $feature_name = $alignment->name;
-      if (property_exists($alignment, 'nid')) {
-        $feature_name = l($feature_name, "node/" . $alignment->nid);
-      }
-      $feature_loc = '';
-      $strand = '.';
-      if ($alignment->strand == -1) {
-        $strand = '-';
-      } 
-      elseif ($alignment->strand == 1) {
-         $strand = '+';
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">The following features are aligned</div><?php
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Aligned Feature' ,'Feature Type', 'Alignment Location');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($alignments as $alignment){
+    $feature_name = $alignment->name;
+    if (property_exists($alignment, 'nid')) {
+      $feature_name = l($feature_name, "node/" . $alignment->nid);
+    }
+    $feature_loc = '';
+    $strand = '.';
+    if ($alignment->strand == -1) {
+      $strand = '-';
+    } 
+    elseif ($alignment->strand == 1) {
+       $strand = '+';
+    } 
+    // if this is a match then make the other location 
+    if(property_exists($alignment, 'right_feature')){
+      $rstrand = '.';
+      if ($alignment->right_strand == -1) {
+        $rstrand = '-';
       } 
-      // if this is a match then make the other location 
-      if(property_exists($alignment, 'right_feature')){
-        $rstrand = '.';
-        if ($alignment->right_strand == -1) {
-          $rstrand = '-';
-        } 
-        elseif ($alignment->right_strand == 1) {
-          $rstrand = '+';
-        }
-        $feature_loc = $feature->name .":". ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand; 
-        $feature_loc .= "<br>" . $alignment->name .":". ($alignment->right_fmin + 1) . ".." . $alignment->right_fmax . " " . $rstrand; 
-      }
-      else {
-        $feature_loc = $alignment->name .":". ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand; 
+      elseif ($alignment->right_strand == 1) {
+        $rstrand = '+';
       }
-      
-      $rows[] = array(
-        $feature_name,
-        $alignment->type,
-        $feature_loc
-      );
-    } 
+      $feature_loc = $feature->name .":". ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand; 
+      $feature_loc .= "<br>" . $alignment->name .":". ($alignment->right_fmin + 1) . ".." . $alignment->right_fmax . " " . $rstrand; 
+    }
+    else {
+      $feature_loc = $alignment->name .":". ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand; 
+    }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-alignments',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $feature_name,
+      $alignment->type,
+      $feature_loc
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div><?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-alignments',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }
 

+ 42 - 45
tripal_feature/theme/tripal_feature/tripal_feature_analyses.tpl.php

@@ -6,51 +6,48 @@ $analyses = $feature->analysisfeature;
 
 // don't show this page if there are no analyses
 if (count($analyses) > 0) { ?>
-  <div id="tripal_feature-analyses-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Analyses</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">This <?php print $feature->type_id->name ?> is derived from or has results from the following analyses</div> <?php
-    
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Analysis Name' ,'Date Performed');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($analyses as $analysis) {
-      $analysis_name = $analysis->analysis_id->name;
-      if (property_exists($analysis->analysis_id, 'nid')) {
-        $analysis_name = l($analysis_name, "node/" . $analysis->analysis_id->nid);
-      } 
-      $rows[] = array(
-        $analysis_name,
-        preg_replace('/\d\d:\d\d:\d\d/', '',  $analysis->analysis_id->timeexecuted),
-      );
-    }
-     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-analyses',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">This <?php print $feature->type_id->name ?> is derived from or has results from the following analyses</div> <?php
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Analysis Name' ,'Date Performed');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($analyses as $analysis) {
+    $analysis_name = $analysis->analysis_id->name;
+    if (property_exists($analysis->analysis_id, 'nid')) {
+      $analysis_name = l($analysis_name, "node/" . $analysis->analysis_id->nid);
+    } 
+    $rows[] = array(
+      $analysis_name,
+      preg_replace('/\d\d:\d\d:\d\d/', '',  $analysis->analysis_id->timeexecuted),
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div><?php 
+  }
+   
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-analyses',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);  
 } 
 

+ 89 - 92
tripal_feature/theme/tripal_feature/tripal_feature_base.tpl.php

@@ -1,111 +1,108 @@
 <?php
 $feature  = $variables['node']->feature;  ?>
 
-<div id="tripal_feature-base-box" class="tripal_feature-info-box tripal-info-box">
-  <div class="tripal_feature-info-box-title tripal-info-box-title">Details</div>
-  <div class="tripal_feature-info-box-desc tripal-info-box-desc"></div> <?php
-   
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  // This table for the analysis has a vertical header (down the first column)
-  // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array();
-  
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
+<div class="tripal_feature-info-box-desc tripal-info-box-desc"></div> <?php
+ 
+// the $headers array is an array of fields to use as the colum headers. 
+// additional documentation can be found here 
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+// This table for the analysis has a vertical header (down the first column)
+// so we do not provide headers here, but specify them in the $rows array below.
+$headers = array();
 
-  // Name row
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+$rows = array();
+
+// Name row
+$rows[] = array(
+  array(
+    'data' => 'Name',
+    'header' => TRUE
+  ),
+  $feature->name
+);
+// Unique Name row
+$rows[] = array(
+  array(
+    'data' => 'Unique Name',
+    'header' => TRUE
+  ),
+  $feature->uniquename
+);
+// Type row
+$rows[] = array(
+  array(
+    'data' => 'Type',
+    'header' => TRUE
+  ),
+  $feature->type_id->name
+);
+// Organism row
+$organism = $feature->organism_id->genus ." " . $feature->organism_id->species ." (" . $feature->organism_id->common_name .")";
+if (property_exists($feature->organism_id, 'nid')) {
+  $organism = l("<i>" . $feature->organism_id->genus . " " . $feature->organism_id->species . "</i> (" . $feature->organism_id->common_name .")", "node/".$feature->organism_id->nid, array('html' => TRUE));
+} 
+$rows[] = array(
+  array(
+    'data' => 'Organism',
+    'header' => TRUE,
+  ),
+  $organism
+);
+// Seqlen row
+if($feature->seqlen > 0) {
   $rows[] = array(
     array(
-      'data' => 'Name',
-      'header' => TRUE
+      'data' => 'Sequence length',
+      'header' => TRUE,
     ),
-    $feature->name
+    $feature->seqlen
   );
-  // Unique Name row
+}
+// allow site admins to see the feature ID
+if (user_access('access administration pages')) { 
+  // Feature ID
   $rows[] = array(
     array(
-      'data' => 'Unique Name',
-      'header' => TRUE
+      'data' => 'Feature ID',
+      'header' => TRUE,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $feature->uniquename
-  );
-  // Type row
-  $rows[] = array(
     array(
-      'data' => 'Type',
-      'header' => TRUE
+      'data' => $feature->feature_id,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $feature->type_id->name
   );
-  // Organism row
-  $organism = $feature->organism_id->genus ." " . $feature->organism_id->species ." (" . $feature->organism_id->common_name .")";
-  if (property_exists($feature->organism_id, 'nid')) {
-    $organism = l("<i>" . $feature->organism_id->genus . " " . $feature->organism_id->species . "</i> (" . $feature->organism_id->common_name .")", "node/".$feature->organism_id->nid, array('html' => TRUE));
-  } 
+}
+// Is Obsolete Row
+if($feature->is_obsolete == TRUE){
   $rows[] = array(
     array(
-      'data' => 'Organism',
-      'header' => TRUE,
+      'data' => '<div class="tripal_feature-obsolete">This feature is obsolete</div>',
+      'colspan' => 2
     ),
-    $organism
   );
-  // Seqlen row
-  if($feature->seqlen > 0) {
-    $rows[] = array(
-      array(
-        'data' => 'Sequence length',
-        'header' => TRUE,
-      ),
-      $feature->seqlen
-    );
-  }
-  // allow site admins to see the feature ID
-  if (user_access('access administration pages')) { 
-    // Feature ID
-    $rows[] = array(
-      array(
-        'data' => 'Feature ID',
-        'header' => TRUE,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-      array(
-        'data' => $feature->feature_id,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-    );
-  }
-  // Is Obsolete Row
-  if($feature->is_obsolete == TRUE){
-    $rows[] = array(
-      array(
-        'data' => '<div class="tripal_feature-obsolete">This feature is obsolete</div>',
-        'colspan' => 2
-      ),
-    );
-  }
+}
 
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_feature-table-base',
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
-  );
-  
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table); ?>
-</div>
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers,
+  'rows' => $rows,
+  'attributes' => array(
+    'id' => 'tripal_feature-table-base',
+  ),
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(),
+  'empty' => '',
+);
+
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table); 

+ 97 - 100
tripal_feature/theme/tripal_feature/tripal_feature_featurepos.tpl.php

@@ -39,112 +39,109 @@ $total_records = $_SESSION['chado_pager'][$featurepos_pager_id]['total_records']
 
 
 if(count($map_positions) > 0){ ?>
-  <div id="tripal_feature-featurepos-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Maps</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">This feature is contained in the following <?php print number_format($total_records) ?> map(s):</div><?php 
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">This feature is contained in the following <?php print number_format($total_records) ?> map(s):</div><?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Map Name', 'Landmark', 'Type', 'Position');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Map Name', 'Landmark', 'Type', 'Position');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
 
-    // iterate through our map positions    
-    foreach ($map_positions as $position){
-      $map_feature = $position->map_feature_id;
+  // iterate through our map positions    
+  foreach ($map_positions as $position){
+    $map_feature = $position->map_feature_id;
 
-      // check if there are any values in the featureposprop table for the start and stop
-      $mappos = $position->mappos;
-      $options = array(
-        'return_array' => 1,
-        'include_fk' => array(
-          'type_id' => 1,            
-        ),
-      );
-      $position = tripal_core_expand_chado_vars($position, 'table', 'featureposprop', $options);
-      $featureposprop = $position->featureposprop;
-      $start = '';
-      $stop = '';
-      if (is_array($featureposprop)) {
-        foreach ($featureposprop as $index => $property) {
-           if ($property->type_id->name == 'start') {
-             $start = $property->value;
-           }
-           if ($property->type_id->name == 'stop') {
-             $stop = $property->value;
-           }
-        }      
-      }  
-      if ($start and $stop and $start != $stop) {
-        $mappos = "$start-$stop";
-      }
-      if ($start and !$stop) {
-        $mappos = $start;
-      }
-      if ($start and $stop and $start == $stop) {
-        $mappos = $start;
-      }
-      
-      // get the map name feature
-      $map_name =  $position->featuremap_id->name;
-      if (property_exists($position->featuremap_id, 'nid')) {
-        $map_name = l($map_name, 'node/' . $position->featuremap_id->nid, array('attributes' => array('target' => '_blank')));
-      }
-      
-      
-      // get the landmark
-      $landmark = $map_feature->name;
-      if (property_exists($map_feature, 'nid')) {
-        $landmark =  l($landmark, 'node/' . $map_feature->nid, array('attributes' => array('target' => '_blank')));
-      }
-      
-      $rows[] = array(
-        $map_name,
-        $landmark,
-        $map_feature->type_id->name,
-        $mappos . ' ' . $position->featuremap_id->unittype_id->name,
-      );
-    }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-featurepos',
+    // check if there are any values in the featureposprop table for the start and stop
+    $mappos = $position->mappos;
+    $options = array(
+      'return_array' => 1,
+      'include_fk' => array(
+        'type_id' => 1,            
       ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
     );
-
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); 
+    $position = tripal_core_expand_chado_vars($position, 'table', 'featureposprop', $options);
+    $featureposprop = $position->featureposprop;
+    $start = '';
+    $stop = '';
+    if (is_array($featureposprop)) {
+      foreach ($featureposprop as $index => $property) {
+         if ($property->type_id->name == 'start') {
+           $start = $property->value;
+         }
+         if ($property->type_id->name == 'stop') {
+           $stop = $property->value;
+         }
+      }      
+    }  
+    if ($start and $stop and $start != $stop) {
+      $mappos = "$start-$stop";
+    }
+    if ($start and !$stop) {
+      $mappos = $start;
+    }
+    if ($start and $stop and $start == $stop) {
+      $mappos = $start;
+    }
     
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'features'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $featurepos_pager_id,
-      'parameters' => array(
-        'block' => 'featurepos'
-      ),
-      'quantity' => $num_results_per_page,
+    // get the map name feature
+    $map_name =  $position->featuremap_id->name;
+    if (property_exists($position->featuremap_id, 'nid')) {
+      $map_name = l($map_name, 'node/' . $position->featuremap_id->nid, array('attributes' => array('target' => '_blank')));
+    }
+    
+    
+    // get the landmark
+    $landmark = $map_feature->name;
+    if (property_exists($map_feature, 'nid')) {
+      $landmark =  l($landmark, 'node/' . $map_feature->nid, array('attributes' => array('target' => '_blank')));
+    }
+    
+    $rows[] = array(
+      $map_name,
+      $landmark,
+      $map_feature->type_id->name,
+      $mappos . ' ' . $position->featuremap_id->unittype_id->name,
     );
-    print theme_pager($pager); ?>
-  </div> <?php 
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-featurepos',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'features'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $featurepos_pager_id,
+    'parameters' => array(
+      'block' => 'featurepos'
+    ),
+    'quantity' => $num_results_per_page,
+  );
+  print theme_pager($pager); 
 }?>
 

+ 38 - 42
tripal_feature/theme/tripal_feature/tripal_feature_properties.tpl.php

@@ -5,48 +5,44 @@ $options = array('return_array' => 1);
 $feature = tripal_core_expand_chado_vars($feature, 'table', 'featureprop', $options);
 $properties = $feature->featureprop;
 
-if(count($properties) > 0){ ?>
-
-  <div id="tripal_feature-properties-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Properties</div> <?php
-
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Property Name', 'Value');
+if(count($properties) > 0){ 
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($properties as $property){
-      $property = tripal_core_expand_chado_vars($property,'field','featureprop.value');
-      $rows[] = array(
-        ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-        urldecode($property->value)
-      );
-    }
-     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-properties',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($properties as $property){
+    $property = tripal_core_expand_chado_vars($property,'field','featureprop.value');
+    $rows[] = array(
+      ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
+      urldecode($property->value)
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
+  }
+   
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-properties',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 64 - 67
tripal_feature/theme/tripal_feature/tripal_feature_publications.tpl.php

@@ -8,78 +8,75 @@ $feature_pubs = $feature->feature_pub;
 
 
 if (count($feature_pubs) > 0) { ?>
-  <div id="tripal_feature_pub-pub-box" class="tripal_feature_pub-info-box tripal-info-box">
-    <div class="tripal_feature_pub-info-box-title tripal-info-box-title">Publications</div>
-    <div class="tripal_feature_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+  <div class="tripal_feature_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Year', 'Publication');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
   
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Year', 'Publication');
+  foreach ($feature_pubs as $feature_pub) {
+    $pub = $feature_pub->pub_id;
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
+    $citation = $pub->title;  // use the title as the default citation
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // get the citation for this pub if it exists
+    $values = array(
+      'pub_id' => $pub->pub_id, 
+      'type_id' => array(
+        'name' => 'Citation',
+      ),
+    );
+    $options = array('return_array' => 1);
+    $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
+    if (count($citation_prop) == 1) {
+      $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
+      $citation = $citation_prop[0]->value;
+    }
     
-    foreach ($feature_pubs as $feature_pub) {
-      $pub = $feature_pub->pub_id;
-      $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-      $citation = $pub->title;  // use the title as the default citation
-      
-      // get the citation for this pub if it exists
-      $values = array(
-        'pub_id' => $pub->pub_id, 
-        'type_id' => array(
-          'name' => 'Citation',
-        ),
-      );
-      $options = array('return_array' => 1);
-      $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
-      if (count($citation_prop) == 1) {
-        $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
-        $citation = $citation_prop[0]->value;
-      }
-      
-      // if the publication is synced then link to it
-      if ($pub->nid) {
-        // replace the title with a link
-        $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-        $patterns = array(
-          '/(\()/', '/(\))/',
-          '/(\])/', '/(\[)/',
-          '/(\{)/', '/(\})/',
-          '/(\+)/', '/(\.)/', '/(\?)/',
-        );
-        $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
-        $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
-      }
-      
-      $rows[] = array(
-        $pub->pyear,
-        $citation,
+    // if the publication is synced then link to it
+    if ($pub->nid) {
+      // replace the title with a link
+      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
+      $patterns = array(
+        '/(\()/', '/(\))/',
+        '/(\])/', '/(\[)/',
+        '/(\{)/', '/(\})/',
+        '/(\+)/', '/(\.)/', '/(\?)/',
       );
+      $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
+      $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-publications',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $pub->pyear,
+      $citation,
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php 
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-publications',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 53 - 56
tripal_feature/theme/tripal_feature/tripal_feature_references.tpl.php

@@ -26,64 +26,61 @@ if (count($feature_dbxrefs) > 0 ) {
 
 
 if(count($references) > 0){ ?>
-  <div id="tripal_feature-references-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Cross References</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">External references for this <?php print $feature->type_id->name ?></div><?php
-     
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Dababase', 'Accession');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
- 
-    foreach ($references as $dbxref){
-    
-      // skip the GFF_source entry as this is just needed for the GBrowse chado adapter 
-      if ($dbxref->db_id->name == 'GFF_source'){
-         continue;  
-      } 
-      $dbname = $dbxref->db_id->name; 
-      if ($dbxref->db_id->url) { 
-        $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
-      } 
-      
-      $accession = $dbxref->accession; 
-      if ($dbxref->db_id->urlprefix) { 
-        $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-      } 
-      if (property_exists($dbxref, 'is_primary')) {
-        $accession .= " <i>(primary cross-reference)</i>";
-      }
-      $rows[] = array(
-        $dbname,
-        $accession
-      );
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">External references for this <?php print $feature->type_id->name ?></div><?php
+   
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Dababase', 'Accession');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+
+  foreach ($references as $dbxref){
+  
+    // skip the GFF_source entry as this is just needed for the GBrowse chado adapter 
+    if ($dbxref->db_id->name == 'GFF_source'){
+       continue;  
+    } 
+    $dbname = $dbxref->db_id->name; 
+    if ($dbxref->db_id->url) { 
+      $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
     } 
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-references',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $accession = $dbxref->accession; 
+    if ($dbxref->db_id->urlprefix) { 
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
+    } 
+    if (property_exists($dbxref, 'is_primary')) {
+      $accession .= " <i>(primary cross-reference)</i>";
+    }
+    $rows[] = array(
+      $dbname,
+      $accession
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div><?php 
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-references',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }?>
 

+ 118 - 120
tripal_feature/theme/tripal_feature/tripal_feature_relationships.tpl.php

@@ -23,124 +23,122 @@ $object_rels = $all_relationships['object'];
 $subject_rels = $all_relationships['subject'];
 
 if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
-  <div id="tripal_feature-relationships-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Relationships</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc"></div> <?php
-    // first add in the subject relationships.  
-    foreach ($subject_rels as $rel_type => $rels){
-      foreach ($rels as $obj_type => $objects){ ?>
-        <p>This <?php print $feature->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> feature(s): <?php
-         
-        // the $headers array is an array of fields to use as the colum headers.
-        // additional documentation can be found here
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $headers = array('Feature Name' ,'Unique Name', 'Species', 'Type');
-        
-        // the $rows array contains an array of rows where each row is an array
-        // of values for each column of the table in that row.  Additional documentation
-        // can be found here:
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $rows = array();
-        
-        foreach ($objects as $object){
-          // link the feature to it's node
-          $feature_name = $object->record->object_id->name;
-          if (property_exists($object->record, 'nid')) {
-            $feature_name = l($feature_name, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
-          }
-          // link the organism to it's node
-          $organism = $object->record->object_id->organism_id;
-          $organism_name = $organism->genus ." " . $organism->species;
-          if (property_exists($organism, 'nid')) {
-            $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
-          }
-          $rows[] = array(
-            $feature_name, 
-            $object->record->object_id->uniquename,
-            $organism_name,
-            $object->record->object_id->type_id->name,
-          ); 
-         } 
-         // the $table array contains the headers and rows array as well as other
-         // options for controlling the display of the table.  Additional
-         // documentation can be found here:
-         // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-         $table = array(
-           'header' => $headers,
-           'rows' => $rows,
-           'attributes' => array(
-             'id' => 'tripal_feature-table-relationship-object',
-           ),
-           'sticky' => FALSE,
-           'caption' => '',
-           'colgroups' => array(),
-           'empty' => '',
-         );
-         
-         // once we have our table array structure defined, we call Drupal's theme_table()
-         // function to generate the table.
-         print theme_table($table); ?>
-         </p>
-         <br><?php
-       }
-    }
-    
-    // second add in the object relationships.  
-    foreach ($object_rels as $rel_type => $rels){
-      foreach ($rels as $subject_type => $subjects){?>
-        <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> feature(s) are <?php print $rel_type ?> this <?php print $feature->type_id->name;?>: <?php 
-        // the $headers array is an array of fields to use as the colum headers.
-        // additional documentation can be found here
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $headers = array('Feature Name' ,'Unique Name', 'Species', 'Type');
-        
-        // the $rows array contains an array of rows where each row is an array
-        // of values for each column of the table in that row.  Additional documentation
-        // can be found here:
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $rows = array();
-        
-        foreach ($subjects as $subject){
-          // link the feature to it's node
-          $feature_name = $subject->record->subject_id->name;
-          if (property_exists($subject->record, 'nid')) {
-            $feature_name = l($feature_name, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
-          }
-          // link the organism to it's node
-          $organism = $subject->record->subject_id->organism_id;
-          $organism_name = $organism->genus ." " . $organism->species;
-          if (property_exists($organism, 'nid')) {
-            $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
-          }
-          $rows[] = array(
-            $feature_name, 
-            $subject->record->subject_id->uniquename,
-            $organism_name,
-            $subject->record->subject_id->type_id->name,
-          ); 
-         } 
-         // the $table array contains the headers and rows array as well as other
-         // options for controlling the display of the table.  Additional
-         // documentation can be found here:
-         // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-         $table = array(
-           'header' => $headers,
-           'rows' => $rows,
-           'attributes' => array(
-             'id' => 'tripal_feature-table-relationship-subject',
-           ),
-           'sticky' => FALSE,
-           'caption' => '',
-           'colgroups' => array(),
-           'empty' => '',
-         );
-         
-         // once we have our table array structure defined, we call Drupal's theme_table()
-         // function to generate the table.
-         print theme_table($table); ?>
-         </p>
-         <br><?php
-       }
-    }?>
-  </div> <?php
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc"></div> <?php
+  
+  // first add in the subject relationships.  
+  foreach ($subject_rels as $rel_type => $rels){
+    foreach ($rels as $obj_type => $objects){ ?>
+      <p>This <?php print $feature->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> feature(s): <?php
+       
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Feature Name' ,'Unique Name', 'Species', 'Type');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($objects as $object){
+        // link the feature to it's node
+        $feature_name = $object->record->object_id->name;
+        if (property_exists($object->record, 'nid')) {
+          $feature_name = l($feature_name, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
+        }
+        // link the organism to it's node
+        $organism = $object->record->object_id->organism_id;
+        $organism_name = $organism->genus ." " . $organism->species;
+        if (property_exists($organism, 'nid')) {
+          $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
+        }
+        $rows[] = array(
+          $feature_name, 
+          $object->record->object_id->uniquename,
+          $organism_name,
+          $object->record->object_id->type_id->name,
+        ); 
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_feature-table-relationship-object',
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
+  
+  // second add in the object relationships.  
+  foreach ($object_rels as $rel_type => $rels){
+    foreach ($rels as $subject_type => $subjects){?>
+      <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> feature(s) are <?php print $rel_type ?> this <?php print $feature->type_id->name;?>: <?php 
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Feature Name' ,'Unique Name', 'Species', 'Type');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($subjects as $subject){
+        // link the feature to it's node
+        $feature_name = $subject->record->subject_id->name;
+        if (property_exists($subject->record, 'nid')) {
+          $feature_name = l($feature_name, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
+        }
+        // link the organism to it's node
+        $organism = $subject->record->subject_id->organism_id;
+        $organism_name = $organism->genus ." " . $organism->species;
+        if (property_exists($organism, 'nid')) {
+          $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
+        }
+        $rows[] = array(
+          $feature_name, 
+          $subject->record->subject_id->uniquename,
+          $organism_name,
+          $subject->record->subject_id->type_id->name,
+        ); 
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_feature-table-relationship-subject',
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
 }

+ 1 - 4
tripal_feature/theme/tripal_feature/tripal_feature_sequence.tpl.php

@@ -39,8 +39,6 @@ $feature = $variables['node']->feature;
 $featureloc_sequences = $feature->featureloc_sequences;
 
 if ($residues or count($featureloc_sequences) > 0) { ?>
-  <div id="tripal_feature-sequence-box" class="tripal_feature-info-box tripal-info-box">
-  <div class="tripal_feature-info-box-title tripal-info-box-title">Sequence</div>
   <div class="tripal_feature-info-box-desc tripal-info-box-desc"></div> <?php
   
   // show the alignment sequences first as they are colored with child features
@@ -56,6 +54,5 @@ if ($residues or count($featureloc_sequences) > 0) { ?>
       // format the sequence to break every 100 residues
       print preg_replace("/(.{50})/","\\1<br>",$feature->residues); ?>  
     </pre> <?php 
-  } ?>
-  </div> <?php 
+  } 
 }

+ 38 - 41
tripal_feature/theme/tripal_feature/tripal_feature_synonyms.tpl.php

@@ -8,46 +8,43 @@ $feature = tripal_core_expand_chado_vars($feature, 'table', 'feature_synonym', $
 $synonyms = $feature->feature_synonym;
 
 if(count($synonyms) > 0){ ?>
-  <div id="tripal_feature-synonyms-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Synonyms</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">The feature '<?php print $feature->name ?>' has the following synonyms</div><?php
-    
-    // the $headers array is an array of fields to use as the colum headers. 
-    // additional documentation can be found here 
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    // This table for the analysis has a vertical header (down the first column)
-    // so we do not provide headers here, but specify them in the $rows array below.
-    $headers = array('Synonym');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-    $rows = array();
-    foreach ($synonyms as $feature_synonym){
-      $rows[] = array(
-        $feature_synonym->synonym_id->name
-      );
-    } 
-    
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-synonyms',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">The feature '<?php print $feature->name ?>' has the following synonyms</div><?php
+  
+  // the $headers array is an array of fields to use as the colum headers. 
+  // additional documentation can be found here 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  // This table for the analysis has a vertical header (down the first column)
+  // so we do not provide headers here, but specify them in the $rows array below.
+  $headers = array('Synonym');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  $rows = array();
+  foreach ($synonyms as $feature_synonym){
+    $rows[] = array(
+      $feature_synonym->synonym_id->name
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-      print theme_table($table); ?>
-  </div><?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-synonyms',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+    print theme_table($table);
 }

+ 49 - 52
tripal_feature/theme/tripal_feature/tripal_feature_terms.tpl.php

@@ -15,59 +15,56 @@ if ($terms) {
 }
 
 if (count($s_terms) > 0) { ?>
-  <div id="tripal_feature-terms-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Annotated Terms</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">The following terms have been associated with this <?php print $node->feature->type_id->name ?>:</div>  <?php
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">The following terms have been associated with this <?php print $node->feature->type_id->name ?>:</div>  <?php
+  
+  // iterate through each term
+  $i = 0;
+  foreach ($s_terms as $cv => $terms) {  
+    // the $headers array is an array of fields to use as the colum headers.
+    // additional documentation can be found here
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $headers = array('Term', 'Definition');
     
-    // iterate through each term
-    $i = 0;
-    foreach ($s_terms as $cv => $terms) {  
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Term', 'Definition');
-      
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row.  Additional documentation
-      // can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
-      
-      foreach ($terms as $term) { 
+    // the $rows array contains an array of rows where each row is an array
+    // of values for each column of the table in that row.  Additional documentation
+    // can be found here:
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $rows = array();
+    
+    foreach ($terms as $term) { 
 
-        $accession = $term->cvterm_id->dbxref_id->accession;
-        if (is_numeric($term->cvterm_id->dbxref_id->accession)) {
-          $accession = $term->cvterm_id->dbxref_id->db_id->name . ":" . $term->cvterm_id->dbxref_id->accession;
-        }
-        if ($term->cvterm_id->dbxref_id->db_id->urlprefix) {
-          $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, array('attributes' => array("target" => '_blank')));
-        } 
-        
-        $rows[] = array(
-          $accession,
-          $term->cvterm_id->name
-        );
+      $accession = $term->cvterm_id->dbxref_id->accession;
+      if (is_numeric($term->cvterm_id->dbxref_id->accession)) {
+        $accession = $term->cvterm_id->dbxref_id->db_id->name . ":" . $term->cvterm_id->dbxref_id->accession;
+      }
+      if ($term->cvterm_id->dbxref_id->db_id->urlprefix) {
+        $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, array('attributes' => array("target" => '_blank')));
       } 
-      // the $table array contains the headers and rows array as well as other
-      // options for controlling the display of the table.  Additional
-      // documentation can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $table = array(
-        'header' => $headers,
-        'rows' => $rows,
-        'attributes' => array(
-          'id' => "tripal_feature-table-terms-$i",
-        ),
-        'sticky' => FALSE,
-        'caption' => '<b>Vocabulary: ' . ucwords(preg_replace('/_/', ' ', $cv)) . '</b>',
-        'colgroups' => array(),
-        'empty' => '',
-      );
       
-      // once we have our table array structure defined, we call Drupal's theme_table()
-      // function to generate the table.
-      print theme_table($table);
-      $i++;
-    } ?>
-  </div> <?php
-} ?>
+      $rows[] = array(
+        $accession,
+        $term->cvterm_id->name
+      );
+    } 
+    // the $table array contains the headers and rows array as well as other
+    // options for controlling the display of the table.  Additional
+    // documentation can be found here:
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $table = array(
+      'header' => $headers,
+      'rows' => $rows,
+      'attributes' => array(
+        'id' => "tripal_feature-table-terms-$i",
+      ),
+      'sticky' => FALSE,
+      'caption' => '<b>Vocabulary: ' . ucwords(preg_replace('/_/', ' ', $cv)) . '</b>',
+      'colgroups' => array(),
+      'empty' => '',
+    );
+    
+    // once we have our table array structure defined, we call Drupal's theme_table()
+    // function to generate the table.
+    print theme_table($table);
+    $i++;
+  } 
+}

+ 86 - 92
tripal_feature/theme/tripal_organism/tripal_organism_feature_browser.tpl.php

@@ -57,101 +57,95 @@ foreach ($results as $result) {
 // only show this block if it is enabled
 if ($enabled) { 
   if (count($features) > 0) { ?>
-    <div id="tripal_organism-feature_browser-box" class="tripal_organism-info-box tripal-info-box">
-      <div class="tripal_organism-info-box-title tripal-info-box-title">Feature Browser</div>
-      <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following browser provides a quick view for new visitors.  Use the searching mechanism to find specific features.</div> <?php
-      
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Feature Name' ,'Unique Name', 'Type');
-      
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row.  Additional documentation
-      // can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
-      
-      // let admins know they can customize the terms that appear in the list
-      print theme('tripal_admin_message', array('message' => "
-        Administrators, you can specify the feature types that should appear in 
-        this browser or remove it from the list of resources by navigating to the ". 
-        l("Tripal feature settings page", "admin/tripal/chado/tripal_feature/configuration", array('attributes' => array('target' => '_blank')))
-      ));
-      
-      foreach ($features as $feature){
-        $fname =  $feature->name;
-        if (property_exists($feature, 'nid')) {
-          $fname =   l($fname, "node/$feature->nid", array('attributes' => array('target' => '_blank')));
-        }
-        $rows[] = array(
-          $fname,
-          $feature->uniquename,
-          $feature->type_id->name
-        );
-      } 
-      // the $table array contains the headers and rows array as well as other
-      // options for controlling the display of the table.  Additional
-      // documentation can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $table = array(
-        'header' => $headers,
-        'rows' => $rows,
-        'attributes' => array(
-          'id' => 'tripal_organism-table-features',
-        ),
-        'sticky' => FALSE,
-        'caption' => '',
-        'colgroups' => array(),
-        'empty' => '',
+    <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following browser provides a quick view for new visitors.  Use the searching mechanism to find specific features.</div> <?php
+    
+    // the $headers array is an array of fields to use as the colum headers.
+    // additional documentation can be found here
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $headers = array('Feature Name' ,'Unique Name', 'Type');
+    
+    // the $rows array contains an array of rows where each row is an array
+    // of values for each column of the table in that row.  Additional documentation
+    // can be found here:
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $rows = array();
+    
+    // let admins know they can customize the terms that appear in the list
+    print theme('tripal_admin_message', array('message' => "
+      Administrators, you can specify the feature types that should appear in 
+      this browser or remove it from the list of resources by navigating to the ". 
+      l("Tripal feature settings page", "admin/tripal/chado/tripal_feature/configuration", array('attributes' => array('target' => '_blank')))
+    ));
+    
+    foreach ($features as $feature){
+      $fname =  $feature->name;
+      if (property_exists($feature, 'nid')) {
+        $fname =   l($fname, "node/$feature->nid", array('attributes' => array('target' => '_blank')));
+      }
+      $rows[] = array(
+        $fname,
+        $feature->uniquename,
+        $feature->type_id->name
       );
-      // once we have our table array structure defined, we call Drupal's theme_table()
-      // function to generate the table.
-      print theme_table($table);
-      
-      // the $pager array values that control the behavior of the pager.  For 
-      // documentation on the values allows in this array see:
-      // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-      // here we add the paramter 'block' => 'feature_browser'. This is because
-      // the pager is not on the default block that appears. When the user clicks a
-      // page number we want the browser to re-appear with the page is loaded.
-      $pager = array(
-        'tags' => array(),
-        'element' => $element,
-        'parameters' => array(
-          'block' => 'feature_browser'
-        ),
-        'quantity' => $num_per_page,
-      );
-      print theme_pager($pager); ?>
-    </div> <?php
+    } 
+    // the $table array contains the headers and rows array as well as other
+    // options for controlling the display of the table.  Additional
+    // documentation can be found here:
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $table = array(
+      'header' => $headers,
+      'rows' => $rows,
+      'attributes' => array(
+        'id' => 'tripal_organism-table-features',
+      ),
+      'sticky' => FALSE,
+      'caption' => '',
+      'colgroups' => array(),
+      'empty' => '',
+    );
+    // once we have our table array structure defined, we call Drupal's theme_table()
+    // function to generate the table.
+    print theme_table($table);
+    
+    // the $pager array values that control the behavior of the pager.  For 
+    // documentation on the values allows in this array see:
+    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+    // here we add the paramter 'block' => 'feature_browser'. This is because
+    // the pager is not on the default block that appears. When the user clicks a
+    // page number we want the browser to re-appear with the page is loaded.
+    $pager = array(
+      'tags' => array(),
+      'element' => $element,
+      'parameters' => array(
+        'block' => 'feature_browser'
+      ),
+      'quantity' => $num_per_page,
+    );
+    print theme_pager($pager); 
   } 
   else {  ?>
-    <div id="tripal_organism-feature_browser-box" class="tripal_organism-info-box tripal-info-box">
-      <div class="tripal_organism-info-box-title tripal-info-box-title">Feature Browser</div>
-      <p>There are no results.</p><?php
-      print theme('tripal_admin_message', array('message' => "
-        Administrators, perform the following to show features in this browser:
-        <ul>
-          <li>Load features for this organism using the " .
-            l("FASTA loader", 'admin/tripal/loaders/fasta_loader') . ",  ".
-            l("GFF Loader",   'admin/tripal/loaders/gff3_load') . " or ".
-            l("Bulk Loader",  'admin/tripal/loaders/bulk'). "</li>
-          <li>Sync the features that should have pages using the ".
-            l("Sync features page", 'admin/tripal/chado/tripal_feature/sync'). "</li>
-          <li>Return to this page to browse features.</li>
-          <li>Ensure the user " .
-           l("has permission", 'admin/people/permissions') . " to view the feature content</li>
-        </ul>
-        <br>
-        <br>
-        You can specify the feature types
-        that should appear in this browser or remove it from the list of resources by navigating to the " . 
-        l("Tripal feature settings page", "admin/tripal/chado/tripal_feature/configuration", array('attributes' => array('target' => '_blank')))  . "
-        </p>
-        The feature browser will not appear to site visitors unless features are present. "
-      )); ?>
-    </div><?php
+    <p>There are no results.</p><?php
+    print theme('tripal_admin_message', array('message' => "
+      Administrators, perform the following to show features in this browser:
+      <ul>
+        <li>Load features for this organism using the " .
+          l("FASTA loader", 'admin/tripal/loaders/fasta_loader') . ",  ".
+          l("GFF Loader",   'admin/tripal/loaders/gff3_load') . " or ".
+          l("Bulk Loader",  'admin/tripal/loaders/bulk'). "</li>
+        <li>Sync the features that should have pages using the ".
+          l("Sync features page", 'admin/tripal/chado/tripal_feature/sync'). "</li>
+        <li>Return to this page to browse features.</li>
+        <li>Ensure the user " .
+         l("has permission", 'admin/people/permissions') . " to view the feature content</li>
+      </ul>
+      <br>
+      <br>
+      You can specify the feature types
+      that should appear in this browser or remove it from the list of resources by navigating to the " . 
+      l("Tripal feature settings page", "admin/tripal/chado/tripal_feature/configuration", array('attributes' => array('target' => '_blank')))  . "
+      </p>
+      The feature browser will not appear to site visitors unless features are present. "
+    ));
   }
 }
 

+ 44 - 50
tripal_feature/theme/tripal_organism/tripal_organism_feature_counts.tpl.php

@@ -13,60 +13,54 @@ if(property_exists($organism, 'feature_counts')) {
 // only show this block if it is enabled
 if ($enabled) { 
   if (count($types) > 0){ ?>
-    <div id="tripal_organism-feature_counts-box" class="tripal_organism-info-box tripal-info-box">
-      <div class="tripal_organism-info-box-title tripal-info-box-title">Data Type Summary</div>
-      <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following data types are currently present for this organism</div> <?php
-      // let admins know they can customize the terms that appear in the list
-      print theme('tripal_admin_message', array('message' => "
-        Administrators, you can customize the types of terms that appear in this report by 
-        navigating to the " . l('Tripal feature configuration page', 'admin/tripal/chado/tripal_feature/configuration') . "
-        opening the section \"Feature Summary Report\" and adding the list of
-        terms you want to appear in the list. You can rename terms as well.  To disable this report and 
-        remove it from the list of resources, navigate to the " . 
-        l('Tripal feature configuration page', 'admin/tripal/tripal_feature/configuration') . "
-        and hide the \"Feature Summary\". To refresh the data,re-populate the " .
-        l('organism_feature_count', 'admin/tripal/schema/mviews') . " materialized view.")
-      ); ?>
-      <table id="tripal_organism-table-feature_counts" class="tripal_organism-table tripal-table tripal-table-horz">     
-        <tr class="tripal_organism-table-odd-row tripal-table-even-row">
-          <th>Feature Type</th>
-          <th>Count</th>
+    <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following data types are currently present for this organism</div> <?php
+    // let admins know they can customize the terms that appear in the list
+    print theme('tripal_admin_message', array('message' => "
+      Administrators, you can customize the types of terms that appear in this report by 
+      navigating to the " . l('Tripal feature configuration page', 'admin/tripal/chado/tripal_feature/configuration') . "
+      opening the section \"Feature Summary Report\" and adding the list of
+      terms you want to appear in the list. You can rename terms as well.  To disable this report and 
+      remove it from the list of resources, navigate to the " . 
+      l('Tripal feature configuration page', 'admin/tripal/tripal_feature/configuration') . "
+      and hide the \"Feature Summary\". To refresh the data,re-populate the " .
+      l('organism_feature_count', 'admin/tripal/schema/mviews') . " materialized view.")
+    ); ?>
+    <table id="tripal_organism-table-feature_counts" class="tripal_organism-table tripal-table tripal-table-horz">     
+      <tr class="tripal_organism-table-odd-row tripal-table-even-row">
+        <th>Feature Type</th>
+        <th>Count</th>
+      </tr> <?php
+      for ($j = 0; $j < count($types); $j++) {
+        $type = $types[$j];
+        $name = $names[$j];
+        $class = 'tripal_organism-table-odd-row tripal-table-odd-row';
+        if ($i % 2 == 0 ) {
+         $class = 'tripal_organism-table-even-row tripal-table-even-row';
+        }?>
+        <tr class="<?php print $class ?>">
+          <td><span title="<?php print $type->definition ?>"><?php print $name?></span></td>
+          <td><?php print number_format($type->num_features) ?></td>
         </tr> <?php
-        for ($j = 0; $j < count($types); $j++) {
-          $type = $types[$j];
-          $name = $names[$j];
-          $class = 'tripal_organism-table-odd-row tripal-table-odd-row';
-          if ($i % 2 == 0 ) {
-           $class = 'tripal_organism-table-even-row tripal-table-even-row';
-          }?>
-          <tr class="<?php print $class ?>">
-            <td><span title="<?php print $type->definition ?>"><?php print $name?></span></td>
-            <td><?php print number_format($type->num_features) ?></td>
-          </tr> <?php
-          $i++;  
-        } ?>
-      </table>
-      <img class="tripal_cv_chart" id="tripal_feature_cv_chart_<?php print $organism->organism_id?>" src="" border="0">
-    </div><?php           
+        $i++;  
+      } ?>
+    </table>
+    <img class="tripal_cv_chart" id="tripal_feature_cv_chart_<?php print $organism->organism_id?>" src="" border="0"><?php 
    } 
    else { 
     if (user_access('access administration pages')) { ?>
-      <div id="tripal_organism-feature_counts-box" class="tripal_organism-info-box tripal-info-box">
-        <div class="tripal_organism-info-box-title tripal-info-box-title">Data Type Summary</div>
-        <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following data types are currently present for this organism</div> <?php 
-        print theme('tripal_admin_message', array('message' => "
-           Administrators, to view the feature type report:
-           <ul>
-              <li>Populate the " . l('organism_feature_count', 'admin/tripal/schema/mviews') ." materialized view</li>
-              <li>Refresh this page</li>
-           </ul> 
-           To disable this report and remove it from the list of resources:
-           <ul>
-             <li>Navigate to the " . l('Tripal feature configuration page', 'admin/tripal/chado/tripal_feature/configuration') ." and hide the \"Feature Summary\"</li>
-            </ul>
-           </p>")
-        ); ?> 
-      </div><?php               
+      <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following data types are currently present for this organism</div> <?php 
+      print theme('tripal_admin_message', array('message' => "
+         Administrators, to view the feature type report:
+         <ul>
+            <li>Populate the " . l('organism_feature_count', 'admin/tripal/schema/mviews') ." materialized view</li>
+            <li>Refresh this page</li>
+         </ul> 
+         To disable this report and remove it from the list of resources:
+         <ul>
+           <li>Navigate to the " . l('Tripal feature configuration page', 'admin/tripal/chado/tripal_feature/configuration') ." and hide the \"Feature Summary\"</li>
+          </ul>
+         </p>")
+      );              
     }
   }
 } 

+ 11 - 0
tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -446,18 +446,29 @@ function tripal_featuremap_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_featuremap_base'] = array(
           '#value' => theme('tripal_featuremap_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
+          '#weight' => 0,
         );
         $node->content['tripal_featuremap_featurepos'] = array(
           '#value' => theme('tripal_featuremap_featurepos', array('node' => $node)),
+          '#tripal_toc_id'    => 'featurepos',
+          '#tripal_toc_title' => 'Map Features',
         );
         $node->content['tripal_featuremap_properties'] = array(
           '#value' => theme('tripal_featuremap_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
         );
         $node->content['tripal_featuremap_publication'] = array(
           '#value' => theme('tripal_featuremap_publication', array('node' => $node)),
+          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_title' => 'Publications',
         );
         $node->content['tripal_featuremap_references'] = array(
           '#value' => theme('tripal_featuremap_references', array('node' => $node)),
+          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_title' => 'Cross References',
         );
       }
       if ($view_mode == 'teaser') {

+ 63 - 67
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.base.tpl.php

@@ -3,78 +3,74 @@
 $featuremap  = $variables['node']->featuremap;
 
 // expand the description field
-$featuremap = tripal_core_expand_chado_vars($featuremap, 'field', 'featuremap.description');
+$featuremap = tripal_core_expand_chado_vars($featuremap, 'field', 'featuremap.description'); ?>
 
-?>
-<div id="tripal_featuremap-base-box" class="tripal_featuremap-info-box tripal-info-box">
-  <div class="tripal_featuremap-info-box-title tripal-info-box-title">Map Details</div>
-  <div class="tripal_featuremap-info-box-desc tripal-info-box-desc"></div> <?php 
-  
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  // This table for the analysis has a vertical header (down the first column)
-  // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array();
-  
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
-  
-  // Map Name row
+<div class="tripal_featuremap-info-box-desc tripal-info-box-desc"></div> <?php 
+
+// the $headers array is an array of fields to use as the colum headers. 
+// additional documentation can be found here 
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+// This table for the analysis has a vertical header (down the first column)
+// so we do not provide headers here, but specify them in the $rows array below.
+$headers = array();
+
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+$rows = array();
+
+// Map Name row
+$rows[] = array(
+  array(
+    'data' => 'Map Name',
+    'header' => TRUE
+  ),
+  $featuremap->name
+);
+// Map Units
+$rows[] = array(
+  array(
+    'data' => 'Map Units',
+    'header' => TRUE
+  ),
+  $featuremap->unittype_id->name
+);
+// allow site admins to see the feature ID
+if (user_access('access administration pages')) {
+  // Feature Map ID
   $rows[] = array(
     array(
-      'data' => 'Map Name',
-      'header' => TRUE
+      'data' => 'Feature Map ID',
+      'header' => TRUE,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $featuremap->name
-  );
-  // Map Units
-  $rows[] = array(
     array(
-      'data' => 'Map Units',
-      'header' => TRUE
+      'data' => $featuremap->featuremap_id,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $featuremap->unittype_id->name
   );
-  // allow site admins to see the feature ID
-  if (user_access('access administration pages')) {
-    // Feature Map ID
-    $rows[] = array(
-      array(
-        'data' => 'Feature Map ID',
-        'header' => TRUE,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-      array(
-        'data' => $featuremap->featuremap_id,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-    );
-  }
+}
 
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_featuremap-table-base',
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
-  );
-  
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table);
-  if (property_exists($featuremap, 'description')) { ?>
-    <div style="text-align: justify"><?php print $featuremap->description; ?></div> <?php  
-  } ?>
-</div>
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers,
+  'rows' => $rows,
+  'attributes' => array(
+    'id' => 'tripal_featuremap-table-base',
+  ),
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(),
+  'empty' => '',
+);
+
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table);
+if (property_exists($featuremap, 'description')) { ?>
+  <div style="text-align: justify"><?php print $featuremap->description; ?></div> <?php  
+} 

+ 109 - 112
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.featurepos.tpl.php

@@ -38,121 +38,118 @@ $total_features = $_SESSION['chado_pager'][$featurepos_pager_id]['total_records'
 
 
 if(count($feature_positions) > 0){ ?>
-  <div id="tripal_featuremap-featurepos-box" class="tripal_featuremap-info-box tripal-info-box">
-    <div class="tripal_featuremap-info-box-title tripal-info-box-title">Map Features</div>
-    <div class="tripal_featuremap-info-box-desc tripal-info-box-desc">This map contains <?php print number_format($total_features) ?> features:</div> <?php 
-    
-        // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Landmark', 'Type', 'Organism', 'Feature Name', 'Type', 'Position');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($feature_positions as $position){
-      $map_feature = $position->map_feature_id;
-      $feature     = $position->feature_id;  
-      $organism    = $map_feature->organism_id; 
+  <div class="tripal_featuremap-info-box-desc tripal-info-box-desc">This map contains <?php print number_format($total_features) ?> features:</div> <?php 
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Landmark', 'Type', 'Organism', 'Feature Name', 'Type', 'Position');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($feature_positions as $position){
+    $map_feature = $position->map_feature_id;
+    $feature     = $position->feature_id;  
+    $organism    = $map_feature->organism_id; 
 
-      // check if there are any values in the featureposprop table for the start and stop
-      $mappos = $position->mappos;
-      $options = array(
-        'return_array' => 1,
-        'include_fk' => array(
-          'type_id' => 1,            
-        ),
-      );
-      $position = tripal_core_expand_chado_vars($position, 'table', 'featureposprop', $options);
-      $featureposprop = $position->featureposprop;
-      $start = 0;
-      $stop = 0;
-      if (is_array($featureposprop)) {
-        foreach ($featureposprop as $index => $property) {
-           if ($property->type_id->name == 'start') {
-             $start = $property->value;
-           }
-           if ($property->type_id->name == 'stop') {
-             $stop = $property->value;
-           }
-        }      
-      }  
-      if ($start and $stop and $start != $stop) {
-        $mappos = "$start-$stop";
-      }
-      if ($start and !$stop) {
-        $mappos = $start;
-      } 
-      if ($start and $stop and $start == $stop) {
-        $mappos = $start;
-      }
-      
-      $mfname = $map_feature->name;
-      if (property_exists($map_feature, 'nid')) {
-        $mfname =  l($mfname, 'node/' . $map_feature->nid, array('attributes' => array('target' => '_blank')));
-      }
-      $orgname = $organism->genus ." " . $organism->species ." (" . $organism->common_name .")";
-      if (property_exists($organism, 'nid')) {
-        $orgname = l(
-          "<i>" . $organism->genus . " " . $organism->species . "</i> (" . $organism->common_name .")", 
-          "node/". $organism->nid, 
-          array('html' => TRUE, 'attributes' => array('target' => '_blank'))
-        );
-      }
-      $organism =  $organism->genus . ' ' . $organism->species;
-      
-      $fname = $feature->name;
-      if (property_exists($feature, 'nid')) {
-        $fname = l($fname, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
-      }
-        
-      $rows[] = array(
-        $mfname,
-        $map_feature->type_id->name,
-        $orgname,
-        $fname,
-        $feature->type_id->name,
-        $mappos . ' ' . $position->featuremap_id->unittype_id->name
-      );
-    } 
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_featuremap-table-featurepos',
+    // check if there are any values in the featureposprop table for the start and stop
+    $mappos = $position->mappos;
+    $options = array(
+      'return_array' => 1,
+      'include_fk' => array(
+        'type_id' => 1,            
       ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
     );
+    $position = tripal_core_expand_chado_vars($position, 'table', 'featureposprop', $options);
+    $featureposprop = $position->featureposprop;
+    $start = 0;
+    $stop = 0;
+    if (is_array($featureposprop)) {
+      foreach ($featureposprop as $index => $property) {
+         if ($property->type_id->name == 'start') {
+           $start = $property->value;
+         }
+         if ($property->type_id->name == 'stop') {
+           $stop = $property->value;
+         }
+      }      
+    }  
+    if ($start and $stop and $start != $stop) {
+      $mappos = "$start-$stop";
+    }
+    if ($start and !$stop) {
+      $mappos = $start;
+    } 
+    if ($start and $stop and $start == $stop) {
+      $mappos = $start;
+    }
     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'features'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $featurepos_pager_id,
-      'parameters' => array(
-        'block' => 'featurepos'
-      ),
-      'quantity' => $num_results_per_page,
+    $mfname = $map_feature->name;
+    if (property_exists($map_feature, 'nid')) {
+      $mfname =  l($mfname, 'node/' . $map_feature->nid, array('attributes' => array('target' => '_blank')));
+    }
+    $orgname = $organism->genus ." " . $organism->species ." (" . $organism->common_name .")";
+    if (property_exists($organism, 'nid')) {
+      $orgname = l(
+        "<i>" . $organism->genus . " " . $organism->species . "</i> (" . $organism->common_name .")", 
+        "node/". $organism->nid, 
+        array('html' => TRUE, 'attributes' => array('target' => '_blank'))
+      );
+    }
+    $organism =  $organism->genus . ' ' . $organism->species;
+    
+    $fname = $feature->name;
+    if (property_exists($feature, 'nid')) {
+      $fname = l($fname, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
+    }
+      
+    $rows[] = array(
+      $mfname,
+      $map_feature->type_id->name,
+      $orgname,
+      $fname,
+      $feature->type_id->name,
+      $mappos . ' ' . $position->featuremap_id->unittype_id->name
     );
-    print theme_pager($pager); ?>
-  </div><?php 
-}?>
+  } 
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_featuremap-table-featurepos',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'features'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $featurepos_pager_id,
+    'parameters' => array(
+      'block' => 'featurepos'
+    ),
+    'quantity' => $num_results_per_page,
+  );
+  print theme_pager($pager); 
+}
 

+ 38 - 44
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.properties.tpl.php

@@ -5,48 +5,42 @@ $options = array('return_array' => 1);
 $featuremap = tripal_core_expand_chado_vars($featuremap, 'table', 'featuremapprop', $options);
 $properties = $featuremap->featuremapprop;
 
-if(count($properties) > 0){ ?>
-
-  <div id="tripal_featuremap-properties-box" class="tripal_featuremap-info-box tripal-info-box">
-    <div class="tripal_featuremap-info-box-title tripal-info-box-title">Properties</div> <?php
-
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Property Name', 'Value');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($properties as $property){
-      $property = tripal_core_expand_chado_vars($property,'field','featuremapprop.value');
-      $rows[] = array(
-        ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-        urldecode($property->value)
-      );
-    }
-     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_featuremap-table-properties',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+if(count($properties) > 0){ 
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($properties as $property){
+    $property = tripal_core_expand_chado_vars($property,'field','featuremapprop.value');
+    $rows[] = array(
+      ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
+      urldecode($property->value)
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
-}
+  }
+   
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_featuremap-table-properties',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 

+ 64 - 67
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.publication.tpl.php

@@ -8,78 +8,75 @@ $featuremap_pubs = $featuremap->featuremap_pub;
 
 
 if (count($featuremap_pubs) > 0) { ?>
-  <div id="tripal_featuremap_pub-pub-box" class="tripal_featuremap_pub-info-box tripal-info-box">
-    <div class="tripal_featuremap_pub-info-box-title tripal-info-box-title">Publications</div>
-    <div class="tripal_featuremap_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+  <div class="tripal_featuremap_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Year', 'Publication');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
   
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Year', 'Publication');
+  foreach ($featuremap_pubs as $featuremap_pub) {
+    $pub = $featuremap_pub->pub_id;
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
+    $citation = $pub->title;  // use the title as the default citation
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // get the citation for this pub if it exists
+    $values = array(
+      'pub_id' => $pub->pub_id, 
+      'type_id' => array(
+        'name' => 'Citation',
+      ),
+    );
+    $options = array('return_array' => 1);
+    $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
+    if (count($citation_prop) == 1) {
+      $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
+      $citation = $citation_prop[0]->value;
+    }
     
-    foreach ($featuremap_pubs as $featuremap_pub) {
-      $pub = $featuremap_pub->pub_id;
-      $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-      $citation = $pub->title;  // use the title as the default citation
-      
-      // get the citation for this pub if it exists
-      $values = array(
-        'pub_id' => $pub->pub_id, 
-        'type_id' => array(
-          'name' => 'Citation',
-        ),
-      );
-      $options = array('return_array' => 1);
-      $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
-      if (count($citation_prop) == 1) {
-        $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
-        $citation = $citation_prop[0]->value;
-      }
-      
-      // if the publication is synced then link to it
-      if (property_exists($pub, 'nid')) {
-        // replace the title with a link
-        $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-        $patterns = array(
-          '/(\()/', '/(\))/', 
-          '/(\])/', '/(\[)/',
-          '/(\{)/', '/(\})/',
-          '/(\+)/', '/(\.)/', '/(\?)/', 
-        );
-        $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
-        $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
-      }
-      
-      $rows[] = array(
-        $pub->pyear,
-        $citation,
+    // if the publication is synced then link to it
+    if (property_exists($pub, 'nid')) {
+      // replace the title with a link
+      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
+      $patterns = array(
+        '/(\()/', '/(\))/', 
+        '/(\])/', '/(\[)/',
+        '/(\{)/', '/(\})/',
+        '/(\+)/', '/(\.)/', '/(\?)/', 
       );
+      $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
+      $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_featuremap-table-publications',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $pub->pyear,
+      $citation,
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php 
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_featuremap-table-publications',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);  
 }

+ 46 - 49
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap.references.tpl.php

@@ -14,56 +14,53 @@ if (count($featuremap_dbxrefs) > 0 ) {
 
 
 if(count($references) > 0){ ?>
-  <div id="tripal_featuremap-references-box" class="tripal_featuremap-info-box tripal-info-box">
-    <div class="tripal_featuremap-info-box-title tripal-info-box-title">Cross References</div>
-    <div class="tripal_featuremap-info-box-desc tripal-info-box-desc">External references for this map</div><?php
-     
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Dababase', 'Accession');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
- 
-    foreach ($references as $dbxref){
-      $dbname = $dbxref->db_id->name; 
-      if ($dbxref->db_id->url) { 
-        $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
-      } 
-      
-      $accession = $dbxref->accession; 
-      if ($dbxref->db_id->urlprefix) { 
-        $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-      } 
-      $rows[] = array(
-        $dbname,
-        $accession
-      );
+  <div class="tripal_featuremap-info-box-desc tripal-info-box-desc">External references for this map</div><?php
+   
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Dababase', 'Accession');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+
+  foreach ($references as $dbxref){
+    $dbname = $dbxref->db_id->name; 
+    if ($dbxref->db_id->url) { 
+      $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
     } 
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_featuremap-table-references',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $accession = $dbxref->accession; 
+    if ($dbxref->db_id->urlprefix) { 
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
+    } 
+    $rows[] = array(
+      $dbname,
+      $accession
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div><?php 
-}?>
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_featuremap-table-references',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);  
+}
 

+ 104 - 108
tripal_genetic/theme/tripal_feature/tripal_feature.genotypes.tpl.php

@@ -44,118 +44,114 @@ $total_records = $_SESSION['chado_pager'][$feature_pager_id]['total_records'];
 
 // now iterate through the feature genotypes and print a paged table.
 if (count($feature_genotypes) > 0) {?>
-  <div id="tripal_feature-genotypes-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Genotypes</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">This following <?php print number_format($total_records) ?> genotype(s) have been recorded for this feature.</div><?php 
-    
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Name', 'Type', 'Genotype', 'Details', 'Germplasm');
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">This following <?php print number_format($total_records) ?> genotype(s) have been recorded for this feature.</div><?php 
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Name', 'Type', 'Genotype', 'Details', 'Germplasm');
 
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach($feature_genotypes as $feature_genotype) {
+    $genotype = $feature_genotype->genotype_id;
     
-    foreach($feature_genotypes as $feature_genotype) {
-      $genotype = $feature_genotype->genotype_id;
-      
-      // show the uniquename for the genotype unless a name exists
-      $name = $genotype->uniquename;
-      if ($genotype->name){
-        $name = $genotype->name;
-      }
-      
-      // get the genotype type
-      $type = 'N/A';
-      if ($genotype->type_id) {
-        $type = ucwords(preg_replace('/_/', ' ', $genotype->type_id->name));
-      }
-      
-      // get the genotype properties
-      $options = array('return_array' => 1);
-      $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'genotypeprop', $options);
-      $properties = $genotype->genotypeprop; 
-      $details = '';
-      if(count($properties) > 0) {
-        foreach ($properties as $property){
-          $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
-        }
-        $details = substr($details, 0, -4); // remove trailing <br>
-      }
-      
-      // add in stocks associated with this genotype if any
-      $options = array(
-        'return_array' => 1,
-        'inlude_fk' => array(
-          'stock_id' => array(
-            'type_id' => 1
-          )
-        ),
-      );
-      $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'stock_genotype', $options);
-      $stock_genotypes = $genotype->stock_genotype; 
-
-      // build the list of germplasm.
-      $stock_names = '';
-      if(count($stock_genotypes) > 0) { 
-        foreach ($stock_genotypes as $stock_genotype){ 
-          $stock = $stock_genotype->stock_id; 
-          $stock_name = $stock->name . ' (' . $stock->uniquename . ')'; 
-          if(property_exists($stock, 'nid')) {
-            $stock_name = l($stock_name, 'node/' . $stock->nid, array('attributes' => array('target' => '_blank')));
-          }
-          $stock_names .= $stock_name . '<br>';
-        }
-        $stock_names = substr($stock_names, 0, -4); // remove trailing <br>
-      } 
-      // add the fields to the table row
-      $rows[] = array(
-        $name,
-        $type,
-        $genotype->description,
-        $details,
-        $stock_names
-      );
+    // show the uniquename for the genotype unless a name exists
+    $name = $genotype->uniquename;
+    if ($genotype->name){
+      $name = $genotype->name;
     }
-     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_genetic-table-genotypes',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); 
+    // get the genotype type
+    $type = 'N/A';
+    if ($genotype->type_id) {
+      $type = ucwords(preg_replace('/_/', ' ', $genotype->type_id->name));
+    }
     
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'features'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $feature_pager_id,
-      'parameters' => array(
-        'block' => 'genotypes'
+    // get the genotype properties
+    $options = array('return_array' => 1);
+    $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'genotypeprop', $options);
+    $properties = $genotype->genotypeprop; 
+    $details = '';
+    if(count($properties) > 0) {
+      foreach ($properties as $property){
+        $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
+      }
+      $details = substr($details, 0, -4); // remove trailing <br>
+    }
+    
+    // add in stocks associated with this genotype if any
+    $options = array(
+      'return_array' => 1,
+      'inlude_fk' => array(
+        'stock_id' => array(
+          'type_id' => 1
+        )
       ),
-      'quantity' => $num_results_per_page,
     );
-    print theme_pager($pager); ?>
-    
-  </div> <?php
-} 
+    $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'stock_genotype', $options);
+    $stock_genotypes = $genotype->stock_genotype; 
+
+    // build the list of germplasm.
+    $stock_names = '';
+    if(count($stock_genotypes) > 0) { 
+      foreach ($stock_genotypes as $stock_genotype){ 
+        $stock = $stock_genotype->stock_id; 
+        $stock_name = $stock->name . ' (' . $stock->uniquename . ')'; 
+        if(property_exists($stock, 'nid')) {
+          $stock_name = l($stock_name, 'node/' . $stock->nid, array('attributes' => array('target' => '_blank')));
+        }
+        $stock_names .= $stock_name . '<br>';
+      }
+      $stock_names = substr($stock_names, 0, -4); // remove trailing <br>
+    } 
+    // add the fields to the table row
+    $rows[] = array(
+      $name,
+      $type,
+      $genotype->description,
+      $details,
+      $stock_names
+    );
+  }
+   
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_genetic-table-genotypes',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'features'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $feature_pager_id,
+    'parameters' => array(
+      'block' => 'genotypes'
+    ),
+    'quantity' => $num_results_per_page,
+  );
+  print theme_pager($pager);
+}

+ 104 - 107
tripal_genetic/theme/tripal_stock/tripal_stock.genotypes.tpl.php

@@ -34,119 +34,116 @@ $total_records = $_SESSION['chado_pager'][$stock_pager_id]['total_records'];
 
 // now iterate through the stock genotypes and print a paged table.
 if (count($stock_genotypes) > 0) {?>
-  <div id="tripal_stock-genotypes-box" class="tripal_stock-info-box tripal-info-box">
-    <div class="tripal_stock-info-box-title tripal-info-box-title">Genotypes</div>
-    <div class="tripal_stock-info-box-desc tripal-info-box-desc">The following <?php print number_format($total_records) ?> genotype(s) have been recorded for this stock.</div> <?php
+  <div class="tripal_stock-info-box-desc tripal-info-box-desc">The following <?php print number_format($total_records) ?> genotype(s) have been recorded for this stock.</div> <?php
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Name', 'Type', 'Genotype', 'Details', 'Markers');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach($stock_genotypes as $stock_genotype) {       
+    $genotype = $stock_genotype->genotype_id;
     
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Name', 'Type', 'Genotype', 'Details', 'Markers');
+    // get the genotype properties
+    $options = array('return_array' => 1);
+    $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'genotypeprop', $options);
+    $properties = $genotype->genotypeprop; 
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // add in markers associated with this genotype if any
+    $options = array(
+      'return_array' => 1,
+      'inlude_fk' => array(
+        'feature_id' => array(
+          'type_id' => 1
+        )
+      ),
+    );
+    $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'feature_genotype', $options);
+    $feature_genotypes = $genotype->feature_genotype; 
     
-    foreach($stock_genotypes as $stock_genotype) {       
-      $genotype = $stock_genotype->genotype_id;
-      
-      // get the genotype properties
-      $options = array('return_array' => 1);
-      $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'genotypeprop', $options);
-      $properties = $genotype->genotypeprop; 
-      
-      // add in markers associated with this genotype if any
-      $options = array(
-        'return_array' => 1,
-        'inlude_fk' => array(
-          'feature_id' => array(
-            'type_id' => 1
-          )
-        ),
-      );
-      $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'feature_genotype', $options);
-      $feature_genotypes = $genotype->feature_genotype; 
-      
-      // show the uniquename for the genotype unless a name exists
-      $name = $genotype->uniquename;
-      if ($genotype->name){
-        $name = $genotype->name;
-      }
-      // get the genotype type
-      $type = 'N/A';
-      if ($genotype->type_id) {
-        $type = ucwords(preg_replace('/_/', ' ', $genotype->type_id->name));
+    // show the uniquename for the genotype unless a name exists
+    $name = $genotype->uniquename;
+    if ($genotype->name){
+      $name = $genotype->name;
+    }
+    // get the genotype type
+    $type = 'N/A';
+    if ($genotype->type_id) {
+      $type = ucwords(preg_replace('/_/', ' ', $genotype->type_id->name));
+    }
+    
+    // get the genotype properties
+    $details = '';
+    if(count($properties) > 0) {
+      foreach ($properties as $property){
+        $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
       }
-      
-      // get the genotype properties
-      $details = '';
-      if(count($properties) > 0) {
-        foreach ($properties as $property){
-          $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
+      $details = substr($details, 0, -4); // remove trailing <br>
+    }
+    
+    // build the list of marker features.
+    $feature_names = 'N/A';
+    if(count($feature_genotypes) > 0) {
+      $feature_names = '';
+      foreach ($feature_genotypes as $feature_genotype){
+        $feature = $feature_genotype->feature_id;
+        $feature_name = $feature->name . ' (' . $feature->uniquename . ')';
+        if(property_exists($feature, 'nid')) {
+          $feature_name = l($feature_name, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
         }
-        $details = substr($details, 0, -4); // remove trailing <br>
+        $feature_names .= $feature_name . '<br>';
       }
+      $feature_names = substr($feature_names, 0, -4); // remove trailing <br>
+    }
       
-      // build the list of marker features.
-      $feature_names = 'N/A';
-      if(count($feature_genotypes) > 0) {
-        $feature_names = '';
-        foreach ($feature_genotypes as $feature_genotype){
-          $feature = $feature_genotype->feature_id;
-          $feature_name = $feature->name . ' (' . $feature->uniquename . ')';
-          if(property_exists($feature, 'nid')) {
-            $feature_name = l($feature_name, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
-          }
-          $feature_names .= $feature_name . '<br>';
-        }
-        $feature_names = substr($feature_names, 0, -4); // remove trailing <br>
-      }
-        
-      // add the fields to the table row
-      $rows[] = array(
-        $name,
-        $type,
-        $genotype->description,
-        $details,
-        $feature_names
-      );
-    } 
-    
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_genetic-table-genotypes',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'features'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $stock_pager_id,
-      'parameters' => array(
-        'block' => 'genotypes'
-      ),
-      'quantity' => $num_results_per_page,
+    // add the fields to the table row
+    $rows[] = array(
+      $name,
+      $type,
+      $genotype->description,
+      $details,
+      $feature_names
     );
-    print theme_pager($pager);  ?>
-  </div><?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_genetic-table-genotypes',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'features'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $stock_pager_id,
+    'parameters' => array(
+      'block' => 'genotypes'
+    ),
+    'quantity' => $num_results_per_page,
+  );
+  print theme_pager($pager); 
 } 

+ 4 - 0
tripal_genetic/tripal_genetic.module

@@ -124,6 +124,8 @@ function tripal_genetic_node_view($node, $view_mode, $langcode) {
       if (!array_key_exists('tripal_feature_nd_genotypes', $node->content)) {
         $node->content['tripal_feature_genotypes'] = array(
           '#value' => theme('tripal_feature_genotypes', array('node' => $node)),
+          '#tripal_toc_id'    => 'genotypes',
+          '#tripal_toc_title' => 'Genotypes',
         );
       }
     }
@@ -137,6 +139,8 @@ function tripal_genetic_node_view($node, $view_mode, $langcode) {
       if (!array_key_exists('tripal_stock_nd_genotypes', $node->content)) {
         $node->content['tripal_stock_genotypes'] = array(
           '#value' => theme('tripal_stock_genotypes', array('node' => $node)),
+          '#tripal_toc_id'    => 'genotypes',
+          '#tripal_toc_title' => 'Genotypes',
         );
       }
     }

+ 17 - 0
tripal_library/includes/tripal_library.chado_node.inc

@@ -391,21 +391,34 @@ function tripal_library_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_library_base'] = array(
           '#value' => theme('tripal_library_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
+          '#weight' => 0,
         );
         $node->content['tripal_library_properties'] = array(
           '#value' => theme('tripal_library_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
         );
         $node->content['tripal_library_publications'] = array(
           '#value' => theme('tripal_library_publications', array('node' => $node)),
+          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_title' => 'Publications',
         );
         $node->content['tripal_library_references'] = array(
           '#value' => theme('tripal_library_references', array('node' => $node)),
+          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_title' => 'References',
         );
         $node->content['tripal_library_synonyms'] = array(
           '#value' => theme('tripal_library_synonyms', array('node' => $node)),
+          '#tripal_toc_id'    => 'synonyms',
+          '#tripal_toc_title' => 'Synonyms',
         );
         $node->content['tripal_library_terms'] = array(
           '#value' => theme('tripal_library_terms', array('node' => $node)),
+          '#tripal_toc_id'    => 'terms',
+          '#tripal_toc_title' => 'Annotated Terms',
         );
       }
       if ($view_mode == 'teaser') {
@@ -418,6 +431,8 @@ function tripal_library_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_organism.libraries'] = array(
           '#value' => theme('tripal_organism.libraries', array('node' => $node)),
+          '#tripal_toc_id'    => 'libraries',
+          '#tripal_toc_title' => 'Libraries',
         );
       }
       break;
@@ -425,6 +440,8 @@ function tripal_library_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_feature.libraries'] = array(
           '#value' => theme('tripal_feature.libraries', array('node' => $node)),
+          '#tripal_toc_id'    => 'libraries',
+          '#tripal_toc_title' => 'Libraries',
         );
       }
       break;

+ 50 - 53
tripal_library/theme/tripal_feature/tripal_feature.libraries.tpl.php

@@ -9,61 +9,58 @@ $library_features = $feature->library_feature;
 
 
 if (count($library_features) > 0) {?>
-  <div id="tripal_feature-library_list-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Libraries</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">The following libraries are associated with this feature.</div> <?php 
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">The following libraries are associated with this feature.</div> <?php 
+  
+  // the $headers array is an array of fields to use as the colum headers. 
+  // additional documentation can be found here 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  // This table for the analysis has a vertical header (down the first column)
+  // so we do not provide headers here, but specify them in the $rows array below.
+  $headers = array('Library Name', 'Type');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  $rows = array();
+  foreach ($library_features as $library_feature){ 
     
-    // the $headers array is an array of fields to use as the colum headers. 
-    // additional documentation can be found here 
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    // This table for the analysis has a vertical header (down the first column)
-    // so we do not provide headers here, but specify them in the $rows array below.
-    $headers = array('Library Name', 'Type');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-    $rows = array();
-    foreach ($library_features as $library_feature){ 
-      
-      $libname = $library_feature->library_id->name;
-      if ($library_feature->library_id->nid) {
-        $libname = l($libname, "node/" . $library_feature->library_id->nid, array('attributes' => array('target' => '_blank')));
-      }
-      
-      $typename = $library_feature->library_id->type_id->name;
-      if ($typename == 'cdna_library') {
-        $typename = 'cDNA';
-      }
-      else if ($typename == 'bac_library') {
-        $typename = 'BAC';
-      }
-      
-      $rows[] = array(
-        $libname,
-        $typename
-      );      
+    $libname = $library_feature->library_id->name;
+    if ($library_feature->library_id->nid) {
+      $libname = l($libname, "node/" . $library_feature->library_id->nid, array('attributes' => array('target' => '_blank')));
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-libraries',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
+    $typename = $library_feature->library_id->type_id->name;
+    if ($typename == 'cdna_library') {
+      $typename = 'cDNA';
+    }
+    else if ($typename == 'bac_library') {
+      $typename = 'BAC';
+    }
     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>  
-  </div><?php
+    $rows[] = array(
+      $libname,
+      $typename
+    );      
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-libraries',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 87 - 92
tripal_library/theme/tripal_library/tripal_library.base.tpl.php

@@ -4,106 +4,101 @@ $library  = $variables['node']->library;
 
 // get the library description. IT uses a tern name of 'Library Description'
 $libprop = tripal_library_get_property($library->library_id, 'Library Description');
-$description = $libprop->value;
+$description = $libprop->value; ?>
 
+<div class="tripal_library-info-box-desc tripal-info-box-desc"></div> <?php 
 
-?>
-<div id="tripal_library-base-box" class="tripal_library-info-box tripal-info-box">
-  <div class="tripal_library-info-box-title tripal-info-box-title">Library Details</div>
-  <div class="tripal_library-info-box-desc tripal-info-box-desc"></div> <?php 
-  
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  // This table for the library has a vertical header (down the first column)
-  // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array();
-  
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
+// the $headers array is an array of fields to use as the colum headers. 
+// additional documentation can be found here 
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+// This table for the library has a vertical header (down the first column)
+// so we do not provide headers here, but specify them in the $rows array below.
+$headers = array();
 
-  // Name row
-  $rows[] = array(
-    array(
-      'data' => 'Library Name',
-      'header' => TRUE
-    ),
-    $library->name
-  );
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+$rows = array();
+
+// Name row
+$rows[] = array(
+  array(
+    'data' => 'Library Name',
+    'header' => TRUE
+  ),
+  $library->name
+);
 
-  // Unique row
+// Unique row
+$rows[] = array(
+  array(
+    'data' => 'Unique Name',
+    'header' => TRUE
+  ),
+  $library->uniquename
+);
+
+// Organism row
+$organism = $library->organism_id->genus ." " . $library->organism_id->species ." (" .$library->organism_id->common_name .")";
+if ($library->organism_id->nid) {
+  $organism = l("<i>" . $library->organism_id->genus . " " . $library->organism_id->species . "</i> (" .$library->organism_id->common_name .")", "node/".$library->organism_id->nid, array('html' => TRUE));
+} 
+$rows[] = array(
+  array(
+    'data' => 'Organism',
+    'header' => TRUE
+  ),
+  $organism
+);
+
+// Library Type row
+$rows[] = array(
+  array(
+    'data' => 'Type',
+    'header' => TRUE
+  ),
+  $library->type_id->name,
+);
+
+// allow site admins to see the library ID
+if (user_access('access administration pages')) {
+  // Library ID
   $rows[] = array(
     array(
-      'data' => 'Unique Name',
-      'header' => TRUE
+      'data'   => 'Library ID',
+      'header' => TRUE,
+      'class'  => 'tripal-site-admin-only-table-row',
     ),
-    $library->uniquename
-  );
-  
-  // Organism row
-  $organism = $library->organism_id->genus ." " . $library->organism_id->species ." (" .$library->organism_id->common_name .")";
-  if ($library->organism_id->nid) {
-    $organism = l("<i>" . $library->organism_id->genus . " " . $library->organism_id->species . "</i> (" .$library->organism_id->common_name .")", "node/".$library->organism_id->nid, array('html' => TRUE));
-  } 
-  $rows[] = array(
     array(
-      'data' => 'Organism',
-      'header' => TRUE
+      'data'  => $library->library_id,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $organism
   );
+}
+
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers,
+  'rows' => $rows,
+  'attributes' => array(
+    'id' => 'tripal_library-table-base',
+  ),
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(),
+  'empty' => '',
+);
+
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table); 
+
+// now add in the description below the table if one exists
+if ($description) { ?>
+  <div style="text-align: justify"><?php print $description; ?></div> <?php  
+}
 
-  // Library Type row
-  $rows[] = array(
-    array(
-      'data' => 'Type',
-      'header' => TRUE
-    ),
-    $library->type_id->name,
-  );
-  
-  // allow site admins to see the library ID
-  if (user_access('access administration pages')) {
-    // Library ID
-    $rows[] = array(
-      array(
-        'data' => 'Library ID',
-        'header' => TRUE
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-      array(
-        'data' => $library->library_id,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-    );
-  }
-  
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_library-table-base',
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
-  );
-  
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table); 
-  
-  // now add in the description below the table if one exists
-  if ($description) { ?>
-    <div style="text-align: justify"><?php print $description; ?></div> <?php  
-  }
-  ?>
-</div>

+ 38 - 42
tripal_library/theme/tripal_library/tripal_library.properties.tpl.php

@@ -15,48 +15,44 @@ foreach ($props as $prop) {
   $properties[] = $prop;
 }
 
-if(count($properties) > 0){ ?>
+if(count($properties) > 0){ 
 
-  <div id="tripal_library-properties-box" class="tripal_library-info-box tripal-info-box">
-    <div class="tripal_library-info-box-title tripal-info-box-title">Properties</div> <?php
-
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Property Name', 'Value');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($properties as $property){
-      $property = tripal_core_expand_chado_vars($property,'field','libraryprop.value');
-      $rows[] = array(
-        ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-        urldecode($property->value)
-      );
-    }
-     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_library-table-properties',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($properties as $property){
+    $property = tripal_core_expand_chado_vars($property,'field','libraryprop.value');
+    $rows[] = array(
+      ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
+      urldecode($property->value)
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
+  }
+   
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_library-table-properties',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
 }

+ 64 - 67
tripal_library/theme/tripal_library/tripal_library.publications.tpl.php

@@ -8,78 +8,75 @@ $library_pubs = $library->library_pub;
 
 
 if (count($library_pubs) > 0) { ?>
-  <div id="tripal_library_pub-pub-box" class="tripal_library_pub-info-box tripal-info-box">
-    <div class="tripal_library_pub-info-box-title tripal-info-box-title">Publications</div>
-    <div class="tripal_library_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+  <div class="tripal_library_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Year', 'Publication');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
   
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Year', 'Publication');
+  foreach ($library_pubs as $library_pub) {
+    $pub = $library_pub->pub_id;
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
+    $citation = $pub->title;  // use the title as the default citation
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // get the citation for this pub if it exists
+    $values = array(
+      'pub_id' => $pub->pub_id, 
+      'type_id' => array(
+        'name' => 'Citation',
+      ),
+    );
+    $options = array('return_array' => 1);
+    $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
+    if (count($citation_prop) == 1) {
+      $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
+      $citation = $citation_prop[0]->value;
+    }
     
-    foreach ($library_pubs as $library_pub) {
-      $pub = $library_pub->pub_id;
-      $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-      $citation = $pub->title;  // use the title as the default citation
-      
-      // get the citation for this pub if it exists
-      $values = array(
-        'pub_id' => $pub->pub_id, 
-        'type_id' => array(
-          'name' => 'Citation',
-        ),
-      );
-      $options = array('return_array' => 1);
-      $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
-      if (count($citation_prop) == 1) {
-        $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
-        $citation = $citation_prop[0]->value;
-      }
-      
-      // if the publication is synced then link to it
-      if ($pub->nid) {
-        // replace the title with a link
-        $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-        $patterns = array(
-          '/(\()/', '/(\))/',
-          '/(\])/', '/(\[)/',
-          '/(\{)/', '/(\})/',
-          '/(\+)/', '/(\.)/', '/(\?)/',
-        );
-        $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
-        $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
-      }
-      
-      $rows[] = array(
-        $pub->pyear,
-        $citation,
+    // if the publication is synced then link to it
+    if ($pub->nid) {
+      // replace the title with a link
+      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
+      $patterns = array(
+        '/(\()/', '/(\))/',
+        '/(\])/', '/(\[)/',
+        '/(\{)/', '/(\})/',
+        '/(\+)/', '/(\.)/', '/(\?)/',
       );
+      $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
+      $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_library-table-publications',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $pub->pyear,
+      $citation,
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php 
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_library-table-publications',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
 }

+ 47 - 50
tripal_library/theme/tripal_library/tripal_library.references.tpl.php

@@ -14,57 +14,54 @@ if (count($library_dbxrefs) > 0 ) {
 
 
 if(count($references) > 0){ ?>
-  <div id="tripal_library-references-box" class="tripal_library-info-box tripal-info-box">
-    <div class="tripal_library-info-box-title tripal-info-box-title">Cross References</div>
-    <div class="tripal_library-info-box-desc tripal-info-box-desc">External references for this <?php print $library->type_id->name ?></div><?php
-     
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Dababase', 'Accession');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
- 
-    foreach ($references as $dbxref){
-     
-      $dbname = $dbxref->db_id->name; 
-      if ($dbxref->db_id->url) { 
-        $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
-      } 
-      
-      $accession = $dbxref->accession; 
-      if ($dbxref->db_id->urlprefix) { 
-        $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-      } 
-      $rows[] = array(
-        $dbname,
-        $accession
-      );
+  <div class="tripal_library-info-box-desc tripal-info-box-desc">External references for this <?php print $library->type_id->name ?></div><?php
+   
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Dababase', 'Accession');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+
+  foreach ($references as $dbxref){
+   
+    $dbname = $dbxref->db_id->name; 
+    if ($dbxref->db_id->url) { 
+      $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
     } 
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_library-table-references',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $accession = $dbxref->accession; 
+    if ($dbxref->db_id->urlprefix) { 
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
+    } 
+    $rows[] = array(
+      $dbname,
+      $accession
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div><?php 
-}?>
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_library-table-references',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+}
 

+ 38 - 41
tripal_library/theme/tripal_library/tripal_library.synonyms.tpl.php

@@ -8,46 +8,43 @@ $library = tripal_core_expand_chado_vars($library, 'table', 'library_synonym', $
 $synonyms = $library->library_synonym;
 
 if(count($synonyms) > 0){ ?>
-  <div id="tripal_library-synonyms-box" class="tripal_library-info-box tripal-info-box">
-    <div class="tripal_library-info-box-title tripal-info-box-title">Synonyms</div>
-    <div class="tripal_library-info-box-desc tripal-info-box-desc">The library '<?php print $library->name ?>' has the following synonyms</div><?php
-    
-    // the $headers array is an array of fields to use as the colum headers. 
-    // additional documentation can be found here 
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    // This table for the analysis has a vertical header (down the first column)
-    // so we do not provide headers here, but specify them in the $rows array below.
-    $headers = array('Synonym');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-    $rows = array();
-    foreach ($synonyms as $library_synonym){
-      $rows[] = array(
-        $library_synonym->synonym_id->name
-      );
-    } 
-    
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_library-table-synonyms',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  <div class="tripal_library-info-box-desc tripal-info-box-desc">The library '<?php print $library->name ?>' has the following synonyms</div><?php
+  
+  // the $headers array is an array of fields to use as the colum headers. 
+  // additional documentation can be found here 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  // This table for the analysis has a vertical header (down the first column)
+  // so we do not provide headers here, but specify them in the $rows array below.
+  $headers = array('Synonym');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  $rows = array();
+  foreach ($synonyms as $library_synonym){
+    $rows[] = array(
+      $library_synonym->synonym_id->name
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-      print theme_table($table); ?>
-  </div><?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_library-table-synonyms',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 48 - 51
tripal_library/theme/tripal_library/tripal_library.terms.tpl.php

@@ -13,59 +13,56 @@ foreach ($terms as $term) {
 }
 
 if (count($s_terms) > 0) { ?>
-  <div id="tripal_library-terms-box" class="tripal_library-info-box tripal-info-box">
-    <div class="tripal_library-info-box-title tripal-info-box-title">Annotated Terms</div>
-    <div class="tripal_library-info-box-desc tripal-info-box-desc">The following terms have been associated with this <?php print $node->library->type_id->name ?>:</div>  <?php
+  <div class="tripal_library-info-box-desc tripal-info-box-desc">The following terms have been associated with this <?php print $node->library->type_id->name ?>:</div>  <?php
+  
+  // iterate through each term
+  $i = 0;
+  foreach ($s_terms as $cv => $terms) {  
+    // the $headers array is an array of fields to use as the colum headers.
+    // additional documentation can be found here
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $headers = array('Term', 'Definition');
     
-    // iterate through each term
-    $i = 0;
-    foreach ($s_terms as $cv => $terms) {  
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Term', 'Definition');
-      
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row.  Additional documentation
-      // can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
-      
-      foreach ($terms as $term) { 
+    // the $rows array contains an array of rows where each row is an array
+    // of values for each column of the table in that row.  Additional documentation
+    // can be found here:
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $rows = array();
+    
+    foreach ($terms as $term) { 
 
-        $accession = $term->cvterm_id->dbxref_id->accession;
-        if (is_numeric($term->cvterm_id->dbxref_id->accession)) {
-          $accession = $term->cvterm_id->dbxref_id->db_id->name . ":" . $term->cvterm_id->dbxref_id->accession;
-        }
-        if ($term->cvterm_id->dbxref_id->db_id->urlprefix) {
-          $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, array('attributes' => array("target" => '_blank')));
-        } 
-        
-        $rows[] = array(
-          $accession,
-          $term->cvterm_id->name
-        );
+      $accession = $term->cvterm_id->dbxref_id->accession;
+      if (is_numeric($term->cvterm_id->dbxref_id->accession)) {
+        $accession = $term->cvterm_id->dbxref_id->db_id->name . ":" . $term->cvterm_id->dbxref_id->accession;
+      }
+      if ($term->cvterm_id->dbxref_id->db_id->urlprefix) {
+        $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, array('attributes' => array("target" => '_blank')));
       } 
-      // the $table array contains the headers and rows array as well as other
-      // options for controlling the display of the table.  Additional
-      // documentation can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $table = array(
-        'header' => $headers,
-        'rows' => $rows,
-        'attributes' => array(
-          'id' => "tripal_library-table-terms-$i",
-        ),
-        'sticky' => FALSE,
-        'caption' => '<b>Vocabulary: ' . ucwords(preg_replace('/_/', ' ', $cv)) . '</b>',
-        'colgroups' => array(),
-        'empty' => '',
-      );
       
-      // once we have our table array structure defined, we call Drupal's theme_table()
-      // function to generate the table.
-      print theme_table($table);
-      $i++;
-    } ?>
-  </div> <?php
+      $rows[] = array(
+        $accession,
+        $term->cvterm_id->name
+      );
+    } 
+    // the $table array contains the headers and rows array as well as other
+    // options for controlling the display of the table.  Additional
+    // documentation can be found here:
+    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+    $table = array(
+      'header' => $headers,
+      'rows' => $rows,
+      'attributes' => array(
+        'id' => "tripal_library-table-terms-$i",
+      ),
+      'sticky' => FALSE,
+      'caption' => '<b>Vocabulary: ' . ucwords(preg_replace('/_/', ' ', $cv)) . '</b>',
+      'colgroups' => array(),
+      'empty' => '',
+    );
+    
+    // once we have our table array structure defined, we call Drupal's theme_table()
+    // function to generate the table.
+    print theme_table($table);
+    $i++;
+  }
 } ?>

+ 50 - 53
tripal_library/theme/tripal_organism/tripal_organism.libraries.tpl.php

@@ -9,63 +9,60 @@ $libraries = $organism->library;
 
 
 if (count($libraries) > 0) {?>
-  <div id="tripal_organism-library_list-box" class="tripal_organism-info-box tripal-info-box">
-    <div class="tripal_organism-info-box-title tripal-info-box-title">Libraries</div>
-    <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following libraries are associated with this organism.</div> <?php 
+  <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following libraries are associated with this organism.</div> <?php 
+  
+  // the $headers array is an array of fields to use as the colum headers. 
+  // additional documentation can be found here 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  // This table for the analysis has a vertical header (down the first column)
+  // so we do not provide headers here, but specify them in the $rows array below.
+  $headers = array('Library Name', 'Type');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  $rows = array();
+  foreach ($libraries as $library){ 
     
-    // the $headers array is an array of fields to use as the colum headers. 
-    // additional documentation can be found here 
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    // This table for the analysis has a vertical header (down the first column)
-    // so we do not provide headers here, but specify them in the $rows array below.
-    $headers = array('Library Name', 'Type');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-    $rows = array();
-    foreach ($libraries as $library){ 
-      
-      $libname = $library->name;
-      if ($library->nid) {
-        $libname = l($libname, "node/".$library->nid, array('attributes' => array('target' => '_blank')));
-      }
-      
-      $typename = $library->type_id->name;
-      if ($typename == 'cdna_library') {
-        $typename = 'cDNA';
-      }
-      else if ($typename == 'bac_library') {
-        $typename = 'BAC';
-      }
-      
-      $rows[] = array(
-        $libname,
-        $typename
-      );      
+    $libname = $library->name;
+    if ($library->nid) {
+      $libname = l($libname, "node/".$library->nid, array('attributes' => array('target' => '_blank')));
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_organism-table-libraries',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
+    $typename = $library->type_id->name;
+    if ($typename == 'cdna_library') {
+      $typename = 'cDNA';
+    }
+    else if ($typename == 'bac_library') {
+      $typename = 'BAC';
+    }
     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>  
-  </div><?php
+    $rows[] = array(
+      $libname,
+      $typename
+    );      
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_organism-table-libraries',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }
 
 

+ 125 - 128
tripal_natural_diversity/theme/tripal_feature/tripal_feature.nd_genotypes.tpl.php

@@ -67,147 +67,144 @@ $total_records = $_SESSION['chado_pager'][$feature_pager_id]['total_records'];
 
 // now iterate through the feature genotypes and print a paged table.
 if (count($feature_genotypes) > 0) { ?>
-  <div id="tripal_feature-nd_genotypes-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Genotypes</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">This following <?php print number_format($total_records) ?> genotype(s) have been recorded for this feature.</div> <?php 
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">This following <?php print number_format($total_records) ?> genotype(s) have been recorded for this feature.</div> <?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Name', 'Type', 'Genotype', 'Details', 'Germplasm', 'Project');
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Name', 'Type', 'Genotype', 'Details', 'Germplasm', 'Project');
 
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($feature_genotypes as $feature_genotype) {
+    $project_names = 'N/A';
+    $stock_names   = 'N/A';
     
-    foreach ($feature_genotypes as $feature_genotype) {
-      $project_names = 'N/A';
-      $stock_names   = 'N/A';
-      
-      // get the genotype from the feature_genotype record
-      $genotype = $feature_genotype->genotype_id;
+    // get the genotype from the feature_genotype record
+    $genotype = $feature_genotype->genotype_id;
 
-      // build the name for displaying the genotype. Use the uniquename by default
-      // unless a name exists
-      $name = $genotype->uniquename;
-      if ($genotype->name){
-        $name = $genotype->name;
-      }
-      
-      // build the genotype type for display
-      $type = 'N/A';
-      if ($genotype->type_id) {
-        $type = ucwords(preg_replace('/_/', ' ', $genotype->type_id->name));
-      }
+    // build the name for displaying the genotype. Use the uniquename by default
+    // unless a name exists
+    $name = $genotype->uniquename;
+    if ($genotype->name){
+      $name = $genotype->name;
+    }
+    
+    // build the genotype type for display
+    $type = 'N/A';
+    if ($genotype->type_id) {
+      $type = ucwords(preg_replace('/_/', ' ', $genotype->type_id->name));
+    }
 
-      // build the genotype properties
-      $options = array('return_array' => 1);
-      $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'genotypeprop', $options);
-      $properties = $genotype->genotypeprop;
-      $details = '';
-      if(count($properties) > 0) {
-        foreach ($properties as $property){
-          $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
-        }
-        $details = substr($details, 0, -4); // remove trailing <br>
+    // build the genotype properties
+    $options = array('return_array' => 1);
+    $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'genotypeprop', $options);
+    $properties = $genotype->genotypeprop;
+    $details = '';
+    if(count($properties) > 0) {
+      foreach ($properties as $property){
+        $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
       }
+      $details = substr($details, 0, -4); // remove trailing <br>
+    }
 
-      // get the nd_experiment_genotype records and if any
-      $values = array('genotype_id' => $genotype->genotype_id);
-      $nd_experiment_genotype = tripal_core_generate_chado_var('nd_experiment_genotype', $values);
-      if ($nd_experiment_genotype) {
-        $nd_experiment    = $nd_experiment_genotype->nd_experiment_id;
-        $nd_experiment_id = $nd_experiment_genotype->nd_experiment_id->nd_experiment_id;
+    // get the nd_experiment_genotype records and if any
+    $values = array('genotype_id' => $genotype->genotype_id);
+    $nd_experiment_genotype = tripal_core_generate_chado_var('nd_experiment_genotype', $values);
+    if ($nd_experiment_genotype) {
+      $nd_experiment    = $nd_experiment_genotype->nd_experiment_id;
+      $nd_experiment_id = $nd_experiment_genotype->nd_experiment_id->nd_experiment_id;
 
-        // expand the nd_experiment object to incldue the nd_experiment_stock table
-        $values = array('nd_experiment_id' => $nd_experiment_id);
-        $options = array(
-          'return_array' => 1,
-          'include_fk' => array(
-            'stock_id' => array(
-              'type_id' => 1
-            )
-          ),
-        );
-        $nd_experiment = tripal_core_expand_chado_vars($nd_experiment, 'table', 'nd_experiment_stock', $options);
-        $nd_experiment_stocks = $nd_experiment->nd_experiment_stock;
-        if (count($nd_experiment_stocks) > 0) {
-          $stock_names = '';
-          foreach ($nd_experiment_stocks as $nd_experiment_stock) {
-            $stock = $nd_experiment_stock->stock_id;
-            $stock_name = $stock->name . ' (' . $stock->uniquename . ')';
-            if (property_exists($stock, 'nid')) {
-              $stock_name = l($stock_name, 'node/' . $stock->nid);
-            }
-            $stock_names .= $stock_name . '<br>';
+      // expand the nd_experiment object to incldue the nd_experiment_stock table
+      $values = array('nd_experiment_id' => $nd_experiment_id);
+      $options = array(
+        'return_array' => 1,
+        'include_fk' => array(
+          'stock_id' => array(
+            'type_id' => 1
+          )
+        ),
+      );
+      $nd_experiment = tripal_core_expand_chado_vars($nd_experiment, 'table', 'nd_experiment_stock', $options);
+      $nd_experiment_stocks = $nd_experiment->nd_experiment_stock;
+      if (count($nd_experiment_stocks) > 0) {
+        $stock_names = '';
+        foreach ($nd_experiment_stocks as $nd_experiment_stock) {
+          $stock = $nd_experiment_stock->stock_id;
+          $stock_name = $stock->name . ' (' . $stock->uniquename . ')';
+          if (property_exists($stock, 'nid')) {
+            $stock_name = l($stock_name, 'node/' . $stock->nid);
           }
-          $stock_names = substr($stock_names, 0, -4); // remove trailing <br>
+          $stock_names .= $stock_name . '<br>';
         }
-        
-        // expand the nd_experiment object to incldue the nd_experiment_project table
-        $values = array('nd_experiment_id' => $nd_experiment_id);
-        $options = array('return_array' => 1);
-        $nd_experiment = tripal_core_expand_chado_vars($nd_experiment, 'table', 'nd_experiment_project', $options);
-        $nd_experiment_projects = $nd_experiment->nd_experiment_project;
-        if (count($nd_experiment_projects) > 0) {
-          $project_names = '';
-          foreach ($nd_experiment_projects as $nd_experiment_project) {
-            $project = $nd_experiment_project->project_id;
-            $project_name = $project->name;
-            if (property_exists($project, 'nid')) {
-              $project_name = l($project_name, "node/" . $project->nid, array('attributes' => array('target' => '_blank')));
-            }
-            $project_names .= $project_name . '<br>';
+        $stock_names = substr($stock_names, 0, -4); // remove trailing <br>
+      }
+      
+      // expand the nd_experiment object to incldue the nd_experiment_project table
+      $values = array('nd_experiment_id' => $nd_experiment_id);
+      $options = array('return_array' => 1);
+      $nd_experiment = tripal_core_expand_chado_vars($nd_experiment, 'table', 'nd_experiment_project', $options);
+      $nd_experiment_projects = $nd_experiment->nd_experiment_project;
+      if (count($nd_experiment_projects) > 0) {
+        $project_names = '';
+        foreach ($nd_experiment_projects as $nd_experiment_project) {
+          $project = $nd_experiment_project->project_id;
+          $project_name = $project->name;
+          if (property_exists($project, 'nid')) {
+            $project_name = l($project_name, "node/" . $project->nid, array('attributes' => array('target' => '_blank')));
           }
-          $project_names = substr($project_names, 0, -4); // remove trailing <br>
+          $project_names .= $project_name . '<br>';
         }
+        $project_names = substr($project_names, 0, -4); // remove trailing <br>
       }
+    }
 
-      $rows[] = array(
-        $name,
-        $type,
-        $genotype->description,
-        $details,
-        $stock_names,
-        $project_names,
-      );
-    } 
-    
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_natural_diversity-table-genotypes',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); 
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'features'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $feature_pager_id,
-      'parameters' => array(
-        'block' => 'genotypes'
-      ),
-      'quantity' => $num_results_per_page,
+    $rows[] = array(
+      $name,
+      $type,
+      $genotype->description,
+      $details,
+      $stock_names,
+      $project_names,
     );
-    print theme_pager($pager); ?>
-  </div> <?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_natural_diversity-table-genotypes',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'features'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $feature_pager_id,
+    'parameters' => array(
+      'block' => 'genotypes'
+    ),
+    'quantity' => $num_results_per_page,
+  );
+  print theme_pager($pager); 
 }

+ 124 - 127
tripal_natural_diversity/theme/tripal_stock/tripal_stock.nd_genotypes.tpl.php

@@ -102,142 +102,139 @@ $total_records = $_SESSION['chado_pager'][$stock_pager_id]['total_records'];
 
 // now iterate through the feature genotypes and print a paged table.
 if (count($genotypes) > 0) { ?>
-  <div id="tripal_feature-nd_genotypes-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Genotypes</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">The following <?php print number_format($total_records) ?> genotype(s) have been recorded for this feature.</div> <?php 
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">The following <?php print number_format($total_records) ?> genotype(s) have been recorded for this feature.</div> <?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Name', 'Type', 'Genotype', 'Details', 'Markers', 'Project');
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Name', 'Type', 'Genotype', 'Details', 'Markers', 'Project');
 
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  // iterate through the genotypes and build each row of the resulting table
+  foreach ($genotypes as $info) {
+    $genotype         = $info['genotype'];
+    $nd_experiment_id = $info['nd_experiment_id'];
     
-    // iterate through the genotypes and build each row of the resulting table
-    foreach ($genotypes as $info) {
-      $genotype         = $info['genotype'];
-      $nd_experiment_id = $info['nd_experiment_id'];
-      
-      // set some defaults for project and feature names
-      $project_names = 'N/A';
-      $feature_names = 'N/A';
-      
-      // build the name for displaying the genotype. Use the uniquename by default
-      // unless a name exists
-      $name = $genotype->uniquename;
-      if ($genotype->name){
-        $name = $genotype->name;
-      }
-      
-      // build the genotype type for display
-      $type = 'N/A';
-      if ($genotype->type_id) {
-        $type = ucwords(preg_replace('/_/', ' ', $genotype->type_id->name));
-      }
+    // set some defaults for project and feature names
+    $project_names = 'N/A';
+    $feature_names = 'N/A';
+    
+    // build the name for displaying the genotype. Use the uniquename by default
+    // unless a name exists
+    $name = $genotype->uniquename;
+    if ($genotype->name){
+      $name = $genotype->name;
+    }
+    
+    // build the genotype type for display
+    $type = 'N/A';
+    if ($genotype->type_id) {
+      $type = ucwords(preg_replace('/_/', ' ', $genotype->type_id->name));
+    }
 
-      // build the genotype properties
-      $options = array('return_array' => 1);
-      $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'genotypeprop', $options);
-      $properties = $genotype->genotypeprop;
-      $details = '';
-      if(count($properties) > 0) {
-        foreach ($properties as $property){
-          $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
-        }
-        $details = substr($details, 0, -4); // remove trailing <br>
+    // build the genotype properties
+    $options = array('return_array' => 1);
+    $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'genotypeprop', $options);
+    $properties = $genotype->genotypeprop;
+    $details = '';
+    if(count($properties) > 0) {
+      foreach ($properties as $property){
+        $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
       }
-      
-      // get the features as found in the feature_genotype table and if any, add them to the $features array
-      // we will later add in the features list for display
-      $features = array();
-      $options = array(
-        'return_array' => 1,
-        'include_fk' => array(
-          'feature_id' => array(
-            'type_id' => 1
-          )
-        ),
-      );
-      $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'feature_genotype', $options);
-      $feature_genotypes = $genotype->feature_genotype;
-      if (count($feature_genotypes) > 0) {
-        $feature_names = '';
-        foreach ($feature_genotypes as $feature_genotype) {
-          $feature = $feature_genotype->feature_id;
-          $feature_name = $feature->name . ' (' . $feature->uniquename . ')';
-          if (property_exists($feature, 'nid')) {
-            $feature_name = l($feature_name, 'node/' . $feature->nid);
-          }
-          $feature_names .= $feature_name . '<br>';
+      $details = substr($details, 0, -4); // remove trailing <br>
+    }
+    
+    // get the features as found in the feature_genotype table and if any, add them to the $features array
+    // we will later add in the features list for display
+    $features = array();
+    $options = array(
+      'return_array' => 1,
+      'include_fk' => array(
+        'feature_id' => array(
+          'type_id' => 1
+        )
+      ),
+    );
+    $genotype = tripal_core_expand_chado_vars($genotype, 'table', 'feature_genotype', $options);
+    $feature_genotypes = $genotype->feature_genotype;
+    if (count($feature_genotypes) > 0) {
+      $feature_names = '';
+      foreach ($feature_genotypes as $feature_genotype) {
+        $feature = $feature_genotype->feature_id;
+        $feature_name = $feature->name . ' (' . $feature->uniquename . ')';
+        if (property_exists($feature, 'nid')) {
+          $feature_name = l($feature_name, 'node/' . $feature->nid);
         }
-        $feature_names = substr($feature_names, 0, -4); // remove trailing <br>
+        $feature_names .= $feature_name . '<br>';
       }
-        
-      // expand the nd_experiment object to incldue the nd_experiment_project table
-      $values = array('nd_experiment_id' => $nd_experiment_id);
-      $options = array('return_array' => 1);
-      $nd_experiment = tripal_core_expand_chado_vars($nd_experiment, 'table', 'nd_experiment_project', $options);
-      $nd_experiment_projects = $nd_experiment->nd_experiment_project;
-      if (count($nd_experiment_projects) > 0) {
-        $project_names = '';
-        foreach ($nd_experiment_projects as $nd_experiment_project) {
-          $project = $nd_experiment_project->project_id;
-          $project_name = $project->name;
-          if (property_exists($project, 'nid')) {
-            $project_name = l($project_name, "node/" . $project->nid, array('attributes' => array('target' => '_blank')));
-          }
-          $project_names .= $project_name . '<br>';
+      $feature_names = substr($feature_names, 0, -4); // remove trailing <br>
+    }
+      
+    // expand the nd_experiment object to incldue the nd_experiment_project table
+    $values = array('nd_experiment_id' => $nd_experiment_id);
+    $options = array('return_array' => 1);
+    $nd_experiment = tripal_core_expand_chado_vars($nd_experiment, 'table', 'nd_experiment_project', $options);
+    $nd_experiment_projects = $nd_experiment->nd_experiment_project;
+    if (count($nd_experiment_projects) > 0) {
+      $project_names = '';
+      foreach ($nd_experiment_projects as $nd_experiment_project) {
+        $project = $nd_experiment_project->project_id;
+        $project_name = $project->name;
+        if (property_exists($project, 'nid')) {
+          $project_name = l($project_name, "node/" . $project->nid, array('attributes' => array('target' => '_blank')));
         }
-        $project_names = substr($project_names, 0, -4); // remove trailing <br>
+        $project_names .= $project_name . '<br>';
       }
+      $project_names = substr($project_names, 0, -4); // remove trailing <br>
+    }
 
-      $rows[] = array(
-        $name,
-        $type,
-        $genotype->description,
-        $details,
-        $feature_names,
-        $project_names,
-      );
-    } 
-    
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_natural_diversity-table-genotypes',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $name,
+      $type,
+      $genotype->description,
+      $details,
+      $feature_names,
+      $project_names,
     );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); 
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'features'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $stock_pager_id,
-      'parameters' => array(
-        'block' => 'genotypes'
-      ),
-      'quantity' => $num_results_per_page,
-    );
-    print theme_pager($pager); ?>
-  </div> <?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_natural_diversity-table-genotypes',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'features'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $stock_pager_id,
+    'parameters' => array(
+      'block' => 'genotypes'
+    ),
+    'quantity' => $num_results_per_page,
+  );
+  print theme_pager($pager);
 }

+ 81 - 84
tripal_natural_diversity/theme/tripal_stock/tripal_stock.nd_phenotypes.tpl.php

@@ -66,95 +66,92 @@ if (count($nd_experiment_stocks) > 0) {
 }
 
 if (count($phenotypes) > 0) {?>
-  <div id="tripal_stock-phenotypes-box" class="tripal_stock-info-box tripal-info-box">
-    <div class="tripal_stock-info-box-title tripal-info-box-title">Phenotypes</div>
-    <div class="tripal_stock-info-box-desc tripal-info-box-desc">This following phenotypes have been recorded for this stock.</div><?php 
+  <div class="tripal_stock-info-box-desc tripal-info-box-desc">This following phenotypes have been recorded for this stock.</div><?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Phenotypes', 'Project');
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Phenotypes', 'Project');
 
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    // iterate through the nd_experiment_stock records and get 
-    // each experiment and the associated phenotypes
-    foreach ($phenotypes as $nd_experiment_id => $phenotype){
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  // iterate through the nd_experiment_stock records and get 
+  // each experiment and the associated phenotypes
+  foreach ($phenotypes as $nd_experiment_id => $phenotype){
 
-      $details = '';
+    $details = '';
 
-      if ($phenotype->name) { 
-        $details .= "Name: $phenotype->name<br>";
-      }
-      
-      // add in the attribute type pheonotypes values are stored qualitatively or quantitatively. 
-      // If qualitatively the cvalue_id will link to a type. If quantitative we
-      // use the value column
-      $details .= ucwords(preg_replace('/_/', ' ', $phenotype->attr_id->name)) . ': ';
-      if ($phenotype->cvalue_id) { 
-        $details .= ucwords(preg_replace('/_/', ' ', $phenotype->cvalue_id->name)) . '<br>';
-      }
-      else { 
-        $details .= $phenotype->value . '<br>';
-      }  
-      
-      // get the observable unit and add it to the details
-      if ($phenotype->observable_id) { 
-        $details .= "Observable Unit: " . ucwords(preg_replace('/_/', ' ', $phenotype->observable_id->name)) . '<br>';
-      }
-      
-      // get the evidence unit and add it to the details
-      if ($phenotype->assay_id) { 
-        $details .= "Evidence: " .  ucwords(preg_replace('/_/', ' ', $phenotype->assay_id->name)) . '<br>';
-      }
-      
-      // Get the project for this experiment. For each nd_experiment_id there should only be one project
-      // but the database does not constrain that there only be one project so just in case we get them all
-      $projects = array();
-      $values = array('nd_experiment_id' => $nd_experiment_stock->nd_experiment_id->nd_experiment_id);
-      $nd_experiment_project = tripal_core_generate_chado_var('nd_experiment_project', $values, $options);
-      $nd_experiment_projects = $nd_experiment_project;
-      foreach ($nd_experiment_projects as $nd_experiment_project) {
-        // we do have a project record, so add it to our $phenotypes array for display below
-        $projects = $nd_experiment_project->project_id;
-      }
-      $pnames = 'N/A';
-      foreach ($projects as $project) {
-        $project = $project->project_id;
-        $name = $project->name;
-        if (property_exists($project, 'nid')) {
-          $name = l($name, "node/" . $project->nid, array('attributes' => array('target' => '_blank')));
-        }
-        $pnames .= $name . '<br>';
+    if ($phenotype->name) { 
+      $details .= "Name: $phenotype->name<br>";
+    }
+    
+    // add in the attribute type pheonotypes values are stored qualitatively or quantitatively. 
+    // If qualitatively the cvalue_id will link to a type. If quantitative we
+    // use the value column
+    $details .= ucwords(preg_replace('/_/', ' ', $phenotype->attr_id->name)) . ': ';
+    if ($phenotype->cvalue_id) { 
+      $details .= ucwords(preg_replace('/_/', ' ', $phenotype->cvalue_id->name)) . '<br>';
+    }
+    else { 
+      $details .= $phenotype->value . '<br>';
+    }  
+    
+    // get the observable unit and add it to the details
+    if ($phenotype->observable_id) { 
+      $details .= "Observable Unit: " . ucwords(preg_replace('/_/', ' ', $phenotype->observable_id->name)) . '<br>';
+    }
+    
+    // get the evidence unit and add it to the details
+    if ($phenotype->assay_id) { 
+      $details .= "Evidence: " .  ucwords(preg_replace('/_/', ' ', $phenotype->assay_id->name)) . '<br>';
+    }
+    
+    // Get the project for this experiment. For each nd_experiment_id there should only be one project
+    // but the database does not constrain that there only be one project so just in case we get them all
+    $projects = array();
+    $values = array('nd_experiment_id' => $nd_experiment_stock->nd_experiment_id->nd_experiment_id);
+    $nd_experiment_project = tripal_core_generate_chado_var('nd_experiment_project', $values, $options);
+    $nd_experiment_projects = $nd_experiment_project;
+    foreach ($nd_experiment_projects as $nd_experiment_project) {
+      // we do have a project record, so add it to our $phenotypes array for display below
+      $projects = $nd_experiment_project->project_id;
+    }
+    $pnames = 'N/A';
+    foreach ($projects as $project) {
+      $project = $project->project_id;
+      $name = $project->name;
+      if (property_exists($project, 'nid')) {
+        $name = l($name, "node/" . $project->nid, array('attributes' => array('target' => '_blank')));
       }
-      $pnames = substr($pnames, 0, -4); // remove trailing <br>
-      
-      $rows[] = array(
-         $details,
-         $pnames,
-      );
+      $pnames .= $name . '<br>';
     }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_natural_diversity-table-phenotypes',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $pnames = substr($pnames, 0, -4); // remove trailing <br>
+    
+    $rows[] = array(
+       $details,
+       $pnames,
     );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?> 
-  </div><?php
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_natural_diversity-table-phenotypes',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 9 - 3
tripal_natural_diversity/tripal_natural_diversity.module

@@ -174,7 +174,9 @@ function tripal_natural_diversity_node_view($node, $view_mode, $langcode) {
           unset($node->content['tripal_feature_genotypes']);
         }
         $node->content['tripal_feature_nd_genotypes'] = array(
-           '#value' => theme('tripal_feature_nd_genotypes', array('node' => $node)),
+          '#value' => theme('tripal_feature_nd_genotypes', array('node' => $node)),
+          '#tripal_toc_id'    => 'genotypes',
+          '#tripal_toc_title' => 'Genotypes',
         );
       }
       break;
@@ -187,10 +189,14 @@ function tripal_natural_diversity_node_view($node, $view_mode, $langcode) {
           unset($node->content['tripal_stock_genotypes']);
         }
         $node->content['tripal_stock_nd_genotypes'] = array(
-           '#value' => theme('tripal_stock_nd_genotypes', array('node' => $node)),
+          '#value' => theme('tripal_stock_nd_genotypes', array('node' => $node)),
+          '#tripal_toc_id'    => 'genotypes',
+          '#tripal_toc_title' => 'Genotypes',
         );
         $node->content['tripal_stock_nd_phenotypes'] = array(
-           '#value' => theme('tripal_stock_nd_phenotypes', array('node' => $node)),
+          '#value' => theme('tripal_stock_nd_phenotypes', array('node' => $node)),
+          '#tripal_toc_id'    => 'phenotypes',
+          '#tripal_toc_title' => 'Phenotypes',
         );
       }
       break;

+ 4 - 1
tripal_organism/includes/tripal_organism.chado_node.inc

@@ -436,7 +436,10 @@ function tripal_organism_node_view($node, $view_mode, $langcode) {
       // Show feature browser and counts
       if ($view_mode == 'full') {
         $node->content['tripal_organism_base'] = array(
-          '#value' => theme('tripal_organism_base', array('node' => $node)),
+          '#value'  => theme('tripal_organism_base', array('node' => $node)),
+          '#weight' => 0,
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
         );
       }
       if ($view_mode == 'teaser') {

+ 89 - 91
tripal_organism/theme/tripal_organism/tripal_organism_base.tpl.php

@@ -1,102 +1,100 @@
 <?php
+
 $organism  = $variables['node']->organism;
 $organism = tripal_core_expand_chado_vars($organism,'field','organism.comment'); ?>
 
-<div id="tripal_organism-base-box" class="tripal_organism-info-box tripal-info-box">
-  <div class="tripal_organism-info-box-title tripal-info-box-title">Details</div>
-  <!--  <div class="tripal_organism-info-box-desc tripal-info-box-desc"></div> --><?php      
-  
-  // generate the image tag
-  $image = '';
-  $image_url = tripal_organism_get_image_url($organism, $node->nid); 
-  if ($image_url) {
-    $image = "<img src=\"$image_url\">";
-  }
-  
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  // This table for the organism has a vertical header (down the first column)
-  // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array();
-  
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
-  
-  // genus row
-  $rows[] = array(
-    array(
-      'data' => 'Genus', 
-      'header' => TRUE
-    ),
-    '<i>' . $organism->genus . '</i>'
-  );
-  
-  // species row
-  $rows[] = array(
-    array(
-      'data' => 'Species', 
-      'header' => TRUE
-    ), 
-    '<i>' . $organism->species . '</i>'
-  );
-  
-  // common name row
+<div class="tripal_organism-info-box-desc tripal-info-box-desc"></div><?php
+
+// generate the image tag
+$image = '';
+$image_url = tripal_organism_get_image_url($organism, $node->nid); 
+if ($image_url) {
+  $image = "<img src=\"$image_url\">";
+}
+
+// the $headers array is an array of fields to use as the colum headers. 
+// additional documentation can be found here 
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+// This table for the organism has a vertical header (down the first column)
+// so we do not provide headers here, but specify them in the $rows array below.
+$headers = array();
+
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+$rows = array();
+
+// genus row
+$rows[] = array(
+  array(
+    'data' => 'Genus', 
+    'header' => TRUE
+  ),
+  '<i>' . $organism->genus . '</i>'
+);
+
+// species row
+$rows[] = array(
+  array(
+    'data' => 'Species', 
+    'header' => TRUE
+  ), 
+  '<i>' . $organism->species . '</i>'
+);
+
+// common name row
+$rows[] = array(
+  array(
+    'data' => 'Common Name',
+    'header' => TRUE
+  ),
+  $organism->common_name,
+);
+
+// abbreviation row
+$rows[] = array(
+  array(
+    'data' => 'Abbreviation', 
+    'header' => TRUE
+  ),
+  $organism->abbreviation
+);
+
+// allow site admins to see the organism ID
+if (user_access('access administration pages')) {
+  // Organism ID
   $rows[] = array(
     array(
-      'data' => 'Common Name',
-      'header' => TRUE
+      'data'   => 'Organism ID',
+      'header' => TRUE,
+      'class'  => 'tripal-site-admin-only-table-row',
     ),
-    $organism->common_name,
-  );
-  
-  // abbreviation row
-  $rows[] = array(
     array(
-      'data' => 'Abbreviation', 
-      'header' => TRUE
+     'data'  => $organism->organism_id,
+     'class' => 'tripal-site-admin-only-table-row',
     ),
-    $organism->abbreviation
   );
-  
-  // allow site admins to see the organism ID
-  if (user_access('access administration pages')) {
-    // Organism ID
-    $rows[] = array(
-      array(
-        'data'   => 'Organism ID',
-        'header' => TRUE,
-        'class'  => 'tripal-site-admin-only-table-row',
-      ),
-      array(
-       'data'  => $organism->organism_id,
-       'class' => 'tripal-site-admin-only-table-row',
-      ),
-    );
-  }
+}
+
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional 
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers, 
+  'rows' => $rows, 
+  'attributes' => array(
+    'id' => 'tripal_organism-table-base',
+    'class' => 'tripal-organism-data-table tripal-data-table',
+  ), 
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(), 
+  'empty' => '', 
+); 
 
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional 
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers, 
-    'rows' => $rows, 
-    'attributes' => array(
-      'id' => 'tripal_organism-table-base',
-      'class' => 'tripal-organism-data-table tripal-data-table',
-    ), 
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(), 
-    'empty' => '', 
-  ); 
-  
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table); ?>
-  <div style="text-align: justify"><?php print $image . $organism->comment?></div>  
-</div>
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table); ?>
+<div style="text-align: justify"><?php print $image . $organism->comment?></div>  

+ 0 - 11
tripal_organism/theme/tripal_organism/tripal_organism_description.tpl.php

@@ -1,11 +0,0 @@
-<?php
-$organism = $variables['node']->organism;
-?>
-<div id="tripal_organism-description-box" class="tripal_organism-info-box tripal-info-box">
-  <div class="tripal_organism-info-box-title tripal-info-box-title">Organism Description</div>
-   <table id="tripal_organism-table-description" class="tripal_organism-table tripal-table tripal-table-horz">
-      <tr class="tripal_organism-table-odd-row tripal-table-even-row">
-        <td><?php print $organism->comment; ?></td>
-      </tr>                                          
-   </table>
-</div>

+ 0 - 20
tripal_organism/theme/tripal_organism/tripal_organism_image.tpl.php

@@ -1,20 +0,0 @@
-<?php
-$node = $variables['node'];
-$organism = $variables['node']->organism;
-
-?>
-<div id="tripal_organism-image-box" class="tripal_organism-info-box tripal-info-box">
-  <div class="tripal_analysis_interpro-info-box-title tripal-info-box-title"><?php $organism->genus." ".$organism->species?> Image</div>
-  <div class="tripal_analysis_interpro-info-box-desc tripal-info-box-desc"></div>
-  <img src="<?php 
-      $image_name = $organism->genus."_".$organism->species.".jpg";
-      $image_dir = file_directory_path() . "/tripal/tripal_organism/images";
-      $files = file_scan_directory($image_dir,$image_name);
-      if(sizeof($files) > 0){
-         print file_create_url("$image_dir/$image_name"); 
-      } else {
-         $image_file = file_directory_path() . "/tripal/tripal_organism/images/".$node->nid.".jpg";
-         print file_create_url($image_file); 
-      }
-   ?>"> 
-</div>

+ 0 - 24
tripal_organism/tripal_organism.module

@@ -34,12 +34,6 @@ function tripal_organism_block_info() {
   $blocks['base']['info'] = t('Tripal Organism Details');
   $blocks['base']['cache'] = DRUPAL_NO_CACHE;
 
-  $blocks['description']['info'] = t('Tripal Organism Description');
-  $blocks['description']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['image']['info'] = t('Tripal Organism Image');
-  $blocks['image']['cache'] = DRUPAL_NO_CACHE;
-
   return $blocks;
 
 }
@@ -59,14 +53,6 @@ function tripal_organism_block_view($delta = '') {
         $block['subject'] = t('Organism Details');
         $block['content'] = theme('tripal_organism_base', $node);
         break;
-      case 'description':
-        $block['subject'] = t('Organism Description');
-        $block['content'] = theme('tripal_organism_description', $node);
-        break;
-      case 'image':
-        $block['subject'] = t('Organism Image');
-        $block['content'] = theme('tripal_organism_image', $node);
-        break;
       default:
     }
     return $block;
@@ -165,16 +151,6 @@ function tripal_organism_theme($existing, $type, $theme, $path) {
       'template' => 'tripal_organism_base',
       'path' => "$path/theme/tripal_organism",
     ),
-    'tripal_organism_description' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_organism_description',
-      'path' => "$path/theme/tripal_organism",
-    ),
-    'tripal_organism_image' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_organism_image',
-      'path' => "$path/theme/tripal_organism",
-    ),
     'tripal_organism_teaser' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_teaser',

+ 54 - 57
tripal_phenotype/theme/tripal_feature/tripal_feature.phenotypes.tpl.php

@@ -17,65 +17,62 @@ $feature_phenotypes = $feature->feature_phenotype;
 
 if(count($feature_phenotypes) > 0){ ?>
   
-  <div id="tripal_feature-phenotypes-box" class="tripal_feature-info-box tripal-info-box">
-    <div class="tripal_feature-info-box-title tripal-info-box-title">Phenotypes</div>
-    <div class="tripal_feature-info-box-desc tripal-info-box-desc">The feature is associated with the following phenotypes</div><?php
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">The feature is associated with the following phenotypes</div><?php
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Attribute', 'Observed Unit', 'Value', 'Evidence Type');
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Attribute', 'Observed Unit', 'Value', 'Evidence Type');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  // iterate through the feature_phenotype records
+  foreach ($feature_phenotypes as $feature_phenotype){
+    $phenotype = $feature_phenotype->phenotype_id;
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // expand the text fields
+    $options = array('return_array' => 1);
+    $phenotype = tripal_core_expand_chado_vars($phenotype, 'field', 'phenotype.value', $options);
+    $phenotype = tripal_core_expand_chado_vars($phenotype, 'field', 'phenotype.uniquename', $options);
+    $phenotype = tripal_core_expand_chado_vars($phenotype, 'field', 'phenotype.name', $options); 
     
-    // iterate through the feature_phenotype records
-    foreach ($feature_phenotypes as $feature_phenotype){
-      $phenotype = $feature_phenotype->phenotype_id;
-      
-      // expand the text fields
-      $options = array('return_array' => 1);
-      $phenotype = tripal_core_expand_chado_vars($phenotype, 'field', 'phenotype.value', $options);
-      $phenotype = tripal_core_expand_chado_vars($phenotype, 'field', 'phenotype.uniquename', $options);
-      $phenotype = tripal_core_expand_chado_vars($phenotype, 'field', 'phenotype.name', $options); 
-      
-      // get the phenotype value. If the value is qualitative the cvalue_id will link to a type. 
-      // If quantitative we use the value column
-      $phen_value = $phenotype->value . '<br>';
-      if ($phenotype->cvalue_id) {
-        $phen_value .= ucwords(preg_replace('/_/', ' ', $phenotype->cvalue_id->name)) . '<br>';
-      }
-      
-      $phen_value = $phenotype->cvalue_id ? $phenotype->cvalue_id->name : $phenotype->value;
-      $phenotype = $feature_phenotype->phenotype_id;
-      $rows[] = array(
-        $phenotype->attr_id->name,
-        $phenotype->observable_id->name,
-        $phen_value,
-        $phenotype->assay_id->name
-      );
-    } 
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_feature-table-phenotypes',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
+    // get the phenotype value. If the value is qualitative the cvalue_id will link to a type. 
+    // If quantitative we use the value column
+    $phen_value = $phenotype->value . '<br>';
+    if ($phenotype->cvalue_id) {
+      $phen_value .= ucwords(preg_replace('/_/', ' ', $phenotype->cvalue_id->name)) . '<br>';
+    }
     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
+    $phen_value = $phenotype->cvalue_id ? $phenotype->cvalue_id->name : $phenotype->value;
+    $phenotype = $feature_phenotype->phenotype_id;
+    $rows[] = array(
+      $phenotype->attr_id->name,
+      $phenotype->observable_id->name,
+      $phen_value,
+      $phenotype->assay_id->name
+    );
+  } 
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_feature-table-phenotypes',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 2 - 0
tripal_phenotype/tripal_phenotype.module

@@ -142,6 +142,8 @@ function tripal_phenotype_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_feature_phenotypes'] = array(
           '#value' => theme('tripal_feature_phenotypes', array('node' => $node)),
+          '#tripal_toc_id'    => 'phenotypes',
+          '#tripal_toc_title' => 'Phenotypes',
         );
       }
       break;

+ 11 - 0
tripal_project/includes/tripal_project.chado_node.inc

@@ -465,18 +465,29 @@ function tripal_project_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_project_base'] = array(
           '#value' => theme('tripal_project_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
+          '#weight' => 0,
         );
         $node->content['tripal_project_contact'] = array(
           '#value' => theme('tripal_project_contact', array('node' => $node)),
+          '#tripal_toc_id'    => 'contacts',
+          '#tripal_toc_title' => 'Contacts',
         );
         $node->content['tripal_project_properties'] = array(
           '#value' => theme('tripal_project_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
         );
         $node->content['tripal_project_publications'] = array(
           '#value' => theme('tripal_project_publications', array('node' => $node)),
+          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_title' => 'Publications',
         );
         $node->content['tripal_project_relationships'] = array(
           '#value' => theme('tripal_project_relationships', array('node' => $node)),
+          '#tripal_toc_id'    => 'relationships',
+          '#tripal_toc_title' => 'Relationships',
         );
       }
       if ($view_mode == 'teaser') {

+ 54 - 58
tripal_project/theme/tripal_project/tripal_project.base.tpl.php

@@ -20,69 +20,65 @@ if ($project->description) {
 else {
   $projectprop = tripal_project_get_property($project->project_id, 'Project Description');
   $description = $projectprop->value;
-}
+} ?>
+
+<div class="tripal_project-info-box-desc tripal-info-box-desc"></div><?php 
 
-?>
-<div id="tripal_project-base-box" class="tripal_project-info-box tripal-info-box">
-  <div class="tripal_project-info-box-title tripal-info-box-title">Project Details</div>
-  <div class="tripal_project-info-box-desc tripal-info-box-desc"></div><?php 
+// the $headers array is an array of fields to use as the colum headers. 
+// additional documentation can be found here 
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+// This table for the project has a vertical header (down the first column)
+// so we do not provide headers here, but specify them in the $rows array below.
+$headers = array();
 
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  // This table for the project has a vertical header (down the first column)
-  // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array();
-  
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+$rows = array();
 
-  // Project Name row
+// Project Name row
+$rows[] = array(
+  array(
+    'data' => 'Project Name',
+    'header' => TRUE
+  ),
+  $project->name
+);
+// allow site admins to see the feature ID
+if (user_access('access administration pages')) {
+  // Project ID
   $rows[] = array(
     array(
-      'data' => 'Project Name',
-      'header' => TRUE
+      'data' => 'Project ID',
+      'header' => TRUE,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $project->name
-  );
-  // allow site admins to see the feature ID
-  if (user_access('access administration pages')) {
-    // Project ID
-    $rows[] = array(
-      array(
-        'data' => 'Project ID',
-        'header' => TRUE,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-      array(
-        'data' => $project->project_id,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-    );
-  }
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_project-table-base',
+    array(
+      'data' => $project->project_id,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
   );
-  
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table);
-  if ($description) { ?>
-    <div style="text-align: justify"><?php print $description; ?></div> <?php  
-  } ?>
-</div>
+}
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers,
+  'rows' => $rows,
+  'attributes' => array(
+    'id' => 'tripal_project-table-base',
+  ),
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(),
+  'empty' => '',
+);
+
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table);
+if ($description) { ?>
+  <div style="text-align: justify"><?php print $description; ?></div> <?php  
+} 

+ 62 - 65
tripal_project/theme/tripal_project/tripal_project.contact.tpl.php

@@ -7,74 +7,71 @@ $project = tripal_core_expand_chado_vars($project,'table','project_contact', arr
 $project_contacts = $project->project_contact;
 
 if (count($project_contacts) > 0) { ?>
-  <div id="tripal_project-contacts-box" class="tripal_project-info-box tripal-info-box">
-    <div class="tripal_project-info-box-title tripal-info-box-title">Participants</div>
-    <div class="tripal_project-info-box-desc tripal-info-box-desc">The following indivuals or groups have particpated in development or execution of this project</div><?php     
+  <div class="tripal_project-info-box-desc tripal-info-box-desc">The following indivuals or groups have particpated in development or execution of this project</div><?php     
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('', 'Details');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  $i = 1;
+  foreach ($project_contacts as $project_contact) {
+    $contact = $project_contact->contact_id;
+    $contact_name = $contact->name;
+    if (property_exists($contact, 'nid')) {
+      $contact_name = l($contact_name, 'node/' . $contact->nid, array('attributes' => array('target' => '_blank')));
+    }
     
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('', 'Details');
+    // Get some additional details about this contact if they exists.
+    $details = '';
+    $options = array('return_array' => 1);
+    $contact = tripal_core_expand_chado_vars($contact, 'table', 'contactprop', $options);
+    $properties = $contact->contactprop;
+    $options = array('order_by' => array('rank' => 'ASC'));
+    $properties = tripal_core_expand_chado_vars($properties, 'field', 'contactprop.value', $options);
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    $i = 1;
-    foreach ($project_contacts as $project_contact) {
-      $contact = $project_contact->contact_id;
-      $contact_name = $contact->name;
-      if (property_exists($contact, 'nid')) {
-        $contact_name = l($contact_name, 'node/' . $contact->nid, array('attributes' => array('target' => '_blank')));
-      }
-      
-      // Get some additional details about this contact if they exists.
-      $details = '';
-      $options = array('return_array' => 1);
-      $contact = tripal_core_expand_chado_vars($contact, 'table', 'contactprop', $options);
-      $properties = $contact->contactprop;
-      $options = array('order_by' => array('rank' => 'ASC'));
-      $properties = tripal_core_expand_chado_vars($properties, 'field', 'contactprop.value', $options);
-      
-      if (is_array($properties)) {
-        foreach ($properties as $property) {
-          // skip the description and name properties
-          if ($property->type_id->name == "contact_description" or
-              $property->type_id->name == "Surname" or
-              $property->type_id->name == "Given Name" or
-              $property->type_id->name == "First Initials" or
-              $property->type_id->name == "Suffix") {
-            continue;
-          }
-          $details .= "<br>" . $property->type_id->name . " : " .  $property->value;
+    if (is_array($properties)) {
+      foreach ($properties as $property) {
+        // skip the description and name properties
+        if ($property->type_id->name == "contact_description" or
+            $property->type_id->name == "Surname" or
+            $property->type_id->name == "Given Name" or
+            $property->type_id->name == "First Initials" or
+            $property->type_id->name == "Suffix") {
+          continue;
         }
+        $details .= "<br>" . $property->type_id->name . " : " .  $property->value;
       }
-      
-      $rows[] = array(
-        $i,
-        $contact_name . $details,
-      );
-      $i++;
-    } 
-        // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-contacts',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
+    }
     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);?>    
-  </div> <?php 
+    $rows[] = array(
+      $i,
+      $contact_name . $details,
+    );
+    $i++;
+  } 
+      // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-contacts',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
 }

+ 39 - 41
tripal_project/theme/tripal_project/tripal_project.properties.tpl.php

@@ -20,46 +20,44 @@ if ($projectprops) {
 
 
 if (count($properties) > 0) { ?>
-  <div id="tripal_project-properties-box" class="tripal_project-info-box tripal-info-box">
-    <div class="tripal_project-info-box-title tripal-info-box-title">More Details</div>
-    <div class="tripal_project-info-box-desc tripal-info-box-desc">Additional information about this project:</div><?php
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Property Name', 'Value');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    // add the properties as individual rows
-    foreach ($properties as $property) {
-      $rows[] = array(
-        ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-        $property->value
-      );
-    } 
-    
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_project-table-properties',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  <div class="tripal_project-info-box-desc tripal-info-box-desc">Additional information about this project:</div><?php
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  // add the properties as individual rows
+  foreach ($properties as $property) {
+    $rows[] = array(
+      ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
+      $property->value
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_project-table-properties',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 64 - 67
tripal_project/theme/tripal_project/tripal_project.publications.tpl.php

@@ -8,78 +8,75 @@ $project_pubs = $project->project_pub;
 
 
 if (count($project_pubs) > 0) { ?>
-  <div id="tripal_project_pub-pub-box" class="tripal_project_pub-info-box tripal-info-box">
-    <div class="tripal_project_pub-info-box-title tripal-info-box-title">Publications</div>
-    <div class="tripal_project_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+  <div class="tripal_project_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Year', 'Publication');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
   
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Year', 'Publication');
+  foreach ($project_pubs as $project_pub) {
+    $pub = $project_pub->pub_id;
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
+    $citation = $pub->title;  // use the title as the default citation
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // get the citation for this pub if it exists
+    $values = array(
+      'pub_id' => $pub->pub_id, 
+      'type_id' => array(
+        'name' => 'Citation',
+      ),
+    );
+    $options = array('return_array' => 1);
+    $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
+    if (count($citation_prop) == 1) {
+      $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
+      $citation = $citation_prop[0]->value;
+    }
     
-    foreach ($project_pubs as $project_pub) {
-      $pub = $project_pub->pub_id;
-      $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-      $citation = $pub->title;  // use the title as the default citation
-      
-      // get the citation for this pub if it exists
-      $values = array(
-        'pub_id' => $pub->pub_id, 
-        'type_id' => array(
-          'name' => 'Citation',
-        ),
-      );
-      $options = array('return_array' => 1);
-      $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
-      if (count($citation_prop) == 1) {
-        $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
-        $citation = $citation_prop[0]->value;
-      }
-      
-      // if the publication is synced then link to it
-      if ($pub->nid) {
-        // replace the title with a link
-        $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-        $patterns = array(
-          '/(\()/', '/(\))/',
-          '/(\])/', '/(\[)/',
-          '/(\{)/', '/(\})/',
-          '/(\+)/', '/(\.)/', '/(\?)/',
-        );
-        $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
-        $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
-      }
-      
-      $rows[] = array(
-        $pub->pyear,
-        $citation,
+    // if the publication is synced then link to it
+    if ($pub->nid) {
+      // replace the title with a link
+      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
+      $patterns = array(
+        '/(\()/', '/(\))/',
+        '/(\])/', '/(\[)/',
+        '/(\{)/', '/(\})/',
+        '/(\+)/', '/(\.)/', '/(\?)/',
       );
+      $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
+      $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_project-table-publications',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $pub->pyear,
+      $citation,
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php 
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_project-table-publications',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 54 - 57
tripal_project/theme/tripal_project/tripal_project.relationships.tpl.php

@@ -23,66 +23,63 @@ $object_rels = $all_relationships['object'];
 $subject_rels = $all_relationships['subject'];
 
 if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
-  <div id="tripal_project-relationships-box" class="tripal_project-info-box tripal-info-box">
-    <div class="tripal_project-info-box-title tripal-info-box-title">Relationships</div>
-    <div class="tripal_project-info-box-desc tripal-info-box-desc">This project is related to the following other projects:</div> <?php
+  <div class="tripal_project-info-box-desc tripal-info-box-desc">This project is related to the following other projects:</div> <?php
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Relationship');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    // first add in the subject relationships.  
-    foreach ($subject_rels as $rel_type => $objects){ 
-      foreach ($objects as $object){
-        // link the project to it's node
-        $object_name = $object->record->object_project_id->name;
-        if (property_exists($object->record, 'nid')) {
-          $object_name = l($object_name, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
-        }
-        $rows[] = array(
-          "$project->name is a \"$rel_type\" of $object_name",
-        ); 
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Relationship');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  // first add in the subject relationships.  
+  foreach ($subject_rels as $rel_type => $objects){ 
+    foreach ($objects as $object){
+      // link the project to it's node
+      $object_name = $object->record->object_project_id->name;
+      if (property_exists($object->record, 'nid')) {
+        $object_name = l($object_name, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
       }
+      $rows[] = array(
+        "$project->name is a \"$rel_type\" of $object_name",
+      ); 
     }
-    
-    // second add in the object relationships.  
-    foreach ($object_rels as $rel_type => $subjects){
-      foreach ($subjects as $subject){
-        // link the project to it's node
-        $subject_name = $subject->record->subject_project_id->name;
-        if (property_exists($subject->record, 'nid')) {
-          $subject_name = l($subject_name, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
-        }
-        $rows[] = array(
-          "$subject_name is a \"$rel_type\" of $project->name",
-        ); 
+  }
+  
+  // second add in the object relationships.  
+  foreach ($object_rels as $rel_type => $subjects){
+    foreach ($subjects as $subject){
+      // link the project to it's node
+      $subject_name = $subject->record->subject_project_id->name;
+      if (property_exists($subject->record, 'nid')) {
+        $subject_name = l($subject_name, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
       }
+      $rows[] = array(
+        "$subject_name is a \"$rel_type\" of $project->name",
+      ); 
     }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_project-table-relationship-subject',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_project-table-relationship-subject',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+   
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 61 - 40
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -974,46 +974,67 @@ function chado_pub_delete(&$node) {
  */
 function tripal_pub_node_view($node, $view_mode, $langcode) {
   switch ($node->type) {
-  	case 'chado_pub':
-  	  // Show feature browser and counts
-  	  if ($view_mode == 'full') {
-  	    $node->content['tripal_pub_authors'] = array(
-  	      '#value' => theme('tripal_pub_authors', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_base'] = array(
-  	      '#value' => theme('tripal_pub_base', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_featuremaps'] = array(
-  	      '#value' => theme('tripal_pub_featuremaps', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_features'] = array(
-  	      '#value' => theme('tripal_pub_features', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_libraries'] = array(
-  	      '#value' => theme('tripal_pub_libraries', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_projects'] = array(
-  	      '#value' => theme('tripal_pub_projects', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_properties'] = array(
-  	      '#value' => theme('tripal_pub_properties', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_references'] = array(
-  	      '#value' => theme('tripal_pub_references', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_relationships'] = array(
-  	      '#value' => theme('tripal_pub_relationships', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_stocks'] = array(
-  	      '#value' => theme('tripal_pub_stocks', array('node' => $node)),
-  	    );
-  	  }
-  	  if ($view_mode == 'teaser') {
-  	    $node->content['tripal_pub_teaser'] = array(
-  	      '#value' => theme('tripal_pub_teaser', array('node' => $node)),
-  	    );
-  	  }
-  	  break;
+    case 'chado_pub':
+      // Show feature browser and counts
+      if ($view_mode == 'full') {
+        $node->content['tripal_pub_authors'] = array(
+          '#value' => theme('tripal_pub_authors', array('node' => $node)),
+          '#tripal_toc_id'    => 'authors',
+          '#tripal_toc_title' => 'Author Details',
+        );
+        $node->content['tripal_pub_base'] = array(
+          '#value' => theme('tripal_pub_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
+          '#weight' => 0
+        );
+        $node->content['tripal_pub_featuremaps'] = array(
+          '#value' => theme('tripal_pub_featuremaps', array('node' => $node)),
+          '#tripal_toc_id'    => 'featuremaps',
+          '#tripal_toc_title' => 'Maps',
+        );
+        $node->content['tripal_pub_features'] = array(
+          '#value' => theme('tripal_pub_features', array('node' => $node)),
+          '#tripal_toc_id'    => 'features',
+          '#tripal_toc_title' => 'Features',
+        );
+        $node->content['tripal_pub_libraries'] = array(
+          '#value' => theme('tripal_pub_libraries', array('node' => $node)),
+          '#tripal_toc_id'    => 'libraries',
+          '#tripal_toc_title' => 'Libraries',
+        );
+        $node->content['tripal_pub_projects'] = array(
+          '#value' => theme('tripal_pub_projects', array('node' => $node)),
+          '#tripal_toc_id'    => 'projects',
+          '#tripal_toc_title' => 'Projects',
+        );
+        $node->content['tripal_pub_properties'] = array(
+          '#value' => theme('tripal_pub_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
+        );
+        $node->content['tripal_pub_references'] = array(
+          '#value' => theme('tripal_pub_references', array('node' => $node)),
+          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_title' => 'Cross References',
+        );
+        $node->content['tripal_pub_relationships'] = array(
+          '#value' => theme('tripal_pub_relationships', array('node' => $node)),
+          '#tripal_toc_id'    => 'relationships',
+          '#tripal_toc_title' => 'Relationships',
+        );
+        $node->content['tripal_pub_stocks'] = array(
+          '#value' => theme('tripal_pub_stocks', array('node' => $node)),
+          '#tripal_toc_id'    => 'stocks',
+          '#tripal_toc_title' => 'Stocks',
+        );
+      }
+      if ($view_mode == 'teaser') {
+        $node->content['tripal_pub_teaser'] = array(
+          '#value' => theme('tripal_pub_teaser', array('node' => $node)),
+        );
+      }
+      break;
   }
 }
 /**

+ 69 - 72
tripal_pub/theme/tripal_pub/tripal_pub_authors.tpl.php

@@ -30,83 +30,80 @@ if (count($authors) > 0) {
 }
 
 if ($has_contacts) { ?>
-  <div id="tripal_pub-pubauthors-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Author Details</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc">Additional information about authors:</div> <?php
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('', 'Details');
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc">Additional information about authors:</div> <?php
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('', 'Details');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  $rank = 1;
+  foreach ($authors as $author) {
+     
+    // expand the author to include the contact information linked via the pubauthor_contact table
+    $contact = $author->pubauthor_contact[0]->contact_id;
+    $options = array(
+      'return_array' => 1,
+      'include_fk' => array(
+        'type_id' => 1,       
+      ),      
+    );
+    $contact = tripal_core_expand_chado_vars($contact, 'table', 'contactprop', $options);
+    $properties = $contact->contactprop;
+    $options = array('order_by' => array('rank' => 'ASC'));
+    $properties = tripal_core_expand_chado_vars($properties, 'field', 'contactprop.value', $options); 
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // link the contact to it's node if one exists
+    $contact_name = $author->givennames . " " . $author->surname;
+    if (property_exists($contact, 'nid')) {
+      $contact_name = l($contact_name, 'node/' . $contact->nid);
+    }
     
-    $rank = 1;
-    foreach ($authors as $author) {
-       
-      // expand the author to include the contact information linked via the pubauthor_contact table
-      $contact = $author->pubauthor_contact[0]->contact_id;
-      $options = array(
-        'return_array' => 1,
-        'include_fk' => array(
-          'type_id' => 1,       
-        ),      
-      );
-      $contact = tripal_core_expand_chado_vars($contact, 'table', 'contactprop', $options);
-      $properties = $contact->contactprop;
-      $options = array('order_by' => array('rank' => 'ASC'));
-      $properties = tripal_core_expand_chado_vars($properties, 'field', 'contactprop.value', $options); 
-      
-      // link the contact to it's node if one exists
-      $contact_name = $author->givennames . " " . $author->surname;
-      if (property_exists($contact, 'nid')) {
-        $contact_name = l($contact_name, 'node/' . $contact->nid);
-      }
-      
-      // Get some additional details about this contact if they exists.
-      $details = '';
-      if (is_array($properties)) {
-        foreach ($properties as $property) {
-          // skip the description and name properties
-          if ($property->type_id->name == "contact_description" or
-              $property->type_id->name == "Surname" or
-              $property->type_id->name == "Given Name" or
-              $property->type_id->name == "First Initials" or
-              $property->type_id->name == "Suffix") {
-            continue;
-          }
-          $details .= "<br>" . $property->type_id->name . " : " .  $property->value;
+    // Get some additional details about this contact if they exists.
+    $details = '';
+    if (is_array($properties)) {
+      foreach ($properties as $property) {
+        // skip the description and name properties
+        if ($property->type_id->name == "contact_description" or
+            $property->type_id->name == "Surname" or
+            $property->type_id->name == "Given Name" or
+            $property->type_id->name == "First Initials" or
+            $property->type_id->name == "Suffix") {
+          continue;
         }
+        $details .= "<br>" . $property->type_id->name . " : " .  $property->value;
       }
-      
-      $rows[] = array(
-        $rank,
-        $contact_name . $details,
-      );
-      $rank++;
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-contacts',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $rank,
+      $contact_name . $details,
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div><?php      
+    $rank++;
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-contacts',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);     
 }

+ 153 - 156
tripal_pub/theme/tripal_pub/tripal_pub_base.tpl.php

@@ -84,172 +84,169 @@ if (count($urls) > 0) {
   $url = $urls[0]->value; 
 }?>
 
-<div id="tripal_pub-base-box" class="tripal_pub-info-box tripal-info-box">
-  <div class="tripal_pub-info-box-title tripal-info-box-title">Publication Details</div>
-  <!-- <div class="tripal_pub-info-box-desc tripal-info-box-desc"></div> --> <?php
+<div class="tripal_pub-info-box-desc tripal-info-box-desc"></div> <?php 
 
-  // to simplify the template, we have a subdirectory named 'pub_types'.  This directory
-  // should have include files each specific to a publication type. If the type is 
-  // not present then the base template will be used, otherwise the template in the
-  // include file is used.
-  $inc_name = strtolower(preg_replace('/ /', '_', $pub->type_id->name)) . '.inc';
-  $inc_path = drupal_realpath(drupal_get_path('module', 'tripal_pub') . "/theme/tripal_pub/pub_types/$inc_name");
-  if (file_exists($inc_path)) {
-    require_once "pub_types/$inc_name";  
-  } 
-  else { 
-    // ========================================================================
-    // TO CUSTOMIZE A SPECIFIC PUBLICATION TYPE, CUT-AND-PASTE THE CODE
-    // BELOW INTO A NEW FILE WITH THE SAME NAME AS THE TYPE (SEE INSTRUCTIONS
-    // ABOVE), AND EDIT.
-    // ========================================================================
-    
-    // the $headers array is an array of fields to use as the colum headers. 
-    // additional documentation can be found here 
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    // This table for the analysis has a vertical header (down the first column)
-    // so we do not provide headers here, but specify them in the $rows array below.
-    $headers = array();
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-    $rows = array();
+// to simplify the template, we have a subdirectory named 'pub_types'.  This directory
+// should have include files each specific to a publication type. If the type is 
+// not present then the base template will be used, otherwise the template in the
+// include file is used.
+$inc_name = strtolower(preg_replace('/ /', '_', $pub->type_id->name)) . '.inc';
+$inc_path = drupal_realpath(drupal_get_path('module', 'tripal_pub') . "/theme/tripal_pub/pub_types/$inc_name");
+if (file_exists($inc_path)) {
+  require_once "pub_types/$inc_name";  
+} 
+else { 
+  // ========================================================================
+  // TO CUSTOMIZE A SPECIFIC PUBLICATION TYPE, CUT-AND-PASTE THE CODE
+  // BELOW INTO A NEW FILE WITH THE SAME NAME AS THE TYPE (SEE INSTRUCTIONS
+  // ABOVE), AND EDIT.
+  // ========================================================================
   
-    // Title row
-    $title = '';
-    if ($url) {
-      $title =  l(htmlspecialchars($pub->title), $url, array('attributes' => array('target' => '_blank')));
-    }
-    elseif ($dbxref and $dbxref->db_id->urlprefix) {
-      $title =  l(htmlspecialchars($pub->title), $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-    }
-    else {
-      $title =  htmlspecialchars($pub->title);
-    }
-    $rows[] = array(
-      array(
-        'data' => 'Title',
-        'header' => TRUE
-      ),
-      $title,
-    );
-    // Authors row
-    $rows[] = array(
-      array(
-        'data' => 'Authors',
-        'header' => TRUE
-      ),
-      $authors_list,
-    );
-    // Type row
-    $rows[] = array(
-      array(
-        'data' => 'Type',
-        'header' => TRUE
-      ),
-      $pub->type_id->name,
-    );
-    // Media Title
+  // the $headers array is an array of fields to use as the colum headers. 
+  // additional documentation can be found here 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  // This table for the analysis has a vertical header (down the first column)
+  // so we do not provide headers here, but specify them in the $rows array below.
+  $headers = array();
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  $rows = array();
+
+  // Title row
+  $title = '';
+  if ($url) {
+    $title =  l(htmlspecialchars($pub->title), $url, array('attributes' => array('target' => '_blank')));
+  }
+  elseif ($dbxref and $dbxref->db_id->urlprefix) {
+    $title =  l(htmlspecialchars($pub->title), $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
+  }
+  else {
+    $title =  htmlspecialchars($pub->title);
+  }
+  $rows[] = array(
+    array(
+      'data' => 'Title',
+      'header' => TRUE
+    ),
+    $title,
+  );
+  // Authors row
+  $rows[] = array(
+    array(
+      'data' => 'Authors',
+      'header' => TRUE
+    ),
+    $authors_list,
+  );
+  // Type row
+  $rows[] = array(
+    array(
+      'data' => 'Type',
+      'header' => TRUE
+    ),
+    $pub->type_id->name,
+  );
+  // Media Title
+  $rows[] = array(
+    array(
+      'data' => 'Media Title',
+      'header' => TRUE,
+      'nowrap' => 'nowrap'
+    ),
+    $pub->series_name,
+  );
+  // Volume
+  $rows[] = array(
+    array(
+      'data' => 'Volume',
+      'header' => TRUE
+    ),
+    $pub->volume ? $pub->volume : 'N/A',
+  );
+  // Issue
+  $rows[] = array(
+    array(
+      'data' => 'Issue',
+      'header' => TRUE
+    ),
+    $pub->issue ? $pub->issue : 'N/A'
+  );
+  // Year
+  $rows[] = array(
+    array(
+      'data' => 'Year',
+      'header' => TRUE
+    ),
+    $pub->pyear
+  );
+  // Pages
+  $rows[] = array(
+    array(
+      'data' => 'Page(s)',
+      'header' => TRUE
+    ),
+    $pub->pages ? $pub->pages : 'N/A'
+  );
+  // Citation row
+  $rows[] = array(
+    array(
+      'data' => 'Citation',
+      'header' => TRUE
+    ),
+    htmlspecialchars($citation->value)
+  );
+  // allow site admins to see the pub ID
+  if (user_access('access administration pages')) {
+    // Pub ID
     $rows[] = array(
       array(
-        'data' => 'Media Title',
+        'data' => 'Pub ID',
         'header' => TRUE,
-        'nowrap' => 'nowrap'
+        'class' => 'tripal-site-admin-only-table-row',
       ),
-      $pub->series_name,
-    );
-    // Volume
-    $rows[] = array(
-      array(
-        'data' => 'Volume',
-        'header' => TRUE
-      ),
-      $pub->volume ? $pub->volume : 'N/A',
-    );
-    // Issue
-    $rows[] = array(
-      array(
-        'data' => 'Issue',
-        'header' => TRUE
-      ),
-      $pub->issue ? $pub->issue : 'N/A'
-    );
-    // Year
-    $rows[] = array(
-      array(
-        'data' => 'Year',
-        'header' => TRUE
-      ),
-      $pub->pyear
-    );
-    // Pages
-    $rows[] = array(
       array(
-        'data' => 'Page(s)',
-        'header' => TRUE
+        'data' => $pub->pub_id,
+        'class' => 'tripal-site-admin-only-table-row',
       ),
-      $pub->pages ? $pub->pages : 'N/A'
     );
-    // Citation row
+  }
+  // Is Obsolete Row
+  if($pub->is_obsolete == TRUE){
     $rows[] = array(
       array(
-        'data' => 'Citation',
-        'header' => TRUE
+        'data' => '<div class="tripal_pub-obsolete">This publication is obsolete</div>',
+        'colspan' => 2
       ),
-      htmlspecialchars($citation->value)
     );
-    // allow site admins to see the pub ID
-    if (user_access('access administration pages')) {
-      // Pub ID
-      $rows[] = array(
-        array(
-          'data' => 'Pub ID',
-          'header' => TRUE,
-          'class' => 'tripal-site-admin-only-table-row',
-        ),
-        array(
-          'data' => $pub->pub_id,
-          'class' => 'tripal-site-admin-only-table-row',
-        ),
-      );
-    }
-    // Is Obsolete Row
-    if($pub->is_obsolete == TRUE){
-      $rows[] = array(
-        array(
-          'data' => '<div class="tripal_pub-obsolete">This publication is obsolete</div>',
-          'colspan' => 2
-        ),
-      );
-    }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-base',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-    if ($abstract_text) { ?>
-      <p><b>Abstract</b></p>
-      <div style="text-align: justify"><?php print $abstract_text; ?></div> <?php 
-    } 
-    
-    // ========================================================================
-    // END OF CUT-AND-PASTE REGION
-    // ========================================================================
-  } ?>
-</div>
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-base',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+  if ($abstract_text) { ?>
+    <p><b>Abstract</b></p>
+    <div style="text-align: justify"><?php print $abstract_text; ?></div> <?php 
+  } 
+  
+  // ========================================================================
+  // END OF CUT-AND-PASTE REGION
+  // ========================================================================
+} 

+ 56 - 59
tripal_pub/theme/tripal_pub/tripal_pub_featuremaps.tpl.php

@@ -32,65 +32,62 @@ if (count($featuremap_pubs) > 0 ) {
 $total_records = $_SESSION['chado_pager'][$element]['total_records'];
 
 if(count($featuremaps) > 0){ ?>
-  <div id="tripal_pub-featuremaps-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Maps</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> maps:</div> <?php 
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> maps:</div> <?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Map Name');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($featuremaps as $featuremap){
-       $featuremap_name = $featuremap->name;
-       if (property_exists($featuremap, 'nid')) {
-         $featuremap_name = l($featuremap_name, 'node/' . $featuremap->nid, array('attributes' => array('target' => '_blank')));
-       }
-       
-       $rows[] = array(
-         $featuremap_name,
-       );
-    }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-featuremaps',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'featuremaps'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $element,
-      'parameters' => array(
-        'block' => 'featuremaps'
-      ),
-      'quantity' => $num_per_page,
-    );
-    print theme_pager($pager); ?>
-  </div><?php 
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Map Name');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($featuremaps as $featuremap){
+     $featuremap_name = $featuremap->name;
+     if (property_exists($featuremap, 'nid')) {
+       $featuremap_name = l($featuremap_name, 'node/' . $featuremap->nid, array('attributes' => array('target' => '_blank')));
+     }
+     
+     $rows[] = array(
+       $featuremap_name,
+     );
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-featuremaps',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'featuremaps'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $element,
+    'parameters' => array(
+      'block' => 'featuremaps'
+    ),
+    'quantity' => $num_per_page,
+  );
+  print theme_pager($pager); 
 }?>
 

+ 59 - 62
tripal_pub/theme/tripal_pub/tripal_pub_features.tpl.php

@@ -32,67 +32,64 @@ if (count($feature_pubs) > 0 ) {
 $total_records = $_SESSION['chado_pager'][$element]['total_records'];
 
 if(count($features) > 0){ ?>
-  <div id="tripal_pub-features-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Features</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> features:</div> <?php 
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> features:</div> <?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Feature Name', 'Uniquenaem', 'Type');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($features as $feature){
-       $feature_name = $feature->name;
-       if (property_exists($feature, 'nid')) {
-         $feature_name = l($feature_name, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
-       }
-       
-       $rows[] = array(
-         $feature_name,
-         $feature->uniquename,
-         $feature->type_id->name,
-       );
-    }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-features',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'features'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $element,
-      'parameters' => array(
-        'block' => 'features'
-      ),
-      'quantity' => $num_per_page,
-    );
-    print theme_pager($pager); ?>
-  </div><?php 
-}?>
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Feature Name', 'Uniquenaem', 'Type');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($features as $feature){
+     $feature_name = $feature->name;
+     if (property_exists($feature, 'nid')) {
+       $feature_name = l($feature_name, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
+     }
+     
+     $rows[] = array(
+       $feature_name,
+       $feature->uniquename,
+       $feature->type_id->name,
+     );
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-features',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'features'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $element,
+    'parameters' => array(
+      'block' => 'features'
+    ),
+    'quantity' => $num_per_page,
+  );
+  print theme_pager($pager);  
+}
 

+ 62 - 65
tripal_pub/theme/tripal_pub/tripal_pub_libraries.tpl.php

@@ -32,70 +32,67 @@ if (count($library_pubs) > 0 ) {
 $total_records = $_SESSION['chado_pager'][$element]['total_records'];
 
 if(count($libraries) > 0){ ?>
-  <div id="tripal_pub-libraries-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Libraries</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> libraries:</div> <?php 
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> libraries:</div> <?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Library Name', 'Unique Name', 'Organism');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($libraries as $library){
-       $library_name = $library->name;
-       if (property_exists($library, 'nid')) {
-         $library_name = l($library_name, 'node/' . $library->nid, array('attributes' => array('target' => '_blank')));
-       }
-       $organism = '<i>' . $library->organism_id->genus . ' ' . $library->organism_id->species . '</i>';
-       if (property_exists($library->organism_id, 'nid')) {
-         $organism = l($organism, 'node/' . $library->organism_id->nid, array('attributes' => array('target' => '_blank')));
-       }
-       $rows[] = array(
-         $library_name,
-         $library->uniquename,
-         $organism,
-       );
-    }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-libraries',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'libraries'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $element,
-      'parameters' => array(
-        'block' => 'libraries'
-      ),
-      'quantity' => $num_per_page,
-    );
-    print theme_pager($pager); ?>
-  </div><?php 
-}?>
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Library Name', 'Unique Name', 'Organism');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($libraries as $library){
+     $library_name = $library->name;
+     if (property_exists($library, 'nid')) {
+       $library_name = l($library_name, 'node/' . $library->nid, array('attributes' => array('target' => '_blank')));
+     }
+     $organism = '<i>' . $library->organism_id->genus . ' ' . $library->organism_id->species . '</i>';
+     if (property_exists($library->organism_id, 'nid')) {
+       $organism = l($organism, 'node/' . $library->organism_id->nid, array('attributes' => array('target' => '_blank')));
+     }
+     $rows[] = array(
+       $library_name,
+       $library->uniquename,
+       $organism,
+     );
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-libraries',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'libraries'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $element,
+    'parameters' => array(
+      'block' => 'libraries'
+    ),
+    'quantity' => $num_per_page,
+  );
+  print theme_pager($pager); 
+}
 

+ 61 - 64
tripal_pub/theme/tripal_pub/tripal_pub_projects.tpl.php

@@ -32,69 +32,66 @@ if (count($project_pubs) > 0 ) {
 $total_records = $_SESSION['chado_pager'][$element]['total_records'];
 
 if(count($projects) > 0){ ?>
-  <div id="tripal_pub-projects-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Projects</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> projects:</div> <?php 
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> projects:</div> <?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Project Name', 'Description');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($projects as $project){
-       $project_name = $project->name;
-       if (property_exists($project, 'nid')) {
-         $project_name = l($project_name, 'node/' . $project->nid, array('attributes' => array('target' => '_blank')));
-       }
-       $description =  substr($project->description, 0, 200);
-       if (strlen($project->description) > 200) {
-         $description .= "... " . l("[more]", 'node/' . $project->nid, array('attributes' => array('target' => '_blank')));
-       } 
-       $rows[] = array(
-         $project_name,
-         $description
-       );
-    }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-projects',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'projects'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $element,
-      'parameters' => array(
-        'block' => 'projects'
-      ),
-      'quantity' => $num_per_page,
-    );
-    print theme_pager($pager); ?>
-  </div><?php 
-}?>
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Project Name', 'Description');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($projects as $project){
+     $project_name = $project->name;
+     if (property_exists($project, 'nid')) {
+       $project_name = l($project_name, 'node/' . $project->nid, array('attributes' => array('target' => '_blank')));
+     }
+     $description =  substr($project->description, 0, 200);
+     if (strlen($project->description) > 200) {
+       $description .= "... " . l("[more]", 'node/' . $project->nid, array('attributes' => array('target' => '_blank')));
+     } 
+     $rows[] = array(
+       $project_name,
+       $description
+     );
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-projects',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'projects'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $element,
+    'parameters' => array(
+      'block' => 'projects'
+    ),
+    'quantity' => $num_per_page,
+  );
+  print theme_pager($pager);  
+}
 

+ 51 - 54
tripal_pub/theme/tripal_pub/tripal_pub_properties.tpl.php

@@ -27,61 +27,58 @@ if (is_array($pubprops)) {
 $keywords = array(); 
 
 if (count($properties)) { ?>
-  <div id="tripal_pub-properties-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Additional Properties</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc">Additional details for this publication include:</div> <?php 
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc">Additional details for this publication include:</div> <?php 
+
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
   
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Property Name', 'Value');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    $keywords = array();
-    foreach ($properties as $property) {
-      // each keyword is stored as a seperate properties. We want to show them
-      // only in a single field not as a bunc of individual properties, so when we see one, 
-      // save it in an array for later and down't add it yet to the table yet.
-      if ($property->type_id->name == 'Keywords') {
-        $keywords[] = $property->value;
-        continue;
-      }
-      $rows[] = array(
-        $property->type_id->name,
-        $property->value
-      );
+  $keywords = array();
+  foreach ($properties as $property) {
+    // each keyword is stored as a seperate properties. We want to show them
+    // only in a single field not as a bunc of individual properties, so when we see one, 
+    // save it in an array for later and down't add it yet to the table yet.
+    if ($property->type_id->name == 'Keywords') {
+      $keywords[] = $property->value;
+      continue;
     }
-    // now add in a single row for all keywords
-    if (count($keywords) > 0) {
-      $rows[] = array(
-        'Keywords',
-        implode(', ', $keywords),
-      );
-    } 
-
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-properties',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $property->type_id->name,
+      $property->value
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);?> 
-  </div> <?php
+  }
+  // now add in a single row for all keywords
+  if (count($keywords) > 0) {
+    $rows[] = array(
+      'Keywords',
+      implode(', ', $keywords),
+    );
+  } 
+
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-properties',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
 }

+ 48 - 51
tripal_pub/theme/tripal_pub/tripal_pub_references.tpl.php

@@ -15,58 +15,55 @@ if (count($pub_dbxrefs) > 0 ) {
 }
 
 if(count($references) > 0){ ?>
-  <div id="tripal_pub-references-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Cross References</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication is also available in the following databases:</div><?php 
-    
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Database', 'Accession');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($references as $dbxref){
-      $database = $dbxref->db_id->name . ': ' . $dbxref->db_id->description;
-      if ($dbxref->db_id->url) {
-        $database = l($dbxref->db_id->name, $dbxref->db_id->url, array('attributes' => array('target' => '_blank'))) . ': ' . $dbxref->db_id->description; 
-      }
-      $accession = $dbxref->db_id->name . ':' . $dbxref->accession;
-      if ($dbxref->db_id->urlprefix) {
-        $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-      }
-      if (property_exists($dbxref, 'is_primary')) {
-        $accession .= " <i>(primary cross-reference)</i>";
-      }
-      
-      $rows[] = array(
-        $database,
-        $accession
-      );
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication is also available in the following databases:</div><?php 
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Database', 'Accession');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($references as $dbxref){
+    $database = $dbxref->db_id->name . ': ' . $dbxref->db_id->description;
+    if ($dbxref->db_id->url) {
+      $database = l($dbxref->db_id->name, $dbxref->db_id->url, array('attributes' => array('target' => '_blank'))) . ': ' . $dbxref->db_id->description; 
+    }
+    $accession = $dbxref->db_id->name . ':' . $dbxref->accession;
+    if ($dbxref->db_id->urlprefix) {
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
+    }
+    if (property_exists($dbxref, 'is_primary')) {
+      $accession .= " <i>(primary cross-reference)</i>";
     }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-references',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);?>
-  </div><?php 
+    $rows[] = array(
+      $database,
+      $accession
+    );
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-references',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
 }
 

+ 118 - 120
tripal_pub/theme/tripal_pub/tripal_pub_relationships.tpl.php

@@ -23,128 +23,126 @@ $object_rels = $all_relationships['object'];
 $subject_rels = $all_relationships['subject'];
 
 if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
-  <div id="tripal_pub-relationships-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Relationships</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc"></div> <?php
-    // first add in the subject relationships.  
-    foreach ($subject_rels as $rel_type => $rels){
-      foreach ($rels as $obj_type => $objects){ ?>
-        <p>This <?php print $pub->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> pub(s): <?php
-         
-        // the $headers array is an array of fields to use as the colum headers.
-        // additional documentation can be found here
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $headers = array('Publication');
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc"></div> <?php
+  
+  // first add in the subject relationships.  
+  foreach ($subject_rels as $rel_type => $rels){
+    foreach ($rels as $obj_type => $objects){ ?>
+      <p>This <?php print $pub->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> pub(s): <?php
+       
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Publication');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($objects as $object){
+        // link the pub to it's node
+        $title = $object->record->object_id->title;
+        if (property_exists($object->record, 'nid')) {
+          $title = l($title, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
+        }
         
-        // the $rows array contains an array of rows where each row is an array
-        // of values for each column of the table in that row.  Additional documentation
-        // can be found here:
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $rows = array();
+        // get the citation
+        $values = array(
+          'pub_id' => $object->record->object_id->pub_id,
+          'type_id' => array(
+            'name' => 'Citation',
+          ),
+        );
+        $citation = tripal_core_generate_chado_var('pubprop', $values);
+        $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value');
         
-        foreach ($objects as $object){
-          // link the pub to it's node
-          $title = $object->record->object_id->title;
-          if (property_exists($object->record, 'nid')) {
-            $title = l($title, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
-          }
-          
-          // get the citation
-          $values = array(
-            'pub_id' => $object->record->object_id->pub_id,
-            'type_id' => array(
-              'name' => 'Citation',
-            ),
-          );
-          $citation = tripal_core_generate_chado_var('pubprop', $values);
-          $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value');
-          
-          $rows[] = array(
-            $title . '<br>' . htmlspecialchars($citation->value),
-          ); 
-         } 
-         // the $table array contains the headers and rows array as well as other
-         // options for controlling the display of the table.  Additional
-         // documentation can be found here:
-         // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-         $table = array(
-           'header' => $headers,
-           'rows' => $rows,
-           'attributes' => array(
-             'id' => 'tripal_pub-table-relationship-object',
-           ),
-           'sticky' => FALSE,
-           'caption' => '',
-           'colgroups' => array(),
-           'empty' => '',
-         );
-         
-         // once we have our table array structure defined, we call Drupal's theme_table()
-         // function to generate the table.
-         print theme_table($table); ?>
-         </p>
-         <br><?php
-       }
-    }
-    
-    // second add in the object relationships.  
-    foreach ($object_rels as $rel_type => $rels){
-      foreach ($rels as $subject_type => $subjects){?>
-        <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> pub(s) are <?php print $rel_type ?> this <?php print $pub->type_id->name;?>: <?php 
-        // the $headers array is an array of fields to use as the colum headers.
-        // additional documentation can be found here
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $headers = array('Publication');
+        $rows[] = array(
+          $title . '<br>' . htmlspecialchars($citation->value),
+        ); 
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_pub-table-relationship-object',
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
+  
+  // second add in the object relationships.  
+  foreach ($object_rels as $rel_type => $rels){
+    foreach ($rels as $subject_type => $subjects){?>
+      <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> pub(s) are <?php print $rel_type ?> this <?php print $pub->type_id->name;?>: <?php 
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Publication');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($subjects as $subject){
+        // link the pub to it's node
+        $title = $subject->record->subject_id->title;
+        if (property_exists($subject->record, 'nid')) {
+          $title = l($title, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
+        }
         
-        // the $rows array contains an array of rows where each row is an array
-        // of values for each column of the table in that row.  Additional documentation
-        // can be found here:
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $rows = array();
+        // get the citation
+        $values = array(
+          'pub_id' => $subject->record->subject_id->pub_id,
+          'type_id' => array(
+            'name' => 'Citation',
+          ),
+        );
+        $citation = tripal_core_generate_chado_var('pubprop', $values);
+        $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value');
         
-        foreach ($subjects as $subject){
-          // link the pub to it's node
-          $title = $subject->record->subject_id->title;
-          if (property_exists($subject->record, 'nid')) {
-            $title = l($title, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
-          }
-          
-          // get the citation
-          $values = array(
-            'pub_id' => $subject->record->subject_id->pub_id,
-            'type_id' => array(
-              'name' => 'Citation',
-            ),
-          );
-          $citation = tripal_core_generate_chado_var('pubprop', $values);
-          $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value');
-          
-          $rows[] = array(
-            $title . '<br>' . htmlspecialchars($citation->value),
-          );
-         } 
-         // the $table array contains the headers and rows array as well as other
-         // options for controlling the display of the table.  Additional
-         // documentation can be found here:
-         // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-         $table = array(
-           'header' => $headers,
-           'rows' => $rows,
-           'attributes' => array(
-             'id' => 'tripal_pub-table-relationship-subject',
-           ),
-           'sticky' => FALSE,
-           'caption' => '',
-           'colgroups' => array(),
-           'empty' => '',
-         );
-         
-         // once we have our table array structure defined, we call Drupal's theme_table()
-         // function to generate the table.
-         print theme_table($table); ?>
-         </p>
-         <br><?php
-       }
-    }?>
-  </div> <?php
+        $rows[] = array(
+          $title . '<br>' . htmlspecialchars($citation->value),
+        );
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_pub-table-relationship-subject',
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
 }

+ 59 - 62
tripal_pub/theme/tripal_pub/tripal_pub_stocks.tpl.php

@@ -32,67 +32,64 @@ if (count($stock_pubs) > 0 ) {
 $total_records = $_SESSION['chado_pager'][$element]['total_records'];
 
 if(count($stocks) > 0){ ?>
-  <div id="tripal_pub-stocks-box" class="tripal_pub-info-box tripal-info-box">
-    <div class="tripal_pub-info-box-title tripal-info-box-title">Stocks</div>
-    <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> stocks:</div> <?php 
+  <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_records) ?> stocks:</div> <?php 
 
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Stock Name', 'Uniquenaem', 'Type');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($stocks as $stock){
-       $stock_name = $stock->name;
-       if (property_exists($stock, 'nid')) {
-         $stock_name = l($stock_name, 'node/' . $stock->nid, array('attributes' => array('target' => '_blank')));
-       }
-       
-       $rows[] = array(
-         $stock_name,
-         $stock->uniquename,
-         $stock->type_id->name,
-       );
-    }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_pub-table-stocks',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'stocks'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $element,
-      'parameters' => array(
-        'block' => 'stocks'
-      ),
-      'quantity' => $num_per_page,
-    );
-    print theme_pager($pager); ?>
-  </div><?php 
-}?>
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Stock Name', 'Uniquenaem', 'Type');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($stocks as $stock){
+     $stock_name = $stock->name;
+     if (property_exists($stock, 'nid')) {
+       $stock_name = l($stock_name, 'node/' . $stock->nid, array('attributes' => array('target' => '_blank')));
+     }
+     
+     $rows[] = array(
+       $stock_name,
+       $stock->uniquename,
+       $stock->type_id->name,
+     );
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-stocks',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'stocks'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $element,
+    'parameters' => array(
+      'block' => 'stocks'
+    ),
+    'quantity' => $num_per_page,
+  );
+  print theme_pager($pager); 
+}
 

+ 17 - 0
tripal_stock/includes/tripal_stock.chado_node.inc

@@ -853,24 +853,39 @@ function tripal_stock_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_stock_base'] = array(
           '#value' => theme('tripal_stock_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Details',
+          '#weight' => 0,
         );
         $node->content['tripal_stock_collections'] = array(
           '#value' => theme('tripal_stock_collections', array('node' => $node)),
+          '#tripal_toc_id'    => 'collections',
+          '#tripal_toc_title' => 'Stock Collections',
         );
         $node->content['tripal_stock_properties'] = array(
           '#value' => theme('tripal_stock_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
         );
         $node->content['tripal_stock_references'] = array(
           '#value' => theme('tripal_stock_references', array('node' => $node)),
+          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_title' => 'References',
         );
         $node->content['tripal_stock_relationships'] = array(
           '#value' => theme('tripal_stock_relationships', array('node' => $node)),
+          '#tripal_toc_id'    => 'relationships',
+          '#tripal_toc_title' => 'Relationships',
         );
         $node->content['tripal_stock_synonyms'] = array(
           '#value' => theme('tripal_stock_synonyms', array('node' => $node)),
+          '#tripal_toc_id'    => 'synonyms',
+          '#tripal_toc_title' => 'Synonyms',
         );
         $node->content['tripal_stock_publications'] = array(
           '#value' => theme('tripal_stock_publications', array('node' => $node)),
+          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_title' => 'Publications',
         );
       }
       if ($view_mode == 'teaser') {
@@ -883,6 +898,8 @@ function tripal_stock_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         $node->content['tripal_organism_stocks'] = array(
           '#value' => theme('tripal_organism_stocks', array('node' => $node)),
+          '#tripal_toc_id'    => 'stocks',
+          '#tripal_toc_title' => 'Stocks',
         );
       }
       break;

+ 61 - 64
tripal_stock/theme/tripal_organism/tripal_organism_stocks.tpl.php

@@ -28,72 +28,69 @@ $total_records = $_SESSION['chado_pager'][$pager_id]['total_records'];
 
  
 if (count($stocks) > 0) { ?>
-  <div id="tripal_organism-stocks-box" class="tripal_organism-info-box tripal-info-box">
-    <div class="tripal_organism-info-box-title tripal-info-box-title">Stocks</div>
-    <div class="tripal_organism-info-box-desc tripal-info-box-desc">This organism is associated with <?php print number_format($total_records) ?> stock(s):</div> <?php 
-    
-    // the $headers array is an array of fields to use as the colum headers. 
-    // additional documentation can be found here 
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    // This table for the analysis has a vertical header (down the first column)
-    // so we do not provide headers here, but specify them in the $rows array below.
-    $headers = array('Name', 'Type');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-    $rows = array();
-    
-    foreach ($stocks as $stock){
-      $name = $stock->name;
-      if (!$name) {
-        $name = $stock->uniquename;
-      }
-      if ($stock->nid) {    
-        $name = l($name, "node/$stock->nid", array('attributes' => array('target' => '_blank')));
-      }
-
-      $rows[] = array(
-        $name,
-        $stock->type_id->name
-      );
+  <div class="tripal_organism-info-box-desc tripal-info-box-desc">This organism is associated with <?php print number_format($total_records) ?> stock(s):</div> <?php 
+  
+  // the $headers array is an array of fields to use as the colum headers. 
+  // additional documentation can be found here 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  // This table for the analysis has a vertical header (down the first column)
+  // so we do not provide headers here, but specify them in the $rows array below.
+  $headers = array('Name', 'Type');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  $rows = array();
+  
+  foreach ($stocks as $stock){
+    $name = $stock->name;
+    if (!$name) {
+      $name = $stock->uniquename;
     }
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_organism-table-stocks',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table);
-    
-    // the $pager array values that control the behavior of the pager.  For
-    // documentation on the values allows in this array see:
-    // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
-    // here we add the paramter 'block' => 'features'. This is because
-    // the pager is not on the default block that appears. When the user clicks a
-    // page number we want the browser to re-appear with the page is loaded.
-    $pager = array(
-      'tags' => array(),
-      'element' => $pager_id,
-      'parameters' => array(
-        'block' => 'stocks'
-      ),
-      'quantity' => $num_results_per_page,
+    if ($stock->nid) {    
+      $name = l($name, "node/$stock->nid", array('attributes' => array('target' => '_blank')));
+    }
+
+    $rows[] = array(
+      $name,
+      $stock->type_id->name
     );
-    print theme_pager($pager);  ?>
-  </div> <?php
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_organism-table-stocks',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+  
+  // the $pager array values that control the behavior of the pager.  For
+  // documentation on the values allows in this array see:
+  // https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7
+  // here we add the paramter 'block' => 'features'. This is because
+  // the pager is not on the default block that appears. When the user clicks a
+  // page number we want the browser to re-appear with the page is loaded.
+  $pager = array(
+    'tags' => array(),
+    'element' => $pager_id,
+    'parameters' => array(
+      'block' => 'stocks'
+    ),
+    'quantity' => $num_results_per_page,
+  );
+  print theme_pager($pager);  
 } 
 
 

+ 64 - 67
tripal_stock/theme/tripal_stock/tripal_stock.publications.tpl.php

@@ -8,78 +8,75 @@ $stock_pubs = $stock->stock_pub;
 
 
 if (count($stock_pubs) > 0) { ?>
-  <div id="tripal_stock_pub-pub-box" class="tripal_stock_pub-info-box tripal-info-box">
-    <div class="tripal_stock_pub-info-box-title tripal-info-box-title">Publications</div>
-    <div class="tripal_stock_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+  <div class="tripal_stock_pub-info-box-desc tripal-info-box-desc"></div> <?php 
+
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Year', 'Publication');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
   
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Year', 'Publication');
+  foreach ($stock_pubs as $stock_pub) {
+    $pub = $stock_pub->pub_id;
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
+    $citation = $pub->title;  // use the title as the default citation
     
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    // get the citation for this pub if it exists
+    $values = array(
+      'pub_id' => $pub->pub_id, 
+      'type_id' => array(
+        'name' => 'Citation',
+      ),
+    );
+    $options = array('return_array' => 1);
+    $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
+    if (count($citation_prop) == 1) {
+      $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
+      $citation = $citation_prop[0]->value;
+    }
     
-    foreach ($stock_pubs as $stock_pub) {
-      $pub = $stock_pub->pub_id;
-      $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-      $citation = $pub->title;  // use the title as the default citation
-      
-      // get the citation for this pub if it exists
-      $values = array(
-        'pub_id' => $pub->pub_id, 
-        'type_id' => array(
-          'name' => 'Citation',
-        ),
-      );
-      $options = array('return_array' => 1);
-      $citation_prop = tripal_core_generate_chado_var('pubprop', $values, $options); 
-      if (count($citation_prop) == 1) {
-        $citation_prop = tripal_core_expand_chado_vars($citation_prop, 'field', 'pubprop.value');
-        $citation = $citation_prop[0]->value;
-      }
-      
-      // if the publication is synced then link to it
-      if ($pub->nid) {
-        // replace the title with a link
-        $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-        $patterns = array(
-          '/(\()/', '/(\))/',
-          '/(\])/', '/(\[)/',
-          '/(\{)/', '/(\})/',
-          '/(\+)/', '/(\.)/', '/(\?)/',
-        );
-        $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
-        $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
-      }
-      
-      $rows[] = array(
-        $pub->pyear,
-        $citation,
+    // if the publication is synced then link to it
+    if ($pub->nid) {
+      // replace the title with a link
+      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
+      $patterns = array(
+        '/(\()/', '/(\))/',
+        '/(\])/', '/(\[)/',
+        '/(\{)/', '/(\})/',
+        '/(\+)/', '/(\.)/', '/(\?)/',
       );
+      $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
+      $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_stock-table-publications',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $rows[] = array(
+      $pub->pyear,
+      $citation,
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php 
+  }
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_stock-table-publications',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 90 - 93
tripal_stock/theme/tripal_stock/tripal_stock_base.tpl.php

@@ -5,108 +5,105 @@ $main_db_reference = $stock->dbxref_id;
 
 // expand the text fields
 $stock = tripal_core_expand_chado_vars($stock, 'field', 'stock.description');
-$stock = tripal_core_expand_chado_vars($stock, 'field', 'stock.uniquename');
-?>
-<div id="tripal_stock-base-box" class="tripal_stock-info-box tripal-info-box">
-  <div class="tripal_stock-info-box-title tripal-info-box-title">Details</div>
-  <!-- <div class="tripal_stock-info-box-desc tripal-info-box-desc"></div> --><?php 
-  
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  // This table for the stock has a vertical header (down the first column)
-  // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array();
-  
-  // the $rows array contains an array of rows where each row is an array
-  // of values for each column of the table in that row.  Additional documentation
-  // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
-  
-  // Stock Name
+$stock = tripal_core_expand_chado_vars($stock, 'field', 'stock.uniquename'); ?>
+
+<div class="tripal_stock-info-box-desc tripal-info-box-desc"></div> <?php  
+
+// the $headers array is an array of fields to use as the colum headers. 
+// additional documentation can be found here 
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+// This table for the stock has a vertical header (down the first column)
+// so we do not provide headers here, but specify them in the $rows array below.
+$headers = array();
+
+// the $rows array contains an array of rows where each row is an array
+// of values for each column of the table in that row.  Additional documentation
+// can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+$rows = array();
+
+// Stock Name
+$rows[] = array(
+  array(
+    'data' => 'Name',
+    'header' => TRUE,
+  ),
+  $stock->name
+);
+// Stock Unique Name
+$rows[] = array(
+  array(
+    'data' => 'Stock Name',
+    'header' => TRUE,
+  ),
+  $stock->uniquename
+);
+// Stock Type
+$rows[] = array(
+  array(
+    'data' => 'Type',
+    'header' => TRUE,
+  ),
+  ucwords(preg_replace('/_/', ' ', $stock->type_id->name))
+);
+
+// Organism
+$organism = $stock->organism_id->genus ." " . $stock->organism_id->species ." (" . $stock->organism_id->common_name .")";
+if (property_exists($stock->organism_id, 'nid')) {
+  $organism = l("<i>" . $stock->organism_id->genus . " " . $stock->organism_id->species . "</i> (" . $stock->organism_id->common_name .")", "node/".$stock->organism_id->nid, array('html' => TRUE));
+}
+$rows[] = array(
+  array(
+    'data' => 'Organism',
+    'header' => TRUE
+  ),
+  $organism
+);
+// allow site admins to see the stock ID
+if (user_access('access administration pages')) {
+  // stock ID
   $rows[] = array(
     array(
-      'data' => 'Name',
+      'data' => 'Stock ID',
       'header' => TRUE,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $stock->name
-  );
-  // Stock Unique Name
-  $rows[] = array(
     array(
-      'data' => 'Stock Name',
-      'header' => TRUE,
+      'data' => $stock->stock_id,
+      'class' => 'tripal-site-admin-only-table-row',
     ),
-    $stock->uniquename
   );
-  // Stock Type
+}
+// Is Obsolete Row
+if($stock->is_obsolete == TRUE){
   $rows[] = array(
     array(
-      'data' => 'Type',
-      'header' => TRUE,
+      'data' => '<div class="tripal_stock-obsolete">This stock is obsolete</div>',
+      'colspan' => 2
     ),
-    ucwords(preg_replace('/_/', ' ', $stock->type_id->name))
   );
+}
+// the $table array contains the headers and rows array as well as other
+// options for controlling the display of the table.  Additional
+// documentation can be found here:
+// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+$table = array(
+  'header' => $headers,
+  'rows' => $rows,
+  'attributes' => array(
+    'id' => 'tripal_stock-table-base',
+  ),
+  'sticky' => FALSE,
+  'caption' => '',
+  'colgroups' => array(),
+  'empty' => '',
+);
 
-  // Organism
-  $organism = $stock->organism_id->genus ." " . $stock->organism_id->species ." (" . $stock->organism_id->common_name .")";
-  if (property_exists($stock->organism_id, 'nid')) {
-    $organism = l("<i>" . $stock->organism_id->genus . " " . $stock->organism_id->species . "</i> (" . $stock->organism_id->common_name .")", "node/".$stock->organism_id->nid, array('html' => TRUE));
-  }
-  $rows[] = array(
-    array(
-      'data' => 'Organism',
-      'header' => TRUE
-    ),
-    $organism
-  );
-  // allow site admins to see the stock ID
-  if (user_access('access administration pages')) {
-    // stock ID
-    $rows[] = array(
-      array(
-        'data' => 'Stock ID',
-        'header' => TRUE,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-      array(
-        'data' => $stock->stock_id,
-        'class' => 'tripal-site-admin-only-table-row',
-      ),
-    );
-  }
-  // Is Obsolete Row
-  if($stock->is_obsolete == TRUE){
-    $rows[] = array(
-      array(
-        'data' => '<div class="tripal_stock-obsolete">This stock is obsolete</div>',
-        'colspan' => 2
-      ),
-    );
-  }
-  // the $table array contains the headers and rows array as well as other
-  // options for controlling the display of the table.  Additional
-  // documentation can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
-    'header' => $headers,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_stock-table-base',
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
-  );
-  
-  // once we have our table array structure defined, we call Drupal's theme_table()
-  // function to generate the table.
-  print theme_table($table);
-  
-  // add in the description if there is one
-  if (property_exists($stock, 'description')) { ?>
-    <div style="text-align: justify"><?php print $stock->description; ?></div> <?php  
-  } ?>
-</div>
+// once we have our table array structure defined, we call Drupal's theme_table()
+// function to generate the table.
+print theme_table($table);
+
+// add in the description if there is one
+if (property_exists($stock, 'description')) { ?>
+  <div style="text-align: justify"><?php print $stock->description; ?></div> <?php  
+} 

+ 48 - 51
tripal_stock/theme/tripal_stock/tripal_stock_collections.tpl.php

@@ -7,58 +7,55 @@ $stock = tripal_core_expand_chado_vars($stock, 'table', 'stockcollection_stock',
 $collections = $stock->stockcollection_stock;
 
 if (count($collections) > 0) {?>
-  <div id="tripal_stock-collections-box" class="tripal_stock-info-box tripal-info-box">
-    <div class="tripal_stock-info-box-title tripal-info-box-title">Stock Collections</div>
-    <div class="tripal_stock-info-box-desc tripal-info-box-desc">This stock is found in the following collections.</div> <?php 
-    
-    // the $headers array is an array of fields to use as the colum headers. 
-    // additional documentation can be found here 
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    // This table for the analysis has a vertical header (down the first column)
-    // so we do not provide headers here, but specify them in the $rows array below.
-    $headers = array('Collection Name', 'Type', 'Contact');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-    $rows = array();
+  <div class="tripal_stock-info-box-desc tripal-info-box-desc">This stock is found in the following collections.</div> <?php 
+  
+  // the $headers array is an array of fields to use as the colum headers. 
+  // additional documentation can be found here 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  // This table for the analysis has a vertical header (down the first column)
+  // so we do not provide headers here, but specify them in the $rows array below.
+  $headers = array('Collection Name', 'Type', 'Contact');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  $rows = array();
 
-    foreach ($collections as $collection_stock){ 
-      // get the stock collection details
-      $collection = $collection_stock->stockcollection_id; 
-      $contact    = $collection->contact_id;
-      
-      $cname = $collection->name;
-      if (property_exists($collection, 'nid')) {
-        $cname = l($collection->name, "node/" . $collection->nid, array('attributes' => array('target' => '_blank')));
-      }
-      
-      $rows[] = array(
-        $cname,
-        ucwords(preg_replace('/_/', ' ', $collection->type_id->name)),
-        $contact->name,
-      );
+  foreach ($collections as $collection_stock){ 
+    // get the stock collection details
+    $collection = $collection_stock->stockcollection_id; 
+    $contact    = $collection->contact_id;
+    
+    $cname = $collection->name;
+    if (property_exists($collection, 'nid')) {
+      $cname = l($collection->name, "node/" . $collection->nid, array('attributes' => array('target' => '_blank')));
     }
-     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_stock-table-synonyms',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
-    );
     
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>  
-  </div><?php
+    $rows[] = array(
+      $cname,
+      ucwords(preg_replace('/_/', ' ', $collection->type_id->name)),
+      $contact->name,
+    );
+  }
+   
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_stock-table-synonyms',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 38 - 42
tripal_stock/theme/tripal_stock/tripal_stock_properties.tpl.php

@@ -20,48 +20,44 @@ if ($stockprops) {
   }
 }
 
-if(count($properties) > 0){ ?>
+if(count($properties) > 0){ 
 
-  <div id="tripal_stock-properties-box" class="tripal_stock-info-box tripal-info-box">
-    <div class="tripal_stock-info-box-title tripal-info-box-title">Properties</div> <?php
-
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Property Name', 'Value');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($properties as $property){
-      $property = tripal_core_expand_chado_vars($property,'field','stockprop.value');
-      $rows[] = array(
-        ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-        urldecode($property->value)
-      );
-    }
-     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_stock-table-properties',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($properties as $property){
+    $property = tripal_core_expand_chado_vars($property,'field','stockprop.value');
+    $rows[] = array(
+      ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
+      urldecode($property->value)
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div> <?php
+  }
+   
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_stock-table-properties',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }

+ 53 - 56
tripal_stock/theme/tripal_stock/tripal_stock_references.tpl.php

@@ -26,64 +26,61 @@ if (count($stock_dbxrefs) > 0 ) {
 
 
 if(count($references) > 0){ ?>
-  <div id="tripal_stock-references-box" class="tripal_stock-info-box tripal-info-box">
-    <div class="tripal_stock-info-box-title tripal-info-box-title">Cross References</div>
-    <div class="tripal_stock-info-box-desc tripal-info-box-desc">External references for this <?php print $stock->type_id->name ?></div><?php
-     
-    // the $headers array is an array of fields to use as the colum headers.
-    // additional documentation can be found here
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Dababase', 'Accession');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
- 
-    foreach ($references as $dbxref){
-    
-      // skip the GFF_source entry as this is just needed for the GBrowse chado adapter 
-      if ($dbxref->db_id->name == 'GFF_source'){
-         continue;  
-      } 
-      $dbname = $dbxref->db_id->name; 
-      if ($dbxref->db_id->url) { 
-        $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
-      } 
-      
-      $accession = $dbxref->accession; 
-      if ($dbxref->db_id->urlprefix) { 
-        $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-      } 
-      if (property_exists($dbxref, 'is_primary')) {
-        $accession .= " <i>(primary cross-reference)</i>";
-      }
-      $rows[] = array(
-        $dbname,
-        $accession
-      );
+  <div class="tripal_stock-info-box-desc tripal-info-box-desc">External references for this <?php print $stock->type_id->name ?></div><?php
+   
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Dababase', 'Accession');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+
+  foreach ($references as $dbxref){
+  
+    // skip the GFF_source entry as this is just needed for the GBrowse chado adapter 
+    if ($dbxref->db_id->name == 'GFF_source'){
+       continue;  
+    } 
+    $dbname = $dbxref->db_id->name; 
+    if ($dbxref->db_id->url) { 
+      $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
     } 
     
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_stock-table-references',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+    $accession = $dbxref->accession; 
+    if ($dbxref->db_id->urlprefix) { 
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
+    } 
+    if (property_exists($dbxref, 'is_primary')) {
+      $accession .= " <i>(primary cross-reference)</i>";
+    }
+    $rows[] = array(
+      $dbname,
+      $accession
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-    print theme_table($table); ?>
-  </div><?php 
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_stock-table-references',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table); 
 }?>
 

+ 118 - 120
tripal_stock/theme/tripal_stock/tripal_stock_relationships.tpl.php

@@ -23,124 +23,122 @@ $object_rels = $all_relationships['object'];
 $subject_rels = $all_relationships['subject'];
 
 if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
-  <div id="tripal_stock-relationships-box" class="tripal_stock-info-box tripal-info-box">
-    <div class="tripal_stock-info-box-title tripal-info-box-title">Relationships</div>
-    <div class="tripal_stock-info-box-desc tripal-info-box-desc"></div> <?php
-    // first add in the subject relationships.  
-    foreach ($subject_rels as $rel_type => $rels){
-      foreach ($rels as $obj_type => $objects){ ?>
-        <p>This <?php print $stock->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> stock(s): <?php
-         
-        // the $headers array is an array of fields to use as the colum headers.
-        // additional documentation can be found here
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $headers = array('Stock Name' ,'Unique Name', 'Species', 'Type');
-        
-        // the $rows array contains an array of rows where each row is an array
-        // of values for each column of the table in that row.  Additional documentation
-        // can be found here:
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $rows = array();
-        
-        foreach ($objects as $object){
-          // link the stock to it's node
-          $stock_name = $object->record->object_id->name;
-          if (property_exists($object->record, 'nid')) {
-            $stock_name = l($stock_name, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
-          }
-          // link the organism to it's node
-          $organism = $object->record->object_id->organism_id;
-          $organism_name = $organism->genus ." " . $organism->species;
-          if (property_exists($organism, 'nid')) {
-            $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
-          }
-          $rows[] = array(
-            $stock_name, 
-            $object->record->object_id->uniquename,
-            $organism_name,
-            $object->record->object_id->type_id->name,
-          ); 
-         } 
-         // the $table array contains the headers and rows array as well as other
-         // options for controlling the display of the table.  Additional
-         // documentation can be found here:
-         // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-         $table = array(
-           'header' => $headers,
-           'rows' => $rows,
-           'attributes' => array(
-             'id' => 'tripal_stock-table-relationship-object',
-           ),
-           'sticky' => FALSE,
-           'caption' => '',
-           'colgroups' => array(),
-           'empty' => '',
-         );
-         
-         // once we have our table array structure defined, we call Drupal's theme_table()
-         // function to generate the table.
-         print theme_table($table); ?>
-         </p>
-         <br><?php
-       }
-    }
-    
-    // second add in the object relationships.  
-    foreach ($object_rels as $rel_type => $rels){
-      foreach ($rels as $subject_type => $subjects){?>
-        <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> stock(s) are <?php print $rel_type ?> this <?php print $stock->type_id->name;?>: <?php 
-        // the $headers array is an array of fields to use as the colum headers.
-        // additional documentation can be found here
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $headers = array('Stock Name' ,'Unique Name', 'Species', 'Type');
-        
-        // the $rows array contains an array of rows where each row is an array
-        // of values for each column of the table in that row.  Additional documentation
-        // can be found here:
-        // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-        $rows = array();
-        
-        foreach ($subjects as $subject){
-          // link the stock to it's node
-          $stock_name = $subject->record->subject_id->name;
-          if (property_exists($subject->record, 'nid')) {
-            $stock_name = l($stock_name, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
-          }
-          // link the organism to it's node
-          $organism = $subject->record->subject_id->organism_id;
-          $organism_name = $organism->genus ." " . $organism->species;
-          if (property_exists($organism, 'nid')) {
-            $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
-          }
-          $rows[] = array(
-            $stock_name, 
-            $subject->record->subject_id->uniquename,
-            $organism_name,
-            $subject->record->subject_id->type_id->name,
-          ); 
-         } 
-         // the $table array contains the headers and rows array as well as other
-         // options for controlling the display of the table.  Additional
-         // documentation can be found here:
-         // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-         $table = array(
-           'header' => $headers,
-           'rows' => $rows,
-           'attributes' => array(
-             'id' => 'tripal_stock-table-relationship-subject',
-           ),
-           'sticky' => FALSE,
-           'caption' => '',
-           'colgroups' => array(),
-           'empty' => '',
-         );
-         
-         // once we have our table array structure defined, we call Drupal's theme_table()
-         // function to generate the table.
-         print theme_table($table); ?>
-         </p>
-         <br><?php
-       }
-    }?>
-  </div> <?php
+  <div class="tripal_stock-info-box-desc tripal-info-box-desc"></div> <?php
+  
+  // first add in the subject relationships.  
+  foreach ($subject_rels as $rel_type => $rels){
+    foreach ($rels as $obj_type => $objects){ ?>
+      <p>This <?php print $stock->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> stock(s): <?php
+       
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Stock Name' ,'Unique Name', 'Species', 'Type');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($objects as $object){
+        // link the stock to it's node
+        $stock_name = $object->record->object_id->name;
+        if (property_exists($object->record, 'nid')) {
+          $stock_name = l($stock_name, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
+        }
+        // link the organism to it's node
+        $organism = $object->record->object_id->organism_id;
+        $organism_name = $organism->genus ." " . $organism->species;
+        if (property_exists($organism, 'nid')) {
+          $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
+        }
+        $rows[] = array(
+          $stock_name, 
+          $object->record->object_id->uniquename,
+          $organism_name,
+          $object->record->object_id->type_id->name,
+        ); 
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_stock-table-relationship-object',
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
+  
+  // second add in the object relationships.  
+  foreach ($object_rels as $rel_type => $rels){
+    foreach ($rels as $subject_type => $subjects){?>
+      <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> stock(s) are <?php print $rel_type ?> this <?php print $stock->type_id->name;?>: <?php 
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Stock Name' ,'Unique Name', 'Species', 'Type');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($subjects as $subject){
+        // link the stock to it's node
+        $stock_name = $subject->record->subject_id->name;
+        if (property_exists($subject->record, 'nid')) {
+          $stock_name = l($stock_name, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
+        }
+        // link the organism to it's node
+        $organism = $subject->record->subject_id->organism_id;
+        $organism_name = $organism->genus ." " . $organism->species;
+        if (property_exists($organism, 'nid')) {
+          $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
+        }
+        $rows[] = array(
+          $stock_name, 
+          $subject->record->subject_id->uniquename,
+          $organism_name,
+          $subject->record->subject_id->type_id->name,
+        ); 
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_stock-table-relationship-subject',
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
 }

+ 38 - 41
tripal_stock/theme/tripal_stock/tripal_stock_synonyms.tpl.php

@@ -20,46 +20,43 @@ if ($stockprops) {
 }
 
 if(count($synonyms) > 0){ ?>
-  <div id="tripal_stock-synonyms-box" class="tripal_stock-info-box tripal-info-box">
-    <div class="tripal_stock-info-box-title tripal-info-box-title">Synonyms</div>
-    <div class="tripal_stock-info-box-desc tripal-info-box-desc">The stock '<?php print $stock->name ?>' has the following synonyms</div> <?php
-    
-    // the $headers array is an array of fields to use as the colum headers. 
-    // additional documentation can be found here 
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    // This table for the analysis has a vertical header (down the first column)
-    // so we do not provide headers here, but specify them in the $rows array below.
-    $headers = array('Synonym');
-    
-    // the $rows array contains an array of rows where each row is an array
-    // of values for each column of the table in that row.  Additional documentation
-    // can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-    $rows = array();
-    foreach ($synonyms as $property){
-      $rows[] = array(
-        $property->value,
-      );
-    } 
-    
-    // the $table array contains the headers and rows array as well as other
-    // options for controlling the display of the table.  Additional
-    // documentation can be found here:
-    // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
-      'header' => $headers,
-      'rows' => $rows,
-      'attributes' => array(
-        'id' => 'tripal_stock-table-synonyms',
-      ),
-      'sticky' => FALSE,
-      'caption' => '',
-      'colgroups' => array(),
-      'empty' => '',
+  <div class="tripal_stock-info-box-desc tripal-info-box-desc">The stock '<?php print $stock->name ?>' has the following synonyms</div> <?php
+  
+  // the $headers array is an array of fields to use as the colum headers. 
+  // additional documentation can be found here 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  // This table for the analysis has a vertical header (down the first column)
+  // so we do not provide headers here, but specify them in the $rows array below.
+  $headers = array('Synonym');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  $rows = array();
+  foreach ($synonyms as $property){
+    $rows[] = array(
+      $property->value,
     );
-    
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
-      print theme_table($table); ?>
-  </div><?php
+  } 
+  
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_stock-table-synonyms',
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
 }