node-chado_stock.tpl.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. // Copyright 2010 University of Saskatchewan (Lacey-Anne Sanderson)
  3. //
  4. // Purpose: This template provides the layout of the stock node (page)
  5. // using the same templates used for the various stock content blocks.
  6. //
  7. // To Customize the Stock Node Page:
  8. // - This Template: customize basic layout and which elements are included
  9. // - Using Panels: Override the node page using Panels3 and place the blocks
  10. // of content as you please. This method requires no programming. See
  11. // the Tripal User Guide for more details
  12. // - Block Templates: customize the content/layout of each block of stock
  13. // content. These templates are found in the tripal_stock subdirectory
  14. //
  15. // Variables Available:
  16. // - $node: a standard object which contains all the fields associated with
  17. // nodes including nid, type, title, taxonomy. It also includes stock
  18. // specific fields such as stock_name, uniquename, stock_type, synonyms,
  19. // properties, db_references, object_relationships, subject_relationships,
  20. // organism, etc.
  21. // NOTE: For a full listing of fields available in the node object the
  22. // print_r $node line below or install the Drupal Devel module which
  23. // provides an extra tab at the top of the node page labelled Devel
  24. ?>
  25. <?php
  26. //uncomment this line to see a full listing of the fields avail. to $node
  27. //print '<pre>'.print_r($node,TRUE).'</pre>';
  28. drupal_add_css('./tripal-node-templates.css');
  29. ?>
  30. <?php if ($teaser) {
  31. include('tripal_stock/tripal_stock_teaser.tpl.php');
  32. } else { ?>
  33. <script type="text/javascript">
  34. if (Drupal.jsEnabled) {
  35. $(document).ready(function() {
  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_stock_toc_list').append('<li><a href="#'+id+'" class="tripal_stock_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_stock_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_stock_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_title = block.toString().replace(/\?block=/g,'');
  62. $("#tripal_stock-"+block_title+"-box").show();
  63. } else {
  64. $("#tripal_stock-base-box").show();
  65. }
  66. $("#tripal_stock_toc").height($("#tripal_stock-base-box").parent().height());
  67. });
  68. }
  69. </script>
  70. <style type="text/css">
  71. /* these styles are specific for this template and is not included
  72. in the main CSS files for the theme as it is anticipated that the
  73. elements on this page may not be used for other customizations */
  74. #tripal_stock_toc {
  75. float: left;
  76. width: 20%;
  77. background-color: #EEEEEE;
  78. -moz-border-radius: 15px;
  79. border-radius: 15px;
  80. -moz-box-shadow: 3px 3px 4px #888888;
  81. -webkit-box-shadow: 3px 3px 4px #888888;
  82. box-shadow: 3px 3px 4px #888888;
  83. padding: 20px;
  84. min-height: 500px;
  85. border-style:solid;
  86. border-width:1px;
  87. }
  88. #tripal_stock_toc ul {
  89. margin-left: 0px;
  90. margin-top: 5px;
  91. padding-left: 15px;
  92. }
  93. #tripal_stock_toc_title {
  94. font-size: 1.5em;
  95. }
  96. #tripal_stock_toc_desc {
  97. font-style: italic;
  98. }
  99. #tripal_stock_details {
  100. float: left;
  101. width: 70%;
  102. background-color: #FFFFFF;
  103. -moz-border-radius: 15px;
  104. border-radius: 15px;
  105. -moz-box-shadow: 3px 3px 4px #888888;
  106. -webkit-box-shadow: 3px 3px 4px #888888;
  107. box-shadow: 3px 3px 4px #888888;
  108. padding: 20px;
  109. min-height: 500px;
  110. margin-right: 10px;
  111. border-style:solid;
  112. border-width:1px;
  113. }
  114. #tripal_stock-base-box img {
  115. float: left;
  116. margin-bottom: 10px;
  117. }
  118. #tripal_stock-table-base {
  119. float: left;
  120. width: 400px;
  121. margin-left: 10px;
  122. margin-bottom: 10px;
  123. }
  124. </style>
  125. <div id="tripal_stock_details" class="tripal_details">
  126. <!-- Base Theme -->
  127. <?php include('tripal_stock/tripal_stock_base.tpl.php'); ?>
  128. <!-- Database References -->
  129. <?php include('tripal_stock/tripal_stock_references.tpl.php'); ?>
  130. <!-- Properties -->
  131. <?php include('tripal_stock/tripal_stock_properties.tpl.php'); ?>
  132. <!-- Synonyms -->
  133. <?php include('tripal_stock/tripal_stock_synonyms.tpl.php'); ?>
  134. <!-- Object Relationships -->
  135. <?php include('tripal_stock/tripal_stock_relationships_as_object.tpl.php'); ?>
  136. <!-- Subject Relationships -->
  137. <?php include('tripal_stock/tripal_stock_relationships_as_subject.tpl.php'); ?>
  138. </div>
  139. <!-- Table of contents -->
  140. <div id="tripal_stock_toc" class="tripal_toc">
  141. <div id="tripal_stock_toc_title" class="tripal_toc_title"><?php print $node->stock_name ?></div>
  142. <span id="tripal_stock_toc_desc" class="tripal_toc_desc">Select a link below for more information</span>
  143. <ul id="tripal_stock_toc_list" class="tripal_toc_list">
  144. </ul>
  145. </div>
  146. <?php } ?>