- some fixes in message list columns handling

release-0.6
alecpl 15 years ago
parent 6c9d496fcc
commit c3eab29e19

@ -1727,16 +1727,13 @@ function rcube_webmail()
name = oldcols[i] == 'to' ? 'from' : oldcols[i]; name = oldcols[i] == 'to' ? 'from' : oldcols[i];
idx = $.inArray(name, cols); idx = $.inArray(name, cols);
if (idx != -1) { if (idx != -1) {
newcols[newcols.length] = name; newcols.push(name);
delete cols[idx]; delete cols[idx];
} }
else if (name == 'threads') {
delete oldcols[i];
}
} }
for (i=0; i<cols.length; i++) for (i=0; i<cols.length; i++)
if (cols[i]) if (cols[i])
newcols[newcols.length] = cols[i]; newcols.push(cols[i]);
if (newcols.join() != oldcols.join()) { if (newcols.join() != oldcols.join()) {
update = 1; update = 1;
@ -4570,54 +4567,50 @@ function rcube_webmail()
this.env.coltypes = coltypes; this.env.coltypes = coltypes;
// set correct list titles // set correct list titles
var thead = this.gui_objects.messagelist ? this.gui_objects.messagelist.tHead : null; var thead = this.gui_objects.messagelist ? this.gui_objects.messagelist.tHead : null,
cell, col, n, len;
// replace old column headers // replace old column headers
if (thead && repl) { if (thead) {
for (var cell, c=0; c < repl.length; c++) { if (repl) {
cell = thead.rows[0].cells[c]; var th = document.createElement('thead'),
if (!cell) { tr = document.createElement('tr');
for (c=0, len=repl.length; c < len; c++) {
cell = document.createElement('td'); cell = document.createElement('td');
thead.rows[0].appendChild(cell); cell.innerHTML = repl[c].html;
if (repl[c].id) cell.id = repl[c].id;
if (repl[c].className) cell.className = repl[c].className;
tr.appendChild(cell);
} }
cell.innerHTML = repl[c].html; th.appendChild(tr);
if (repl[c].id) cell.id = repl[c].id; thead.parentNode.replaceChild(th, thead);
if (repl[c].className) cell.className = repl[c].className;
} }
}
var cell, col, n; for (n=0, len=this.env.coltypes.length; n<len; n++) {
for (n=0; thead && n<this.env.coltypes.length; n++) { col = this.env.coltypes[n];
col = this.env.coltypes[n]; if ((cell = thead.rows[0].cells[n]) && (col=='from' || col=='to')) {
if ((cell = thead.rows[0].cells[n]) && (col=='from' || col=='to')) { cell.id = 'rcm'+col;
// if we have links for sorting, it's a bit more complicated... // if we have links for sorting, it's a bit more complicated...
if (cell.firstChild && cell.firstChild.tagName.toLowerCase()=='a') { if (cell.firstChild && cell.firstChild.tagName.toLowerCase()=='a') {
cell.firstChild.innerHTML = this.get_label(this.env.coltypes[n]); cell = cell.firstChild;
cell.firstChild.onclick = function(){ return rcmail.command('sort', this.__col, this); }; cell.onclick = function(){ return rcmail.command('sort', this.__col, this); };
cell.firstChild.__col = col; cell.__col = col;
}
cell.innerHTML = this.get_label(col);
} }
else
cell.innerHTML = this.get_label(this.env.coltypes[n]);
cell.id = 'rcm'+col;
} }
} }
// remove excessive columns
for (var i=n+1; thead && i<thead.rows[0].cells.length; i++)
thead.rows[0].removeChild(thead.rows[0].cells[i]);
this.env.subject_col = null; this.env.subject_col = null;
this.env.flagged_col = null; this.env.flagged_col = null;
var found; if ((n = $.inArray('subject', this.env.coltypes)) >= 0) {
if ((found = $.inArray('subject', this.env.coltypes)) >= 0) { this.set_env('subject_col', n);
this.set_env('subject_col', found);
if (this.message_list) if (this.message_list)
this.message_list.subject_col = found; this.message_list.subject_col = n;
} }
if ((found = $.inArray('flag', this.env.coltypes)) >= 0) if ((n = $.inArray('flag', this.env.coltypes)) >= 0)
this.set_env('flagged_col', found); this.set_env('flagged_col', n);
this.message_list.init_header(); this.message_list.init_header();
}; };

@ -172,7 +172,7 @@
<roundcube:endif /> <roundcube:endif />
<fieldset class="thinbordered"><legend><roundcube:label name="listcolumns" /></legend> <fieldset class="thinbordered"><legend><roundcube:label name="listcolumns" /></legend>
<ul class="toolbarmenu"> <ul class="toolbarmenu">
<li><input type="checkbox" name="list_col[]" value="flag" id="cols_flag" /><label for="cols_flag"><roundcube:label name="flag" /></label></li> <li><input type="checkbox" name="list_col[]" value="threads" id="cols_threads" checked="checked" disabled="disabled" /><label for="cols_threads" class="disabled"><roundcube:label name="threads" /></label></li>
<li><input type="checkbox" name="list_col[]" value="subject" id="cols_subject" checked="checked" disabled="disabled" /><label for="cols_subject" class="disabled"><roundcube:label name="subject" /></label></li> <li><input type="checkbox" name="list_col[]" value="subject" id="cols_subject" checked="checked" disabled="disabled" /><label for="cols_subject" class="disabled"><roundcube:label name="subject" /></label></li>
<li><input type="checkbox" name="list_col[]" value="from" id="cols_fromto" /><label for="cols_fromto"><roundcube:label name="fromto" /></label></li> <li><input type="checkbox" name="list_col[]" value="from" id="cols_fromto" /><label for="cols_fromto"><roundcube:label name="fromto" /></label></li>
<li><input type="checkbox" name="list_col[]" value="replyto" id="cols_replyto" /><label for="cols_replyto"><roundcube:label name="replyto" /></label></li> <li><input type="checkbox" name="list_col[]" value="replyto" id="cols_replyto" /><label for="cols_replyto"><roundcube:label name="replyto" /></label></li>
@ -180,6 +180,7 @@
<li><input type="checkbox" name="list_col[]" value="date" id="cols_date" /><label for="cols_date"><roundcube:label name="date" /></label></li> <li><input type="checkbox" name="list_col[]" value="date" id="cols_date" /><label for="cols_date"><roundcube:label name="date" /></label></li>
<li><input type="checkbox" name="list_col[]" value="size" id="cols_size" /><label for="cols_size"><roundcube:label name="size" /></label></li> <li><input type="checkbox" name="list_col[]" value="size" id="cols_size" /><label for="cols_size"><roundcube:label name="size" /></label></li>
<li><input type="checkbox" name="list_col[]" value="attachment" id="cols_attachment" /><label for="cols_attachment"><roundcube:label name="attachment" /></label></li> <li><input type="checkbox" name="list_col[]" value="attachment" id="cols_attachment" /><label for="cols_attachment"><roundcube:label name="attachment" /></label></li>
<li><input type="checkbox" name="list_col[]" value="flag" id="cols_flag" /><label for="cols_flag"><roundcube:label name="flag" /></label></li>
</ul> </ul>
</fieldset> </fieldset>
<fieldset class="thinbordered"><legend><roundcube:label name="listsorting" /></legend> <fieldset class="thinbordered"><legend><roundcube:label name="listsorting" /></legend>

Loading…
Cancel
Save