From bdab270db497d1edb66f2e23b01d8a87719e36f6 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 18 Feb 2009 01:09:33 -0700 Subject: [PATCH] Dynamically create thread images --- imp/js/src/DimpBase.js | 4 +-- imp/lib/IMAP/Thread.php | 35 +++++---------------------- imp/templates/index/index-dimp.inc | 4 --- imp/themes/graphics/tree/join.png | Bin 0 -> 177 bytes imp/themes/graphics/tree/joinbottom-down.png | Bin 0 -> 111 bytes imp/themes/graphics/tree/joinbottom.png | Bin 0 -> 180 bytes imp/themes/graphics/tree/line.png | Bin 0 -> 173 bytes imp/themes/screen-dimp.css | 28 +++++++++++++++------ 8 files changed, 29 insertions(+), 42 deletions(-) create mode 100644 imp/themes/graphics/tree/join.png create mode 100644 imp/themes/graphics/tree/joinbottom-down.png create mode 100644 imp/themes/graphics/tree/joinbottom.png create mode 100644 imp/themes/graphics/tree/line.png diff --git a/imp/js/src/DimpBase.js b/imp/js/src/DimpBase.js index 9b2d775b8..cc69d2dda 100644 --- a/imp/js/src/DimpBase.js +++ b/imp/js/src/DimpBase.js @@ -427,7 +427,7 @@ var DimpBase = { tmp = elt.cloneNode(false); u = thread.get(row.imapuid); $R(0, u.length, true).each(function(i) { - tmp.insert($($('thread_img_' + u.charAt(i)).cloneNode(false)).writeAttribute('id', '')); + tmp.insert(new Element('SPAN', { className: 'iconImg threadImg threadImg' + u.charAt(i) })); }); elt.replace(tmp.insert(elt.getText().escapeHTML())); } @@ -954,7 +954,7 @@ var DimpBase = { if (r.atc_label) { tmp = $('msgAtc').show().down('.label'); tmp2 = $('partlist'); - tmp2.hide().previous().update(new Element('SPAN', { className: 'atcLabel'}).insert(r.atc_label)).insert(r.atc_download); + tmp2.hide().previous().update(new Element('SPAN', { className: 'atcLabel' }).insert(r.atc_label)).insert(r.atc_download); if (r.atc_list) { $('partlist_col').show(); $('partlist_exp').hide(); diff --git a/imp/lib/IMAP/Thread.php b/imp/lib/IMAP/Thread.php index 911ccff7c..763c53dbd 100644 --- a/imp/lib/IMAP/Thread.php +++ b/imp/lib/IMAP/Thread.php @@ -119,8 +119,12 @@ class IMP_IMAP_Thread */ public function getThreadImageTree($indices, $sortdir) { - $tree = array(); - $imgs = self::getImageUrls(false); + $imgs = $tree = array(); + + foreach (self::$_imglist as $key => $val) { + $imgs[$key] = Horde::img('tree/' . (($key != 0 && !empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) ? ('rev-' . $val) : $val)); + } + foreach ($this->getThreadTreeOb($indices, $sortdir) as $k => $v) { $tree[$k] = ''; for ($i = 0, $length = strlen($v); $i < $length; ++$i) { @@ -130,31 +134,4 @@ class IMP_IMAP_Thread return $tree; } - /** - * Get potential image URLs that may be used to display a thread. - * - * @param ids $ids Add unique DOM ID to each image? - * @param ids $datauri Output data URIs, if possible? - * - * @return array An array with the image code as a key and the image url - * as the value. - */ - static public function getImageUrls($ids = true, $datauri = false) - { - $graphicsdir = $GLOBALS['registry']->getImageDir('horde'); - $args = array(); - - foreach (self::$_imglist as $key => $val) { - if ($ids) { - $args['id'] = 'thread_img_' . $key; - } - if ($datauri) { - $out[$key] = IMP::img('tree/' . (($key != 0 && !empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) ? ('rev-' . $val) : $val), '', $args, $graphicsdir); - } else { - $out[$key] = Horde::img('tree/' . (($key != 0 && !empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) ? ('rev-' . $val) : $val), '', $args, $graphicsdir); - } - } - - return $out; - } } diff --git a/imp/templates/index/index-dimp.inc b/imp/templates/index/index-dimp.inc index 477f6b502..56688332a 100644 --- a/imp/templates/index/index-dimp.inc +++ b/imp/templates/index/index-dimp.inc @@ -2,9 +2,6 @@ // Generate various dimp graphics used in multiple locations $hordeimg = $registry->getImageDir('horde'); -// Thread images -$thread_imgs = IMP_IMAP_Thread::getImageUrls(true, true); - $usetrash = $prefs->getValue('use_trash'); $menu_view = $prefs->getValue('menu_view'); $show_text = ($menu_view == 'text' || $menu_view == 'both'); @@ -436,7 +433,6 @@ function _simpleButton($id, $text, $image, $imagedir = null)
- [] diff --git a/imp/themes/graphics/tree/join.png b/imp/themes/graphics/tree/join.png new file mode 100644 index 0000000000000000000000000000000000000000..927a988163e0cbfec0259052f9dee871a4903879 GIT binary patch literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAj%)r2Sz+wLlAcrO0(btiIVf_hn)~=U8zGR7O zL`iUdT1k0gQ7VIDN`6wRf@f}GdTLN=VoGJ<$y6JlBDMgZ5LY1m|NsA`H|O64vY1MO z{DS{8Jl$^K1>`Avx;Tb#L?=faU}$1L@PSR>U&G<|><%xOnWub|xBvCOQG$n|h|SS_ TQ@)ugP&tFAtDnm{r-UW|x!5)j literal 0 HcmV?d00001 diff --git a/imp/themes/graphics/tree/joinbottom-down.png b/imp/themes/graphics/tree/joinbottom-down.png new file mode 100644 index 0000000000000000000000000000000000000000..e97be02429e12779678d9d984c2c878696c9a419 GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAj3?#R^_xk}Uwg8_HS0MfW|No^o=iddgm`Z~D zg8wr--EQCo~uDx;Tb#L?_1_*wOHj@iC*po`XM_IqU2>o#a_0{>!T{8P=$U&G<|>;V_*|GfCmo@BtV_J!j=0oI7? PK&1?xu6{1-oD!M<5vVs4 literal 0 HcmV?d00001 diff --git a/imp/themes/screen-dimp.css b/imp/themes/screen-dimp.css index 6fb17a430..7761df8ab 100644 --- a/imp/themes/screen-dimp.css +++ b/imp/themes/screen-dimp.css @@ -262,13 +262,6 @@ div.msgSize { background-image: url("graphics/signed.png"); } -/* Thread images. */ -div.msgSubject img { - margin-top: -4px; - vertical-align: top; - padding-right: 1px; -} - /* Scroller */ .sbdiv { position: relative; @@ -1082,6 +1075,27 @@ span.dimpactionDrafts { background-image: url("graphics/add_contact.png"); } +/* Thread images */ +span.threadImg { + margin-top: -4px; + padding-right: 5px; + margin-right: 0; + height: 20px; +} + +span.threadImg1 { + background-image: url("graphics/tree/line.png"); +} +span.threadImg2 { + background-image: url("graphics/tree/join.png"); +} +span.threadImg3 { + background-image: url("graphics/tree/joinbottom-down.png"); +} +span.threadImg4 { + background-image: url("graphics/tree/joinbottom.png"); +} + /* Other images */ #msg_newwin span.iconImg, #msg_newwin_options span.iconImg { background-image: url("graphics/newwin.png"); -- 2.11.0