Browse Source

Various bug fixes and theming adjustments

spficklin 14 years ago
parent
commit
740bec5016

+ 5 - 1
theme_tripal/css/tripal.css

@@ -7,7 +7,11 @@
 }
 }
 .tripal-table th, 
 .tripal-table th, 
 .tripal-table td {
 .tripal-table td {
-   padding: 5px;
+   vertical-align:text-top;
+   padding-left: 10px;
+   padding-right: 10px;
+   padding-top: 5px;
+   padding-bottom: 5px;
 }
 }
 .tripal-table-horz {
 .tripal-table-horz {
    border-top: 2px solid #999999;
    border-top: 2px solid #999999;

+ 151 - 51
theme_tripal/node-chado_analysis.tpl.php

@@ -1,56 +1,156 @@
 <?php
 <?php
+// Purpose: This template provides the layout of the organism node (page)
+//   using the same templates used for the various feature content blocks.
 //
 //
-// Copyright 2009 Clemson University
+// To Customize the Featture Node Page:
+//   - This Template: customize basic layout and which elements are included
+//   - Using Panels: Override the node page using Panels3 and place the blocks
+//       of content as you please. This method requires no programming. See
+//       the Tripal User Guide for more details
+//   - Block Templates: customize the content/layout of each block of stock 
+//       content. These templates are found in the tripal_stock subdirectory
 //
 //
+// Variables Available:
+//   - $node: a standard object which contains all the fields associated with
+//       nodes including nid, type, title, taxonomy. It also includes stock
+//       specific fields such as stock_name, uniquename, stock_type, synonyms,
+//       properties, db_references, object_relationships, subject_relationships,
+//       organism, etc.
+//   NOTE: For a full listing of fields available in the node object the
+//       print_r $node line below or install the Drupal Devel module which 
+//       provides an extra tab at the top of the node page labelled Devel
 ?>
 ?>
 
 
-   <?php if ($picture) {
-      print $picture;
-   }?>
-    
-   <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
-
-   <?php if ($page == 0) { ?><h2 class="nodeTitle"><a href="<?php print $node_url?>"><?php print $title?></a>
-	<?php global $base_url;
-	if ($sticky) { print '<img src="'.base_path(). drupal_get_path('theme','sanqreal').'/img/sticky.gif" alt="sticky icon" class="sticky" />'; } ?>
-	</h2><?php }; ?>
-    
-	<?php if (!$teaser): ?>
-	<?php if ($submitted): ?>
-      <div class="metanode"><p><?php print t('') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p></div>
-      <div>
-      <!-- tripal_analysis theme -->
-         <table>
-            <tr><th>Name</th><td><?php print $node->analysisname;?></td></tr>
-            <tr><th>Program (version)</th><td><?php print $node->program.' ('.$node->programversion.')';?></td></tr>
-            <?php
-               $ver = $node->sourceversion;
-               if ($node->sourceversion) {
-                  $ver = "($node->sourceversion)";
-               }
-               $date = preg_replace("/^(\d+-\d+-\d+) .*/","$1",$node->timeexecuted);
-            ?>
-            <tr><th>Source (version)</th><td><?php print $node->sourcename.' '.$ver;?></td></tr>
-            <tr><th>Source URI</th><td><?php print $node->sourceuri;?></td></tr>
-            <tr><th>Executed</th><td><?php print $date?></td></tr>
-            <tr><th>Description</th><td><?php print $node->description?></td></tr>
-         </table>
-      <!-- End of tripal_analysis theme-->
-	  </div> 
-    <?php endif; ?>
-    <?php endif; ?>
-    
-    <div class="content"><?php print $content?></div>
-    
-    <?php if (!$teaser): ?>
-    <?php if ($links) { ?><div class="links"><?php print $links?></div><?php }; ?>
-    <?php endif; ?>
-    
-    <?php if ($teaser): ?>
-    <?php if ($links) { ?><div class="linksteaser"><div class="links"><?php print $links?></div></div><?php }; ?>
-    <?php endif; ?>
-    
-    <?php if (!$teaser): ?>
-    <?php if ($terms) { ?><div class="taxonomy"><span><?php print t('tags') ?></span> <?php print $terms?></div><?php } ?>
-    <?php endif; ?>
-  </div>
+<?php
+ //uncomment this line to see a full listing of the fields avail. to $node
+ //print '<pre>'.print_r($variables,TRUE).'</pre>';
+
+$node = $variables['node'];
+$organism = $variables['node']->organism;
+?>
+
+<?php if ($teaser) { 
+  include('tripal_analysis/tripal_analysis_teaser.tpl.php'); 
+} else { ?>
+
+<script type="text/javascript">
+if (Drupal.jsEnabled) {
+   $(document).ready(function() {
+      // hide all tripal info boxes at the start
+      $(".tripal-info-box").hide();
+ 
+      // 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_analysis_toc_list').append('<li><a href="#'+id+'" class="tripal_analysis_toc_item">'+title+'</a></li>');
+      });
+
+      // when a title in the table of contents is clicked, then
+      // show the corresponding item in the details box
+      $(".tripal_analysis_toc_item").click(function(){
+         $(".tripal-info-box").hide();
+         href = $(this).attr('href');
+         $(href).fadeIn('slow');
+         // we want to make sure our table of contents and the details
+         // box stay the same height
+         $("#tripal_analysis_toc").height($(href).parent().height());
+         return false;
+      }); 
+
+      // we want the base details to show up when the page is first shown 
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_analysis-"+block_title+"-box").show();
+      } else {
+         $("#tripal_analysis-base-box").show();
+      }
+      
+      // make the height of the table of contents match the height of the details box
+      $("#tripal_analysis_toc").height($("#tripal_analysis-base-box").parent().height());
+      
+   });
+}
+</script>
+
+<style type="text/css">
+  /* these styles are specific for this template and is not included 
+     in the main CSS files for the theme as it is anticipated that the
+     elements on this page may not be used for other customizations */
+  #tripal_analysis_toc {
+     float: left;
+     width: 20%;
+     background-color: #EEEEEE;
+     -moz-border-radius: 15px;
+     border-radius: 15px;
+     -moz-box-shadow: 3px 3px 4px #000;
+	  -webkit-box-shadow: 3px 3px 4px #000;
+	  box-shadow: 3px 3px 4px #000;
+     padding: 20px;
+     min-height: 500px;
+     border-style:solid;
+     border-width:1px;
+  }
+  #tripal_analysis_toc ul {
+    margin-left: 0px;
+    margin-top: 5px;
+    padding-left: 15px;
+  }
+  #tripal_analysis_toc_title {
+     font-size: 1.5em;
+     line-height: 110%;
+  }
+  #tripal_analysis_toc_desc {
+    /*font-style: italic; */
+  }
+  #tripal_analysis_details {
+     float: left;
+     width: 70%;
+     background-color: #FFFFFF;
+     -moz-border-radius: 15px;
+     border-radius: 15px;
+     -moz-box-shadow: 3px 3px 4px #000;
+	  -webkit-box-shadow: 3px 3px 4px #000;
+	  box-shadow: 3px 3px 4px #000;
+     padding: 20px;
+     min-height: 500px;
+     margin-right: 10px;
+     margin-bottom: 10px;
+     border-style:solid;
+     border-width:1px;
+  }
+  #tripal_analysis-base-box img {
+    float: left;
+    margin-bottom: 10px;
+  }
+  #tripal_analysis-table-base {
+    float: left;
+    width: 100%;
+    margin-left: 0px;
+    margin-bottom: 10px;
+  }
+</style>
+
+
+<div id="tripal_analysis_details">
+
+   <!-- Basic Details Theme -->
+   <?php include('tripal_analysis/tripal_analysis_base.tpl.php'); ?>
+
+   <?php print $content ?>
+</div>
+
+<!-- Table of contents -->
+<div id="tripal_analysis_toc">
+   <div id="tripal_analysis_toc_title">Resources</i></div>
+   <span id="tripal_analysis_toc_desc">Select a link below for more information</span>
+   <ul id="tripal_analysis_toc_list">
+
+   </ul>
+</div>
+
+<?php } ?>

+ 6 - 16
theme_tripal/node-chado_analysis_blast.tpl.php

@@ -61,26 +61,16 @@ if (Drupal.jsEnabled) {
       }); 
       }); 
 
 
       // we want the base details to show up when the page is first shown 
       // 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(window.location.href.match(/\?page=\d+/)){
-         $("#tripal_analysis_blast-feature_browser-box").show();
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_analysis_blast-"+block_title+"-box").show();
       } else {
       } else {
          $("#tripal_analysis_blast-base-box").show();
          $("#tripal_analysis_blast-base-box").show();
       }
       }
-      $("#tripal_analysis_blast_toc").height($("#tripal_analysis_blast-base-box").parent().height());
 
 
-      // we want to select the first GO/KEGG report by default
-		$('.form-select').each(function() {
-        var default_option = this.getElementsByTagName('option')[1];
-        if (default_option) {
-           this.selectedIndex =default_option.index ;
-           if (this.onchange.toString().match('tripal_analysis_go_org_charts')) {   
-              tripal_analysis_go_org_charts(default_option.value);
-           } else if (this.onchange.toString().match('tripal_analysis_kegg_org_report')) {            
-              tripal_analysis_kegg_org_report(default_option.value);
-           }
-        }
-		});
+      $("#tripal_analysis_blast_toc").height($("#tripal_analysis_blast-base-box").parent().height());
       
       
    });
    });
 }
 }

+ 151 - 61
theme_tripal/node-chado_analysis_kegg.tpl.php

@@ -1,67 +1,157 @@
 <?php
 <?php
+// Purpose: This template provides the layout of the organism node (page)
+//   using the same templates used for the various feature content blocks.
 //
 //
-// Copyright 2009 Clemson University
+// To Customize the Featture Node Page:
+//   - This Template: customize basic layout and which elements are included
+//   - Using Panels: Override the node page using Panels3 and place the blocks
+//       of content as you please. This method requires no programming. See
+//       the Tripal User Guide for more details
+//   - Block Templates: customize the content/layout of each block of stock 
+//       content. These templates are found in the tripal_stock subdirectory
 //
 //
+// Variables Available:
+//   - $node: a standard object which contains all the fields associated with
+//       nodes including nid, type, title, taxonomy. It also includes stock
+//       specific fields such as stock_name, uniquename, stock_type, synonyms,
+//       properties, db_references, object_relationships, subject_relationships,
+//       organism, etc.
+//   NOTE: For a full listing of fields available in the node object the
+//       print_r $node line below or install the Drupal Devel module which 
+//       provides an extra tab at the top of the node page labelled Devel
 ?>
 ?>
 
 
-   <?php if ($picture) {
-      print $picture;
-   }?>
-    
-   <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
+<?php
+ //uncomment this line to see a full listing of the fields avail. to $node
+ //print '<pre>'.print_r($variables,TRUE).'</pre>';
+
+$node = $variables['node'];
+$organism = $variables['node']->organism;
+?>
+
+<?php if ($teaser) { 
+  include('tripal_analysis_kegg/tripal_analysis_kegg_teaser.tpl.php'); 
+} else { ?>
+
+<script type="text/javascript">
+if (Drupal.jsEnabled) {
+   $(document).ready(function() {
+      // hide all tripal info boxes at the start
+      $(".tripal-info-box").hide();
+ 
+      // 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_analysis_kegg_toc_list').append('<li><a href="#'+id+'" class="tripal_analysis_kegg_toc_item">'+title+'</a></li>');
+      });
+
+      // when a title in the table of contents is clicked, then
+      // show the corresponding item in the details box
+      $(".tripal_analysis_kegg_toc_item").click(function(){
+         $(".tripal-info-box").hide();
+         href = $(this).attr('href');
+         $(href).fadeIn('slow');
+         // we want to make sure our table of contents and the details
+         // box stay the same height
+         $("#tripal_analysis_kegg_toc").height($(href).parent().height());
+         return false;
+      }); 
+
+      // we want the base details to show up when the page is first shown 
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_analysis_kegg-"+block_title+"-box").show();
+      } else {
+         $("#tripal_analysis_kegg-base-box").show();
+      }
+      
+      // make the height of the table of contents match the height of the details box
+      $("#tripal_analysis_kegg_toc").height($("#tripal_analysis_kegg-base-box").parent().height());
+      
+   });
+}
+</script>
+
+<style type="text/css">
+  /* these styles are specific for this template and is not included 
+     in the main CSS files for the theme as it is anticipated that the
+     elements on this page may not be used for other customizations */
+  #tripal_analysis_kegg_toc {
+     float: left;
+     width: 20%;
+     background-color: #EEEEEE;
+     -moz-border-radius: 15px;
+     border-radius: 15px;
+     -moz-box-shadow: 3px 3px 4px #000;
+	  -webkit-box-shadow: 3px 3px 4px #000;
+	  box-shadow: 3px 3px 4px #000;
+     padding: 20px;
+     min-height: 500px;
+     border-style:solid;
+     border-width:1px;
+  }
+  #tripal_analysis_kegg_toc ul {
+    margin-left: 0px;
+    margin-top: 5px;
+    padding-left: 15px;
+  }
+  #tripal_analysis_kegg_toc_title {
+     font-size: 1.5em;
+     line-height: 110%;
+  }
+  #tripal_analysis_kegg_toc_desc {
+    /*font-style: italic; */
+  }
+  #tripal_analysis_kegg_details {
+     float: left;
+     width: 70%;
+     background-color: #FFFFFF;
+     -moz-border-radius: 15px;
+     border-radius: 15px;
+     -moz-box-shadow: 3px 3px 4px #000;
+	  -webkit-box-shadow: 3px 3px 4px #000;
+	  box-shadow: 3px 3px 4px #000;
+     padding: 20px;
+     min-height: 500px;
+     margin-right: 10px;
+     margin-bottom: 10px;
+     border-style:solid;
+     border-width:1px;
+  }
+  #tripal_analysis_kegg-base-box img {
+    float: left;
+    margin-bottom: 10px;
+  }
+  #tripal_analysis_kegg-table-base {
+    float: left;
+    width: 100%;
+    margin-left: 0px;
+    margin-bottom: 10px;
+  }
+</style>
+
+
+<div id="tripal_analysis_kegg_details">
+
+   <!-- Basic Details Theme -->
+   <?php include('tripal_analysis_kegg/tripal_analysis_kegg_base.tpl.php'); ?>
+   <?php include('tripal_analysis_kegg/tripal_analysis_kegg_report.tpl.php'); ?>
+
+   <?php print $content ?>
+</div>
+
+<!-- Table of contents -->
+<div id="tripal_analysis_kegg_toc">
+   <div id="tripal_analysis_kegg_toc_title">Resources</i></div>
+   <span id="tripal_analysis_kegg_toc_desc">Select a link below for more information</span>
+   <ul id="tripal_analysis_kegg_toc_list">
+
+   </ul>
+</div>
 
 
-   <?php if ($page == 0) { ?><h2 class="nodeTitle"><a href="<?php print $node_url?>"><?php print $title?></a>
-	<?php global $base_url;
-	if ($sticky) { print '<img src="'.base_path(). drupal_get_path('theme','sanqreal').'/img/sticky.gif" alt="sticky icon" class="sticky" />'; } ?>
-	</h2><?php }; ?>
-    
-	<?php if (!$teaser): ?>
-	   <?php if ($submitted): ?>
-      <div class="metanode"><p><?php print t('') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p></div>
-      <?php endif; ?>
-      <div>
-      <!-- tripal_analysis_kegg theme -->
-         <table>
-            <tr><th>Name</th><td><?php print $node->analysisname;?></td></tr>
-            <tr><th>Program (version)</th><td><?php print $node->program.' ('.$node->programversion.')';?></td></tr>
-            <?php
-               $ver = $node->sourceversion;
-               if ($node->sourceversion) {
-                  $ver = "($node->sourceversion)";
-               }
-               $date = preg_replace("/^(\d+-\d+-\d+) .*/","$1",$node->timeexecuted);
-            ?>
-            <tr><th>Source (version)</th><td><?php print $node->sourcename.' '.$ver;?></td></tr>
-            <tr><th>Source URI</th><td><?php print $node->sourceuri;?></td></tr>
-            <tr><th>Executed</th><td><?php print $date?></td></tr>
-            <tr><th>Description</th><td><?php print $node->description?></td></tr>
-            <tr><th>KEGG Settings</th>
-              <td>
-                <b>File:</b>
-                  <?php print preg_replace("/.*\/(.*)/", "$1", $node->hierfile); ?><br>
-                  <?php if ($node->keggjob) {
-                           print "A job for parsing KAAS heir output will be submitted.";
-                        }
-                  ?>
-              </td>
-            </tr>
-         </table>
-      <!-- End of tripal_analysis_kegg theme-->
-	  </div> 
-    
-    <?php endif; ?>
-    
-    <div class="content"><?php print $content?></div>
-    
-    <?php if (!$teaser): ?>
-    <?php if ($links) { ?><div class="links"><?php print $links?></div><?php }; ?>
-    <?php endif; ?>
-    
-    <?php if ($teaser): ?>
-    <?php if ($links) { ?><div class="linksteaser"><div class="links"><?php print $links?></div></div><?php }; ?>
-    <?php endif; ?>
-    
-    <?php if (!$teaser): ?>
-    <?php if ($terms) { ?><div class="taxonomy"><span><?php print t('tags') ?></span> <?php print $terms?></div><?php } ?>
-    <?php endif; ?>
-  </div>
+<?php } ?>

+ 5 - 3
theme_tripal/node-chado_analysis_unigene.tpl.php

@@ -68,9 +68,11 @@ if (Drupal.jsEnabled) {
       }); 
       }); 
 
 
       // we want the base details to show up when the page is first shown 
       // 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(window.location.href.match(/\?page=\d+/)){
-         $("#tripal_analysis_unigene-feature_browser-box").show();
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_analysis_unigene-"+block_title+"-box").show();
       } else {
       } else {
          $("#tripal_analysis_unigene-base-box").show();
          $("#tripal_analysis_unigene-base-box").show();
       }
       }

+ 10 - 2
theme_tripal/node-chado_feature.tpl.php

@@ -58,8 +58,16 @@ if (Drupal.jsEnabled) {
          return false;
          return false;
       }); 
       }); 
 
 
-      // we want the base details to show up when the page is first shown
-      $("#tripal_feature-base-box").show();
+      // we want the base details to show up when the page is first shown 
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_feature-"+block_title+"-box").show();
+      } else {
+         $("#tripal_feature-base-box").show();
+      }
+
       $("#tripal_organism_toc").height($("#tripal_feature-base-box").parent().height());
       $("#tripal_organism_toc").height($("#tripal_feature-base-box").parent().height());
    });
    });
 }
 }

+ 8 - 15
theme_tripal/node-chado_organism.tpl.php

@@ -62,25 +62,18 @@ if (Drupal.jsEnabled) {
 
 
       // we want the base details to show up when the page is first shown 
       // 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
       // unless we're using the feature browser then we want that page to show
-      if(window.location.href.match(/\?page=\d+/)){
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_orgnism-"+block_title+"-box").show();
+      } 
+      else if(window.location.href.match(/\?page=\d+/)){
          $("#tripal_organism-feature_browser-box").show();
          $("#tripal_organism-feature_browser-box").show();
-      } else {
+      } 
+      else {
          $("#tripal_organism-base-box").show();
          $("#tripal_organism-base-box").show();
       }
       }
       $("#tripal_organism_toc").height($("#tripal_organism-base-box").parent().height());
       $("#tripal_organism_toc").height($("#tripal_organism-base-box").parent().height());
-
-      // we want to select the first GO/KEGG report by default
-		$('.form-select').each(function() {
-        var default_option = this.getElementsByTagName('option')[1];
-        if (default_option) {
-           this.selectedIndex =default_option.index ;
-           if (this.onchange.toString().match('tripal_analysis_go_org_charts')) {   
-              tripal_analysis_go_org_charts(default_option.value);
-           } else if (this.onchange.toString().match('tripal_analysis_kegg_org_report')) {            
-              tripal_analysis_kegg_org_report(default_option.value);
-           }
-        }
-		});
       
       
    });
    });
 }
 }

+ 11 - 3
theme_tripal/node-chado_stock.tpl.php

@@ -59,8 +59,16 @@
          return false;
          return false;
       }); 
       }); 
 
 
-      // we want the base details to show up when the page is first shown
-      $("#tripal_stock-base-box").show();
+      // we want the base details to show up when the page is first shown 
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_stock-"+block_title+"-box").show();
+      } else {
+         $("#tripal_stock-base-box").show();
+      }
+
       $("#tripal_stock_toc").height($("#tripal_stock-base-box").parent().height());
       $("#tripal_stock_toc").height($("#tripal_stock-base-box").parent().height());
    });
    });
 }
 }
@@ -151,4 +159,4 @@
 
 
    </ul>
    </ul>
 </div>
 </div>
-<?php } ?>
+<?php } ?>

+ 49 - 0
theme_tripal/tripal_analysis/tripal_analysis_base.tpl.php

@@ -0,0 +1,49 @@
+<?php
+$node = $variables['node'];
+$analysis = $variables['node']->analysis;
+
+?>
+<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>
+   <table id="tripal_analysis-table-base" class="tripal_analysis-table tripal-table tripal-table-vert">
+      <tr class="tripal_analysis-table-odd-row tripal-table-even-row">
+        <th>Analysis Name</th>
+        <td><?php print $analysis->name; ?></td>
+      </tr>
+      <tr class="tripal_analysis-table-odd-row tripal-table-odd-row">
+        <th nowrap>Software</th>
+        <td><?php 
+          print $analysis->program; 
+          if($analysis->programversion){
+             print " (" . $analysis->programversion . ")"; 
+          }
+          if($analysis->algorithm){
+             print ". " . $analysis->algorithm; 
+          }
+          ?>
+        </td>
+      </tr>
+      <tr class="tripal_analysis-table-odd-row tripal-table-even-row">
+        <th nowrap>Source</th>
+        <td><?php 
+          if($analysis->sourceuri){
+             print "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>"; 
+          } else {
+             print $analysis->sourcename; 
+          }
+          if($analysis->sourceversion){
+             print " (" . $analysis->sourceversion . ")"; 
+          }
+          ?>
+          </td>
+      </tr>
+      <tr class="tripal_analysis-table-odd-row tripal-table-odd-row">
+        <th nowrap>Date performed</th>
+        <td><?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$analysis->timeexecuted); ?></td>
+      </tr>
+      <tr class="tripal_analysis-table-odd-row tripal-table-even-row">
+        <th nowrap>Description</th>
+        <td><?php print $analysis->description; ?></td>
+      </tr>             	                                
+   </table>   
+</div>

+ 49 - 0
theme_tripal/tripal_analysis_kegg/tripal_analysis_kegg_base.tpl.php

@@ -0,0 +1,49 @@
+<?php
+$node = $variables['node'];
+$analysis = $variables['node']->analysis;
+
+?>
+<div id="tripal_analysis_kegg-base-box" class="tripal_analysis_kegg-info-box tripal-info-box">
+  <div class="tripal_analysis_kegg-info-box-title tripal-info-box-title">KEGG Analysis Details</div>
+   <table id="tripal_analysis_kegg-table-base" class="tripal_analysis_kegg-table tripal-table tripal-table-vert">
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-even-row">
+        <th>Analysis Name</th>
+        <td><?php print $analysis->name; ?></td>
+      </tr>
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-odd-row">
+        <th nowrap>Software</th>
+        <td><?php 
+          print $analysis->program; 
+          if($analysis->programversion){
+             print " (" . $analysis->programversion . ")"; 
+          }
+          if($analysis->algorithm){
+             print ". " . $analysis->algorithm; 
+          }
+          ?>
+        </td>
+      </tr>
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-even-row">
+        <th nowrap>Source</th>
+        <td><?php 
+          if($analysis->sourceuri){
+             print "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>"; 
+          } else {
+             print $analysis->sourcename; 
+          }
+          if($analysis->sourceversion){
+             print " (" . $analysis->sourceversion . ")"; 
+          }
+          ?>
+          </td>
+      </tr>
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-odd-row">
+        <th nowrap>Date performed</th>
+        <td><?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$analysis->timeexecuted); ?></td>
+      </tr>
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-even-row">
+        <th nowrap>Description</th>
+        <td><?php print $analysis->description; ?></td>
+      </tr>             	                                
+   </table>   
+</div>

+ 11 - 0
theme_tripal/tripal_analysis_kegg/tripal_analysis_kegg_report.tpl.php

@@ -0,0 +1,11 @@
+<?php
+$analysis = $node->analysis;
+$report = $analysis->tripal_analysis_kegg->kegg_report;
+//dpm($analysis);
+?>
+
+<div id="tripal_analysis_kegg-report-box" class="tripal_analysis_kegg-box tripal-info-box">
+  <div class="tripal_analysis_kegg-info-box-title tripal-info-box-title">KEGG Report</div>
+  <div class="tripal_analysis_kegg-info-box-desc tripal-info-box-desc"><?php print $analysis->name ?></div>
+  <?php print $report ?>
+</div>

+ 1 - 36
tripal_analysis_blast/tripal_analysis_blast.module

@@ -728,44 +728,9 @@ function chado_analysis_blast_submit_jobs($node){
  * Delete blast anlysis
  * Delete blast anlysis
  */
  */
 function chado_analysis_blast_delete($node){
 function chado_analysis_blast_delete($node){
-	// Before removing, get analysis_id so we can remove it from chado database
-	// later
-	$sql_drupal = "SELECT analysis_id ".
-                 "FROM {chado_analysis} ".
-                 "WHERE nid = %d ".
-                 "AND vid = %d";
-	$analysis_id = db_result(db_query($sql_drupal, $node->nid, $node->vid));
-
-	// Remove data from the {chado_analysis}, {node}, and {node_revisions} tables
-	$sql_del = "DELETE FROM {chado_analysis} ".
-              "WHERE nid = %d ".
-              "AND vid = %d";
-	db_query($sql_del, $node->nid, $node->vid);
-	$sql_del = "DELETE FROM {node} ".
-              "WHERE nid = %d ".
-              "AND vid = %d";
-	db_query($sql_del, $node->nid, $node->vid);
-	$sql_del = "DELETE FROM {node_revisions} ".
-              "WHERE nid = %d ".
-              "AND vid = %d";
-	db_query($sql_del, $node->nid, $node->vid);
-
-	//Remove from analysisfeatureprop, analysisfeature, analysis, and analysisprop tables
-	$previous_db = tripal_db_set_active('chado');
-	$sql = "SELECT analysisfeature_id FROM {analysisfeature} WHERE analysis_id=%d";
-	$results = db_query($sql, $analysis_id);
-	while ($af = db_fetch_object($results)) {
-		db_query("DELETE FROM {analysisfeatureprop} WHERE analysisfeature_id = %d", $af->analysisfeature_id);
-	}
-	db_query("DELETE FROM {analysisfeature} WHERE analysis_id = %d", $analysis_id);
-	db_query("DELETE FROM {analysisprop} WHERE analysis_id = %d", $analysis_id);
-	db_query("DELETE FROM {analysis} WHERE analysis_id = %d", $analysis_id);
-	tripal_db_set_active($previous_db);
+	chado_analysis_delete($node);
 }
 }
 
 
-
-
-
 /*******************************************************************************
 /*******************************************************************************
  *  This function customizes the view of the chado_analysis node.  It allows
  *  This function customizes the view of the chado_analysis node.  It allows
  *  us to generate the markup.
  *  us to generate the markup.

+ 70 - 325
tripal_analysis_kegg/tripal_analysis_kegg.module

@@ -49,7 +49,7 @@ function tripal_analysis_kegg_menu() {
    $items['tripal_analysis_kegg_org_report'] = array(
    $items['tripal_analysis_kegg_org_report'] = array(
       'path' => 'tripal_analysis_kegg_org_report',
       'path' => 'tripal_analysis_kegg_org_report',
       'title' => t('Analysis KEGG report'),
       'title' => t('Analysis KEGG report'),
-      'page callback' => 'tripal_analysis_kegg_org_report',
+      'page callback' => 'f',
       'page arguments' => array(1),
       'page arguments' => array(1),
       'access arguments' => array('access chado_analysis_kegg content'),
       'access arguments' => array('access chado_analysis_kegg content'),
       'type' => MENU_CALLBACK
       'type' => MENU_CALLBACK
@@ -176,95 +176,13 @@ function tripal_analysis_kegg_brite($analysis_id, $type_id, $ajax){
  *  Provide a KEGG Analysis form
  *  Provide a KEGG Analysis form
  */
  */
 function chado_analysis_kegg_form ($node){
 function chado_analysis_kegg_form ($node){
+   // add in the default fields
+   $form = chado_analysis_form($node);
 
 
-   $type = node_get_types('type', $node);
-   $form = array();
-   $form['title']= array(
-      '#type' => 'hidden',
-      '#default_value' => $node->title,
-   );
-   $form['analysisname']= array(
-      '#type' => 'textfield',
-      '#title' => t('Analysis Name'),
-      '#required' => FALSE,
-      '#default_value' => $node->analysisname,
-      '#weight' => 1
-   );
-   $form['program']= array(
-      '#type' => 'textfield',
-      '#title' => t('Program'),
-      '#required' => TRUE,
-      '#default_value' => $node->program,
-      '#weight' => 2
-   );
-   $form['programversion']= array(
-      '#type' => 'textfield',
-      '#title' => t('Program Version'),
-      '#required' => TRUE,
-      '#default_value' => $node->programversion,
-      '#weight' => 3
-   );
-   $form['algorithm']= array(
-      '#type' => 'textfield',
-      '#title' => t('Algorithm'),
-      '#required' => FALSE,
-      '#default_value' => $node->algorithm,
-      '#weight' => 4
-   );
-   $form['sourcename']= array(
-      '#type' => 'textfield',
-      '#title' => t('Source Name'),
-      '#required' => FALSE,
-      '#default_value' => $node->sourcename,
-      '#weight' => 5
-   );
-   $form['sourceversion']= array(
-      '#type' => 'textfield',
-      '#title' => t('Source Version'),
-      '#required' => FALSE,
-      '#default_value' => $node->sourceversion,
-      '#weight' => 6
-   );
-   $form['sourceuri']= array(
-      '#type' => 'textfield',
-      '#title' => t('Source URI'),
-      '#required' => FALSE,
-      '#default_value' => $node->sourceuri,
-      '#weight' => 7
-   );
-   // Get time saved in chado
-   $default_time = $node->timeexecuted;
-   $year = preg_replace("/^(\d+)-\d+-\d+ .*/", "$1", $default_time);
-   $month = preg_replace("/^\d+-0?(\d+)-\d+ .*/", "$1", $default_time);
-   $day = preg_replace("/^\d+-\d+-0?(\d+) .*/", "$1", $default_time);
-   // If the time is not set, use current time
-   if (!$default_time) {
-      $default_time = time();
-      $year = format_date($default_time, 'custom', 'Y');
-      $month = format_date($default_time, 'custom', 'n');
-      $day = format_date($default_time, 'custom', 'j');
-   }
-   $form['timeexecuted']= array(
-      '#type' => 'date',
-      '#title' => t('Time Executed'),
-      '#required' => TRUE,
-      '#default_value' => array(
-         'year' => $year,
-         'month' => $month,
-         'day' => $day,
-   ),
-      '#weight' => 8
-   );
-   $form['description']= array(
-      '#type' => 'textarea',
-      '#rows' => 15,
-      '#title' => t('Description and/or Program Settings'),
-      '#required' => FALSE,
-      '#default_value' => $node->description,
-      '#weight' => 9
-   );
+   // set the defaults
+   $kegg = $node->analysis->tripal_analysis_kegg;
+   $hierfile = $kegg->hierfile;
 
 
-   //----KEGG/KAAS Settings (Shown only when Tripal KASS is enabled) ----
    $moreSettings ['kegg'] = 'KEGG Analysis Settings';
    $moreSettings ['kegg'] = 'KEGG Analysis Settings';
    $form['kegg'] = array(
    $form['kegg'] = array(
       '#title' => t('KEGG Settings'),
       '#title' => t('KEGG Settings'),
@@ -280,7 +198,7 @@ function chado_analysis_kegg_form ($node){
       '#description' => t('The full path to the hier.tar.gz file generated by KAAS. 
       '#description' => t('The full path to the hier.tar.gz file generated by KAAS. 
                            Alternatively, you can input the full path to the directory
                            Alternatively, you can input the full path to the directory
                            that contains decompressed kegg files.'),
                            that contains decompressed kegg files.'),
-      '#default_value' => $node->hierfile,
+      '#default_value' => $hierfile,
    );
    );
    $form['kegg']['keggjob'] = array(
    $form['kegg']['keggjob'] = array(
       '#type' => 'checkbox',
       '#type' => 'checkbox',
@@ -289,7 +207,6 @@ function chado_analysis_kegg_form ($node){
                           'exist in chado before parsing the file. Otherwise, KEGG '.
                           'exist in chado before parsing the file. Otherwise, KEGG '.
                           'results that cannot be linked to a feature will be '.
                           'results that cannot be linked to a feature will be '.
                           'discarded.'),
                           'discarded.'),
-      '#default_value' => $node->keggjob,
    );
    );
    return $form;
    return $form;
 }
 }
@@ -297,268 +214,77 @@ function chado_analysis_kegg_form ($node){
  *
  *
  */
  */
 function chado_analysis_kegg_insert($node){
 function chado_analysis_kegg_insert($node){
-   global $user;
-   // Create a timestamp so we can insert it into the chado database
-   $time = $node->timeexecuted;
-   $month = $time['month'];
-   $day = $time['day'];
-   $year = $time['year'];
-   $timestamp = $month.'/'.$day.'/'.$year;
+   // insert the analysis
+   chado_analysis_insert($node);
 
 
-   // If this analysis already exists then don't recreate it in chado
-   $analysis_id = $node->analysis_id;
-   if ($analysis_id) {
-      $sql = "SELECT analysis_id ".
-             "FROM {Analysis} ".
-             "WHERE analysis_id = %d ";
-      $previous_db = tripal_db_set_active('chado');
-      $analysis = db_fetch_object(db_query($sql, $node->analysis_id));
-      tripal_db_set_active($previous_db);
-   }
-
-   // If the analysis doesn't exist then let's create it in chado.
-   if(!$analysis){
-      // First add the item to the chado analysis table
-      $sql = "INSERT INTO {analysis} ".
-             "  (name, description, program, programversion, algorithm, ".
-             "   sourcename, sourceversion, sourceuri, timeexecuted) ".
-             "VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')";
-      $previous_db = tripal_db_set_active('chado');  // use chado database
-      db_query($sql,$node->analysisname, $node->description,
-      $node->program,$node->programversion,$node->algorithm,
-      $node->sourcename, $node->sourceversion, $node->sourceuri,
-      $timestamp);
+   // set the type for this analysis
+   tripal_analysis_insert_property($node->analysis->analysis_id,'analysis_type','tripal_analysis_kegg');
 
 
-      // find the newly entered analysis_id
-      $sql = "SELECT analysis_id ".
-             "FROM {Analysis} ".
-             "WHERE program='%s'".
-             "AND programversion='%s'".
-             "AND sourcename='%s'";
-      $analysis_id = db_result(db_query($sql, $node->program,
-      $node->programversion, $node->sourcename));
-
-      // Get cvterm_id for 'analysis_kegg_settings'
-      $sql = "SELECT CVT.cvterm_id FROM {cvterm} CVT ".
-             "INNER JOIN cv ON cv.cv_id = CVT.cv_id ".
-             "WHERE CVT.name = 'analysis_kegg_settings' ".
-             "AND CV.name = 'tripal'";
-      $type_id = db_result(db_query($sql));
-      
-      // Insert the analysis type into the analysisprop table
-      $sql = "
-         INSERT INTO {analysisprop} (analysis_id, type_id, value) 
-         VALUES (%d, %d, '%s')
-      ";
-      $keggsettings = $node->hierfile;
-      db_query($sql, $analysis_id, $type_id, $keggsettings);
-
-      tripal_db_set_active($previous_db);  // switch back to drupal database
-      // Add a job if the user wants to parse the html output
-      if($node->keggjob) {
-         $job_args[0] = $analysis_id;
-         $job_args[1] = $node->hierfile;
-         $job_args[2] = base_path();
-         if (is_readable($node->hierfile)) {
-         	$fname = preg_replace("/.*\/(.*)/", "$1", $node->hierfile);
-            tripal_add_job("Parse KAAS output: $fname",'tripal_analysis_kegg',
-                           'tripal_analysis_kegg_parseHierFile', $job_args, $user->uid);
-         } else {
-            drupal_set_message("Can not open KAAS hier.tar.gz output file. Job not scheduled.");
-         }
-      }
-   }
+   // now add in the remaining settings as a single property but separated by bars
+   tripal_analysis_insert_property($node->analysis_id,'analysis_kegg_settings',$node->hierfile);
+     
+   // Add a job if the user wants to parse the html output
+   chado_analysis_kegg_submit_job($node);
+}
+/**
+*
+*/
+function chado_analysis_kegg_submit_job($node){
+   global $user;
 
 
-   // Make sure the entry for this analysis doesn't already exist in the
-   // chado_analysis table if it doesn't exist then we want to add it.
-   $node_check_sql = "SELECT * FROM {chado_analysis} ".
-                     "WHERE analysis_id = %d";
-   $node_check = db_fetch_object(db_query($node_check_sql, $analysis_id));
-   if(!$node_check){
-      // next add the item to the drupal table
-      $sql = "INSERT INTO {chado_analysis} (nid, vid, analysis_id) ".
-             "VALUES (%d, %d, %d)";
-      db_query($sql,$node->nid,$node->vid,$analysis_id);
-      // Create a title for the analysis node using the unique keys so when the
-      // node is saved, it will have a title
-      $record = new stdClass();
-      // If the analysis has a name, use it as the node title. If not, construct
-      // the title using program, programversion, and sourcename
-      if ($node->analysisname) {
-         $record->title = $node->analysisname;
+   if($node->keggjob) {
+      $job_args[0] = $analysis_id;
+      $job_args[1] = $node->hierfile;
+      $job_args[2] = base_path();
+      if (is_readable($node->hierfile)) {
+      	$fname = preg_replace("/.*\/(.*)/", "$1", $node->hierfile);
+         tripal_add_job("Parse KAAS output: $fname",'tripal_analysis_kegg',
+                        'tripal_analysis_kegg_parseHierFile', $job_args, $user->uid);
       } else {
       } else {
-         //Construct node title as "program (version)
-         $record->title = "$node->program ($node->programversion)";
+         drupal_set_message("Can not open KAAS hier.tar.gz output file. Job not scheduled.");
       }
       }
-      $record->nid = $node->nid;
-      drupal_write_record('node',$record,'nid');
-      drupal_write_record('node_revisions',$record,'nid');
    }
    }
 }
 }
 /*******************************************************************************
 /*******************************************************************************
  * Delete KEGG anlysis
  * Delete KEGG anlysis
  */
  */
 function chado_analysis_kegg_delete($node){
 function chado_analysis_kegg_delete($node){
-   // Before removing, get analysis_id so we can remove it from chado database
-   // later
-   $sql_drupal = "SELECT analysis_id ".
-                 "FROM {chado_analysis} ".
-                 "WHERE nid = %d ".
-                 "AND vid = %d";
-   $analysis_id = db_result(db_query($sql_drupal, $node->nid, $node->vid));
-
-   // Remove data from the {chado_analysis}, {node}, and {node_revisions} tables
-   $sql_del = "DELETE FROM {chado_analysis} ".
-              "WHERE nid = %d ".
-              "AND vid = %d";
-   db_query($sql_del, $node->nid, $node->vid);
-   $sql_del = "DELETE FROM {node} ".
-              "WHERE nid = %d ".
-              "AND vid = %d";
-   db_query($sql_del, $node->nid, $node->vid);
-   $sql_del = "DELETE FROM {node_revisions} ".
-              "WHERE nid = %d ".
-              "AND vid = %d";
-   db_query($sql_del, $node->nid, $node->vid);
-
-   //Remove from analysisfeatureprop, analysisfeature, analysis, and analysisprop tables
-   $previous_db = tripal_db_set_active('chado');
-   $sql = "SELECT analysisfeature_id FROM {analysisfeature} WHERE analysis_id=%d";
-   $results = db_query($sql, $analysis_id);
-   while ($af = db_fetch_object($results)) {
-      db_query("DELETE FROM {analysisfeatureprop} WHERE analysisfeature_id = %d", $af->analysisfeature_id);
-   }
-   db_query("DELETE FROM {analysisfeature} WHERE analysis_id = %d", $analysis_id);
-   db_query("DELETE FROM {analysisprop} WHERE analysis_id = %d", $analysis_id);
-   db_query("DELETE FROM {analysis} WHERE analysis_id = %d", $analysis_id);
-   tripal_db_set_active($previous_db);
+   chado_analysis_delete($node);
 }
 }
 
 
 /*******************************************************************************
 /*******************************************************************************
  * Update KEGG analysis
  * Update KEGG analysis
  */
  */
 function chado_analysis_kegg_update($node){
 function chado_analysis_kegg_update($node){
-   global $user;
-   if($node->revision){
-      // TODO -- decide what to do about revisions
-   } else {
-      // Create a timestamp so we can insert it into the chado database
-      $time = $node->timeexecuted;
-      $month = $time['month'];
-      $day = $time['day'];
-      $year = $time['year'];
-      $timestamp = $month.'/'.$day.'/'.$year;
+   // insert the analysis
+   chado_analysis_update($node);
 
 
-      // get the analysis_id for this node:
-      $sql = "SELECT analysis_id ".
-             "FROM {chado_analysis} ".
-             "WHERE vid = %d";
-      $analysis_id = db_fetch_object(db_query($sql, $node->vid))->analysis_id;
-
-      $sql = "UPDATE {analysis} ".
-             "SET name = '%s', ".
-             "    description = '%s', ".
-             "    program = '%s', ".
-             "    programversion = '%s', ".
-             "    algorithm = '%s', ".
-             "    sourcename = '%s', ".
-             "    sourceversion = '%s', ".
-             "    sourceuri = '%s', ".
-             "    timeexecuted = '%s' ".
-             "WHERE analysis_id = %d ";
-
-      $previous_db = tripal_db_set_active('chado');  // use chado database
-      db_query($sql, $node->analysisname, $node->description, $node->program,
-      $node->programversion,$node->algorithm,$node->sourcename,
-      $node->sourceversion, $node->sourceuri, $timestamp, $analysis_id);
-
-      // Get cvterm_id for 'analysis_kegg_settings'
-      $sql = "SELECT CVT.cvterm_id FROM {cvterm} CVT ".
-             "INNER JOIN cv CV ON CV.cv_id = CVT.cv_id ".
-             "WHERE CVT.name = 'analysis_kegg_settings' ".
-             "AND CV.name = 'tripal'";
-      $type_id = db_result(db_query($sql));
-       
-      $sql = "UPDATE {analysisprop} ".
-             "SET value = '%s' ".
-             "WHERE analysis_id = %d AND type_id = %d";
-      $keggsettings = $node->hierfile;
-      db_query($sql, $keggsettings, $analysis_id, $type_id);
-
-      tripal_db_set_active($previous_db);  // switch back to drupal database
-      // Add a job if the user wants to parse the html output
-      if($node->keggjob) {
-         $job_args[0] = $analysis_id;
-         $job_args[1] = $node->hierfile;
-         $job_args[2] = base_path();
-         if (is_readable($node->hierfile)) {
-         	$fname = preg_replace("/.*\/(.*)/", "$1", $node->hierfile);
-            tripal_add_job("Parse KAAS output: $fname",'tripal_analysis_kegg',
-                           'tripal_analysis_kegg_parseHierFile', $job_args, $user->uid);
-         } else {
-            drupal_set_message("Can not open KAAS hier.tar.gz output file. Job not scheduled.");
-         }
-      }
+   // set the type for this analysis
+   tripal_analysis_update_property($node->analysis->analysis_id,'analysis_type','tripal_analysis_kegg',1);
 
 
-      // Create a title for the analysis node using the unique keys so when the
-      // node is saved, it will have a title
-      $record = new stdClass();
-      // If the analysis has a name, use it as the node title. If not, construct
-      // the title using program, programversion, and sourcename
-      if ($node->analysisname) {
-         $record->title = $node->analysisname;
-      } else {
-         //Construct node title as "program (version)
-         $record->title = "$node->program ($node->programversion)";
-      }
-      $record->nid = $node->nid;
-      drupal_write_record('node',$record,'nid');
-      drupal_write_record('node_revisions',$record,'nid');
-   }
+   // now add in the remaining settings as a single property but separated by bars
+   tripal_analysis_update_property($node->analysis_id,'analysis_kegg_settings',$node->hierfile,1);
+     
+   // Add a job if the user wants to parse the html output
+   chado_analysis_kegg_submit_job($node);
 }
 }
 /*******************************************************************************
 /*******************************************************************************
  *  When a node is requested by the user this function is called to allow us
  *  When a node is requested by the user this function is called to allow us
  *  to add auxiliary data to the node object.
  *  to add auxiliary data to the node object.
  */
  */
 function chado_analysis_kegg_load($node){
 function chado_analysis_kegg_load($node){
-   // get the analysis_id for this node:
-   $sql = "SELECT analysis_id FROM {chado_analysis} WHERE vid = %d";
-   $ana_node = db_fetch_object(db_query($sql, $node->vid));
-   $additions = new stdClass();
-   if ($ana_node) {
-      // get analysis information
-      $sql = "SELECT Analysis_id, name AS analysisname, description, program, ".
-             "  programversion, algorithm, sourcename, sourceversion, ".
-             "  sourceuri, timeexecuted ".
-             "FROM {Analysis} ".
-             "WHERE Analysis_id = $ana_node->analysis_id";
-      $previous_db = tripal_db_set_active('chado');  // use chado database
-      $additions = db_fetch_object(db_query($sql));
 
 
-      // get cvterm_id for 'analysis_kegg_settings'
-      $sql = "SELECT CVT.cvterm_id FROM {cvterm} CVT ".
-             "INNER JOIN cv ON cv.cv_id = CVT.cv_id ".
-             "WHERE CVT.name = 'analysis_kegg_settings' ".
-             "AND CV.name = 'tripal'";
-      $type_id = db_result(db_query($sql));
-      // get analysisprop information
-      $sql = "SELECT value FROM {analysisprop} ".
-             "WHERE analysis_id = %d ".
-             "AND type_id = %d";
-      $analysisprop = db_result(db_query($sql, $ana_node->analysis_id, $type_id));
-      
-      $additions->hierfile = $analysisprop;
+   // load the default set of analysis fields
+	$additions = chado_analysis_load($node);
+
+   // create some variables for easier lookup
+   $analysis = $additions->analysis;
+   $analysis_id = $analysis->analysis_id;
+
+   // get the heirfile name
+   $hierfile  = tripal_analysis_get_property($analysis_id,'analysis_kegg_settings');	
+   $analysis->tripal_analysis_kegg->hierfile = $hierfile->value;
 
 
-      tripal_db_set_active($previous_db);  // now use drupal database
-   }
-   // If the analysis has a name, use it as the node title. If not, construct
-   // the title using program programversion, and sourcename
-   if ($additions->analysisname) {
-      $additions->title = $additions->analysisname;
-   } else {
-      // Construct node title as "program version (source)
-      $additions->title = "$additions->program ($additions->programversion)";
-   }
    return $additions;
    return $additions;
 }
 }
 
 
@@ -864,8 +590,27 @@ function tripal_analysis_kegg_theme () {
          'arguments' => array('node'=> null),
          'arguments' => array('node'=> null),
          'template' => 'tripal_organism_kegg_summary',
          'template' => 'tripal_organism_kegg_summary',
       ),
       ),
+      'tripal_analysis_kegg_report' => array (
+         'arguments' => array('node'=> null),
+         'template' => 'tripal_analysis_kegg_report',
+      ),
    );
    );
 }
 }
+/**
+ *  
+ *
+ * @ingroup tripal_analysis_kegg
+ */
+function tripal_analysis_kegg_preprocess(&$variables){
+
+   // if the template file is the default node template file then we want
+   // to add all of our variables.
+   if($variables['template_files'][0] == 'node-chado_analysis_kegg'){
+      $analysis = $variables['node']->analysis;
+      $report = tripal_analysis_kegg_full_report($analysis->analysis_id);
+      $analysis->tripal_analysis_kegg->kegg_report = $report;
+   }
+}
 /*******************************************************************************
 /*******************************************************************************
  *  
  *  
  */
  */

+ 2 - 13
tripal_analysis_unigene/tripal_analysis_unigene.module

@@ -66,7 +66,8 @@ function chado_analysis_unigene_access($op, $node, $account){
 */
 */
 function chado_analysis_unigene_form ($node){
 function chado_analysis_unigene_form ($node){
 
 
-	$form = array();
+   // add in the default fields
+   $form = chado_analysis_form($node);
 
 
    $unigene = $node->analysis->tripal_analysis_unigene;
    $unigene = $node->analysis->tripal_analysis_unigene;
    $unigene_name = $unigene->unigene_name;
    $unigene_name = $unigene->unigene_name;
@@ -114,15 +115,6 @@ function chado_analysis_unigene_form ($node){
       '#description' => t('Provide the number of singlets remaining in the assembly'),
       '#description' => t('Provide the number of singlets remaining in the assembly'),
       '#default_value' => $num_singlets,
       '#default_value' => $num_singlets,
 	);
 	);
-
-
-
-   // add in the analysis fields
-   $analysis_form_elements = chado_analysis_form($node);
-   foreach ($analysis_form_elements as $key => $element){
-      $form[$key] = $element;
-   }
-   return $form;
 }
 }
 /**
 /**
 *
 *
@@ -155,9 +147,6 @@ function chado_analysis_unigene_update($node){
 *
 *
 */
 */
 function chado_analysis_unigene_delete($node){
 function chado_analysis_unigene_delete($node){
-  // delete the unigene name as a property of the anslysis
-//  tripal_analysis_delete_property($node->analysis_id,'analysis_unigene_name',$node->unigene_name);	
-
   chado_analysis_delete($node);
   chado_analysis_delete($node);
 }
 }
 /**
 /**

+ 9 - 19
tripal_organism/tripal_organism.module

@@ -117,26 +117,16 @@ function tripal_organism_menu() {
  *  perform actions on data managed by this module
  *  perform actions on data managed by this module
  */
  */
 function chado_organism_access($op, $node, $account){
 function chado_organism_access($op, $node, $account){
-  if ($op == 'create') {
-      return user_access('create chado_organism content', $account);
+   switch ($op){
+      case 'create': 
+        return user_access('create chado_organism content', $account);
+      case 'update':
+        return user_access('edit chado_organism content', $account);
+      case 'delete':
+        return user_access('delete chado_organism content', $account);
+      case 'view' :
+        return user_access('access chado_organism content', $account);
    }
    }
-
-   if ($op == 'update') {
-      if (user_access('edit chado_organism content', $account)) {
-         return TRUE;
-      }
-   }
-   if ($op == 'delete') {
-      if (user_access('delete chado_organism content', $account)) {
-         return TRUE;
-      }
-   }
-   if ($op == 'view') {
-      if (user_access('access chado_organism content', $account)) {
-         return TRUE;
-      }
-   }
-   return FALSE;
 }
 }
 /*******************************************************************************
 /*******************************************************************************
 *  Set the permission types that the chado module uses.  Essentially we
 *  Set the permission types that the chado module uses.  Essentially we