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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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).show();
  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. }
  30. };
  31. })(jQuery);
  32. </script>
  33. <div id="tripal_<?php print $node_type?>_content" class="tripal-contents">
  34. <table id="tripal-contents-table">
  35. <tr class="tripal-contents-table-tr">
  36. <td nowrap class="tripal-contents-table-td tripal-contents-table-td-toc" align="left"><?php
  37. // print the table of contents. It's found in the content array
  38. print $content['tripal_toc']['#markup'];
  39. // remove the table of contents so it doesn't show up in the
  40. // data section with the $content array is rendered
  41. unset($content['tripal_toc']); ?>
  42. </td>
  43. <td class="tripal-contents-table-td-data" align="left" width="100%"> <?php
  44. // print the rendered content
  45. print render($content); ?>
  46. </td>
  47. </tr>
  48. </table>
  49. </div> <?php
  50. }