| | |
| | | this.rows = []; |
| | | this.rowcount = 0; |
| | | |
| | | var row, r; |
| | | var r, len, rows = this.list.tBodies[0].rows; |
| | | |
| | | for (r=0; r<this.list.tBodies[0].rows.length; r++) { |
| | | row = this.list.tBodies[0].rows[r]; |
| | | this.init_row(row); |
| | | for (r=0, len=rows.length; r<len; r++) { |
| | | this.init_row(rows[r]); |
| | | this.rowcount++; |
| | | } |
| | | |
| | |
| | | if (sel_next) |
| | | this.select_next(); |
| | | |
| | | this.rows[uid] = null; |
| | | delete this.rows[uid]; |
| | | this.rowcount--; |
| | | }, |
| | | |
| | |
| | | */ |
| | | insert_row: function(row, attop) |
| | | { |
| | | if (this.background) |
| | | var tbody = this.background; |
| | | else |
| | | var tbody = this.list.tBodies[0]; |
| | | var tbody = this.list.tBodies[0]; |
| | | |
| | | if (attop && tbody.rows.length) |
| | | tbody.insertBefore(row, tbody.firstChild); |
| | |
| | | */ |
| | | focus: function(e) |
| | | { |
| | | var id; |
| | | this.focused = true; |
| | | for (var n=0; n<this.selection.length; n++) { |
| | | for (var n in this.selection) { |
| | | id = this.selection[n]; |
| | | if (this.rows[id] && this.rows[id].obj) { |
| | | $(this.rows[id].obj).addClass('selected').removeClass('unfocused'); |
| | |
| | | { |
| | | var id; |
| | | this.focused = false; |
| | | for (var n=0; n<this.selection.length; n++) { |
| | | for (var n in this.selection) { |
| | | id = this.selection[n]; |
| | | if (this.rows[id] && this.rows[id].obj) { |
| | | $(this.rows[id].obj).removeClass('selected').addClass('unfocused'); |
| | |
| | | get_first_row: function() |
| | | { |
| | | if (this.rowcount) { |
| | | var rows = this.list.tBodies[0].rows; |
| | | var i, len, 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; |
| | | for (i=0, len=rows.length-1; i<len; 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() |
| | | { |
| | | if (this.rowcount) { |
| | | var rows = this.list.tBodies[0].rows; |
| | | var i, rows = this.list.tBodies[0].rows; |
| | | |
| | | for(var i=rows.length-1; i>=0; i--) |
| | | if(rows[i].id && String(rows[i].id).match(/rcmrow([a-z0-9\-_=\+\/]+)/i) && this.rows[RegExp.$1] != null) |
| | | |
| | | return RegExp.$1; |
| | | for (i=rows.length-1; i>=0; 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; |
| | |
| | | if (!this.rows[this.shift_start] || !this.selection.length) |
| | | this.shift_start = id; |
| | | |
| | | var from_rowIndex = this.rows[this.shift_start].obj.rowIndex; |
| | | var to_rowIndex = this.rows[id].obj.rowIndex; |
| | | |
| | | var i = ((from_rowIndex < to_rowIndex)? from_rowIndex : to_rowIndex); |
| | | var j = ((from_rowIndex > to_rowIndex)? from_rowIndex : to_rowIndex); |
| | | var from_rowIndex = this.rows[this.shift_start].obj.rowIndex, |
| | | to_rowIndex = this.rows[id].obj.rowIndex, |
| | | i = ((from_rowIndex < to_rowIndex)? from_rowIndex : to_rowIndex), |
| | | j = ((from_rowIndex > to_rowIndex)? from_rowIndex : to_rowIndex); |
| | | |
| | | // iterate through the entire message list |
| | | for (var n in this.rows) { |
| | | if ((this.rows[n].obj.rowIndex >= i) && (this.rows[n].obj.rowIndex <= j)) { |
| | | if (this.rows[n].obj.rowIndex >= i && this.rows[n].obj.rowIndex <= j) { |
| | | if (!this.in_selection(n)) { |
| | | this.highlight_row(n, true); |
| | | } |
| | |
| | | this.selection = []; |
| | | |
| | | for (var n in this.rows) { |
| | | if (!filter || (this.rows[n] && this.rows[n][filter] == true)) { |
| | | if (!filter || this.rows[n][filter] == true) { |
| | | this.last_selected = n; |
| | | this.highlight_row(n, true); |
| | | } |
| | | else if (this.rows[n]) { |
| | | else { |
| | | $(this.rows[n].obj).removeClass('selected').removeClass('unfocused'); |
| | | } |
| | | } |
| | |
| | | |
| | | // one row |
| | | if (id) { |
| | | for (var n=0; n<this.selection.length; n++) |
| | | for (var n=0 in this.selection) |
| | | if (this.selection[n] == id) { |
| | | this.selection.splice(n,1); |
| | | break; |
| | |
| | | } |
| | | // all rows |
| | | else { |
| | | for (var n=0; n<this.selection.length; n++) |
| | | for (var n in this.selection) |
| | | if (this.rows[this.selection[n]]) { |
| | | $(this.rows[this.selection[n]].obj).removeClass('selected').removeClass('unfocused'); |
| | | } |
| | |
| | | .appendTo(document.body); |
| | | |
| | | // also select childs of (collapsed) threads for dragging |
| | | var selection = $.merge([], this.selection); |
| | | var depth, row, uid, r; |
| | | for (var n=0; n < selection.length; n++) { |
| | | var n, uid, selection = $.merge([], this.selection); |
| | | for (n in selection) { |
| | | uid = selection[n]; |
| | | if (this.rows[uid].has_children && !this.rows[uid].expanded) |
| | | this.select_childs(uid); |
| | |
| | | // get subjects of selected messages |
| | | var names = ''; |
| | | var c, i, subject, obj; |
| | | for(var n=0; n<this.selection.length; n++) { |
| | | for (var n=0; n<this.selection.length; n++) { |
| | | // only show 12 lines |
| | | if (n>12) { |
| | | names += '...'; |
| | |
| | | this.subject_col = to > from ? to - 1 : to; |
| | | |
| | | this.triggerEvent('column_replace'); |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * Creating the list in background |
| | | */ |
| | | set_background_mode: function(flag) |
| | | { |
| | | if (flag) { |
| | | this.background = document.createElement('tbody'); |
| | | } else if (this.background) { |
| | | this.list.replaceChild(this.background, this.list.tBodies[0]); |
| | | this.background = null; |
| | | } |
| | | } |
| | | |
| | | }; |