From 84a7acd0f42e3c30c896d65699bbd4b1a3cedd41 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sat, 28 Mar 2009 13:40:21 +0000 Subject: Implemented using a single image to display all icons via CSS positioning of the image in a div. --- roundcubemail/program/include/main.inc | 1 + roundcubemail/program/js/app.js | 24 +++---- roundcubemail/program/steps/mail/func.inc | 76 +++++++++------------- .../program/steps/settings/manage_folders.inc | 15 ++--- 4 files changed, 44 insertions(+), 72 deletions(-) (limited to 'roundcubemail/program') 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 ? '' : ''; + 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 = ''; - else if(!flags.flagged && this.env.unflaggedicon) - col.innerHTML = ''; + col.innerHTML = this.env.flagicon; } else if (c=='attachment') - col.innerHTML = attachment && this.env.attachmenticon ? '' : ' '; + col.innerHTML = attachment ? this.env.attachmenticon : ' '; 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 = '
'; break; case 'attachment': - $col_name = sprintf($image_tag, $skin_path, $attrib['attachmenticon'], ''); + $col_name = '
'; 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 = '
'; + else if ($header->answered) { - if ($attrib['forwardedrepliedicon'] && $header->forwarded) - $message_icon = $attrib['forwardedrepliedicon']; + if ($header->forwarded) + $message_icon = '
'; else - $message_icon = $attrib['repliedicon']; + $message_icon = '
'; } - 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']; - - 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']; + else if ($header->forwarded) + $message_icon = '
'; + else if (!$header->seen) + $message_icon = '
'; + else + $message_icon = '
'; + + // set attachment icons + if (preg_match("/multipart\/m/i", $header->ctype)) + $attach_icon = '
'; + else + $attach_icon = ' '; $out .= sprintf(''."\n", $header->uid, @@ -291,7 +288,7 @@ function rcmail_message_list($attrib) $header->flagged ? ' flagged' : '', $zebra_class); - $out .= sprintf("%s\n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : ''); + $out .= sprintf("%s\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('%s', 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 = '
'; 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 .= '' . $cont . "\n"; else - $out .= sprintf("%s\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : ' '); + $out .= '' . $attach_icon . "\n"; } $out .= "\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', '
'); + $OUTPUT->set_env('deletedicon', '
'); + $OUTPUT->set_env('unreadicon', '
'); + $OUTPUT->set_env('repliedicon', '
'); + $OUTPUT->set_env('forwardedicon', '
'); + $OUTPUT->set_env('forwardedrepliedicon', '
'); + $OUTPUT->set_env('attachmenticon', '
'); + $OUTPUT->set_env('flagicon', '
'); $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 = '
'; + $edit_button = '
'; // 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', ' '); -- cgit v1.2.3