X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fpage_header.php;h=a7812b526b77302c2998cbe4c26fbbcf0bd5ad6d;hb=a9a7cda1e186f13501bd2d59a28c0763f16f2f96;hp=127b553305f689a357a8a60d2202f65459d38425;hpb=fcae54451082f393a0cccf4eccc8430c550059b4;p=squirrelmail.git diff --git a/functions/page_header.php b/functions/page_header.php index 127b5533..a7812b52 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -3,11 +3,10 @@ /** * page_header.php * - * Copyright (c) 1999-2005 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * Prints the page header (duh) * + * @copyright © 1999-2005 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail */ @@ -41,7 +40,8 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true } else { echo ''; } - echo "\n\n" . html_tag( 'html' ,'' , '', '', 'lang="'.$squirrelmail_language.'"' ) . "\n\n"; + echo "\n" . html_tag( 'html' ,'' , '', '', 'lang="'.$squirrelmail_language.'"' ) . + "\n\n"; /* * Add closing / to link and meta elements only after switching to xhtml 1.0 Transitional. @@ -56,6 +56,8 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true $base_uri . 'themes/css/'.$custom_css.'">'; } + echo ''; + if ($squirrelmail_language == 'ja_JP') { /* * force correct detection of charset, when browser does not follow @@ -67,12 +69,11 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true echo "\n"; echo '' . "\n"; } - if ($do_hook) { do_hook('generic_header'); } - echo "\n$title$xtra\n"; + echo "$title\n$xtra\n"; /* work around IE6's scrollbar bug */ echo <<' . - "\n\n\n"; - } - - displayHtmlHeader ('SquirrelMail', $js); - $onload = $xtra; - break; - case 'src/compose.php': - $js = '\n"; - $onload = 'onload="checkForm();"'; - displayHtmlHeader ('SquirrelMail', $js); - break; - - default: - $js = '\n"; - - $onload = 'onload="checkForm();"'; - displayHtmlHeader ('SquirrelMail', $js); - break; - + if( $javascript_on || strpos($sHeaderJs, 'new_js_autodetect_results.value') ) { + $sJsBlock = '' ."\n"; + if ($sHeaderJs) { + $sJsBlock .= "\n\n"; } - } else { + displayHtmlHeader ('SquirrelMail', $sJsBlock); + } else { /* do not use JavaScript */ displayHtmlHeader ('SquirrelMail'); - $onload = ''; + $sBodyTagJs = ''; } - echo "\n\n"; + echo "\n\n"; + /** Here is the header and wrapping table **/ $shortBoxName = htmlspecialchars(imap_utf7_decode_local( readShortMailboxName($mailbox, $delimiter))); @@ -345,6 +209,8 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) { : html_tag( 'td', '', 'left' ) ) . "\n"; $urlMailbox = urlencode($mailbox); + $startMessage = (int)$startMessage; + echo makeComposeLink('src/compose.php?mailbox='.$urlMailbox.'&startMessage='.$startMessage); echo "  \n"; displayInternalLink ('src/addressbook.php', _("Addresses")); @@ -365,9 +231,12 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) { if (!$hide_sm_attributions) { echo html_tag( 'td', '', 'right' ) ."\n"; - if (!isset($provider_uri)) $provider_uri= 'http://www.squirrelmail.org/'; - if (!isset($provider_name)) $provider_name= 'SquirrelMail'; - echo ''.$provider_name.''; + if (empty($provider_uri)) { + echo 'SquirrelMail'; + } else { + if (empty($provider_name)) $provider_name= 'SquirrelMail'; + echo ''.$provider_name.''; + } echo "\n"; } echo " \n". @@ -380,75 +249,46 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) { * * @param array color the array of theme colors * @param string mailbox the current mailbox name to display + * @param string sHeaderJs javascipt code to be inserted in a script block in the header + * @param string sBodyTagJs js events to be inserted in the body tag * @return void */ -function compose_Header($color, $mailbox) { +function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { + + global $reply_focus, $javascript_on, $action; + + if (empty($sBodyTagJs)) { + if (strpos($action, 'reply') !== FALSE && $reply_focus) { + if ($reply_focus == 'select') + $sBodyTagJs = 'onload="checkForm(\'select\');"'; + else if ($reply_focus == 'focus') + $sBodyTagJs = 'onload="checkForm(\'focus\');"'; + else if ($reply_focus != 'none') + $sBodyTagJs = 'onload="checkForm();"'; + } + else + $sBodyTagJs = 'onload="checkForm();"'; + } - global $javascript_on; /* * Locate the first displayable form element (only when JavaScript on) */ if($javascript_on) { - global $base_uri, $PHP_SELF, $data_dir, $username; - - $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 ); - - switch ( $module ) { - case 'src/search.php': - $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1; - $onload = "onload=\"document.forms[$pos].elements[2].focus();\""; - displayHtmlHeader (_("Compose")); - break; - default: - $js = '\n"; - $onload = 'onload="checkForm();"'; - displayHtmlHeader (_("Compose"), $js); - break; + if ($sHeaderJs) { + $sJsBlock = "\n\n"; + } else { + $sJsBlock = ''; } + $sJsBlock .= "\n" . '' ."\n"; + displayHtmlHeader (_("Compose"), $sJsBlock); } else { /* javascript off */ displayHtmlHeader(_("Compose")); $onload = ''; } - - echo "\n\n"; + echo "\n\n"; } - -?> \ No newline at end of file +?>