node-chado_organism.tpl.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. // Purpose: This template provides the layout of the organism node (page)
  3. // using the same templates used for the various feature content blocks.
  4. //
  5. // To Customize the Featture Node Page:
  6. // - This Template: customize basic layout and which elements are included
  7. // - Using Panels: Override the node page using Panels3 and place the blocks
  8. // of content as you please. This method requires no programming. See
  9. // the Tripal User Guide for more details
  10. // - Block Templates: customize the content/layout of each block of stock
  11. // content. These templates are found in the tripal_stock subdirectory
  12. //
  13. // Variables Available:
  14. // - $node: a standard object which contains all the fields associated with
  15. // nodes including nid, type, title, taxonomy. It also includes stock
  16. // specific fields such as stock_name, uniquename, stock_type, synonyms,
  17. // properties, db_references, object_relationships, subject_relationships,
  18. // organism, etc.
  19. // NOTE: For a full listing of fields available in the node object the
  20. // print_r $node line below or install the Drupal Devel module which
  21. // provides an extra tab at the top of the node page labelled Devel
  22. ?>
  23. <?php
  24. //uncomment this line to see a full listing of the fields avail. to $node
  25. //print '<pre>'.print_r($variables,TRUE).'</pre>';
  26. drupal_add_css('./tripal-node-templates.css');
  27. $organism = $variables['node']->organism;
  28. //dpm($organism);
  29. ?>
  30. <?php if ($teaser) {
  31. include('tripal_organism/tripal_organism_teaser.tpl.php');
  32. } else { ?>
  33. <script type="text/javascript">
  34. Drupal.behaviors.organismBehavior = function (context){
  35. // hide all tripal info boxes at the start
  36. $(".tripal-info-box").hide();
  37. // iterate through all of the info boxes and add their titles
  38. // to the table of contents
  39. $(".tripal-info-box-title").each(function(){
  40. var parent = $(this).parent();
  41. var id = $(parent).attr('id');
  42. var title = $(this).text();
  43. $('#tripal_organism_toc_list').append('<li><a href="#'+id+'" class="tripal_organism_toc_item">'+title+'</a></li>');
  44. });
  45. // when a title in the table of contents is clicked, then
  46. // show the corresponding item in the details box
  47. $(".tripal_organism_toc_item").click(function(){
  48. $(".tripal-info-box").hide();
  49. href = $(this).attr('href');
  50. if(href.match(/^#/)){
  51. //alert("correct: " + href);
  52. }
  53. else{
  54. tmp = href.replace(/^.*?#/, "#");
  55. href = tmp;
  56. //alert("fixed: " + href);
  57. }
  58. $(href).fadeIn('slow');
  59. // we want to make sure our table of contents and the details
  60. // box stay the same height
  61. $("#tripal_organism_toc").height($(href).parent().height());
  62. return false;
  63. });
  64. // we want the base details to show up when the page is first shown
  65. // unless we're using the feature browser then we want that page to show
  66. var block = window.location.href.match(/[\?|\&]block=(.+?)\&/)
  67. if(block == null){
  68. block = window.location.href.match(/[\?|\&]block=(.+)/)
  69. }
  70. if(block != null){
  71. $("#tripal_organism-"+block[1]+"-box").show();
  72. }
  73. else if(window.location.href.match(/\?page=\d+/)){
  74. $("#tripal_organism-feature_browser-box").show();
  75. }
  76. else {
  77. $("#tripal_organism-base-box").show();
  78. }
  79. $("#tripal_organism_toc").height($("#tripal_organism-base-box").parent().height());
  80. };
  81. </script>
  82. <div id="tripal_organism_details" class="tripal_details">
  83. <!-- Basic Details Theme -->
  84. <?php include('tripal_organism/tripal_organism_base.tpl.php'); ?>
  85. <?php print $content ?>
  86. </div>
  87. <!-- Table of contents -->
  88. <div id="tripal_organism_toc" class="tripal_toc">
  89. <div id="tripal_organism_toc_title" class="tripal_toc_title">Resources</i></div>
  90. <span id="tripal_organism_toc_desc" class="tripal_toc_desc"></span>
  91. <ul id="tripal_organism_toc_list" class="tripal_toc_list">
  92. <?php // ADD CUSTOMIZED LINKS HERE ?>
  93. </ul>
  94. </div>
  95. <?php } ?>