- When read-status column is disabled create status icon in subject column

- Change read-status column icons so they are working like in flag column
- Some js code cleanup
release-0.6
alecpl 14 years ago
parent 8b6eff6e69
commit 98f2c93209

@ -1545,23 +1545,28 @@ function rcube_webmail()
this.init_message_row = function(row) this.init_message_row = function(row)
{ {
var expando, self = this, uid = row.uid; var expando, self = this, uid = row.uid,
status_icon = (this.env.status_col != null ? 'status' : 'msg') + 'icn' + row.uid;
if (uid && this.env.messages[uid]) if (uid && this.env.messages[uid])
$.extend(row, this.env.messages[uid]); $.extend(row, this.env.messages[uid]);
row.msgicon = document.getElementById('msgicn'+row.uid); // set eventhandler to status icon
if (row.icon = document.getElementById(status_icon)) {
// set eventhandler to message status icon
if (row.icon = document.getElementById('statusicn'+row.uid)) {
row.icon._row = row.obj; row.icon._row = row.obj;
row.icon.onmousedown = function(e) { self.command('toggle_status', this); rcube_event.cancel(e); }; row.icon.onmousedown = function(e) { self.command('toggle_status', this); rcube_event.cancel(e); };
} }
// save message icon position too
if (this.env.status_col != null)
row.msgicon = document.getElementById('msgicn'+row.uid);
else
row.msgicon = row.icon;
// set eventhandler to flag icon, if icon found // set eventhandler to flag icon, if icon found
if (this.env.flagged_col != null && (row.flagged_icon = document.getElementById('flagicn'+row.uid))) { if (this.env.flagged_col != null && (row.flagicon = document.getElementById('flagicn'+row.uid))) {
row.flagged_icon._row = row.obj; row.flagicon._row = row.obj;
row.flagged_icon.onmousedown = function(e) { self.command('toggle_flag', this); rcube_event.cancel(e); }; row.flagicon.onmousedown = function(e) { self.command('toggle_flag', this); rcube_event.cancel(e); };
} }
if (!row.depth && row.has_children && (expando = document.getElementById('rcmexpando'+row.uid))) { if (!row.depth && row.has_children && (expando = document.getElementById('rcmexpando'+row.uid))) {
@ -1622,8 +1627,15 @@ function rcube_webmail()
// message status icons // message status icons
css_class = 'msgicon'; css_class = 'msgicon';
if (!flags.unread && flags.unread_children > 0) if (this.env.status_col === null) {
css_class += ' unreadchildren'; css_class += ' status';
if (flags.deleted)
css_class += ' deleted';
else if (flags.unread)
css_class += ' unread';
else if (flags.unread_children > 0)
css_class += ' unreadchildren';
}
if (flags.replied) if (flags.replied)
css_class += ' replied'; css_class += ' replied';
if (flags.forwarded) if (flags.forwarded)
@ -1694,6 +1706,8 @@ function rcube_webmail()
css_class = 'deleted'; css_class = 'deleted';
else if (flags.unread) else if (flags.unread)
css_class = 'unread'; css_class = 'unread';
else if (flags.unread_children > 0)
css_class = 'unreadchildren';
else else
css_class = 'msgicon'; css_class = 'msgicon';
html = '<span id="statusicn'+uid+'" class="'+css_class+'">&nbsp;</span>'; html = '<span id="statusicn'+uid+'" class="'+css_class+'">&nbsp;</span>';
@ -2220,84 +2234,94 @@ function rcube_webmail()
this.set_message_icon = function(uid) this.set_message_icon = function(uid)
{ {
var css_class, var css_class,
rows = this.message_list.rows; row = this.message_list.rows[uid];
if (!rows[uid]) if (!row)
return false; return false;
if (rows[uid].icon) { if (row.icon) {
if (rows[uid].deleted) css_class = 'msgicon';
css_class = 'deleted'; if (row.deleted)
else if (rows[uid].unread) css_class += ' deleted';
css_class = 'unread'; else if (row.unread)
else css_class += ' unread';
css_class = 'msgicon'; else if (row.unread_children)
css_class += ' unreadchildren';
if (row.msgicon == row.icon) {
if (row.replied)
css_class += ' replied';
if (row.forwarded)
css_class += ' forwarded';
css_class += ' status';
}
rows[uid].icon.className = css_class; row.icon.className = css_class;
} }
if (rows[uid].msgicon) { if (row.msgicon && row.msgicon != row.icon) {
css_class = 'msgicon'; css_class = 'msgicon';
if (!rows[uid].unread && rows[uid].unread_children) if (!row.unread && row.unread_children)
css_class += ' unreadchildren'; css_class += ' unreadchildren';
if (rows[uid].replied) if (row.replied)
css_class += ' replied'; css_class += ' replied';
if (rows[uid].forwarded) if (row.forwarded)
css_class += ' forwarded'; css_class += ' forwarded';
rows[uid].msgicon.className = css_class; row.msgicon.className = css_class;
} }
if (rows[uid].flagged_icon) { if (row.flagicon) {
css_class = (rows[uid].flagged ? 'flagged' : 'unflagged'); css_class = (row.flagged ? 'flagged' : 'unflagged');
rows[uid].flagged_icon.className = css_class; row.flagicon.className = css_class;
} }
}; };
// set message status // set message status
this.set_message_status = function(uid, flag, status) this.set_message_status = function(uid, flag, status)
{ {
var rows = this.message_list.rows; var row = this.message_list.rows[uid];
if (!rows[uid]) return false; if (!row)
return false;
if (flag == 'unread') if (flag == 'unread')
rows[uid].unread = status; row.unread = status;
else if(flag == 'deleted') else if(flag == 'deleted')
rows[uid].deleted = status; row.deleted = status;
else if (flag == 'replied') else if (flag == 'replied')
rows[uid].replied = status; row.replied = status;
else if (flag == 'forwarded') else if (flag == 'forwarded')
rows[uid].forwarded = status; row.forwarded = status;
else if (flag == 'flagged') else if (flag == 'flagged')
rows[uid].flagged = status; row.flagged = status;
}; };
// set message row status, class and icon // set message row status, class and icon
this.set_message = function(uid, flag, status) this.set_message = function(uid, flag, status)
{ {
var rows = this.message_list.rows; var row = this.message_list.rows[uid];
if (!rows[uid]) return false; if (!row)
return false;
if (flag) if (flag)
this.set_message_status(uid, flag, status); this.set_message_status(uid, flag, status);
var rowobj = $(rows[uid].obj); var rowobj = $(row.obj);
if (rows[uid].unread && !rowobj.hasClass('unread')) if (row.unread && !rowobj.hasClass('unread'))
rowobj.addClass('unread'); rowobj.addClass('unread');
else if (!rows[uid].unread && rowobj.hasClass('unread')) else if (!row.unread && rowobj.hasClass('unread'))
rowobj.removeClass('unread'); rowobj.removeClass('unread');
if (rows[uid].deleted && !rowobj.hasClass('deleted')) if (row.deleted && !rowobj.hasClass('deleted'))
rowobj.addClass('deleted'); rowobj.addClass('deleted');
else if (!rows[uid].deleted && rowobj.hasClass('deleted')) else if (!row.deleted && rowobj.hasClass('deleted'))
rowobj.removeClass('deleted'); rowobj.removeClass('deleted');
if (rows[uid].flagged && !rowobj.hasClass('flagged')) if (row.flagged && !rowobj.hasClass('flagged'))
rowobj.addClass('flagged'); rowobj.addClass('flagged');
else if (!rows[uid].flagged && rowobj.hasClass('flagged')) else if (!row.flagged && rowobj.hasClass('flagged'))
rowobj.removeClass('flagged'); rowobj.removeClass('flagged');
this.set_unread_children(uid); this.set_unread_children(uid);
@ -4681,6 +4705,7 @@ function rcube_webmail()
this.env.subject_col = null; this.env.subject_col = null;
this.env.flagged_col = null; this.env.flagged_col = null;
this.env.status_col = null;
if ((n = $.inArray('subject', this.env.coltypes)) >= 0) { if ((n = $.inArray('subject', this.env.coltypes)) >= 0) {
this.set_env('subject_col', n); this.set_env('subject_col', n);
@ -4689,6 +4714,8 @@ function rcube_webmail()
} }
if ((n = $.inArray('flag', this.env.coltypes)) >= 0) if ((n = $.inArray('flag', this.env.coltypes)) >= 0)
this.set_env('flagged_col', n); this.set_env('flagged_col', n);
if ((n = $.inArray('status', this.env.coltypes)) >= 0)
this.set_env('status_col', n);
this.message_list.init_header(); this.message_list.init_header();
}; };

@ -130,12 +130,16 @@ ul.toolbarmenu li.separator_below
#messagelist tr td.flag span.unflagged:hover, #messagelist tr td.flag span.unflagged:hover,
#messagelist tr td.status span.status, #messagelist tr td.status span.status,
#messagelist tr td.status span.msgicon, #messagelist tr td.status span.msgicon,
#messagelist tr td.status span.unread,
#messagelist tr td.status span.deleted, #messagelist tr td.status span.deleted,
#messagelist tr td.status span.unread,
#messagelist tr td.status span.unreadchildren,
#messagelist tr td.subject span.msgicon, #messagelist tr td.subject span.msgicon,
#messagelist tr td.subject span.msgicon.replied, #messagelist tr td.subject span.deleted,
#messagelist tr td.subject span.msgicon.forwarded, #messagelist tr td.subject span.unread,
#messagelist tr td.subject span.msgicon.unreadchildren #messagelist tr td.subject span.replied,
#messagelist tr td.subject span.forwarded,
#messagelist tr td.subject span.unreadchildren
{ {
background-image: url(images/messageicons.gif); background-image: url(images/messageicons.gif);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

@ -702,7 +702,8 @@ body.messagelist
} }
#messagelist tbody tr td.flag, #messagelist tbody tr td.flag,
#messagelist tbody tr td.status #messagelist tbody tr td.status,
#messagelist tbody tr td.subject span.status
{ {
cursor: pointer; cursor: pointer;
} }
@ -725,10 +726,13 @@ body.messagelist
#messagelist tr td.status span.msgicon, #messagelist tr td.status span.msgicon,
#messagelist tr td.status span.deleted, #messagelist tr td.status span.deleted,
#messagelist tr td.status span.unread, #messagelist tr td.status span.unread,
#messagelist tr td.status span.unreadchildren,
#messagelist tr td.subject span.msgicon, #messagelist tr td.subject span.msgicon,
#messagelist tr td.subject span.msgicon.replied, #messagelist tr td.subject span.deleted,
#messagelist tr td.subject span.msgicon.forwarded, #messagelist tr td.subject span.unread,
#messagelist tr td.subject span.msgicon.unreadchildren #messagelist tr td.subject span.replied,
#messagelist tr td.subject span.forwarded,
#messagelist tr td.subject span.unreadchildren
{ {
vertical-align: middle; vertical-align: middle;
height: 17px; height: 17px;
@ -757,39 +761,47 @@ body.messagelist
} }
#messagelist tr td.subject span.msgicon, #messagelist tr td.subject span.msgicon,
#messagelist tr td.subject span.msgicon.unreadchildren #messagelist tr td.subject span.unreadchildren
{ {
background-position: 0 -51px; background-position: 0 -51px;
margin: 0 2px; margin: 0 2px;
} }
#messagelist tr td.subject span.msgicon.replied #messagelist tr td.subject span.replied
{ {
background-position: 0 -85px; background-position: 0 -85px;
} }
#messagelist tr td.subject span.msgicon.forwarded #messagelist tr td.subject span.forwarded
{ {
background-position: 0 -68px; background-position: 0 -68px;
} }
#messagelist tr td.subject span.msgicon.replied.forwarded #messagelist tr td.subject span.replied.forwarded
{ {
background-position: 0 -102px; background-position: 0 -102px;
} }
#messagelist tr td.status span.msgicon #messagelist tr td.status span.msgicon,
#messagelist tr td.status span.unreadchildren
{ {
background-position: 0 -51px; background-position: 0 17px; /* no icon */
} }
#messagelist tr td.status span.deleted #messagelist tr td.status span.msgicon:hover
{
background-position: 0 -272px;
}
#messagelist tr td.status span.deleted,
#messagelist tr td.subject span.deleted
{ {
background-position: 0 -187px; background-position: 0 -187px;
} }
#messagelist tr td.status span.status, #messagelist tr td.status span.status,
#messagelist tr td.status span.unread #messagelist tr td.status span.unread,
#messagelist tr td.subject span.unread
{ {
background-position: 0 -119px; background-position: 0 -119px;
} }

Loading…
Cancel
Save