Happy New Year
[squirrelmail.git] / templates / default_advanced / page_header.tpl
index 90133816f1b9075f304a23ffad70f459eda40940..3fc0f326f29530f062bb9c7a8d92284c082c4fcd 100644 (file)
@@ -5,9 +5,9 @@
  *
  * Template to create the header for each page.
  *
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright 1999-2020 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @version $Id: page_header.tpl 12135 2007-01-15 08:27:10Z pdontthink $
+ * @version $Id$
  * @package squirrelmail
  * @subpackage templates
  */
@@ -51,23 +51,31 @@ $options_str = $options_link_default;
 $search_str = $search_link_default;
 $help_str = $help_link_default;
 
-$compose_link  = makeComposeLink ('src/compose.php?mailbox='.$urlMailbox.'&startMessage='.$startMessage, $compose_str);
-$signout_link  = makeInternalLink ('src/signout.php', $signout_str, $frame_top);
-$address_link  = makeInternalLink ('src/addressbook.php', $address_str);
-$folders_link  = makeInternalLink ('src/folders.php', $folders_str);
-$search_link   = makeInternalLink ('src/search.php?mailbox='.$urlMailbox, $search_str);
-$options_link  = makeInternalLink ('src/options.php', $options_str);
-$help_link             = makeInternalLink ('src/help.php', $help_str);
+$compose_link = makeComposeLink('src/compose.php?mailbox=' . $urlMailbox
+                                . '&startMessage=' . $startMessage,
+                                $compose_str, '', $accesskey_menubar_compose);
+$signout_link = makeInternalLink('src/signout.php', $signout_str, $frame_top,
+                                 $accesskey_menubar_signout);
+$address_link = makeInternalLink('src/addressbook.php', $address_str, '',
+                                 $accesskey_menubar_addresses);
+$folders_link = makeInternalLink('src/folders.php', $folders_str, '',
+                                 $accesskey_menubar_folders);
+$search_link  = makeInternalLink('src/search.php?mailbox='.$urlMailbox . '&what=',
+                                 $search_str, '', $accesskey_menubar_search);
+$options_link = makeInternalLink('src/options.php', $options_str, '',
+                                 $accesskey_menubar_options);
+$help_link    = makeInternalLink('src/help.php', $help_str, '',
+                                 $accesskey_menubar_help);
 
 ?>
-<body <?php echo $body_tag_js; ?>>
+<body <?php if (!empty($onload)) echo ' onload="' . $onload . '"'; ?>>
 <?php
 
    /** if preview pane turned on, do not show menubar above message */
-   global $data_dir, $username, $PHP_SELF, $pp_skip_menubar;
+   global $data_dir, $username, $pp_skip_menubar;
    $use_previewPane = getPref($data_dir, $username, 'use_previewPane', 0);
    $show_preview_pane = checkForJavascript() && $use_previewPane;
-   $current_page_is_read_body = (strpos($PHP_SELF, '/read_body.php') !== FALSE);
+   $current_page_is_read_body = (defined('PAGE_NAME') && 'PAGE_NAME' == 'read_body');
    if (!$pp_skip_menubar && (!$current_page_is_read_body || !$show_preview_pane)) {
 // Note: If we want to hide menubar on compose screen, we could do the following, 
 // but the compose screen when in the message list frame should not have the menubar
@@ -75,7 +83,7 @@ $help_link            = makeInternalLink ('src/help.php', $help_str);
 // and then use document.write() to output the menubar if needed... and we'll
 // leave that for some other time
 //-   if (!$pp_skip_menubar && (!$current_page_is_read_body || !$show_preview_pane)) {
-//+   $current_page_is_compose = (strpos($PHP_SELF, '/compose.php') !== FALSE);
+//+   $current_page_is_compose = (defined('PAGE_NAME') && 'PAGE_NAME' == 'compose');
 //+   if (!$pp_skip_menubar 
 //+    && ((!$current_page_is_read_body && !$current_page_is_compose) 
 //+        || !$show_preview_pane)) {
@@ -102,7 +110,7 @@ $help_link          = makeInternalLink ('src/help.php', $help_str);
    <?php echo $options_link; ?>&nbsp;&nbsp;
    <?php echo $search_link; ?>&nbsp;&nbsp;
    <?php echo $help_link; ?>&nbsp;&nbsp;
-   <?php /* FIXME: no hooks in templates!! */ global $null; do_hook('menuline', $null); ?>
+   <?php if (!empty($plugin_output['menuline'])) echo $plugin_output['menuline']; ?>
   </td>
   <td class="sqm_providerInfo">
     <?php 
@@ -119,13 +127,104 @@ $help_link               = makeInternalLink ('src/help.php', $help_str);
 </div>
 <br />
 <!-- End Header Navigation Table -->
+<?php 
+   } 
+
+   // now, some generic javascript for use with preview pane
+
+?>
 <script type="text/javascript" language="JavaScript">
 <!--
    var delayed_page_load_uri = '';
    function delayed_page_load(page_uri)
-   { page_load_uri = page_uri; setTimeout('page_load()', 500); }
+   { delayed_page_load_uri = page_uri; setTimeout('page_load()', 500); }
    function page_load()
-   { document.location = page_load_uri; }
+   { document.location = delayed_page_load_uri; }
+   function refresh_message_list()
+   {
+<?php if (!empty($message_list_href)) { ?>
+      if (typeof(parent.right.delayed_page_load) != 'undefined')
+         parent.right.delayed_page_load("<?php echo $message_list_href; ?>");
+<?php } ?>
+   }
+<?php 
+
+   // autohide the preview pane if desired when not viewing messages,
+   // also maximize any frame with a compose screen in it
+   if ($show_preview_pane 
+    && getPref($data_dir, $username, 'previewPane_autohide', 0) == 1) 
+   {
+      $previewPane_vertical_split = getPref($data_dir, $username, 'previewPane_vertical_split', 0);
+      if ($previewPane_vertical_split)
+         $orientation = 'cols';
+      else
+         $orientation = 'rows';
+      
+      // spit out javascript to maximize compose frame
+      if (defined('PAGE_NAME') && PAGE_NAME=='compose')
+      {
+?>
+   var first_frame = 0;
+   var second_frame = 0;
+   if (self.name == 'right')
+   {
+      first_frame = '100%';
+      second_frame = '*';
+   }
+   else if (self.name == 'bottom')
+   {
+      first_frame = '*';
+      second_frame = '100%';
+   }
+   if (first_frame != 0)
+   {
+      if (document.all)
+      {
+         parent.document.all["fs2"].<?php echo $orientation; ?> = first_frame + ", " + second_frame;
+      }
+      else if (this.document.getElementById)
+      {
+         parent.document.getElementById("fs2").<?php echo $orientation; ?> = first_frame + ", " + second_frame;
+      }
+   }
+<?php 
+
+    // not on the compose screen, either hide or restore preview pane
+    } else {
+
+        $previewPane_size = getPref($data_dir, $username, 'previewPane_size', 300);
+        if (defined('PAGE_NAME') && (PAGE_NAME=='right_main'||PAGE_NAME=='search')) {
+            $new_size = $previewPane_size;
+        } else {
+            $new_size = 0;
+        }
+?>
+   if (self.name == 'right')
+   {
+      if (document.all)
+      {
+         parent.document.all["fs2"].<?php echo $orientation; ?> = "*, " + <?php echo $new_size; ?>;
+      }
+      else if (this.document.getElementById)
+      {
+         parent.document.getElementById("fs2").<?php echo $orientation; ?> = "*, " + <?php echo $new_size; ?>;
+      }
+   }
+
+   // restores the preview pane if it sucked up the whole page for composing a message
+   else if (self.name == 'bottom')
+   {
+      if (document.all)
+      {
+         if (parent.document.all["fs2"].<?php echo $orientation; ?> == "*, 100%")
+            parent.document.all["fs2"].<?php echo $orientation; ?> = "*, " + <?php echo $previewPane_size; ?>;
+      }
+      else if (this.document.getElementById)
+      {
+         if (parent.document.getElementById("fs2").<?php echo $orientation; ?> == "*, 100%")
+            parent.document.getElementById("fs2").<?php echo $orientation; ?> = "*, " + <?php echo $previewPane_size; ?>;
+      }
+   }
+<?php } } ?>
 // -->
 </script>
-<?php }