node--chado-generic.tpl.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. if($teaser) {
  3. print render($content);
  4. }
  5. else {
  6. $node_type = $node->type; ?>
  7. <script type="text/javascript">
  8. // we do not use Drupal Behaviors because we do not want this
  9. // code to be executed on AJAX callbacks. This code only needs to
  10. // be executed once the page is ready.
  11. jQuery(document).ready(function($){
  12. // hide all but the first data block
  13. $(".tripal-data-block").hide().filter(":first-child").show();
  14. // when a title in the table of contents is clicked, then
  15. // show the corresponding item in the details box
  16. $(".tripal_toc_list_item_link").click(function(){
  17. var id = $(this).attr('id') + "-tripal-data-block";
  18. $(".tripal-data-block").hide().filter("#"+ id).fadeIn('fast');
  19. return false;
  20. });
  21. // if a ?block= is specified in the URL then we want to show the
  22. // requested block
  23. var block = window.location.href.match(/[\?|\&]block=(.+?)[\&|\#]/)
  24. if(block == null){
  25. block = window.location.href.match(/[\?|\&]block=(.+)/)
  26. }
  27. if(block != null){
  28. $(".tripal-data-block").hide().filter("#" + block[1] + "-tripal-data-block").show();
  29. }
  30. // remove the 'active' class from the links section, as it doesn't
  31. // make sense for this layout
  32. $("a.active").removeClass('active');
  33. });
  34. </script>
  35. <div id="tripal_<?php print $node_type?>_contents" class="tripal-contents">
  36. <table id ="tripal-<?php print $node_type?>-contents-table" class="tripal-contents-table">
  37. <tr class="tripal-contents-table-tr">
  38. <td nowrap class="tripal-contents-table-td tripal-contents-table-td-toc" align="left"><?php
  39. // print the table of contents. It's found in the content array
  40. if (array_key_exists('tripal_toc', $content)) {
  41. print $content['tripal_toc']['#markup'];
  42. // we may want to add the links portion of the contents to the sidebar
  43. //print render($content['links']);
  44. // remove the table of contents and links so thye doent show up in the
  45. // data section when the rest of the $content array is rendered
  46. unset($content['tripal_toc']);
  47. unset($content['links']);
  48. } ?>
  49. </td>
  50. <td class="tripal-contents-table-td-data" align="left" width="100%"> <?php
  51. // print the rendered content
  52. print render($content); ?>
  53. </td>
  54. </tr>
  55. </table>
  56. </div> <?php
  57. }