diff --git a/plugins/kolab_notes/kolab_notes_ui.php b/plugins/kolab_notes/kolab_notes_ui.php index fa2fe5a7..143bc54b 100644 --- a/plugins/kolab_notes/kolab_notes_ui.php +++ b/plugins/kolab_notes/kolab_notes_ui.php @@ -135,8 +135,9 @@ class kolab_notes_ui if ($prop['class_name']) $class .= ' '.$prop['class_name']; + $attr = $prop['virtual'] ? array('tabindex' => '0') : array('href' => $this->rc->url(array('_list' => $id))); $items .= html::tag('li', array('id' => 'rcmliknb' . $html_id, 'class' => trim($class)), - html::span(array('class' => 'listname', 'title' => $title), $prop['listname']) . + html::a($attr + array('class' => 'listname', 'title' => $title), $prop['listname']) . html::span(array('class' => 'count'), '') ); } @@ -169,7 +170,7 @@ class kolab_notes_ui $this->rc->output->add_gui_object('noteseditform', $attrib['id']); $this->rc->output->include_script('tinymce/tinymce.min.js'); - $textarea = new html_textarea(array('name' => 'content', 'id' => 'notecontent', 'cols' => 60, 'rows' => 20, 'tabindex' => 3)); + $textarea = new html_textarea(array('name' => 'content', 'id' => 'notecontent', 'cols' => 60, 'rows' => 20, 'tabindex' => 0)); return html::tag('form', $attrib, $textarea->show(), array_merge(html::$common_attrib, array('action'))); } @@ -185,7 +186,7 @@ class kolab_notes_ui $attrib += array('id' => 'rcmkolabnotestitle'); $this->rc->output->add_gui_object('noteviewtitle', $attrib['id']); - $summary = new html_inputfield(array('name' => 'summary', 'class' => 'notetitle inline-edit', 'size' => 60, 'tabindex' => 1)); + $summary = new html_inputfield(array('name' => 'summary', 'class' => 'notetitle inline-edit', 'size' => 60, 'tabindex' => 0)); $html = $summary->show(); $html .= html::div(array('class' => 'tagline tagedit', 'style' => 'display:none'), ' '); @@ -247,7 +248,7 @@ class kolab_notes_ui $form['properties']['fields']['name'] = array( 'label' => $this->plugin->gettext('listname'), 'value' => $input_name->show($list['editname'], array('disabled' => ($options['norename'] || $options['protected']))), - 'id' => 'folder-name', + 'id' => 'noteslist-name', ); // prevent user from moving folder @@ -255,10 +256,11 @@ class kolab_notes_ui $hidden_fields[] = array('name' => 'parent', 'value' => $path_imap); } else { - $select = kolab_storage::folder_selector('note', array('name' => 'parent'), $folder_name); + $select = kolab_storage::folder_selector('note', array('name' => 'parent', 'id' => 'parent-folder'), $folder_name); $form['properties']['fields']['path'] = array( 'label' => $this->plugin->gettext('parentfolder'), 'value' => $select->show(strlen($folder_name) ? $path_imap : ''), + 'id' => 'parent-folder', ); } @@ -289,7 +291,6 @@ class kolab_notes_ui if (is_array($tab['fields']) && empty($tab['content'])) { $table = new html_table(array('cols' => 2)); foreach ($tab['fields'] as $col => $colprop) { - $colprop['id'] = '_'.$col; $label = !empty($colprop['label']) ? $colprop['label'] : $this->plugin->gettext($col); $table->add('title', html::label($colprop['id'], Q($label))); diff --git a/plugins/kolab_notes/localization/en_US.inc b/plugins/kolab_notes/localization/en_US.inc index 71a26cd4..74e65377 100644 --- a/plugins/kolab_notes/localization/en_US.inc +++ b/plugins/kolab_notes/localization/en_US.inc @@ -31,6 +31,7 @@ $labels['savein'] = 'Save in'; $labels['savingdata'] = 'Saving data...'; $labels['recordnotfound'] = 'Record not found'; +$labels['norecordsfound'] = 'No notes found'; $labels['nochanges'] = 'No changes to be saved'; $labels['entertitle'] = 'Please enter a title for this note!'; $labels['deletenotesconfirm'] = 'Do you really want to delete the selected notes?'; @@ -46,3 +47,4 @@ $labels['arialabelnotesquicksearchbox'] = 'Notes search input'; $labels['arialabelnotessortmenu'] = 'Notes list sorting options'; $labels['arialabelnotesoptionsmenu'] = 'Notebook actions menu'; $labels['arialabelnotebookform'] = 'Notebook properties'; +$labels['arialabelmessagereferences'] = 'Linked email messages'; diff --git a/plugins/kolab_notes/notes.js b/plugins/kolab_notes/notes.js index c52e0b92..5f29ba46 100644 --- a/plugins/kolab_notes/notes.js +++ b/plugins/kolab_notes/notes.js @@ -40,6 +40,7 @@ function rcube_kolab_notes_ui(settings) var search_request; var search_query; var tag_draghelper; + var render_no_focus; var me = this; /* public members */ @@ -112,9 +113,16 @@ function rcube_kolab_notes_ui(settings) } }); + $(rcmail.gui_objects.notebooks).on('click', 'li a', function(e) { + var id = String($(this).closest('li').attr('id')).replace(/^rcmliknb/, ''); + notebookslist.select(id); + e.preventDefault(); + return false; + }); + // register dbl-click handler to open list edit dialog - $(rcmail.gui_objects.notebooks).on('dblclick', 'li:not(.virtual)', function(e){ - var id = String(this.id).replace(/^rcmliknb/, ''); + $(rcmail.gui_objects.notebooks).on('dblclick', 'li:not(.virtual) a', function(e) { + var id = String($(this).closest('li').attr('id')).replace(/^rcmliknb/, ''); if (me.notebooks[id] && me.notebooks[id].editable) { list_edit_dialog(id); } @@ -137,6 +145,7 @@ function rcube_kolab_notes_ui(settings) noteslist = new rcube_list_widget(rcmail.gui_objects.noteslist, { multiselect:true, draggable:true, keyboard:true }); noteslist.addEventListener('select', function(list) { + render_no_focus = rcube_event._last_keyboard_event && $(list.list).has(rcube_event._last_keyboard_event.target); var selection_changed = list.selection.length != 1 || !me.selected_note || list.selection[0] != me.selected_note.id; selection_changed && warn_unsaved_changes(function(){ var note; @@ -183,7 +192,7 @@ function rcube_kolab_notes_ui(settings) } // click-handler on tags list - $(rcmail.gui_objects.notestagslist).on('click', function(e){ + $(rcmail.gui_objects.notestagslist).on('click', 'li', function(e){ var item = e.target.nodeName == 'LI' ? $(e.target) : $(e.target).closest('li'), tag = item.data('value'); @@ -198,17 +207,17 @@ function rcube_kolab_notes_ui(settings) if (tagsfilter.length > 1) index = -1; - $('li', this).removeClass('selected'); + $('li', rcmail.gui_objects.notestagslist).removeClass('selected').attr('aria-checked', 'false'); tagsfilter = []; } // add tag to filter if (index < 0) { - item.addClass('selected'); + item.addClass('selected').attr('aria-checked', 'true'); tagsfilter.push(tag); } else if (shift) { - item.removeClass('selected'); + item.removeClass('selected').attr('aria-checked', 'false'); var a = tagsfilter.slice(0,index); tagsfilter = a.concat(tagsfilter.slice(index+1)); } @@ -222,6 +231,11 @@ function rcube_kolab_notes_ui(settings) e.preventDefault(); return false; }) + .on('keypress', 'li', function(e) { + if (e.keyCode == 13) { + $(this).trigger('click', { pointerType:'keyboard' }); + } + }) .mousedown(function(e){ // disable content selection with the mouse e.preventDefault(); @@ -314,6 +328,7 @@ function rcube_kolab_notes_ui(settings) //spellchecker_rpc_url: '../../../../../?_task=utils&_action=spell_html&_remote=1', //spellchecker_language: rcmail.env.spell_lang, accessibility_focus: false, + tabfocus_elements: [':prev','btn-save-note'], setup: function(ed) { // make links open on shift-click ed.on('click', function(e) { @@ -453,7 +468,7 @@ function rcube_kolab_notes_ui(settings) modal: true, resizable: true, closeOnEscape: false, - title: rcmail.gettext((list.id ? 'editlist' : 'createlist'), 'kolab_notes'), + title: rcmail.gettext((list.id ? 'editlist' : 'newnotebook'), 'kolab_notes'), open: function() { $dialog.parent().find('.ui-dialog-buttonset .ui-button').first().addClass('mainaction'); }, @@ -707,6 +722,10 @@ function rcube_kolab_notes_ui(settings) else if (me.selected_note && notesdata[me.selected_note.id]) { noteslist.select(me.selected_note.id); } + else if (!data.data.length) { + console.log(data); + rcmail.display_message(rcmail.gettext('norecordsfound','kolab_notes'), 'info'); + } } /** @@ -738,7 +757,7 @@ function rcube_kolab_notes_ui(settings) $.each(typeof data.categories == 'object' && data.categories.length ? data.categories : [''], function(i,val){ $('') .attr('name', 'tags[]') - .attr('tabindex', '2') + .attr('tabindex', '0') .addClass('tag') .val(val) .appendTo(tagline); @@ -808,8 +827,10 @@ function rcube_kolab_notes_ui(settings) node = editor.getContentAreaContainer().childNodes[0]; if (node) node.tabIndex = content.get(0).tabIndex; - if (me.selected_note.uid) - editor.getBody().focus(); + if (me.selected_note.uid) { + if (!render_no_focus) + editor.getBody().focus(); + } else $('.notetitle', rcmail.gui_objects.noteviewtitle).focus().select(); @@ -822,6 +843,8 @@ function rcube_kolab_notes_ui(settings) $(rcmail.gui_objects.notesdetailview).html(html).show(); } + render_no_focus = false; + // notify subscribers rcmail.triggerEvent('kolab_notes_render', { data:data, readonly:readonly, html:is_html }); if (rcmail.is_framed()) @@ -916,7 +939,9 @@ function rcube_kolab_notes_ui(settings) // append tags to tag cloud $.each(tags, function(i, tag){ - li = $('