node--chado-feature.tpl.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. $feature = $variables['node']->feature;
  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']['feature']) {
  29. $no_sidebar = 1;
  30. }
  31. $feature_no_sidebar = preg_split('/\n/', $template_settings['tripal_feature_no_sidebar']);
  32. if ($teaser) {
  33. print theme('tripal_feature_teaser', $variables);
  34. }
  35. else { ?>
  36. <script type="text/javascript">
  37. (function ($) {
  38. Drupal.behaviors.featureBehavior = {
  39. attach: function (context, settings){ <?php
  40. if ($no_sidebar or in_array($feature->type_id->name, $feature_no_sidebar)) { ?>
  41. // hide the resource side bar and strech the details section
  42. $(".tripal_toc").hide();
  43. $(".tripal_details").addClass("tripal_details_full");
  44. $(".tripal_details_full").removeClass("tripal_details"); <?php
  45. } else { ?>
  46. // use default resource sidebar
  47. $(".tripal-info-box").hide(); <?php
  48. } ?>
  49. // iterate through all of the info boxes and add their titles
  50. // to the table of contents
  51. $(".tripal-info-box-title").each(function(){
  52. var parent = $(this).parent();
  53. var id = $(parent).attr('id');
  54. var title = $(this).text();
  55. $('#tripal_feature_toc_list').append('<li><a href="#'+id+'" class="tripal_feature_toc_item">'+title+'</a></li>');
  56. });
  57. // when a title in the table of contents is clicked, then
  58. // show the corresponding item in the details box
  59. $(".tripal_feature_toc_item").click(function(){
  60. $(".tripal-info-box").hide();
  61. href = $(this).attr('href');
  62. $(href).fadeIn('slow');
  63. // we want to make sure our table of contents and the details
  64. // box stay the same height
  65. $("#tripal_feature_toc").height($(href).parent().height());
  66. return false;
  67. });
  68. // we want the base details to show up when the page is first shown
  69. // unless the user specified a specific block
  70. var block = window.location.href.match(/[\?|\&]block=(.+?)\&/)
  71. if(block == null){
  72. block = window.location.href.match(/[\?|\&]block=(.+)/)
  73. }
  74. if(block != null){
  75. $("#tripal_feature-"+block[1]+"-box").show();
  76. } else {
  77. $("#tripal_feature-base-box").show();
  78. }
  79. $("#tripal_organism_toc").height($("#tripal_feature-base-box").parent().height());
  80. }
  81. };
  82. })(jQuery);
  83. </script>
  84. <div id="tripal_feature_details" class="tripal_details">
  85. <!-- Basic Details Theme -->
  86. <?php print theme('tripal_feature_base',$node); ?>
  87. <!-- Database References -->
  88. <?php print theme('tripal_feature_references', $node); ?>
  89. <!-- Properties -->
  90. <?php print theme('tripal_feature_properties', $node); ?>
  91. <!-- Annotated Terms -->
  92. <?php print theme('tripal_feature_terms', $node); ?>
  93. <!-- Synonyms -->
  94. <?php print theme('tripal_feature_synonyms', $node); ?>
  95. <!-- Phenotypes -->
  96. <?php print theme('tripal_feature_phenotypes', $node); ?>
  97. <!-- Maps -->
  98. <?php print theme('tripal_feature_featurepos', $node); ?>
  99. <!-- Sequence --> <?php
  100. if(strcmp($feature->type_id->name,'scaffold')!=0 and
  101. strcmp($feature->type_id->name,'chromosome')!=0 and
  102. strcmp($feature->type_id->name,'supercontig')!=0 and
  103. strcmp($feature->type_id->name,'pseudomolecule')!=0)
  104. {
  105. print theme('tripal_feature_sequence', $node);
  106. } ?>
  107. <!-- Formatted Sequences -->
  108. <?php print theme('tripal_feature_featureloc_sequences', $node); ?>
  109. <!-- Relationships -->
  110. <?php print theme('tripal_feature_relationships', $node); ?>
  111. <!-- Feature locations --> <?php
  112. if(strcmp($feature->type_id->name,'scaffold')!=0 and
  113. strcmp($feature->type_id->name,'chromosome')!=0 and
  114. strcmp($feature->type_id->name,'supercontig')!=0 and
  115. strcmp($feature->type_id->name,'pseudomolecule')!=0)
  116. {
  117. print theme('tripal_feature_alignments', $node);
  118. } ?>
  119. <!-- Resource Blocks CCK elements --><?php
  120. for($i = 0; $i < count($node->field_resource_titles); $i++){
  121. if($node->field_resource_titles[$i]['value']){ ?>
  122. <div id="tripal_feature-resource_<?php print $i?>-box" class="tripal_feature-info-box tripal-info-box">
  123. <div class="tripal_feature-info-box-title tripal-info-box-title"><?php print $node->field_resource_titles[$i]['value'] ?></div>
  124. <?php print $node->field_resource_blocks[$i]['value']; ?>
  125. </div><?php
  126. }
  127. }?>
  128. <!-- Let modules add more content -->
  129. <?php print $content ?>
  130. </div>
  131. <!-- Table of contents -->
  132. <div id="tripal_feature_toc" class="tripal_toc">
  133. <div id="tripal_feature_toc_title" class="tripal_toc_title">Resources</div>
  134. <ul id="tripal_feature_toc_list" class="tripal_toc_list">
  135. <!-- Resource Links CCK elements --><?php
  136. for($i = 0; $i < count($node->field_resource_links); $i++){
  137. if($node->field_resource_links[$i]['value']){
  138. $matches = preg_split("/\|/",$node->field_resource_links[$i]['value']);?>
  139. <li><a href="<?php print $matches[1] ?>" target="_blank"><?php print $matches[0] ?></a></li><?php
  140. }
  141. }?>
  142. <?php // ADD CUSTOMIZED <li> LINKS HERE ?>
  143. </ul>
  144. </div>
  145. <?php } ?>