page_header.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. <?php
  2. /**
  3. * page_header.php
  4. *
  5. * Copyright (c) 1999-2005 The SquirrelMail Project Team
  6. * Licensed under the GNU GPL. For full terms see the file COPYING.
  7. *
  8. * Prints the page header (duh)
  9. *
  10. * @version $Id$
  11. * @package squirrelmail
  12. */
  13. /** Include required files from SM */
  14. require_once(SM_PATH . 'functions/strings.php');
  15. require_once(SM_PATH . 'functions/html.php');
  16. require_once(SM_PATH . 'functions/imap_mailbox.php');
  17. require_once(SM_PATH . 'functions/global.php');
  18. /**
  19. * Output a SquirrelMail page header, from <!doctype> to </head>
  20. * Always set up the language before calling these functions.
  21. *
  22. * @param string title the page title, default SquirrelMail.
  23. * @param string xtra extra HTML to insert into the header
  24. * @param bool do_hook whether to execute hooks, default true
  25. * @param bool frames generate html frameset doctype (since 1.5.1)
  26. * @return void
  27. */
  28. function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true, $frames = false ) {
  29. global $squirrelmail_language;
  30. if ( !sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
  31. global $base_uri;
  32. }
  33. global $theme_css, $custom_css, $pageheader_sent;
  34. if ($frames) {
  35. echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">';
  36. } else {
  37. echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
  38. }
  39. echo "\n\n" . html_tag( 'html' ,'' , '', '', 'lang="'.$squirrelmail_language.'"' ) . "\n<head>\n";
  40. /*
  41. * Add closing / to link and meta elements only after switching to xhtml 1.0 Transitional.
  42. * It is not compatible with html 4.01 Transitional
  43. */
  44. if ( !isset( $custom_css ) || $custom_css == 'none' ) {
  45. if ($theme_css != '') {
  46. echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$theme_css\">";
  47. }
  48. } else {
  49. echo '<link rel="stylesheet" type="text/css" href="' .
  50. $base_uri . 'themes/css/'.$custom_css.'">';
  51. }
  52. if ($squirrelmail_language == 'ja_JP') {
  53. /*
  54. * force correct detection of charset, when browser does not follow
  55. * http content-type and tries to detect charset from page content.
  56. * Shooting of browser's creator can't be implemented in php.
  57. * We might get rid of it, if we follow http://www.w3.org/TR/japanese-xml/
  58. * recommendations and switch to unicode.
  59. */
  60. echo "<!-- \xfd\xfe -->\n";
  61. echo '<meta http-equiv="Content-type" content="text/html; charset=euc-jp">' . "\n";
  62. }
  63. if ($do_hook) {
  64. do_hook('generic_header');
  65. }
  66. echo "\n<title>$title</title>$xtra\n";
  67. /* work around IE6's scrollbar bug */
  68. echo <<<ECHO
  69. <style type="text/css">
  70. <!--
  71. /* avoid stupid IE6 bug with frames and scrollbars */
  72. body {
  73. voice-family: "\"}\"";
  74. voice-family: inherit;
  75. width: expression(document.documentElement.clientWidth - 30);
  76. }
  77. -->
  78. </style>
  79. ECHO;
  80. echo "\n</head>\n\n";
  81. /* this is used to check elsewhere whether we should call this function */
  82. $pageheader_sent = TRUE;
  83. }
  84. /**
  85. * Given a path to a SquirrelMail file, return a HTML link to it
  86. *
  87. * @param string path the SquirrelMail file to link to
  88. * @param string text the link text
  89. * @param string target the target frame for this link
  90. */
  91. function makeInternalLink($path, $text, $target='') {
  92. sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
  93. if ($target != '') {
  94. $target = " target=\"$target\"";
  95. }
  96. // This is an inefficient hook and is only used by
  97. // one plugin that still needs to patch this code,
  98. // plus if we are templat-izing SM, visual hooks
  99. // are not needed. However, I am leaving the code
  100. // here just in case we find a good (non-visual?)
  101. // use for the internal_link hook.
  102. //
  103. //$hooktext = do_hook_function('internal_link',$text);
  104. //if ($hooktext != '')
  105. // $text = $hooktext;
  106. return '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
  107. }
  108. /**
  109. * Same as makeInternalLink, but echoes it too
  110. */
  111. function displayInternalLink($path, $text, $target='') {
  112. echo makeInternalLink($path, $text, $target);
  113. }
  114. /**
  115. * Outputs a complete SquirrelMail page header, starting with <!doctype> and
  116. * including the default menu bar. Uses displayHtmlHeader and takes
  117. * JavaScript and locale settings into account.
  118. *
  119. * @param array color the array of theme colors
  120. * @param string mailbox the current mailbox name to display
  121. * @param string xtra extra html code to add
  122. * @param bool session
  123. * @return void
  124. */
  125. function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
  126. global $hide_sm_attributions, $PHP_SELF, $frame_top,
  127. $compose_new_win, $compose_width, $compose_height,
  128. $provider_name, $provider_uri, $startMessage,
  129. $javascript_on, $default_use_mdn, $mdn_user_support;
  130. sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION );
  131. sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION );
  132. $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
  133. if ($qmark = strpos($module, '?')) {
  134. $module = substr($module, 0, $qmark);
  135. }
  136. if (!isset($frame_top)) {
  137. $frame_top = '_top';
  138. }
  139. if ($session) {
  140. $compose_uri = $base_uri.'src/compose.php?mailbox='.urlencode($mailbox).'&amp;attachedmessages=true&amp;session='."$session";
  141. } else {
  142. $compose_uri = $base_uri.'src/compose.php?newmessage=1';
  143. $session = 0;
  144. }
  145. if( $javascript_on || strpos($xtra, 'new_js_autodetect_results.value') ) {
  146. switch ( $module ) {
  147. case 'src/read_body.php':
  148. $js ='';
  149. // compose in new window code
  150. if ($compose_new_win == '1') {
  151. if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
  152. $compose_width = '640';
  153. }
  154. if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
  155. $compose_height = '550';
  156. }
  157. $js .= "function comp_in_new_form(comp_uri, button, myform) {\n".
  158. ' if (!comp_uri) {'."\n".
  159. ' comp_uri = "'.$compose_uri."\";\n".
  160. ' }'. "\n".
  161. ' comp_uri += "&" + button.name + "=1";'."\n".
  162. ' for ( var i=0; i < myform.elements.length; i++ ) {'."\n".
  163. ' if ( myform.elements[i].type == "checkbox" && myform.elements[i].checked )'."\n".
  164. ' comp_uri += "&" + myform.elements[i].name + "=1";'."\n".
  165. ' }'."\n".
  166. ' var newwin = window.open(comp_uri' .
  167. ', "_blank",'.
  168. '"width='.$compose_width. ',height='.$compose_height.
  169. ',scrollbars=yes,resizable=yes,status=yes");'."\n".
  170. "}\n\n";
  171. $js .= "function comp_in_new(comp_uri) {\n".
  172. " if (!comp_uri) {\n".
  173. ' comp_uri = "'.$compose_uri."\";\n".
  174. ' }'. "\n".
  175. ' var newwin = window.open(comp_uri' .
  176. ', "_blank",'.
  177. '"width='.$compose_width. ',height='.$compose_height.
  178. ',scrollbars=yes,resizable=yes,status=yes");'."\n".
  179. "}\n\n";
  180. }
  181. // javascript for sending read receipts
  182. if($default_use_mdn && $mdn_user_support) {
  183. $js .= 'function sendMDN() {'."\n".
  184. " mdnuri=window.location+'&sendreceipt=1'; ".
  185. "var newwin = window.open(mdnuri,'right');".
  186. "\n}\n\n";
  187. }
  188. // if any of the above passes, add the JS tags too.
  189. if($js) {
  190. $js = "\n".'<script language="JavaScript" type="text/javascript">' .
  191. "\n<!--\n" . $js . "// -->\n</script>\n";
  192. }
  193. displayHtmlHeader ('SquirrelMail', $js);
  194. $onload = $xtra;
  195. break;
  196. case 'src/compose.php':
  197. $js = '<script language="JavaScript" type="text/javascript">' .
  198. "\n<!--\n" .
  199. "function checkForm() {\n";
  200. global $action, $reply_focus;
  201. if (strpos($action, 'reply') !== FALSE && $reply_focus)
  202. {
  203. if ($reply_focus == 'select') $js .= "document.forms['compose'].body.select();}\n";
  204. else if ($reply_focus == 'focus') $js .= "document.forms['compose'].body.focus();}\n";
  205. else if ($reply_focus == 'none') $js .= "}\n";
  206. }
  207. // no reply focus also applies to composing new messages
  208. else if ($reply_focus == 'none')
  209. {
  210. $js .= "}\n";
  211. }
  212. else
  213. $js .= "var f = document.forms.length;\n".
  214. "var i = 0;\n".
  215. "var pos = -1;\n".
  216. "while( pos == -1 && i < f ) {\n".
  217. "var e = document.forms[i].elements.length;\n".
  218. "var j = 0;\n".
  219. "while( pos == -1 && j < e ) {\n".
  220. "if ( document.forms[i].elements[j].type == 'text' ) {\n".
  221. "pos = j;\n".
  222. "}\n".
  223. "j++;\n".
  224. "}\n".
  225. "i++;\n".
  226. "}\n".
  227. "if( pos >= 0 ) {\n".
  228. "document.forms[i-1].elements[pos].focus();\n".
  229. "}\n".
  230. "}\n";
  231. $js .= "// -->\n".
  232. "</script>\n";
  233. $onload = 'onload="checkForm();"';
  234. displayHtmlHeader ('SquirrelMail', $js);
  235. break;
  236. case 'src/right_main.php':
  237. // following code graciously stolen from phpMyAdmin project at:
  238. // http://www.phpmyadmin.net
  239. $js = <<<EOS
  240. /**
  241. * This array is used to remember mark status of rows in browse mode
  242. */
  243. var marked_row = new Array;
  244. /**
  245. * Sets/unsets the pointer and marker in browse mode
  246. *
  247. * @param object the table row
  248. * @param integer the row number
  249. * @param string the action calling this script (over, out or click)
  250. * @param string the default background color
  251. * @param string the color to use for mouseover
  252. * @param string the color to use for marking a row
  253. *
  254. * @return boolean whether pointer is set or not
  255. */
  256. function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
  257. {
  258. var theCells = null;
  259. // 1. Pointer and mark feature are disabled or the browser can't get the
  260. // row -> exits
  261. if ((thePointerColor == '' && theMarkColor == '')
  262. || typeof(theRow.style) == 'undefined') {
  263. return false;
  264. }
  265. // 2. Gets the current row and exits if the browser can't get it
  266. if (typeof(document.getElementsByTagName) != 'undefined') {
  267. theCells = theRow.getElementsByTagName('td');
  268. }
  269. else if (typeof(theRow.cells) != 'undefined') {
  270. theCells = theRow.cells;
  271. }
  272. else {
  273. return false;
  274. }
  275. // 3. Gets the current color...
  276. var rowCellsCnt = theCells.length;
  277. var domDetect = null;
  278. var currentColor = null;
  279. var newColor = null;
  280. // 3.1 ... with DOM compatible browsers except Opera that does not return
  281. // valid values with "getAttribute"
  282. if (typeof(window.opera) == 'undefined'
  283. && typeof(theCells[0].getAttribute) != 'undefined') {
  284. currentColor = theCells[0].getAttribute('bgcolor');
  285. domDetect = true;
  286. }
  287. // 3.2 ... with other browsers
  288. else {
  289. currentColor = theCells[0].style.backgroundColor;
  290. domDetect = false;
  291. } // end 3
  292. // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
  293. if (currentColor.indexOf("rgb") >= 0)
  294. {
  295. var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
  296. currentColor.indexOf(')'));
  297. var rgbValues = rgbStr.split(",");
  298. currentColor = "#";
  299. var hexChars = "0123456789ABCDEF";
  300. for (var i = 0; i < 3; i++)
  301. {
  302. var v = rgbValues[i].valueOf();
  303. currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
  304. }
  305. }
  306. // 4. Defines the new color
  307. // 4.1 Current color is the default one
  308. if (currentColor == ''
  309. || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
  310. if (theAction == 'over' && thePointerColor != '') {
  311. newColor = thePointerColor;
  312. }
  313. else if (theAction == 'click' && theMarkColor != '') {
  314. newColor = theMarkColor;
  315. marked_row[theRowNum] = true;
  316. // deactivated onclick marking of the checkbox because it's also executed
  317. // when an action (clicking on the checkbox itself) on a single item is
  318. // performed. Then the checkbox would get deactived, even though we need
  319. // it activated. Maybe there is a way to detect if the row was clicked,
  320. // and not an item therein...
  321. document.getElementById('msg[' + theRowNum + ']').checked = true;
  322. }
  323. }
  324. // 4.1.2 Current color is the pointer one
  325. else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
  326. && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
  327. if (theAction == 'out') {
  328. newColor = theDefaultColor;
  329. }
  330. else if (theAction == 'click' && theMarkColor != '') {
  331. newColor = theMarkColor;
  332. marked_row[theRowNum] = true;
  333. document.getElementById('msg[' + theRowNum + ']').checked = true;
  334. }
  335. }
  336. // 4.1.3 Current color is the marker one
  337. else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
  338. if (theAction == 'click') {
  339. newColor = (thePointerColor != '')
  340. ? thePointerColor
  341. : theDefaultColor;
  342. marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
  343. ? true
  344. : null;
  345. document.getElementById('msg[' + theRowNum + ']').checked = false;
  346. }
  347. } // end 4
  348. // 5. Sets the new color...
  349. if (newColor) {
  350. var c = null;
  351. // 5.1 ... with DOM compatible browsers except Opera
  352. if (domDetect) {
  353. for (c = 0; c < rowCellsCnt; c++) {
  354. theCells[c].setAttribute('bgcolor', newColor, 0);
  355. } // end for
  356. }
  357. // 5.2 ... with other browsers
  358. else {
  359. for (c = 0; c < rowCellsCnt; c++) {
  360. theCells[c].style.backgroundColor = newColor;
  361. }
  362. }
  363. } // end 5
  364. return true;
  365. } // end of the 'setPointer()' function
  366. EOS;
  367. $js = "\n".'<script language="JavaScript" type="text/javascript">' .
  368. "\n<!--\n" . $js . "// -->\n</script>\n";
  369. $onload = '';
  370. displayHtmlHeader ('SquirrelMail', $js);
  371. break;
  372. default:
  373. $js = '<script language="JavaScript" type="text/javascript">' .
  374. "\n<!--\n" .
  375. "function checkForm() {\n".
  376. "var f = document.forms.length;\n".
  377. "var i = 0;\n".
  378. "var pos = -1;\n".
  379. "while( pos == -1 && i < f ) {\n".
  380. "var e = document.forms[i].elements.length;\n".
  381. "var j = 0;\n".
  382. "while( pos == -1 && j < e ) {\n".
  383. "if ( document.forms[i].elements[j].type == 'text' " .
  384. "|| document.forms[i].elements[j].type == 'password' ) {\n".
  385. "pos = j;\n".
  386. "}\n".
  387. "j++;\n".
  388. "}\n".
  389. "i++;\n".
  390. "}\n".
  391. "if( pos >= 0 ) {\n".
  392. "document.forms[i-1].elements[pos].focus();\n".
  393. "}\n".
  394. "$xtra\n".
  395. "}\n";
  396. if ($compose_new_win == '1') {
  397. if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
  398. $compose_width = '640';
  399. }
  400. if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
  401. $compose_height = '550';
  402. }
  403. $js .= "function comp_in_new(comp_uri) {\n".
  404. " if (!comp_uri) {\n".
  405. ' comp_uri = "'.$compose_uri."\";\n".
  406. ' }'. "\n".
  407. ' var newwin = window.open(comp_uri' .
  408. ', "_blank",'.
  409. '"width='.$compose_width. ',height='.$compose_height.
  410. ',scrollbars=yes,resizable=yes,status=yes");'."\n".
  411. "}\n\n";
  412. }
  413. $js .= "// -->\n". "</script>\n";
  414. $onload = 'onload="checkForm();"';
  415. displayHtmlHeader ('SquirrelMail', $js);
  416. break;
  417. }
  418. } else {
  419. /* do not use JavaScript */
  420. displayHtmlHeader ('SquirrelMail');
  421. $onload = '';
  422. }
  423. echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";
  424. /** Here is the header and wrapping table **/
  425. $shortBoxName = htmlspecialchars(imap_utf7_decode_local(
  426. readShortMailboxName($mailbox, $delimiter)));
  427. if ( $shortBoxName == 'INBOX' ) {
  428. $shortBoxName = _("INBOX");
  429. }
  430. echo "<a name=\"pagetop\"></a>\n"
  431. . html_tag( 'table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"' ) ."\n"
  432. . html_tag( 'tr', '', '', $color[9] ) ."\n"
  433. . html_tag( 'td', '', 'left' ) ."\n";
  434. if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
  435. echo ' ' . _("Current Folder") . ": <b>$shortBoxName&nbsp;</b>\n";
  436. } else {
  437. echo '&nbsp;';
  438. }
  439. echo " </td>\n"
  440. . html_tag( 'td', '', 'right' ) ."<b>\n";
  441. displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
  442. echo "</b></td>\n"
  443. . " </tr>\n"
  444. . html_tag( 'tr', '', '', $color[4] ) ."\n"
  445. . ($hide_sm_attributions ? html_tag( 'td', '', 'left', '', 'colspan="2"' )
  446. : html_tag( 'td', '', 'left' ) )
  447. . "\n";
  448. $urlMailbox = urlencode($mailbox);
  449. echo makeComposeLink('src/compose.php?mailbox='.$urlMailbox.'&amp;startMessage='.$startMessage);
  450. echo "&nbsp;&nbsp;\n";
  451. displayInternalLink ('src/addressbook.php', _("Addresses"));
  452. echo "&nbsp;&nbsp;\n";
  453. displayInternalLink ('src/folders.php', _("Folders"));
  454. echo "&nbsp;&nbsp;\n";
  455. displayInternalLink ('src/options.php', _("Options"));
  456. echo "&nbsp;&nbsp;\n";
  457. displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"));
  458. echo "&nbsp;&nbsp;\n";
  459. displayInternalLink ('src/help.php', _("Help"));
  460. echo "&nbsp;&nbsp;\n";
  461. do_hook('menuline');
  462. echo " </td>\n";
  463. if (!$hide_sm_attributions)
  464. {
  465. echo html_tag( 'td', '', 'right' ) ."\n";
  466. if (!isset($provider_uri)) $provider_uri= 'http://www.squirrelmail.org/';
  467. if (!isset($provider_name)) $provider_name= 'SquirrelMail';
  468. echo '<a href="'.$provider_uri.'" target="_blank">'.$provider_name.'</a>';
  469. echo "</td>\n";
  470. }
  471. echo " </tr>\n".
  472. "</table><br />\n\n";
  473. }
  474. /**
  475. * Blatantly copied/truncated/modified from displayPageHeader.
  476. * Outputs a page header specifically for the compose_in_new popup window
  477. *
  478. * @param array color the array of theme colors
  479. * @param string mailbox the current mailbox name to display
  480. * @return void
  481. */
  482. function compose_Header($color, $mailbox) {
  483. global $javascript_on;
  484. /*
  485. * Locate the first displayable form element (only when JavaScript on)
  486. */
  487. if($javascript_on) {
  488. global $base_uri, $PHP_SELF, $data_dir, $username;
  489. $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
  490. switch ( $module ) {
  491. case 'src/search.php':
  492. $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
  493. $onload = "onload=\"document.forms[$pos].elements[2].focus();\"";
  494. displayHtmlHeader (_("Compose"));
  495. break;
  496. default:
  497. $js = '<script language="JavaScript" type="text/javascript">' .
  498. "\n<!--\n" .
  499. "function checkForm() {\n";
  500. global $action, $reply_focus;
  501. if (strpos($action, 'reply') !== FALSE && $reply_focus)
  502. {
  503. if ($reply_focus == 'select') $js .= "document.forms['compose'].body.select();}\n";
  504. else if ($reply_focus == 'focus') $js .= "document.forms['compose'].body.focus();}\n";
  505. else if ($reply_focus == 'none') $js .= "}\n";
  506. }
  507. // no reply focus also applies to composing new messages
  508. else if ($reply_focus == 'none')
  509. {
  510. $js .= "}\n";
  511. }
  512. else
  513. $js .= "var f = document.forms.length;\n".
  514. "var i = 0;\n".
  515. "var pos = -1;\n".
  516. "while( pos == -1 && i < f ) {\n".
  517. "var e = document.forms[i].elements.length;\n".
  518. "var j = 0;\n".
  519. "while( pos == -1 && j < e ) {\n".
  520. "if ( document.forms[i].elements[j].type == 'text' ) {\n".
  521. "pos = j;\n".
  522. "}\n".
  523. "j++;\n".
  524. "}\n".
  525. "i++;\n".
  526. "}\n".
  527. "if( pos >= 0 ) {\n".
  528. "document.forms[i-1].elements[pos].focus();\n".
  529. "}\n".
  530. "}\n";
  531. $js .= "// -->\n".
  532. "</script>\n";
  533. $onload = 'onload="checkForm();"';
  534. displayHtmlHeader (_("Compose"), $js);
  535. break;
  536. }
  537. } else {
  538. /* javascript off */
  539. displayHtmlHeader(_("Compose"));
  540. $onload = '';
  541. }
  542. echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";
  543. }
  544. ?>