summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2009-03-28 13:40:21 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2009-03-28 13:40:21 +0000
commit84a7acd0f42e3c30c896d65699bbd4b1a3cedd41 (patch)
tree5a683bf0f11b0f69692cecc3e7ed72cb0ae2d8f7
parent2887ae484ec8f94112c739fb6efad7bc3b9c9c22 (diff)
Implemented using a single image to display all icons via CSS positioning of the image in a div.
-rw-r--r--roundcubemail/program/include/main.inc1
-rw-r--r--roundcubemail/program/js/app.js24
-rw-r--r--roundcubemail/program/steps/mail/func.inc74
-rw-r--r--roundcubemail/program/steps/settings/manage_folders.inc15
-rw-r--r--roundcubemail/skins/default/images/icons/rc_icons.pngbin0 -> 8224 bytes
-rw-r--r--roundcubemail/skins/default/mail.css94
-rw-r--r--roundcubemail/skins/default/settings.css18
-rw-r--r--roundcubemail/skins/default/templates/mail.html11
8 files changed, 140 insertions, 97 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc
index b22be1aca..bdcb52614 100644
--- a/roundcubemail/program/include/main.inc
+++ b/roundcubemail/program/include/main.inc
@@ -1110,6 +1110,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, &$jslist, $at
'id' => "rcmli".$folder_id,
'class' => join(' ', $classes),
'noclose' => true),
+ html::div(array('class' => 'icon-holder')) .
html::a($link_attrib, $html_name) .
(!empty($folder['folders']) ? html::div(array(
'class' => ($collapsed ? 'collapsed' : 'expanded'),
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js
index 7f1e7241b..4386be777 100644
--- a/roundcubemail/program/js/app.js
+++ b/roundcubemail/program/js/app.js
@@ -384,7 +384,7 @@ function rcube_webmail()
}
// set eventhandler to message icon
- if ((row.icon = row.obj.cells[0].childNodes[0]) && row.icon.nodeName=='IMG')
+ if ((row.icon = row.obj.cells[0].childNodes[1]) && row.icon.nodeName=='DIV')
{
var p = this;
row.icon.id = 'msgicn_'+row.uid;
@@ -402,7 +402,7 @@ function rcube_webmail()
// set eventhandler to flag icon, if icon found
if (this.env.flagged_col && (row.flagged_icon = row.obj.cells[this.env.flagged_col].childNodes[0])
- && row.flagged_icon.nodeName=='IMG')
+ && row.flagged_icon.nodeName=='DIV')
{
var p = this;
row.flagged_icon.id = 'flaggedicn_'+row.uid;
@@ -1248,7 +1248,7 @@ function rcube_webmail()
{
var div;
if ((li = this.get_folder_li(id)) &&
- (div = li.getElementsByTagName("div")[0]) &&
+ (div = li.getElementsByTagName("div")[1]) &&
(div.className.match(/collapsed/) || div.className.match(/expanded/)))
{
var ul = li.getElementsByTagName("ul")[0];
@@ -1622,13 +1622,8 @@ function rcube_webmail()
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].flagged && this.env.flagicon)
+ icn_src = this.env.flagicon;
}
// set message status
@@ -3542,7 +3537,7 @@ function rcube_webmail()
var col = document.createElement('TD');
col.className = 'icon';
- col.innerHTML = icon ? '<img src="'+icon+'" alt="" />' : '';
+ col.innerHTML = icon ? icon : '';
row.appendChild(col);
// add each submitted col
@@ -3554,13 +3549,10 @@ function rcube_webmail()
if (c=='flag')
{
- if (flags.flagged && this.env.flaggedicon)
- col.innerHTML = '<img src="'+this.env.flaggedicon+'" alt="" />';
- else if(!flags.flagged && this.env.unflaggedicon)
- col.innerHTML = '<img src="'+this.env.unflaggedicon+'" alt="" />';
+ col.innerHTML = this.env.flagicon;
}
else if (c=='attachment')
- col.innerHTML = attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : '&nbsp;';
+ col.innerHTML = attachment ? this.env.attachmenticon : '&nbsp;';
else
col.innerHTML = cols[c];
diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc
index 79e148d8a..c3320855d 100644
--- a/roundcubemail/program/steps/mail/func.inc
+++ b/roundcubemail/program/steps/mail/func.inc
@@ -169,10 +169,10 @@ function rcmail_message_list($attrib)
switch ($col)
{
case 'flag':
- $col_name = sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], '');
+ $col_name = '<div class="icon-holder flag"></div>';
break;
case 'attachment':
- $col_name = sprintf($image_tag, $skin_path, $attrib['attachmenticon'], '');
+ $col_name = '<div class="icon-holder attachment"></div>';
break;
default:
$col_name = Q(rcube_label($col));
@@ -259,30 +259,27 @@ function rcmail_message_list($attrib)
$js_row_arr['flagged'] = true;
// set message icon
- if ($attrib['deletedicon'] && $header->deleted)
- $message_icon = $attrib['deletedicon'];
- else if ($attrib['repliedicon'] && $header->answered)
+ if ($header->deleted)
+ $message_icon = '<div class="icon-holder deleted"></div>';
+ else if ($header->answered)
{
- if ($attrib['forwardedrepliedicon'] && $header->forwarded)
- $message_icon = $attrib['forwardedrepliedicon'];
+ if ($header->forwarded)
+ $message_icon = '<div class="icon-holder forwardedreplied"></div>';
else
- $message_icon = $attrib['repliedicon'];
+ $message_icon = '<div class="icon-holder replied"></div>';
}
- else if ($attrib['forwardedicon'] && $header->forwarded)
- $message_icon = $attrib['forwardedicon'];
- else if ($attrib['unreadicon'] && !$header->seen)
- $message_icon = $attrib['unreadicon'];
- else if ($attrib['messageicon'])
- $message_icon = $attrib['messageicon'];
+ else if ($header->forwarded)
+ $message_icon = '<div class="icon-holder forwarded"></div>';
+ else if (!$header->seen)
+ $message_icon = '<div class="icon-holder unread"></div>';
+ else
+ $message_icon = '<div class="icon-holder message"></div>';
- if ($attrib['flaggedicon'] && $header->flagged)
- $flagged_icon = $attrib['flaggedicon'];
- else if ($attrib['unflaggedicon'] && !$header->flagged)
- $flagged_icon = $attrib['unflaggedicon'];
-
- // set attachment icon
- if ($attrib['attachmenticon'] && preg_match("/multipart\/m/i", $header->ctype))
- $attach_icon = $attrib['attachmenticon'];
+ // set attachment icons
+ if (preg_match("/multipart\/m/i", $header->ctype))
+ $attach_icon = '<div class="icon-holder attachment"></div>';
+ else
+ $attach_icon = '&nbsp';
$out .= sprintf('<tr id="rcmrow%d" class="message%s%s%s%s">'."\n",
$header->uid,
@@ -291,7 +288,7 @@ function rcmail_message_list($attrib)
$header->flagged ? ' flagged' : '',
$zebra_class);
- $out .= sprintf("<td class=\"icon\">%s</td>\n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : '');
+ $out .= sprintf("<td class=\"icon\">%s</td>\n", $message_icon);
$IMAP->set_charset(!empty($header->charset) ? $header->charset : $CONFIG['default_charset']);
@@ -310,7 +307,7 @@ function rcmail_message_list($attrib)
$cont = sprintf('<a href="%s" onclick="return rcube_event.cancel(event)">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), Q($cont));
}
else if ($col=='flag')
- $cont = $flagged_icon ? sprintf($image_tag, $skin_path, $flagged_icon, '') : '';
+ $cont = '<div class="icon-holder flag"></div>';
else if ($col=='size')
$cont = show_bytes($header->$col);
else if ($col=='date')
@@ -321,7 +318,7 @@ function rcmail_message_list($attrib)
if ($col!='attachment')
$out .= '<td class="'.$col.'">' . $cont . "</td>\n";
else
- $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : '&nbsp;');
+ $out .= '<td class="icon">' . $attach_icon . "</td>\n";
}
$out .= "</tr>\n";
@@ -344,25 +341,14 @@ function rcmail_message_list($attrib)
$OUTPUT->set_env('sort_col', $sort_col);
$OUTPUT->set_env('sort_order', $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']);
-
+ $OUTPUT->set_env('messageicon', '<div class="icon-holder message"></div>');
+ $OUTPUT->set_env('deletedicon', '<div class="icon-holder deleted"></div>');
+ $OUTPUT->set_env('unreadicon', '<div class="icon-holder unread"></div>');
+ $OUTPUT->set_env('repliedicon', '<div class="icon-holder replied"></div>');
+ $OUTPUT->set_env('forwardedicon', '<div class="icon-holder forwarded"></div>');
+ $OUTPUT->set_env('forwardedrepliedicon', '<div class="icon-holder forwardedreplied"></div>');
+ $OUTPUT->set_env('attachmenticon', '<div class="icon-holder attachment"></div>');
+ $OUTPUT->set_env('flagicon', '<div class="icon-holder flag"></div>');
$OUTPUT->set_env('messages', $a_js_message_arr);
$OUTPUT->set_env('coltypes', $a_show_cols);
diff --git a/roundcubemail/program/steps/settings/manage_folders.inc b/roundcubemail/program/steps/settings/manage_folders.inc
index 9affded98..c466bcd1e 100644
--- a/roundcubemail/program/steps/settings/manage_folders.inc
+++ b/roundcubemail/program/steps/settings/manage_folders.inc
@@ -213,15 +213,8 @@ function rcube_subscription_form($attrib)
'onclick' => JS_OBJECT_NAME.".command(this.checked?'subscribe':'unsubscribe',this.value)",
));
- if (!empty($attrib['deleteicon']))
- $del_button = html::img(array('src' => $CONFIG['skin_path'] . $attrib['deleteicon'], 'alt' => rcube_label('delete')));
- else
- $del_button = rcube_label('delete');
-
- if (!empty($attrib['renameicon']))
- $edit_button = html::img(array('src' => $CONFIG['skin_path'] . $attrib['renameicon'], 'alt' => rcube_label('rename')));
- else
- $edit_button = rcube_label('rename');
+ $del_button = '<div class="icon-holder delete"></div>';
+ $edit_button = '<div class="icon-holder rename"></div>';
// create list of available folders
foreach ($list_folders as $i => $folder) {
@@ -245,8 +238,8 @@ function rcube_subscription_form($attrib)
// add rename and delete buttons
if (!$protected && !$folder['virtual']) {
- $table->add('rename', html::a(array('href' => "#rename", 'title' => rcube_label('renamefolder')), $edit_button));
- $table->add('delete', html::a(array('href' => "#delete", 'title' => rcube_label('deletefolder')), $del_button));
+ $table->add('rename', html::div('icon-holder rename', html::a(array('href' => "#rename", 'title' => rcube_label('renamefolder'), 'style' => 'display: block; width: 16px; height: 16px;'), '')));
+ $table->add('delete', html::div('icon-holder delete', html::a(array('href' => "#delete", 'title' => rcube_label('deletefolder'), 'style' => 'display: block; width: 16px; height: 16px;'), '')));
}
else {
$table->add('rename', '&nbsp;');
diff --git a/roundcubemail/skins/default/images/icons/rc_icons.png b/roundcubemail/skins/default/images/icons/rc_icons.png
new file mode 100644
index 000000000..a8771153b
--- /dev/null
+++ b/roundcubemail/skins/default/images/icons/rc_icons.png
Binary files differ
diff --git a/roundcubemail/skins/default/mail.css b/roundcubemail/skins/default/mail.css
index bb614dbd7..658eed68d 100644
--- a/roundcubemail/skins/default/mail.css
+++ b/roundcubemail/skins/default/mail.css
@@ -312,8 +312,6 @@ td.formlinks a:visited
display: block;
position: relative;
font-size: 11px;
- background: url(images/icons/folder-closed.png) no-repeat;
- background-position: 5px 1px;
border-bottom: 1px solid #EBEBEB;
}
@@ -327,6 +325,56 @@ td.formlinks a:visited
height: 16px;
}
+#mailboxlist li div.icon-holder {
+ position: static;
+ height: 16px;
+ width: 16px;
+ margin: 2px 4px 2px 4px;
+ overflow: hidden;
+ float: left;
+}
+
+div.icon-holder {
+ position: static;
+ height: 16px;
+ width: 16px;
+ overflow: hidden;
+}
+div.icon-holder.attachment {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -48px -16px;
+}
+div.icon-holder.unflagged {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -48px -32px;
+}
+div.icon-holder.flagged {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -32px -32px;
+}
+div.icon-holder.replied {
+ background: url(images/icons/rc_icons.png) no-repeat scroll 0 -48px;
+}
+div.icon-holder.forwarded {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -16px -48px;
+}
+div.icon-holder.forwardedreplied {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -32px -48px;
+}
+div.icon-holder.unread {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -64px -16px;
+}
+div.icon-holder.message {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -64px 0;
+}
+div.icon-holder.delete {
+ background: url(images/icons/rc_icons.png) no-repeat scroll 0 -32px;
+}
+div.icon-holder.deleted {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -16px -32px;
+}
+div.icon-holder.rename {
+ background: #ffffff url(images/icons/rc_icons.png) no-repeat scroll -48px -48px;
+}
+
+
#mailboxlist li div.collapsed,
#mailboxlist li div.expanded
{
@@ -343,29 +391,38 @@ td.formlinks a:visited
background: url(images/icons/expanded.png) bottom right no-repeat;
}
-#mailboxlist li.inbox
+#mailboxlist li.inbox div.icon-holder
{
- background-image: url(images/icons/folder-inbox.png);
+ background: url(images/icons/rc_icons.png) no-repeat scroll;
}
-#mailboxlist li.drafts
+#mailboxlist li.drafts div.icon-holder
{
- background-image: url(images/icons/folder-drafts.png);
+ background: url(images/icons/rc_icons.png) no-repeat scroll -16px 0;
}
-#mailboxlist li.sent
+#mailboxlist li.sent div.icon-holder
{
- background-image: url(images/icons/folder-sent.png);
+ background: url(images/icons/rc_icons.png) no-repeat scroll -32px 0;
}
-#mailboxlist li.junk
+#mailboxlist li.junk div.icon-holder
{
- background-image: url(images/icons/folder-junk.png);
+ background: url(images/icons/rc_icons.png) no-repeat scroll -48px 0;
}
-#mailboxlist li.trash
+#mailboxlist li.trash div.icon-holder
{
- background-image: url(images/icons/folder-trash.png);
+ background: url(images/icons/rc_icons.png) no-repeat scroll 0 -16px;
+}
+
+#mailboxlist li div.icon-holder
+{
+ background: url(images/icons/rc_icons.png) no-repeat scroll -16px -16px;
+}
+#mailboxlist li.selected > div.icon-holder
+{
+ background: url(images/icons/rc_icons.png) no-repeat scroll -32px -16px;
}
#mailboxlist li a
@@ -373,7 +430,6 @@ td.formlinks a:visited
cursor: default;
display: block;
position: relative;
- padding-left: 25px;
padding-top: 2px;
padding-bottom: 2px;
text-decoration: none;
@@ -547,10 +603,16 @@ body.messagelist
cursor: pointer;
}
-#messagelist tbody tr td.flag img:hover,
-#messagelist thead tr td.flag img
+#messagelist tbody tr.flagged td.flag div.icon-holder
+{
+ background: url(images/icons/rc_icons.png) no-repeat scroll -32px -32px;
+}
+
+#messagelist tbody tr.flagged td.flag div.icon-holder:hover,
+#messagelist tbody tr td.flag div:hover,
+#messagelist thead tr td.flag div
{
- background: url(images/icons/unflagged.png) center no-repeat;
+ background: url(images/icons/rc_icons.png) no-repeat scroll -48px -32px;
}
#messagelist tr td.subject
diff --git a/roundcubemail/skins/default/settings.css b/roundcubemail/skins/default/settings.css
index 5c4bd56dc..ab93eaf47 100644
--- a/roundcubemail/skins/default/settings.css
+++ b/roundcubemail/skins/default/settings.css
@@ -292,3 +292,21 @@ div.advswitch
right: 20px;
width: 460px;
}
+
+div.icon-holder {
+ position: static;
+ height: 16px;
+ width: 16px;
+ overflow: hidden;
+}
+div.icon-holder.delete {
+ background: url(images/icons/rc_icons.png) no-repeat scroll 0 -16px;
+}
+div.icon-holder.rename {
+ background: url(images/icons/rc_icons.png) no-repeat scroll -48px -48px;
+}
+
+/* Background image of containing <div> must be visible */
+#subscription-table tr.selected td div.icon-holder a {
+ background-color: transparent;
+}
diff --git a/roundcubemail/skins/default/templates/mail.html b/roundcubemail/skins/default/templates/mail.html
index fb887ba5e..d7bc29294 100644
--- a/roundcubemail/skins/default/templates/mail.html
+++ b/roundcubemail/skins/default/templates/mail.html
@@ -47,16 +47,7 @@
id="messagelist"
cellspacing="0"
columns=""
- summary="Message list"
- messageIcon="/images/icons/dot.png"
- unreadIcon="/images/icons/unread.png"
- deletedIcon="/images/icons/deleted.png"
- repliedIcon="/images/icons/replied.png"
- forwardedIcon="/images/icons/forwarded.png"
- forwardedrepliedIcon="/images/icons/forwarded_replied.png"
- attachmentIcon="/images/icons/attachment.png"
- flaggedIcon="/images/icons/flagged.png"
- unflaggedIcon="/images/icons/blank.gif" />
+ summary="Message list" />
</div>
<roundcube:if condition="config:preview_pane == true" />