From 87745b9cf4c1ea33c3788ab0c3a554e9574ec5d7 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Tue, 6 Sep 2005 23:58:45 +0000 Subject: [PATCH] Don't auto-focus on compose form when user has already focused somewhere manually (very annoying over slow connections) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10073 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/forms.php | 5 +++-- src/compose.php | 23 ++++++++++++++++------- templates/default/js/default.js | 4 ++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/functions/forms.php b/functions/forms.php index 388ce3e4..f35edc66 100644 --- a/functions/forms.php +++ b/functions/forms.php @@ -130,7 +130,8 @@ function addHidden($sName, $sValue, $aAttribs=array()) { * @param string $sValue initial field value * @param integer $iSize field size (number of characters) * @param integer $iMaxlength maximum number of characters the user may enter - * @param array $aAttribs (since 1.5.1) extra attributes + * @param array $aAttribs (since 1.5.1) extra attributes - should be given + * in the form array('attribute_name' => 'attribute_value', ...) * @return string html formated text input field */ function addInput($sName, $sValue = '', $iSize = 0, $iMaxlength = 0, $aAttribs=array()) { @@ -291,4 +292,4 @@ function addForm($sAction, $sMethod = 'post', $sName = '', $sEnctype = '', $sCha $sEnctype . $sName . $sCharset . $sAttribs . ">\n"; } -?> \ No newline at end of file +?> diff --git a/src/compose.php b/src/compose.php index a11e178e..e0011165 100644 --- a/src/compose.php +++ b/src/compose.php @@ -1020,6 +1020,15 @@ function showInputForm ($session, $values=false) { $mailprio, $compose_new_win, $saved_draft, $mail_sent, $sig_first, $username, $compose_messages, $composesession, $default_charset; + if (checkForJavascript()) { + $onfocus = ' onfocus="alreadyFocused=true;"'; + $onfocus_array = array('onfocus' => 'alreadyFocused=true;'); + } + else { + $onfocus = ''; + $onfocus_array = array(); + } + $composeMessage = $compose_messages[$session]; if ($values) { $send_to = $values['send_to']; @@ -1108,28 +1117,28 @@ function showInputForm ($session, $values=false) { html_tag( 'td', '', 'right', $color[4], 'width="10%"' ) . _("To") . ':' . "\n" . html_tag( 'td', '', 'left', $color[4], 'width="90%"' ) . - addInput('send_to', $send_to, 60). '
' . "\n" . + addInput('send_to', $send_to, 60, 0, $onfocus_array). '
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . html_tag( 'td', '', 'right', $color[4] ) . _("Cc") . ':' . "\n" . html_tag( 'td', '', 'left', $color[4] ) . - addInput('send_to_cc', $send_to_cc, 60). '
' . "\n" . + addInput('send_to_cc', $send_to_cc, 60, 0, $onfocus_array). '
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . html_tag( 'td', '', 'right', $color[4] ) . _("Bcc") . ':' . "\n" . html_tag( 'td', '', 'left', $color[4] ) . - addInput('send_to_bcc', $send_to_bcc, 60).'
' . "\n" . + addInput('send_to_bcc', $send_to_bcc, 60, 0, $onfocus_array).'
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . html_tag( 'td', '', 'right', $color[4] ) . _("Subject") . ':' . "\n" . html_tag( 'td', '', 'left', $color[4] ) . "\n"; - echo ' '.addInput('subject', $subject, 60). + echo ' '.addInput('subject', $subject, 60, 0, $onfocus_array). ' ' . "\n" . ' ' . "\n\n"; @@ -1142,13 +1151,13 @@ function showInputForm ($session, $values=false) { echo ' ' . "\n" . ' ' . "\n" . '