Happy New Year
[squirrelmail.git] / templates / default_advanced / page_header.tpl
index 7f30409e337edec96cdb6eb76f77c365bc5fd677..0715aaf78ed9df58f03b614546c17d6993415cac 100644 (file)
@@ -5,9 +5,9 @@
  *
  * Template to create the header for each page.
  *
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright 1999-2018 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,24 +51,42 @@ $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 or compose view */
-   global $data_dir, $username, $PHP_SELF, $pp_skip_menubar;
+   /** if preview pane turned on, do not show menubar above message */
+   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
+// hidden... which would require some javascript to detect the current frame name
+// 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 = (defined('PAGE_NAME') && 'PAGE_NAME' == 'compose');
+//+   if (!$pp_skip_menubar 
+//+    && ((!$current_page_is_read_body && !$current_page_is_compose) 
+//+        || !$show_preview_pane)) {
 
 ?>
 <div id="page_header">
@@ -85,31 +103,128 @@ $help_link                = makeInternalLink ('src/help.php', $help_str);
   </td>
  </tr>
  <tr>
-  <td class="sqm_topNavigation"<?php echo ($hide_sm_attributions ? ' colspan="2"' : ''); ?>>
+  <td class="sqm_topNavigation">
    <?php echo $compose_link; ?>&nbsp;&nbsp;
    <?php echo $address_link; ?>&nbsp;&nbsp;
    <?php echo $folders_link; ?>&nbsp;&nbsp;
    <?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 
+        if (!empty($plugin_output['provider_link_before'])) 
+            echo $plugin_output['provider_link_before'];
+        if (!empty($provider_link)) 
+            echo $provider_link; 
+        if (!empty($plugin_output['provider_link_after'])) 
+            echo $plugin_output['provider_link_after'];
+    ?>
   </td>
-  <?php if (!empty($sm_attribute_str))
-            echo '<td class="sqm_providerInfo">'
-               . $sm_attribute_str
-               . "</td>\n"; ?>
  </tr>
 </table>
 </div>
 <br />
 <!-- End Header Navigation Table -->
-<script type="text/javascript">
+<?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 }