From d58c39126f6e1754e29b6f3bbc01f0f6a3ea2581 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 2 Jun 2014 16:35:12 +0200 Subject: Some more improvemements on content structure, text representation and keyboard navigation within the mail view --- program/include/rcmail.php | 2 +- program/include/rcmail_output_html.php | 4 ++-- program/js/app.js | 35 +++++++++++++++++++++++++++------- program/js/list.js | 3 +-- program/localization/en_US/labels.inc | 3 +++ program/steps/mail/list_contacts.inc | 2 +- program/steps/mail/search_contacts.inc | 2 +- 7 files changed, 37 insertions(+), 14 deletions(-) (limited to 'program') diff --git a/program/include/rcmail.php b/program/include/rcmail.php index cc70739cf..8e66e85e7 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1501,7 +1501,7 @@ class rcmail extends rcube $html_name = $this->Q($foldername) . ($unread ? html::span('unreadcount', sprintf($attrib['unreadwrap'], $unread)) : ''); $link_attrib = $folder['virtual'] ? array() : array( 'href' => $this->url(array('_mbox' => $folder['id'])), - 'onclick' => sprintf("return %s.command('list','%s',this)", rcmail_output::JS_OBJECT_NAME, $js_name), + 'onclick' => sprintf("return %s.command('list','%s',this,event)", rcmail_output::JS_OBJECT_NAME, $js_name), 'rel' => $folder['id'], 'title' => $title, ); diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 1fa0376fb..e8b5c9828 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -859,10 +859,10 @@ EOF; } // localize title and summary attributes - if (!empty($attrib['title']) && $this->app->text_exists($attrib['title'])) { + if ($command != 'button' && !empty($attrib['title']) && $this->app->text_exists($attrib['title'])) { $attrib['title'] = $this->app->gettext($attrib['title']); } - if (!empty($attrib['summary']) && $this->app->text_exists($attrib['summary'])) { + if ($command != 'button' && !empty($attrib['summary']) && $this->app->text_exists($attrib['summary'])) { $attrib['summary'] = $this->app->gettext($attrib['summary']); } diff --git a/program/js/app.js b/program/js/app.js index bf163c614..e7f9d02b6 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -342,7 +342,16 @@ function rcube_webmail() .addEventListener('initrow', function(o) { ref.triggerEvent('insertrow', { cid:o.uid, row:o }); }) .addEventListener('select', function(o) { ref.compose_recipient_select(o); }) .addEventListener('dblclick', function(o) { ref.compose_add_recipient('to'); }) - .addEventListener('keypress', function(o) { if (o.key_pressed == o.ENTER_KEY) ref.compose_add_recipient('to'); }) + .addEventListener('keypress', function(o) { + if (o.key_pressed == o.ENTER_KEY) { + if (!ref.compose_add_recipient('to')) { + // execute link action on if not a recipient entry + if (o.last_selected && String(o.last_selected).charAt(0) == 'G') { + $(o.rows[o.last_selected].obj).find('a').first().click(); + } + } + } + }) .init(); } @@ -602,7 +611,7 @@ function rcube_webmail() { var ret, uid, cid, url, flag, aborted = false; - if (obj && obj.blur) + if (obj && obj.blur && !(event || rcube_event.is_keyboard(event))) obj.blur(); // do nothing if interface is locked by other command (with exception for searching reset) @@ -1647,9 +1656,12 @@ function rcube_webmail() { // Helper method to move focus to the next/prev active menu item var focus_menu_item = function(dir) { - var obj, mod = dir < 0 ? 'prevAll' : 'nextAll', limit = dir < 0 ? 'last' : 'first'; + var obj, item, mod = dir < 0 ? 'prevAll' : 'nextAll', limit = dir < 0 ? 'last' : 'first'; if (ref.focused_menu && (obj = $('#'+ref.focused_menu))) { - return obj.find(':focus').closest('li')[mod](':has(:not([aria-disabled=true]))').find('a,input')[limit]().focus().length; + item = obj.find(':focus').closest('li')[mod](':has(:not([aria-disabled=true]))').find('a,input')[limit](); + if (!item.length) + item = obj.find(':focus').closest('ul')[mod](':has(:not([aria-disabled=true]))').find('a,input')[limit](); + return item.focus().length; } return 0; @@ -2402,7 +2414,6 @@ function rcube_webmail() this.clear_message_list = function() { this.env.messages = {}; - this.last_selected = 0; this.show_contentframe(false); if (this.message_list) @@ -3490,6 +3501,8 @@ function rcube_webmail() input.val(oldval + recipients.join(delim + ' ') + delim + ' '); this.triggerEvent('add-recipient', { field:field, recipients:recipients }); } + + return recipients.length; }; // checks the input fields before sending a message @@ -7405,7 +7418,8 @@ function rcube_webmail() this.enable_command('set-listmode', this.env.threads && !is_multifolder); if ((response.action == 'list' || response.action == 'search') && this.message_list) { - this.message_list.focus(); + if (this.message_list.rowcount > 0) + this.message_list.focus(); this.msglist_select(this.message_list); this.triggerEvent('listupdate', { folder:this.env.mailbox, rowcount:this.message_list.rowcount }); } @@ -7417,11 +7431,18 @@ function rcube_webmail() this.enable_command('search-create', this.env.source == ''); this.enable_command('search-delete', this.env.search_id); this.update_group_commands(); - this.contact_list.focus(); + if (this.contact_list.rowcount > 0) + this.contact_list.focus(); this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount }); } } break; + + case 'list-contacts': + case 'search-contacts': + if (this.contact_list && this.contact_list.rowcount > 0) + this.contact_list.focus(); + break; } if (response.unlock) diff --git a/program/js/list.js b/program/js/list.js index 0bf5d568b..65d4a9260 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -274,11 +274,10 @@ clear: function(sel) this.rows = {}; this.rowcount = 0; + this.last_selected = 0; if (sel) this.clear_selection(); - else - this.last_selected = 0; // reset scroll position (in Opera) if (this.frame) diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index 0b5ff8c5a..874f19be2 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -591,11 +591,14 @@ $labels['arialabelmessagelistoptions'] = 'Message list display and sorting optio $labels['arialabelmailimportdialog'] = 'Message import dialog'; $labels['arialabelmessagenav'] = 'Message navigation'; $labels['arialabelmessagebody'] = 'Message Body'; +$labels['arialabelmessageactions'] = 'Message actions'; $labels['arialabelcontactquicksearch'] = 'Contacts search form'; $labels['arialabelcontactsearchbox'] = 'Contact search input'; $labels['arialabelmessageheaders'] = 'Message headers'; $labels['arialabelcomposeoptions'] = 'Composition options'; $labels['arialabelresponsesmenu'] = 'Canned responses menu'; $labels['arialabelattachmentuploadform'] = 'Attachment upload form'; +$labels['arialabelattachmentpreview'] = 'Attachment preview'; +$labels['ariasummarycomposecontacts'] = 'List of contacts and groups to select as recipients'; ?> diff --git a/program/steps/mail/list_contacts.inc b/program/steps/mail/list_contacts.inc index 0ee81135b..4f17beffd 100644 --- a/program/steps/mail/list_contacts.inc +++ b/program/steps/mail/list_contacts.inc @@ -110,7 +110,7 @@ else if (!empty($result) && $result->count > 0) { $keyname = $row['_type'] == 'group' ? 'contactgroup' : 'contact'; $OUTPUT->command('add_contact_row', $row_id, array( - $keyname => html::span(array('title' => $email), rcube::Q($name ? $name : $email) . + $keyname => html::a(array('title' => $email), rcube::Q($name ? $name : $email) . ($name && count($emails) > 1 ? ' ' . html::span('email', rcube::Q($email)) : '') )), $classname); } diff --git a/program/steps/mail/search_contacts.inc b/program/steps/mail/search_contacts.inc index d56581695..ccef32dd2 100644 --- a/program/steps/mail/search_contacts.inc +++ b/program/steps/mail/search_contacts.inc @@ -87,7 +87,7 @@ if (!empty($result) && $result->count > 0) { $row_id = $row['ID'].'-'.$i; $jsresult[$row_id] = format_email_recipient($email, $name); $OUTPUT->command('add_contact_row', $row_id, array( - 'contact' => html::span(array('title' => $email), rcube::Q($name ? $name : $email) . + 'contact' => html::a(array('title' => $email), rcube::Q($name ? $name : $email) . ($name && count($emails) > 1 ? ' ' . html::span('email', rcube::Q($email)) : '') )), 'person'); } -- cgit v1.2.3