alecpl
2010-10-18 98f2c93209dfb6277502ec0f29d5128e139cf0ff
- 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


5 files modified
163 ■■■■■ changed files
program/js/app.js 115 ●●●●● patch | view | raw | blame | history
skins/default/ie6hacks.css 12 ●●●●● patch | view | raw | blame | history
skins/default/images/messageicons.gif patch | view | raw | blame | history
skins/default/images/messageicons.png patch | view | raw | blame | history
skins/default/mail.css 36 ●●●●● patch | view | raw | blame | history
program/js/app.js
@@ -1545,23 +1545,28 @@
  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])
      $.extend(row, this.env.messages[uid]);
    row.msgicon = document.getElementById('msgicn'+row.uid);
    // set eventhandler to message status icon
    if (row.icon = document.getElementById('statusicn'+row.uid)) {
    // set eventhandler to status icon
    if (row.icon = document.getElementById(status_icon)) {
      row.icon._row = row.obj;
      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
    if (this.env.flagged_col != null && (row.flagged_icon = document.getElementById('flagicn'+row.uid))) {
      row.flagged_icon._row = row.obj;
      row.flagged_icon.onmousedown = function(e) { self.command('toggle_flag', this); rcube_event.cancel(e); };
    if (this.env.flagged_col != null && (row.flagicon = document.getElementById('flagicn'+row.uid))) {
      row.flagicon._row = row.obj;
      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))) {
@@ -1622,8 +1627,15 @@
    // message status icons
    css_class = 'msgicon';
    if (!flags.unread && flags.unread_children > 0)
      css_class += ' unreadchildren';
    if (this.env.status_col === null) {
      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)
      css_class += ' replied';
    if (flags.forwarded)
@@ -1694,6 +1706,8 @@
          css_class = 'deleted';
        else if (flags.unread)
          css_class = 'unread';
        else if (flags.unread_children > 0)
          css_class = 'unreadchildren';
        else
          css_class = 'msgicon';
        html = '<span id="statusicn'+uid+'" class="'+css_class+'">&nbsp;</span>';
@@ -2220,84 +2234,94 @@
  this.set_message_icon = function(uid)
  {
    var css_class,
      rows = this.message_list.rows;
      row = this.message_list.rows[uid];
    if (!rows[uid])
    if (!row)
      return false;
    if (rows[uid].icon) {
      if (rows[uid].deleted)
        css_class = 'deleted';
      else if (rows[uid].unread)
        css_class = 'unread';
      else
        css_class = 'msgicon';
    if (row.icon) {
      css_class = 'msgicon';
      if (row.deleted)
        css_class += ' deleted';
      else if (row.unread)
        css_class += ' unread';
      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';
      if (!rows[uid].unread && rows[uid].unread_children)
      if (!row.unread && row.unread_children)
        css_class += ' unreadchildren';
      if (rows[uid].replied)
      if (row.replied)
        css_class += ' replied';
      if (rows[uid].forwarded)
      if (row.forwarded)
        css_class += ' forwarded';
      rows[uid].msgicon.className = css_class;
      row.msgicon.className = css_class;
    }
    if (rows[uid].flagged_icon) {
      css_class = (rows[uid].flagged ? 'flagged' : 'unflagged');
      rows[uid].flagged_icon.className = css_class;
    if (row.flagicon) {
      css_class = (row.flagged ? 'flagged' : 'unflagged');
      row.flagicon.className = css_class;
    }
  };
  // set message 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')
      rows[uid].unread = status;
      row.unread = status;
    else if(flag == 'deleted')
      rows[uid].deleted = status;
      row.deleted = status;
    else if (flag == 'replied')
      rows[uid].replied = status;
      row.replied = status;
    else if (flag == 'forwarded')
      rows[uid].forwarded = status;
      row.forwarded = status;
    else if (flag == 'flagged')
      rows[uid].flagged = status;
      row.flagged = status;
  };
  // set message row status, class and icon
  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)
      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');
    else if (!rows[uid].unread && rowobj.hasClass('unread'))
    else if (!row.unread && rowobj.hasClass('unread'))
      rowobj.removeClass('unread');
    if (rows[uid].deleted && !rowobj.hasClass('deleted'))
    if (row.deleted && !rowobj.hasClass('deleted'))
      rowobj.addClass('deleted');
    else if (!rows[uid].deleted && rowobj.hasClass('deleted'))
    else if (!row.deleted && rowobj.hasClass('deleted'))
      rowobj.removeClass('deleted');
    if (rows[uid].flagged && !rowobj.hasClass('flagged'))
    if (row.flagged && !rowobj.hasClass('flagged'))
      rowobj.addClass('flagged');
    else if (!rows[uid].flagged && rowobj.hasClass('flagged'))
    else if (!row.flagged && rowobj.hasClass('flagged'))
      rowobj.removeClass('flagged');
    this.set_unread_children(uid);
@@ -4681,6 +4705,7 @@
    this.env.subject_col = null;
    this.env.flagged_col = null;
    this.env.status_col = null;
    if ((n = $.inArray('subject', this.env.coltypes)) >= 0) {
      this.set_env('subject_col', n);
@@ -4689,6 +4714,8 @@
    }
    if ((n = $.inArray('flag', this.env.coltypes)) >= 0)
      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();
  };
skins/default/ie6hacks.css
@@ -130,12 +130,16 @@
#messagelist tr td.flag span.unflagged:hover,
#messagelist tr td.status span.status,
#messagelist tr td.status span.msgicon,
#messagelist tr td.status span.unread,
#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.replied,
#messagelist tr td.subject span.msgicon.forwarded,
#messagelist tr td.subject span.msgicon.unreadchildren
#messagelist tr td.subject span.deleted,
#messagelist tr td.subject span.unread,
#messagelist tr td.subject span.replied,
#messagelist tr td.subject span.forwarded,
#messagelist tr td.subject span.unreadchildren
{
  background-image: url(images/messageicons.gif);
}
skins/default/images/messageicons.gif

skins/default/images/messageicons.png

skins/default/mail.css
@@ -702,7 +702,8 @@
}
#messagelist tbody tr td.flag,
#messagelist tbody tr td.status
#messagelist tbody tr td.status,
#messagelist tbody tr td.subject span.status
{
  cursor: pointer;
}
@@ -725,10 +726,13 @@
#messagelist tr td.status span.msgicon,
#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.replied,
#messagelist tr td.subject span.msgicon.forwarded,
#messagelist tr td.subject span.msgicon.unreadchildren
#messagelist tr td.subject span.deleted,
#messagelist tr td.subject span.unread,
#messagelist tr td.subject span.replied,
#messagelist tr td.subject span.forwarded,
#messagelist tr td.subject span.unreadchildren
{
  vertical-align: middle;
  height: 17px;
@@ -757,39 +761,47 @@
}
#messagelist tr td.subject span.msgicon,
#messagelist tr td.subject span.msgicon.unreadchildren
#messagelist tr td.subject span.unreadchildren
{
  background-position: 0 -51px;
  margin: 0 2px;
}
#messagelist tr td.subject span.msgicon.replied
#messagelist tr td.subject span.replied
{
  background-position: 0 -85px;
}
#messagelist tr td.subject span.msgicon.forwarded
#messagelist tr td.subject span.forwarded
{
  background-position: 0 -68px;
}
#messagelist tr td.subject span.msgicon.replied.forwarded
#messagelist tr td.subject span.replied.forwarded
{
  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;
}
#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;
}