|
|
@ -55,7 +55,6 @@ function rcube_list_widget(list, p)
|
|
|
|
this.column_fixed = null;
|
|
|
|
this.column_fixed = null;
|
|
|
|
this.last_selected = 0;
|
|
|
|
this.last_selected = 0;
|
|
|
|
this.shift_start = 0;
|
|
|
|
this.shift_start = 0;
|
|
|
|
this.in_selection_before = false;
|
|
|
|
|
|
|
|
this.focused = false;
|
|
|
|
this.focused = false;
|
|
|
|
this.drag_mouse_start = null;
|
|
|
|
this.drag_mouse_start = null;
|
|
|
|
this.dblclick_time = 500; // default value on MS Windows is 500
|
|
|
|
this.dblclick_time = 500; // default value on MS Windows is 500
|
|
|
@ -405,20 +404,15 @@ drag_column: function(e, col)
|
|
|
|
drag_row: function(e, id)
|
|
|
|
drag_row: function(e, id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// don't do anything (another action processed before)
|
|
|
|
// don't do anything (another action processed before)
|
|
|
|
var evtarget = rcube_event.get_target(e),
|
|
|
|
if (!this.is_event_target(e))
|
|
|
|
tagname = evtarget.tagName.toLowerCase();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (evtarget && (tagname == 'input' || tagname == 'img' || (tagname != 'a' && evtarget.onclick)))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
// accept right-clicks
|
|
|
|
// accept right-clicks
|
|
|
|
if (rcube_event.get_button(e) == 2)
|
|
|
|
if (rcube_event.get_button(e) == 2)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
this.in_selection_before = e && e.istouch || this.in_selection(id) ? id : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// selects currently unselected row
|
|
|
|
// selects currently unselected row
|
|
|
|
if (!this.in_selection_before) {
|
|
|
|
if (!(e && e.istouch || this.in_selection(id))) {
|
|
|
|
var mod_key = rcube_event.get_modifier(e);
|
|
|
|
var mod_key = rcube_event.get_modifier(e);
|
|
|
|
this.select_row(id, mod_key, false);
|
|
|
|
this.select_row(id, mod_key, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -446,22 +440,18 @@ drag_row: function(e, id)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
click_row: function(e, id)
|
|
|
|
click_row: function(e, id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var now = new Date().getTime(),
|
|
|
|
// don't do anything (another action processed before)
|
|
|
|
mod_key = rcube_event.get_modifier(e),
|
|
|
|
if (!this.is_event_target(e))
|
|
|
|
evtarget = rcube_event.get_target(e),
|
|
|
|
|
|
|
|
tagname = evtarget.tagName.toLowerCase();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((evtarget && (tagname == 'input' || tagname == 'img')))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
var dblclicked = now - this.rows[id].clicked < this.dblclick_time;
|
|
|
|
var now = new Date().getTime(),
|
|
|
|
|
|
|
|
dblclicked = now - this.rows[id].clicked < this.dblclick_time;
|
|
|
|
|
|
|
|
|
|
|
|
// selects/unselects currently selected row
|
|
|
|
// selects (or unselects currently selected) row
|
|
|
|
if (!this.drag_active && this.in_selection_before == id && !dblclicked)
|
|
|
|
if (!this.drag_active && !dblclicked)
|
|
|
|
this.select_row(id, mod_key, true);
|
|
|
|
this.select_row(id, rcube_event.get_modifier(e), true);
|
|
|
|
|
|
|
|
|
|
|
|
this.drag_start = false;
|
|
|
|
this.drag_start = false;
|
|
|
|
this.in_selection_before = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// row was double clicked
|
|
|
|
// row was double clicked
|
|
|
|
if (this.rowcount && dblclicked && this.in_selection(id)) {
|
|
|
|
if (this.rowcount && dblclicked && this.in_selection(id)) {
|
|
|
@ -482,6 +472,18 @@ click_row: function(e, id)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Check target of the current event
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
is_event_target: function(e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var target = rcube_event.get_target(e),
|
|
|
|
|
|
|
|
tagname = target.tagName.toLowerCase();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return !(target && (tagname == 'input' || tagname == 'img' || (tagname != 'a' && target.onclick)));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Returns thread root ID for specified row ID
|
|
|
|
* Returns thread root ID for specified row ID
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -856,15 +858,9 @@ select_first: function(mod_key)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var row = this.get_first_row();
|
|
|
|
var row = this.get_first_row();
|
|
|
|
if (row) {
|
|
|
|
if (row) {
|
|
|
|
if (mod_key) {
|
|
|
|
this.select_row(row, mod_key, false);
|
|
|
|
this.shift_select(row, mod_key);
|
|
|
|
|
|
|
|
this.triggerEvent('select');
|
|
|
|
|
|
|
|
this.scrollto(row);
|
|
|
|
this.scrollto(row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.select(row);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -875,15 +871,9 @@ select_last: function(mod_key)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var row = this.get_last_row();
|
|
|
|
var row = this.get_last_row();
|
|
|
|
if (row) {
|
|
|
|
if (row) {
|
|
|
|
if (mod_key) {
|
|
|
|
this.select_row(row, mod_key, false);
|
|
|
|
this.shift_select(row, mod_key);
|
|
|
|
|
|
|
|
this.triggerEvent('select');
|
|
|
|
|
|
|
|
this.scrollto(row);
|
|
|
|
this.scrollto(row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.select(row);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1255,14 +1245,15 @@ scrollto: function(id)
|
|
|
|
scroll_to = Number(row.offsetTop);
|
|
|
|
scroll_to = Number(row.offsetTop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(this.fixed_header)
|
|
|
|
if (this.fixed_header)
|
|
|
|
head_offset = Number(this.thead.offsetHeight);
|
|
|
|
head_offset = Number(this.thead.offsetHeight);
|
|
|
|
|
|
|
|
|
|
|
|
// if row is above the frame (or behind header)
|
|
|
|
// if row is above the frame (or behind header)
|
|
|
|
if (scroll_to < Number(this.frame.scrollTop) + head_offset) {
|
|
|
|
if (scroll_to < Number(this.frame.scrollTop) + head_offset) {
|
|
|
|
// scroll window so that row isn't behind header
|
|
|
|
// scroll window so that row isn't behind header
|
|
|
|
this.frame.scrollTop = scroll_to - head_offset;
|
|
|
|
this.frame.scrollTop = scroll_to - head_offset;
|
|
|
|
} else if (scroll_to + Number(row.offsetHeight) > Number(this.frame.scrollTop) + Number(this.frame.offsetHeight))
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (scroll_to + Number(row.offsetHeight) > Number(this.frame.scrollTop) + Number(this.frame.offsetHeight))
|
|
|
|
this.frame.scrollTop = (scroll_to + Number(row.offsetHeight)) - Number(this.frame.offsetHeight);
|
|
|
|
this.frame.scrollTop = (scroll_to + Number(row.offsetHeight)) - Number(this.frame.offsetHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|