From 726f0cd49d9370c27d4bac240f038c947af021d1 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Wed, 25 Mar 2009 08:29:39 +0000 Subject: [PATCH] Make access keys on read message screen work without needing to press git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13441 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/read_body.php | 48 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/src/read_body.php b/src/read_body.php index 12be8adb..f8fde2ed 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -459,13 +459,21 @@ function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, /** * Format message toolbar * - * @param array $aMailbox Current mailbox information array - * @param int $passed_id UID of current message - * @param int $passed_ent_id Id of entity within message - * @param object $message Current message object - * @param object $mbx_response + * @param array $aMailbox Current mailbox information array + * @param int $passed_id UID of current message + * @param int $passed_ent_id Id of entity within message + * @param object $message Current message object + * @param void $removedVar This parameter is no longer used, but remains + * so as not to break this function's prototype + * (OPTIONAL) + * @param boolean $nav_on_top When TRUE, the menubar is being constructed + * for use at the top of the page, otherwise it + * will be used for page bottom (OPTIONAL; + * default = TRUE) */ -function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removedVar, $nav_on_top = TRUE) { +function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, + $removedVar=FALSE, $nav_on_top=TRUE) { + global $base_uri, $draft_folder, $where, $what, $sort, $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, @@ -658,12 +666,30 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed $oTemplate->assign('can_be_copied', false); } - // access keys... + // access keys... only add to the bottom menubar, because adding + // them twice makes them less functional (press access key, *then* + // press to make it work), and we always have a bottom + // menubar, even on the non-JavaScript printable screen + // + // the one exception we'll make to this is the "move to" (folder + // selection) since the user can get confused if the focus for + // that access key does not land in the folder select widget at + // the top of the page + // + // FIXME: this also can be confusing for the "as attachment" and "bypass trash" checkboxes, but they are not being excepted like "move to" because pressing their access keys will only focus on them and not check them, which might be even more confusing to naive users or those that can't see the focus indication on the checkbox - this is a compromise, the best I can think of at this time // - global $accesskey_read_msg_reply, $accesskey_read_msg_reply_all, - $accesskey_read_msg_forward, $accesskey_read_msg_as_attach, - $accesskey_read_msg_delete, $accesskey_read_msg_bypass_trash, - $accesskey_read_msg_move_to, $accesskey_read_msg_move; + global $accesskey_read_msg_move_to; + if (!$nav_on_top) { + global $accesskey_read_msg_reply, $accesskey_read_msg_reply_all, + $accesskey_read_msg_forward, $accesskey_read_msg_as_attach, + $accesskey_read_msg_delete, $accesskey_read_msg_bypass_trash, + $accesskey_read_msg_move; + } else { + $accesskey_read_msg_reply = $accesskey_read_msg_reply_all = + $accesskey_read_msg_forward = $accesskey_read_msg_as_attach = + $accesskey_read_msg_delete = $accesskey_read_msg_bypass_trash = + $accesskey_read_msg_move = 'NONE'; + } $oTemplate->assign('accesskey_read_msg_reply', $accesskey_read_msg_reply); $oTemplate->assign('accesskey_read_msg_reply_all', $accesskey_read_msg_reply_all); $oTemplate->assign('accesskey_read_msg_forward', $accesskey_read_msg_forward); -- 2.25.1