| | |
| | | this.multiselect = false; |
| | | this.draggable = false; |
| | | this.keyboard = false; |
| | | this.toggleselect = false; |
| | | |
| | | this.dont_select = false; |
| | | this.drag_active = false; |
| | |
| | | /** |
| | | * 'remove' message row from list (just hide it) |
| | | */ |
| | | remove_row: function(uid) |
| | | remove_row: function(uid, sel_next) |
| | | { |
| | | if (this.rows[uid].obj) |
| | | this.rows[uid].obj.style.display = 'none'; |
| | | |
| | | if (sel_next) |
| | | this.select_next(); |
| | | |
| | | this.rows[uid] = null; |
| | | }, |
| | |
| | | |
| | | if (this.last_selected != 0 && this.rows[this.last_selected]) |
| | | this.set_classname(this.rows[this.last_selected].obj, 'focused', false); |
| | | |
| | | |
| | | // unselect if toggleselect is active and the same row was clicked again |
| | | if (this.toggleselect && this.last_selected == id) |
| | | { |
| | | this.clear_selection(); |
| | | id = null; |
| | | } |
| | | else |
| | | this.set_classname(this.rows[id].obj, 'focused', true); |
| | | |
| | | if (!this.selection.length) |
| | | this.shift_start = null; |
| | | |
| | | this.last_selected = id; |
| | | this.set_classname(this.rows[id].obj, 'focused', true); |
| | | }, |
| | | |
| | | |
| | |
| | | if (!this.rows || !this.rows.length) |
| | | return false; |
| | | |
| | | // reset selection first |
| | | // reset but remember selection first |
| | | var select_before = this.selection.join(','); |
| | | this.clear_selection(); |
| | | |
| | | for (var n in this.rows) |
| | |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | // trigger event if selection changed |
| | | if (this.selection.join(',') != select_before) |
| | | this.trigger_event('select'); |
| | | |
| | | return true; |
| | | }, |
| | | |
| | | |
| | |
| | | */ |
| | | clear_selection: function() |
| | | { |
| | | for(var n=0; n<this.selection.length; n++) |
| | | var num_select = this.selection.length; |
| | | for (var n=0; n<this.selection.length; n++) |
| | | if (this.rows[this.selection[n]]) |
| | | { |
| | | this.set_classname(this.rows[this.selection[n]].obj, 'selected', false); |
| | | this.set_classname(this.rows[this.selection[n]].obj, 'unfocused', false); |
| | | } |
| | | |
| | | this.selection = new Array(); |
| | | this.selection = new Array(); |
| | | |
| | | if (num_select) |
| | | this.trigger_event('select'); |
| | | }, |
| | | |
| | | |
| | |
| | | if (this.focused != true) |
| | | return true; |
| | | |
| | | this.shiftkey = e.shiftKey; |
| | | |
| | | var keyCode = document.layers ? e.which : document.all ? event.keyCode : document.getElementById ? e.keyCode : 0; |
| | | var mod_key = rcube_event.get_modifier(e); |
| | | switch (keyCode) |
| | |
| | | break; |
| | | |
| | | default: |
| | | this.shiftkey = e.shiftKey; |
| | | this.key_pressed = keyCode; |
| | | this.trigger_event('keypress'); |
| | | } |