From f672e1e90d1bddb6d6dc6870376488936f36206b Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 2 Mar 2009 15:39:29 -0700 Subject: [PATCH] Update thread image handling for imp view. Reimplement RTL thread graphics for dimp. --- imp/js/src/DimpBase.js | 2 +- imp/lib/Imap/Thread.php | 42 +++++++++++------------ imp/lib/Imap/Tree.php | 7 ++-- imp/themes/graphics/tree/rev-join.png | Bin 0 -> 112 bytes imp/themes/graphics/tree/rev-joinbottom-down.png | Bin 0 -> 111 bytes imp/themes/graphics/tree/rev-joinbottom.png | Bin 0 -> 113 bytes imp/themes/graphics/tree/rev-line.png | Bin 0 -> 108 bytes imp/themes/screen-dimp.css | 15 -------- imp/themes/screen.css | 36 +++++++++++++++++-- 9 files changed, 59 insertions(+), 43 deletions(-) create mode 100644 imp/themes/graphics/tree/rev-join.png create mode 100644 imp/themes/graphics/tree/rev-joinbottom-down.png create mode 100644 imp/themes/graphics/tree/rev-joinbottom.png create mode 100644 imp/themes/graphics/tree/rev-line.png diff --git a/imp/js/src/DimpBase.js b/imp/js/src/DimpBase.js index 1379fd20b..6df32faa3 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(new Element('SPAN', { className: 'iconImg threadImg threadImg' + u.charAt(i) })); + tmp.insert(new Element('SPAN', { className: 'threadImg threadImg' + u.charAt(i) })); }); elt.replace(tmp.insert(elt.getText().escapeHTML())); } diff --git a/imp/lib/Imap/Thread.php b/imp/lib/Imap/Thread.php index 9a409ce90..6dba5f9c9 100644 --- a/imp/lib/Imap/Thread.php +++ b/imp/lib/Imap/Thread.php @@ -21,19 +21,6 @@ class IMP_Imap_Thread protected $_thread; /** - * Images used and their internal representations. - * - * @var array - */ - static protected $_imglist = array( - '0' => 'blank.png', - '1' => 'line.png', - '2' => 'join.png', - '3' => 'joinbottom-down.png', - '4' => 'joinbottom.png' - ); - - /** * Constructor. * * @param Horde_Imap_Client_Thread $thread The thread data object. @@ -45,18 +32,29 @@ class IMP_Imap_Thread /** * Generate the thread representation for the given index list in the - * internal format (a string with each character representing the graphic - * to be displayed from $_imglist). + * internal format. * * @param array $indices The list of indices to create a tree for. * @param boolean $sortdir True for newest first, false for oldest first. * * @return array An array with the index as the key and the internal * thread representation as the value. + *
+     * 0 - blank
+     * 1 - line
+     * 2 - join
+     * 3 - joinbottom-down
+     * 4 - joinbottom
+     * 5 - line (reverse)
+     * 6 - join (reverse)
+     * 7 - joinbottom-down (reverse)
+     * 8 - joinbottom (reverse)
+     * 
*/ public function getThreadTreeOb($indices, $sortdir) { $container = $last_level = $last_thread = null; + $rtl = !empty($GLOBALS['nls']['rtl'][$GLOBALS['language']]); $thread_level = $tree = array(); $t = &$this->_thread; @@ -96,11 +94,15 @@ class IMP_Imap_Thread $join_img = 2; } + if ($rtl) { + $join_img += 4; + } + $thread_level[$indentLevel] = $lastinlevel; $line = ''; for ($i = 1; $i < $indentLevel; ++$i) { - $line .= (!isset($thread_level[$i]) || ($thread_level[$i])) ? 0 : 1; + $line .= (!isset($thread_level[$i]) || ($thread_level[$i])) ? 0 : ($rtl ? 5 : 1); } $tree[$val] = $line . $join_img; } @@ -119,16 +121,12 @@ class IMP_Imap_Thread */ public function getThreadImageTree($indices, $sortdir) { - $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), null, null, $GLOBALS['registry']->getImageDir('horde')); - } + $tree = array(); foreach ($this->getThreadTreeOb($indices, $sortdir) as $k => $v) { $tree[$k] = ''; for ($i = 0, $length = strlen($v); $i < $length; ++$i) { - $tree[$k] .= $imgs[$v[$i]]; + $tree[$k] .= ''; } } return $tree; diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index c8bc954c3..bb6d473cb 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -1135,7 +1135,7 @@ class IMP_Imap_Tree /** * Initializes and returns the list of mailboxes to poll. * - * @param boolean $prune Prune non-existant folders from list? + * @param boolean $prune Prune non-existent folders from list? * @param boolean $sort Sort the directory list? * * @return array The list of mailboxes to poll. @@ -1144,7 +1144,10 @@ class IMP_Imap_Tree { $this->_initPollList(); - $plist = ($prune) ? array_values(array_intersect(array_keys($this->_poll), $this->folderList())) : $this->_poll; + $plist = ($prune) + ? array_values(array_intersect(array_keys($this->_poll), $this->folderList())) + : $this->_poll; + if ($sort) { $ns_new = $this->_getNamespace(null); Horde_Imap_Client_Sort::sortMailboxes($plist, array('delimiter' => $ns_new['delimiter'], 'inbox' => true)); diff --git a/imp/themes/graphics/tree/rev-join.png b/imp/themes/graphics/tree/rev-join.png new file mode 100644 index 0000000000000000000000000000000000000000..6697b5ff85f0c62f8349d5ae3da3e62365f6e50e GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAj3?#R^_xk}Uwg8_HS0MfW|No^o=iddgm`Z~D zg8wr--EQCoVkNNQb{|-J4aa-qUlrsEev`kUHmHi#4gu&C*&t;uc GLK6T)=ps=7 literal 0 HcmV?d00001 diff --git a/imp/themes/graphics/tree/rev-joinbottom-down.png b/imp/themes/graphics/tree/rev-joinbottom-down.png new file mode 100644 index 0000000000000000000000000000000000000000..2cfce1e47408e66f2e7d0d3a21f728a6323bf9d2 GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAj3?#R^_xk}Uwg8_HS0MfW|No^o=iddgm`Z~D zg8wr--EQCoVpP5;4PnK=S+3F?}297|TgAW;AS literal 0 HcmV?d00001 diff --git a/imp/themes/graphics/tree/rev-joinbottom.png b/imp/themes/graphics/tree/rev-joinbottom.png new file mode 100644 index 0000000000000000000000000000000000000000..027f85a5897c2a8370312e8946c6e5bdcec4336a GIT binary patch literal 113 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAj3?#R^_xk}Uwg8_HS0MfW|No^o=iddgm`Z~D zg8wr--EQCo