node-chado_feature.tpl.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. // Purpose: This template provides the layout of the feature 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. $feature = $variables['node']->feature;
  28. //dpm($feature);
  29. ?>
  30. <?php if ($teaser) {
  31. include('tripal_feature/tripal_feature_teaser.tpl.php');
  32. } else { ?>
  33. <script type="text/javascript">
  34. if (Drupal.jsEnabled) {
  35. Drupal.behaviors.organismBehavior = function (context){
  36. // hide all tripal info boxes at the start
  37. $(".tripal-info-box").hide();
  38. // iterate through all of the info boxes and add their titles
  39. // to the table of contents
  40. $(".tripal-info-box-title").each(function(){
  41. var parent = $(this).parent();
  42. var id = $(parent).attr('id');
  43. var title = $(this).text();
  44. $('#tripal_feature_toc_list').append('<li><a href="#'+id+'" class="tripal_feature_toc_item">'+title+'</a></li>');
  45. });
  46. // when a title in the table of contents is clicked, then
  47. // show the corresponding item in the details box
  48. $(".tripal_feature_toc_item").click(function(){
  49. $(".tripal-info-box").hide();
  50. href = $(this).attr('href');
  51. $(href).fadeIn('slow');
  52. // we want to make sure our table of contents and the details
  53. // box stay the same height
  54. $("#tripal_feature_toc").height($(href).parent().height());
  55. return false;
  56. });
  57. // we want the base details to show up when the page is first shown
  58. // unless the user specified a specific block
  59. var block = window.location.href.match(/[\?|\&]block=(.+?)\&/)
  60. if(block == null){
  61. block = window.location.href.match(/[\?|\&]block=(.+)/)
  62. }
  63. if(block != null){
  64. $("#tripal_feature-"+block[1]+"-box").show();
  65. } else {
  66. $("#tripal_feature-base-box").show();
  67. }
  68. $("#tripal_organism_toc").height($("#tripal_feature-base-box").parent().height());
  69. };
  70. }
  71. </script>
  72. <div id="tripal_feature_details" class="tripal_details">
  73. <!-- Basic Details Theme -->
  74. <?php include('tripal_feature/tripal_feature_base.tpl.php'); ?>
  75. <!-- Database References -->
  76. <?php include('tripal_feature/tripal_feature_references.tpl.php'); ?>
  77. <!-- Properties -->
  78. <?php include('tripal_feature/tripal_feature_properties.tpl.php'); ?>
  79. <!-- Synonyms -->
  80. <?php include('tripal_feature/tripal_feature_synonyms.tpl.php'); ?>
  81. <!-- Sequence -->
  82. <?php
  83. if(strcmp($feature->type_id->name,'scaffold')!=0 and
  84. strcmp($feature->type_id->name,'chromosome')!=0 and
  85. strcmp($feature->type_id->name,'supercontig')!=0 and
  86. strcmp($feature->type_id->name,'pseudomolecule')!=0)
  87. {
  88. include('tripal_feature/tripal_feature_sequence.tpl.php');
  89. }
  90. ?>
  91. <!-- Formatted Sequences -->
  92. <?php include('tripal_feature/tripal_feature_featureloc_sequences.tpl.php'); ?>
  93. <!-- Relationships -->
  94. <?php include('tripal_feature/tripal_feature_relationships.tpl.php'); ?>
  95. <!-- Feature locations -->
  96. <?php
  97. if(strcmp($feature->type_id->name,'scaffold')!=0 and
  98. strcmp($feature->type_id->name,'chromosome')!=0 and
  99. strcmp($feature->type_id->name,'supercontig')!=0 and
  100. strcmp($feature->type_id->name,'pseudomolecule')!=0)
  101. {
  102. include('tripal_feature/tripal_feature_featurelocs.tpl.php');
  103. }
  104. ?>
  105. <?php print $content ?>
  106. </div>
  107. <!-- Table of contents -->
  108. <div id="tripal_feature_toc" class="tripal_toc">
  109. <div id="tripal_feature_toc_title" class="tripal_toc_title">Resources</div>
  110. <ul id="tripal_feature_toc_list" class="tripal_toc_list">
  111. </ul>
  112. </div>
  113. <?php } ?>