| | |
| | | |
| | | // enable general commands |
| | | this.enable_command('close', 'logout', 'mail', 'addressbook', 'settings', 'save-pref', |
| | | 'compose', 'undo', 'about', 'switch-task', 'menu-open', 'menu-save', true); |
| | | 'compose', 'undo', 'about', 'switch-task', 'menu-open', 'menu-close', 'menu-save', true); |
| | | |
| | | // set active task button |
| | | this.set_button(this.task, 'sel'); |
| | |
| | | $('a.insertresponse', this.gui_objects.responseslist) |
| | | .attr('unselectable', 'on') |
| | | .mousedown(function(e){ return rcube_event.cancel(e); }) |
| | | .mouseup(function(e){ |
| | | ref.command('insert-response', $(this).attr('rel')); |
| | | $(document.body).trigger('mouseup'); // hides the menu |
| | | return rcube_event.cancel(e); |
| | | .bind('mouseup keypress', function(e){ |
| | | if (e.type == 'mouseup' || rcube_event.get_keycode(e) == 13) { |
| | | ref.command('insert-response', $(this).attr('rel')); |
| | | $(document.body).trigger('mouseup'); // hides the menu |
| | | return rcube_event.cancel(e); |
| | | } |
| | | }); |
| | | |
| | | // avoid textarea loosing focus when hitting the save-response button/link |
| | |
| | | // init address book widget |
| | | if (this.gui_objects.contactslist) { |
| | | this.contact_list = new rcube_list_widget(this.gui_objects.contactslist, |
| | | { multiselect:true, draggable:false, keyboard:false }); |
| | | { multiselect:true, draggable:false, keyboard:true }); |
| | | this.contact_list |
| | | .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'); }) |
| | | .init(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | case 'menu-save': |
| | | this.triggerEvent(command, {props:props, e:event}); |
| | | case 'menu-close': |
| | | this.triggerEvent(command, {props:props, originalEvent:event}); |
| | | return false; |
| | | |
| | | case 'open': |
| | |
| | | url._page = page; |
| | | |
| | | this.http_request('list', url, lock); |
| | | this.update_state({ _mbox: mbox, _page: (page && page > 1 ? page : null) }); |
| | | }; |
| | | |
| | | // removes messages that doesn't exists from list selection array |
| | |
| | | $('<a>').addClass('insertresponse active') |
| | | .attr('href', '#') |
| | | .attr('rel', key) |
| | | .attr('tabindex', '0') |
| | | .html(this.quote_html(response.name)) |
| | | .appendTo(li) |
| | | .mousedown(function(e){ |
| | | return rcube_event.cancel(e); |
| | | }) |
| | | .mouseup(function(e){ |
| | | ref.command('insert-response', key); |
| | | $(document.body).trigger('mouseup'); // hides the menu |
| | | return rcube_event.cancel(e); |
| | | .bind('mouseup keypress', function(e){ |
| | | if (e.type == 'mouseup' || rcube_event.get_keycode(e) == 13) { |
| | | ref.command('insert-response', $(this).attr('rel')); |
| | | $(document.body).trigger('mouseup'); // hides the menu |
| | | return rcube_event.cancel(e); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | |
| | | // set button to a specific state |
| | | this.set_button = function(command, state) |
| | | { |
| | | var n, button, obj, a_buttons = this.buttons[command], |
| | | var n, button, obj, $obj, a_buttons = this.buttons[command], |
| | | len = a_buttons ? a_buttons.length : 0; |
| | | |
| | | for (n=0; n<len; n++) { |
| | |
| | | $(obj).button('option', 'disabled', state == 'pas'); |
| | | } |
| | | else { |
| | | $(obj) |
| | | .attr('tabindex', state == 'pas' || state == 'sel' ? '-1' : '0') |
| | | $obj = $(obj); |
| | | $obj |
| | | .attr('tabindex', state == 'pas' || state == 'sel' ? '-1' : ($obj.attr('data-tabindex') || '0')) |
| | | .attr('aria-disabled', state == 'pas' || state == 'sel' ? 'true' : 'false'); |
| | | } |
| | | } |
| | |
| | | this.start_keepalive(); |
| | | }; |
| | | |
| | | // update browser location to remember current view |
| | | this.update_state = function(query) |
| | | { |
| | | if (window.history.replaceState) |
| | | window.history.replaceState({}, document.title, rcmail.url('', query)); |
| | | }; |
| | | |
| | | // send a http request to the server |
| | | this.http_request = function(action, query, lock) |
| | | { |
| | |
| | | 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(); |
| | | this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount }); |
| | | } |
| | | } |