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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. if($teaser) {
  3. print render($content);
  4. }
  5. else {
  6. $node_type = $node->type; ?>
  7. <script type="text/javascript">
  8. (function ($) {
  9. Drupal.behaviors.<?php print $node_type?>Behavior = {
  10. attach: function (context, settings){
  11. // hide all but the first data block
  12. $(".tripal-data-block").hide().filter(":first-child").show();
  13. // when a title in the table of contents is clicked, then
  14. // show the corresponding item in the details box
  15. $(".tripal_toc_list_item_link").click(function(){
  16. var id = $(this).attr('id') + "-tripal-data-block";
  17. $(".tripal-data-block").hide().filter("#"+ id).fadeIn('fast');
  18. return false;
  19. });
  20. // if a ?block= is specified in the URL then we want to show the
  21. // requested block
  22. var block = window.location.href.match(/[\?|\&]block=(.+?)\&/)
  23. if(block == null){
  24. block = window.location.href.match(/[\?|\&]block=(.+)/)
  25. }
  26. if(block != null){
  27. $(".tripal-data-block").hide().filter("#" + block[1] + "-tripal-data-block").show();
  28. }
  29. // remove the 'active' class from the links section, as it doesn't
  30. // make sense for this layout
  31. $("a.active").removeClass('active');
  32. }
  33. };
  34. })(jQuery);
  35. </script>
  36. <div id="tripal_<?php print $node_type?>_contents" class="tripal-contents">
  37. <table id ="tripal-<?php print $node_type?>-contents-table" class="tripal-contents-table">
  38. <tr class="tripal-contents-table-tr">
  39. <td nowrap class="tripal-contents-table-td tripal-contents-table-td-toc" align="left"><?php
  40. // print the table of contents. It's found in the content array
  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. </td>
  49. <td class="tripal-contents-table-td-data" align="left" width="100%"> <?php
  50. // print the rendered content
  51. print render($content); ?>
  52. </td>
  53. </tr>
  54. </table>
  55. </div> <?php
  56. }