summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-10-08 06:47:54 +0000
committeralecpl <alec@alec.pl>2010-10-08 06:47:54 +0000
commite9470683bf6f8a4995097512247c4a7f941315eb (patch)
treeed289584e6e7db0bb8764ab2283e444a958f1c28 /program
parentf22ea7ba1875863890b486db3e5f448f99c1debc (diff)
- Use css sprite image for messages list
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js106
-rw-r--r--program/steps/mail/func.inc28
2 files changed, 51 insertions, 83 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 93db9b93e..9c3252f53 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -368,7 +368,7 @@ function rcube_webmail()
$('#rcmlogintz').val(new Date().getTimezoneOffset() / -60);
// display 'loading' message on form submit
- $('form').submit(function () {
+ $('form').submit(function () {
rcmail.display_message(rcmail.get_label('loading'), 'loading', true);
});
@@ -1526,13 +1526,13 @@ function rcube_webmail()
// set eventhandler to message icon
if (this.env.subject_col != null && (row.icon = document.getElementById('msgicn'+row.uid))) {
row.icon._row = row.obj;
- row.icon.onmousedown = function(e) { self.command('toggle_status', this); };
+ row.icon.onmousedown = function(e) { self.command('toggle_status', this); rcube_event.cancel(e); };
}
// set eventhandler to flag icon, if icon found
- if (this.env.flagged_col != null && (row.flagged_icon = document.getElementById('flaggedicn'+row.uid))) {
+ 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); };
+ row.flagged_icon.onmousedown = function(e) { self.command('toggle_flag', this); rcube_event.cancel(e); };
}
if (!row.depth && row.has_children && (expando = document.getElementById('rcmexpando'+row.uid))) {
@@ -1569,7 +1569,7 @@ function rcube_webmail()
flags: flags.extra_flags
});
- var c, tree = expando = '',
+ var c, html, tree = expando = '',
list = this.message_list,
rows = list.rows,
tbody = this.gui_objects.messagelist.tBodies[0],
@@ -1591,21 +1591,19 @@ function rcube_webmail()
row.className = css_class;
// message status icon
- var icon = this.env.messageicon;
- if (!flags.unread && flags.unread_children > 0 && this.env.unreadchildrenicon)
- icon = this.env.unreadchildrenicon;
- else if (flags.deleted && this.env.deletedicon)
- icon = this.env.deletedicon;
- else if (flags.replied && this.env.repliedicon) {
- if (flags.forwarded && this.env.forwardedrepliedicon)
- icon = this.env.forwardedrepliedicon;
- else
- icon = this.env.repliedicon;
- }
- else if (flags.forwarded && this.env.forwardedicon)
- icon = this.env.forwardedicon;
- else if(flags.unread && this.env.unreadicon)
- icon = this.env.unreadicon;
+ css_class = 'msgicon';
+ if (!flags.unread && flags.unread_children > 0)
+ css_class += ' unreadchildren';
+ if (flags.deleted)
+ css_class += ' deleted';
+ else if (flags.replied || flags.forwarded) {
+ if (flags.replied)
+ css_class += ' replied';
+ if (flags.forwarded)
+ css_class += ' forwarded';
+ }
+ else if (flags.unread)
+ css_class += ' unread';
// update selection
if (message.selected && !list.in_selection(uid))
@@ -1639,7 +1637,7 @@ function rcube_webmail()
expando = '<div id="rcmexpando' + uid + '" class="' + (message.expanded ? 'expanded' : 'collapsed') + '">&nbsp;&nbsp;</div>';
}
- tree += icon ? '<img id="msgicn'+uid+'" src="'+icon+'" alt="" class="msgicon" />' : '';
+ tree += '<span id="msgicn'+uid+'" class="'+css_class+'">&nbsp;</span>';
// build subject link
if (!bw.ie && cols.subject) {
@@ -1655,17 +1653,15 @@ function rcube_webmail()
col = document.createElement('td');
col.className = String(c).toLowerCase();
- var html;
if (c == 'flag') {
- if (flags.flagged && this.env.flaggedicon)
- html = '<img id="flaggedicn'+uid+'" src="'+this.env.flaggedicon+'" class="flagicon" alt="" />';
- else if(!flags.flagged && this.env.unflaggedicon)
- html = '<img id="flaggedicn'+uid+'" src="'+this.env.unflaggedicon+'" class="flagicon" alt="" />';
+ css_class = (flags.flagged ? 'flagged' : 'unflagged');
+ html = '<span id="flagicn'+uid+'" class="'+css_class+'">&nbsp;</span>';
+ }
+ else if (c == 'attachment') {
+ html = flags.attachment ? '<span class="attachment">&nbsp;</span>' : '&nbsp;';
}
else if (c == 'threads')
html = expando;
- else if (c == 'attachment')
- html = flags.attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : '&nbsp;';
else if (c == 'subject')
html = tree + cols[c];
else
@@ -2184,40 +2180,34 @@ function rcube_webmail()
// set message icon
this.set_message_icon = function(uid)
{
- var icn_src,
+ var css_class,
rows = this.message_list.rows;
if (!rows[uid])
return false;
- if (!rows[uid].unread && rows[uid].unread_children && this.env.unreadchildrenicon) {
- icn_src = this.env.unreadchildrenicon;
- }
- else if (rows[uid].deleted && this.env.deletedicon)
- icn_src = this.env.deletedicon;
- else if (rows[uid].replied && this.env.repliedicon) {
- if (rows[uid].forwarded && this.env.forwardedrepliedicon)
- icn_src = this.env.forwardedrepliedicon;
- else
- icn_src = this.env.repliedicon;
- }
- else if (rows[uid].forwarded && this.env.forwardedicon)
- icn_src = this.env.forwardedicon;
- else if (rows[uid].unread && this.env.unreadicon)
- icn_src = this.env.unreadicon;
- else if (this.env.messageicon)
- icn_src = this.env.messageicon;
-
- if (icn_src && rows[uid].icon)
- rows[uid].icon.src = icn_src;
-
- icn_src = '';
-
- if (rows[uid].flagged && this.env.flaggedicon)
- icn_src = this.env.flaggedicon;
- else if (!rows[uid].flagged && this.env.unflaggedicon)
- icn_src = this.env.unflaggedicon;
- if (rows[uid].flagged_icon && icn_src)
- rows[uid].flagged_icon.src = icn_src;
+
+ if (rows[uid].icon) {
+ css_class = 'msgicon';
+ if (!rows[uid].unread && rows[uid].unread_children)
+ css_class += ' unreadchildren';
+ if (rows[uid].deleted)
+ css_class += ' deleted';
+ else if (rows[uid].replied || rows[uid].forwarded) {
+ if (rows[uid].replied)
+ css_class += ' replied';
+ if (rows[uid].forwarded)
+ css_class += ' forwarded';
+ }
+ else if (rows[uid].unread)
+ css_class += ' unread';
+
+ rows[uid].icon.className = css_class;
+ }
+
+ if (rows[uid].flagged_icon) {
+ css_class = (rows[uid].flagged ? 'flagged' : 'unflagged');
+ rows[uid].flagged_icon.className = css_class;
+ }
};
// set message status
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 0fa22753d..914ab1538 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -186,28 +186,6 @@ function rcmail_message_list($attrib)
$OUTPUT->set_env('autoexpand_threads', intval($CONFIG['autoexpand_threads']));
$OUTPUT->set_env('sort_col', $_SESSION['sort_col']);
$OUTPUT->set_env('sort_order', $_SESSION['sort_order']);
-
- if ($attrib['messageicon'])
- $OUTPUT->set_env('messageicon', $skin_path . $attrib['messageicon']);
- if ($attrib['deletedicon'])
- $OUTPUT->set_env('deletedicon', $skin_path . $attrib['deletedicon']);
- if ($attrib['unreadicon'])
- $OUTPUT->set_env('unreadicon', $skin_path . $attrib['unreadicon']);
- if ($attrib['repliedicon'])
- $OUTPUT->set_env('repliedicon', $skin_path . $attrib['repliedicon']);
- if ($attrib['forwardedicon'])
- $OUTPUT->set_env('forwardedicon', $skin_path . $attrib['forwardedicon']);
- if ($attrib['forwardedrepliedicon'])
- $OUTPUT->set_env('forwardedrepliedicon', $skin_path . $attrib['forwardedrepliedicon']);
- if ($attrib['attachmenticon'])
- $OUTPUT->set_env('attachmenticon', $skin_path . $attrib['attachmenticon']);
- if ($attrib['flaggedicon'])
- $OUTPUT->set_env('flaggedicon', $skin_path . $attrib['flaggedicon']);
- if ($attrib['unflaggedicon'])
- $OUTPUT->set_env('unflaggedicon', $skin_path . $attrib['unflaggedicon']);
- if ($attrib['unreadchildrenicon'])
- $OUTPUT->set_env('unreadchildrenicon', $skin_path . $attrib['unreadchildrenicon']);
-
$OUTPUT->set_env('messages', array());
$OUTPUT->set_env('coltypes', $a_show_cols);
@@ -394,10 +372,10 @@ function rcmail_message_list_head($attrib, $a_show_cols)
// get column name
switch ($col) {
case 'flag':
- $col_name = sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], '');
+ $col_name = '<span class="flagged">&nbsp;</span>';
break;
case 'attachment':
- $col_name = sprintf($image_tag, $skin_path, $attrib['attachmenticon'], '');
+ $col_name = '<span class="attachment">&nbsp;</span>';
break;
case 'threads':
$col_name = $list_menu;
@@ -411,7 +389,7 @@ function rcmail_message_list_head($attrib, $a_show_cols)
$col_name = html::a(array('href'=>"./#sort", 'onclick' => 'return '.JS_OBJECT_NAME.".command('sort','".$col."',this)", 'title' => rcube_label('sortby')), $col_name);
$sort_class = $col == $sort_col ? " sorted$sort_order" : '';
- $class_name = $col == 'attachment' ? 'icon' : $col.$sort_class;
+ $class_name = $col.$sort_class;
// put it all together
$cells[] = array('className' => $class_name, 'id' => "rcm$col", 'html' => $col_name);