node--chado-pub.tpl.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. // Purpose: This template provides the layout of the pub node (page)
  3. // using the same templates used for the various pub content blocks.
  4. //
  5. // To Customize the Libray 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. $pub = $variables['node']->pub;
  23. // get the template settings
  24. $template_settings = theme_get_setting('tripal');
  25. // toggle the sidebar if desired
  26. $no_sidebar = 0;
  27. if (is_array($template_settings['tripal_no_sidebar']) and
  28. $template_settings['tripal_no_sidebar']['pub']) {
  29. $no_sidebar = 1;
  30. }
  31. if ($teaser) {
  32. print theme('tripal_pub_teaser',$node);
  33. }
  34. else { ?>
  35. <script type="text/javascript">
  36. // hide the node title. It is not informative to the viewer
  37. $(".title").hide();
  38. (function ($) {
  39. Drupal.behaviors.pubBehavior = {
  40. attach: function (context, settings){ <?php
  41. if ($no_sidebar) { ?>
  42. // hide the resource side bar and strech the details section
  43. $(".tripal_toc").hide();
  44. $(".tripal_details").addClass("tripal_details_full");
  45. $(".tripal_details_full").removeClass("tripal_details"); <?php
  46. } else { ?>
  47. // use default resource sidebar
  48. $(".tripal-info-box").hide(); <?php
  49. } ?>
  50. // iterate through all of the info boxes and add their titles
  51. // to the table of contents
  52. $(".tripal-info-box-title").each(function(){
  53. var parent = $(this).parent();
  54. var id = $(parent).attr('id');
  55. var title = $(this).text();
  56. $('#tripal_pub_toc_list').append('<li><a href="#'+id+'" class="tripal_pub_toc_item">'+title+'</a></li>');
  57. });
  58. // when a title in the table of contents is clicked, then
  59. // show the corresponding item in the details box
  60. $(".tripal_pub_toc_item").click(function(){
  61. $(".tripal-info-box").hide();
  62. href = $(this).attr('href');
  63. $(href).fadeIn('slow');
  64. // we want to make sure our table of contents and the details
  65. // box stay the same height
  66. $("#tripal_pub_toc").height($(href).parent().height());
  67. return false;
  68. });
  69. // we want the base details to show up when the page is first shown
  70. // unless the user specified a specific block
  71. var block = window.location.href.match(/[\?|\&]block=(.+?)\&/)
  72. if(block == null){
  73. block = window.location.href.match(/[\?|\&]block=(.+)/)
  74. }
  75. if(block != null){
  76. $("#tripal_pub-"+block[1]+"-box").show();
  77. } else {
  78. $("#tripal_pub-base-box").show();
  79. }
  80. $("#tripal_pub_toc").height($("#tripal_pub-base-box").parent().height());
  81. }
  82. };
  83. })(jQuery);
  84. </script>
  85. <div id="tripal_pub_details" class="tripal_details">
  86. <!-- Basic Details Theme -->
  87. <?php print theme('tripal_pub_base', $node); ?>
  88. <!-- Properties Theme -->
  89. <?php print theme('tripal_pub_properties', $node); ?>
  90. <!-- Authors Theme -->
  91. <?php print theme('tripal_pub_authors', $node); ?>
  92. <!-- References Theme -->
  93. <?php print theme('tripal_pub_references', $node); ?>
  94. <!-- Relationships Theme -->
  95. <?php print theme('tripal_pub_relationships', $node); ?>
  96. <!-- FeatureMaps Theme -->
  97. <?php print theme('tripal_pub_featuremaps', $node); ?>
  98. <!-- Features Theme -->
  99. <?php print theme('tripal_pub_features', $node); ?>
  100. <!-- Libraries Theme -->
  101. <?php print theme('tripal_pub_libraries', $node); ?>
  102. <!-- Projects Theme -->
  103. <?php print theme('tripal_pub_projects', $node); ?>
  104. <!-- Stocks Theme -->
  105. <?php print theme('tripal_pub_stocks', $node); ?>
  106. <!-- Resource Blocks CCK elements --><?php
  107. for($i = 0; $i < count($node->field_resource_titles); $i++){
  108. if($node->field_resource_titles[$i]['value']){ ?>
  109. <div id="tripal_pub-resource_<?php print $i?>-box" class="tripal_pub-info-box tripal-info-box">
  110. <div class="tripal_pub-info-box-title tripal-info-box-title"><?php print $node->field_resource_titles[$i]['value'] ?></div>
  111. <?php print $node->field_resource_blocks[$i]['value']; ?>
  112. </div><?php
  113. }
  114. }?>
  115. <!-- Let modules add more content -->
  116. <?php print $content ?>
  117. </div>
  118. <!-- Table of contents -->
  119. <div id="tripal_pub_toc" class="tripal_toc">
  120. <div id="tripal_pub_toc_title" class="tripal_toc_title">Resources</div>
  121. <ul id="tripal_pub_toc_list" class="tripal_toc_list">
  122. <!-- Resource Links CCK elements --><?php
  123. for($i = 0; $i < count($node->field_resource_links); $i++){
  124. if($node->field_resource_links[$i]['value']){
  125. $matches = preg_split("/\|/",$node->field_resource_links[$i]['value']);?>
  126. <li><a href="<?php print $matches[1] ?>" target="_blank"><?php print $matches[0] ?></a></li><?php
  127. }
  128. }?>
  129. <?php // ADD CUSTOMIZED <li> LINKS HERE ?>
  130. </ul>
  131. </div>
  132. <?php } ?>