page_header.tpl 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?php
  2. /**
  3. * page_header.tpl
  4. *
  5. * Template to create the header for each page.
  6. *
  7. * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  8. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  9. * @version $Id: page_header.tpl 12135 2007-01-15 08:27:10Z pdontthink $
  10. * @package squirrelmail
  11. * @subpackage templates
  12. */
  13. /* retrieve the template vars */
  14. extract($t);
  15. $current_folder_str = '';
  16. if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
  17. $current_folder_str .= _("Current Folder") . ": <em>$shortBoxName&nbsp;</em>\n";
  18. } else {
  19. $current_folder_str .= '&nbsp;';
  20. }
  21. // Define our default link text.
  22. $signout_link_default = _("Sign Out");
  23. $compose_link_default = _("Compose");
  24. $address_link_default = _("Addresses");
  25. $folders_link_default = _("Folders");
  26. $options_link_default = _("Options");
  27. $search_link_default = _("Search");
  28. $help_link_default = _("Help");
  29. /*
  30. * Create strings to use for links. If tempalte authors
  31. * wish to use images instead, they may change the values
  32. * below to img tags.
  33. * Example w/ image:
  34. * $compose_str = '<img src="compose.png" border="0" ' .
  35. * 'alt="'.$compose_link_default.'" ' .
  36. * 'title="'.$compose_link_default.'" />';
  37. */
  38. $signout_str = $signout_link_default;
  39. $compose_str = $compose_link_default;
  40. $address_str = $address_link_default;
  41. $folders_str = $folders_link_default;
  42. $options_str = $options_link_default;
  43. $search_str = $search_link_default;
  44. $help_str = $help_link_default;
  45. $compose_link = makeComposeLink ('src/compose.php?mailbox='.$urlMailbox.'&amp;startMessage='.$startMessage, $compose_str);
  46. $signout_link = makeInternalLink ('src/signout.php', $signout_str, $frame_top);
  47. $address_link = makeInternalLink ('src/addressbook.php', $address_str);
  48. $folders_link = makeInternalLink ('src/folders.php', $folders_str);
  49. $search_link = makeInternalLink ('src/search.php?mailbox='.$urlMailbox, $search_str);
  50. $options_link = makeInternalLink ('src/options.php', $options_str);
  51. $help_link = makeInternalLink ('src/help.php', $help_str);
  52. ?>
  53. <body <?php echo $body_tag_js; ?>>
  54. <?php
  55. /** if preview pane turned on, do not show menubar above message */
  56. global $data_dir, $username, $pp_skip_menubar;
  57. $use_previewPane = getPref($data_dir, $username, 'use_previewPane', 0);
  58. $show_preview_pane = checkForJavascript() && $use_previewPane;
  59. $current_page_is_read_body = (defined('PAGE_NAME') && 'PAGE_NAME' == 'read_body');
  60. if (!$pp_skip_menubar && (!$current_page_is_read_body || !$show_preview_pane)) {
  61. // Note: If we want to hide menubar on compose screen, we could do the following,
  62. // but the compose screen when in the message list frame should not have the menubar
  63. // hidden... which would require some javascript to detect the current frame name
  64. // and then use document.write() to output the menubar if needed... and we'll
  65. // leave that for some other time
  66. //- if (!$pp_skip_menubar && (!$current_page_is_read_body || !$show_preview_pane)) {
  67. //+ $current_page_is_compose = (defined('PAGE_NAME') && 'PAGE_NAME' == 'compose');
  68. //+ if (!$pp_skip_menubar
  69. //+ && ((!$current_page_is_read_body && !$current_page_is_compose)
  70. //+ || !$show_preview_pane)) {
  71. ?>
  72. <div id="page_header">
  73. <a name="pagetop"></a>
  74. <?php if (!empty($plugin_output['page_header_top'])) echo $plugin_output['page_header_top']; ?>
  75. <!-- Begin Header Navigation Table -->
  76. <table class="table_empty" cellspacing="0">
  77. <tr>
  78. <td class="sqm_currentFolder">
  79. <?php echo $current_folder_str; ?>
  80. </td>
  81. <td class="sqm_headerSignout">
  82. <?php echo $signout_link; ?>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td class="sqm_topNavigation">
  87. <?php echo $compose_link; ?>&nbsp;&nbsp;
  88. <?php echo $address_link; ?>&nbsp;&nbsp;
  89. <?php echo $folders_link; ?>&nbsp;&nbsp;
  90. <?php echo $options_link; ?>&nbsp;&nbsp;
  91. <?php echo $search_link; ?>&nbsp;&nbsp;
  92. <?php echo $help_link; ?>&nbsp;&nbsp;
  93. <?php if (!empty($plugin_output['menuline'])) echo $plugin_output['menuline']; ?>
  94. </td>
  95. <td class="sqm_providerInfo">
  96. <?php
  97. if (!empty($plugin_output['provider_link_before']))
  98. echo $plugin_output['provider_link_before'];
  99. if (!empty($provider_link))
  100. echo $provider_link;
  101. if (!empty($plugin_output['provider_link_after']))
  102. echo $plugin_output['provider_link_after'];
  103. ?>
  104. </td>
  105. </tr>
  106. </table>
  107. </div>
  108. <br />
  109. <!-- End Header Navigation Table -->
  110. <?php
  111. }
  112. // now, some generic javascript for use with preview pane
  113. ?>
  114. <script type="text/javascript" language="JavaScript">
  115. <!--
  116. var delayed_page_load_uri = '';
  117. function delayed_page_load(page_uri)
  118. { delayed_page_load_uri = page_uri; setTimeout('page_load()', 500); }
  119. function page_load()
  120. { document.location = delayed_page_load_uri; }
  121. function refresh_message_list()
  122. {
  123. <?php if (!empty($message_list_href)) { ?>
  124. if (typeof(parent.right.delayed_page_load) != 'undefined')
  125. parent.right.delayed_page_load("<?php echo $message_list_href; ?>");
  126. <?php } ?>
  127. }
  128. <?php
  129. // autohide the preview pane if desired when not viewing messages,
  130. // also maximize any frame with a compose screen in it
  131. if ($show_preview_pane
  132. && getPref($data_dir, $username, 'previewPane_autohide', 0) == 1)
  133. {
  134. $previewPane_vertical_split = getPref($data_dir, $username, 'previewPane_vertical_split', 0);
  135. if ($previewPane_vertical_split)
  136. $orientation = 'cols';
  137. else
  138. $orientation = 'rows';
  139. // spit out javascript to maximize compose frame
  140. if (defined('PAGE_NAME') && PAGE_NAME=='compose')
  141. {
  142. ?>
  143. var first_frame = 0;
  144. var second_frame = 0;
  145. if (self.name == 'right')
  146. {
  147. first_frame = '100%';
  148. second_frame = '*';
  149. }
  150. else if (self.name == 'bottom')
  151. {
  152. first_frame = '*';
  153. second_frame = '100%';
  154. }
  155. if (first_frame != 0)
  156. {
  157. if (document.all)
  158. {
  159. parent.document.all["fs2"].<?php echo $orientation; ?> = first_frame + ", " + second_frame;
  160. }
  161. else if (this.document.getElementById)
  162. {
  163. parent.document.getElementById("fs2").<?php echo $orientation; ?> = first_frame + ", " + second_frame;
  164. }
  165. }
  166. <?php
  167. // not on the compose screen, either hide or restore preview pane
  168. } else {
  169. $previewPane_size = getPref($data_dir, $username, 'previewPane_size', 300);
  170. if (defined('PAGE_NAME') && (PAGE_NAME=='right_main'||PAGE_NAME=='search')) {
  171. $new_size = $previewPane_size;
  172. } else {
  173. $new_size = 0;
  174. }
  175. ?>
  176. if (self.name == 'right')
  177. {
  178. if (document.all)
  179. {
  180. parent.document.all["fs2"].<?php echo $orientation; ?> = "*, " + <?php echo $new_size; ?>;
  181. }
  182. else if (this.document.getElementById)
  183. {
  184. parent.document.getElementById("fs2").<?php echo $orientation; ?> = "*, " + <?php echo $new_size; ?>;
  185. }
  186. }
  187. // restores the preview pane if it sucked up the whole page for composing a message
  188. else if (self.name == 'bottom')
  189. {
  190. if (document.all)
  191. {
  192. if (parent.document.all["fs2"].<?php echo $orientation; ?> == "*, 100%")
  193. parent.document.all["fs2"].<?php echo $orientation; ?> = "*, " + <?php echo $previewPane_size; ?>;
  194. }
  195. else if (this.document.getElementById)
  196. {
  197. if (parent.document.getElementById("fs2").<?php echo $orientation; ?> == "*, 100%")
  198. parent.document.getElementById("fs2").<?php echo $orientation; ?> = "*, " + <?php echo $previewPane_size; ?>;
  199. }
  200. }
  201. <?php } } ?>
  202. // -->
  203. </script>