| | |
| | | |
| | | // set body events |
| | | if (this.keyboard) { |
| | | rcube_event.add_listener({element:document, event:'keyup', object:this, method:'key_press'}); |
| | | rcube_event.add_listener({element:document, event:bw.opera?'keypress':'keydown', object:this, method:'key_press'}); |
| | | rcube_event.add_listener({element:document, event:'keydown', object:this, method:'key_down'}); |
| | | } |
| | | } |
| | |
| | | */ |
| | | clear: function(sel) |
| | | { |
| | | var tbody = document.createElement('TBODY'); |
| | | var tbody = document.createElement('tbody'); |
| | | this.list.insertBefore(tbody, this.list.tBodies[0]); |
| | | this.list.removeChild(this.list.tBodies[1]); |
| | | this.rows = new Array(); |
| | |
| | | { |
| | | // don't do anything (another action processed before) |
| | | var evtarget = rcube_event.get_target(e); |
| | | if (this.dont_select || (evtarget && (evtarget.tagName == 'INPUT' || evtarget.tagName == 'IMG'))) |
| | | var tagname = evtarget.tagName.toLowerCase(); |
| | | if (this.dont_select || (evtarget && (tagname == 'input' || tagname == 'img'))) |
| | | return true; |
| | | |
| | | // accept right-clicks |
| | |
| | | rcube_event.add_listener({element:document, event:'mouseup', object:this, method:'drag_mouse_up'}); |
| | | |
| | | // add listener for iframes |
| | | var iframes = document.getElementsByTagName('IFRAME'); |
| | | var iframes = document.getElementsByTagName('iframe'); |
| | | this.iframe_events = Object(); |
| | | for (var n in iframes) |
| | | { |
| | |
| | | var now = new Date().getTime(); |
| | | var mod_key = rcube_event.get_modifier(e); |
| | | var evtarget = rcube_event.get_target(e); |
| | | var tagname = evtarget.tagName.toLowerCase(); |
| | | |
| | | if ((evtarget && (evtarget.tagName == 'INPUT' || evtarget.tagName == 'IMG'))) |
| | | if ((evtarget && (tagname == 'input' || tagname == 'img'))) |
| | | return true; |
| | | |
| | | // don't do anything (another action processed before) |
| | |
| | | |
| | | |
| | | /** |
| | | * get next/previous/last rows that are not hidden |
| | | * get first/next/previous/last rows that are not hidden |
| | | */ |
| | | get_next_row: function() |
| | | { |
| | |
| | | new_row = new_row.previousSibling; |
| | | |
| | | return new_row; |
| | | }, |
| | | |
| | | get_first_row: function() |
| | | { |
| | | if (this.rowcount) |
| | | { |
| | | var rows = this.list.tBodies[0].rows; |
| | | |
| | | for(var i=0; i<rows.length-1; i++) |
| | | if(rows[i].id && String(rows[i].id).match(/rcmrow([a-z0-9\-_=\+\/]+)/i) && this.rows[RegExp.$1] != null) |
| | | return RegExp.$1; |
| | | } |
| | | |
| | | return null; |
| | | }, |
| | | |
| | | get_last_row: function() |
| | |
| | | this.select_row(new_row.uid, false, false); |
| | | }, |
| | | |
| | | /** |
| | | * Select first row |
| | | */ |
| | | select_first: function() |
| | | { |
| | | var first_row = this.get_first_row(); |
| | | if (first_row) |
| | | this.select_row(first_row, false, false); |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * Perform selection when shift key is pressed |
| | |
| | | $(this.rows[n].obj).removeClass('selected').removeClass('unfocused'); |
| | | } |
| | | } |
| | | |
| | | // trigger event if selection changed |
| | | if (this.selection.join(',') != select_before) |
| | | this.triggerEvent('select'); |
| | | |
| | | this.focus(); |
| | | |
| | | return true; |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * Invert selection |
| | | */ |
| | | invert_selection: function() |
| | | { |
| | | if (!this.rows || !this.rows.length) |
| | | return false; |
| | | |
| | | // remember old selection |
| | | var select_before = this.selection.join(','); |
| | | |
| | | for (var n in this.rows) |
| | | this.highlight_row(n, true); |
| | | |
| | | // trigger event if selection changed |
| | | if (this.selection.join(',') != select_before) |
| | |
| | | { |
| | | case 27: |
| | | if (this.drag_active) |
| | | this.drag_mouse_up(e); |
| | | return this.drag_mouse_up(e); |
| | | |
| | | case 40: |
| | | case 38: |
| | | case 63233: |
| | |
| | | { |
| | | var pos = rcube_event.get_mouse_pos(e); |
| | | this.draglayer.css({ left:(pos.x+20)+'px', top:(pos.y-5 + (bw.ie ? document.documentElement.scrollTop : 0))+'px' }); |
| | | this.triggerEvent('dragmove', e); |
| | | this.triggerEvent('dragmove', e?e:window.event); |
| | | } |
| | | |
| | | this.drag_start = false; |
| | |
| | | rcube_event.remove_listener({element:document, event:'mousemove', object:this, method:'drag_mouse_move'}); |
| | | rcube_event.remove_listener({element:document, event:'mouseup', object:this, method:'drag_mouse_up'}); |
| | | |
| | | var iframes = document.getElementsByTagName('IFRAME'); |
| | | var iframes = document.getElementsByTagName('iframe'); |
| | | for (var n in iframes) { |
| | | var iframedoc; |
| | | |
| | |
| | | set_background_mode: function(flag) |
| | | { |
| | | if (flag) { |
| | | this.background = document.createElement('TBODY'); |
| | | this.background = document.createElement('tbody'); |
| | | } else if (this.background) { |
| | | this.list.replaceChild(this.background, this.list.tBodies[0]); |
| | | this.background = null; |