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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 pane
  13. $(".tripal-data-pane").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-pane";
  18. $(".tripal-data-pane").hide().filter("#" + id).fadeIn('fast');
  19. return false;
  20. });
  21. // If a ?pane= is specified in the URL then we want to show the
  22. // requested content pane. For previous version of Tripal,
  23. // ?block=, was used. We support it here for backwards
  24. // compatibility
  25. var pane;
  26. pane = window.location.href.match(/[\?|\&]pane=(.+?)[\&|\#]/)
  27. if (pane == null) {
  28. pane = window.location.href.match(/[\?|\&]pane=(.+)/)
  29. }
  30. // if we don't have a pane then try the old style ?block=
  31. if (pane == null) {
  32. pane = window.location.href.match(/[\?|\&]block=(.+?)[\&|\#]/)
  33. if (pane == null) {
  34. pane = window.location.href.match(/[\?|\&]block=(.+)/)
  35. }
  36. }
  37. if (pane != null) {
  38. $(".tripal-data-pane").hide().filter("#" + pane[1] + "-tripal-data-pane").show();
  39. }
  40. // Remove the 'active' class from the links section, as it doesn't
  41. // make sense for this layout
  42. $("a.active").removeClass('active');
  43. });
  44. </script>
  45. <div id="tripal_<?php print $node_type ?>_contents" class="tripal-contents">
  46. <table id="tripal-<?php print $node_type ?>-contents-table"
  47. class="tripal-contents-table">
  48. <tr class="tripal-contents-table-tr">
  49. <td nowrap
  50. class="tripal-contents-table-td tripal-contents-table-td-toc"
  51. align="left"><?php
  52. // print the table of contents. It's found in the content array
  53. if (array_key_exists('tripal_toc', $content)) {
  54. print $content['tripal_toc']['#markup'];
  55. // we may want to add the links portion of the contents to the sidebar
  56. //print render($content['links']);
  57. // remove the table of contents and links so thye doent show up in the
  58. // data section when the rest of the $content array is rendered
  59. unset($content['tripal_toc']);
  60. unset($content['links']);
  61. } ?>
  62. </td>
  63. <td class="tripal-contents-table-td-data" align="left"
  64. width="100%"> <?php
  65. // print the rendered content
  66. print render($content); ?>
  67. </td>
  68. </tr>
  69. </table>
  70. </div> <?php
  71. }