rcube_list_widget.rows is not an array - fixed checking if it's empty (#1489359)

pull/125/merge
Aleksander Machniak 11 years ago
parent 170702fd13
commit 85fece2c4d

@ -2832,10 +2832,10 @@ function rcube_webmail()
{ {
var len = a_uids.length, var len = a_uids.length,
i, uid, all_deleted = true, i, uid, all_deleted = true,
rows = this.message_list ? this.message_list.rows : []; rows = this.message_list ? this.message_list.rows : {};
if (len == 1) { if (len == 1) {
if (!rows.length || (rows[a_uids[0]] && !rows[a_uids[0]].deleted)) if (!this.message_list || (rows[a_uids[0]] && !rows[a_uids[0]].deleted))
this.flag_as_deleted(a_uids); this.flag_as_deleted(a_uids);
else else
this.flag_as_undeleted(a_uids); this.flag_as_undeleted(a_uids);
@ -2876,7 +2876,7 @@ function rcube_webmail()
var r_uids = [], var r_uids = [],
post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: 'delete'}), post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: 'delete'}),
lock = this.display_message(this.get_label('markingmessage'), 'loading'), lock = this.display_message(this.get_label('markingmessage'), 'loading'),
rows = this.message_list ? this.message_list.rows : [], rows = this.message_list ? this.message_list.rows : {},
count = 0; count = 0;
for (var i=0, len=a_uids.length; i<len; i++) { for (var i=0, len=a_uids.length; i<len; i++) {
@ -2896,7 +2896,7 @@ function rcube_webmail()
// make sure there are no selected rows // make sure there are no selected rows
if (this.env.skip_deleted && this.message_list) { if (this.env.skip_deleted && this.message_list) {
if(!this.env.display_next) if (!this.env.display_next)
this.message_list.clear_selection(); this.message_list.clear_selection();
if (count < 0) if (count < 0)
post_data._count = (count*-1); post_data._count = (count*-1);
@ -2920,7 +2920,7 @@ function rcube_webmail()
this.flag_deleted_as_read = function(uids) this.flag_deleted_as_read = function(uids)
{ {
var icn_src, uid, i, len, var icn_src, uid, i, len,
rows = this.message_list ? this.message_list.rows : []; rows = this.message_list ? this.message_list.rows : {};
uids = String(uids).split(','); uids = String(uids).split(',');

@ -35,7 +35,7 @@ function rcube_list_widget(list, p)
this.tbody; this.tbody;
this.fixed_header; this.fixed_header;
this.frame = null; this.frame = null;
this.rows = []; this.rows = {};
this.selection = []; this.selection = [];
this.rowcount = 0; this.rowcount = 0;
this.colcount = 0; this.colcount = 0;
@ -86,7 +86,7 @@ init: function()
} }
if (this.tbody) { if (this.tbody) {
this.rows = []; this.rows = {};
this.rowcount = 0; this.rowcount = 0;
var r, len, rows = this.tbody.childNodes; var r, len, rows = this.tbody.childNodes;
@ -240,7 +240,7 @@ clear: function(sel)
$(this.row_tagname() + ':not(.thead)', this.tbody).remove(); $(this.row_tagname() + ':not(.thead)', this.tbody).remove();
} }
this.rows = []; this.rows = {};
this.rowcount = 0; this.rowcount = 0;
if (sel) if (sel)
@ -471,7 +471,7 @@ click_row: function(e, id)
this.in_selection_before = false; this.in_selection_before = false;
// row was double clicked // row was double clicked
if (this.rows && dblclicked && this.in_selection(id)) { if (this.rowcount && dblclicked && this.in_selection(id)) {
this.triggerEvent('dblclick'); this.triggerEvent('dblclick');
now = 0; now = 0;
} }
@ -703,7 +703,7 @@ update_expando: function(uid, expanded)
*/ */
get_next_row: function() get_next_row: function()
{ {
if (!this.rows) if (!this.rowcount)
return false; return false;
var last_selected_row = this.rows[this.last_selected], var last_selected_row = this.rows[this.last_selected],
@ -717,7 +717,7 @@ get_next_row: function()
get_prev_row: function() get_prev_row: function()
{ {
if (!this.rows) if (!this.rowcount)
return false; return false;
var last_selected_row = this.rows[this.last_selected], var last_selected_row = this.rows[this.last_selected],
@ -969,7 +969,7 @@ in_selection: function(id)
*/ */
select_all: function(filter) select_all: function(filter)
{ {
if (!this.rows || !this.rows.length) if (!this.rowcount)
return false; return false;
// reset but remember selection first // reset but remember selection first
@ -1001,7 +1001,7 @@ select_all: function(filter)
*/ */
invert_selection: function() invert_selection: function()
{ {
if (!this.rows || !this.rows.length) if (!this.rowcount)
return false; return false;
// remember old selection // remember old selection

Loading…
Cancel
Save