Update thread image handling for imp view.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 2 Mar 2009 22:39:29 +0000 (15:39 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 3 Mar 2009 07:02:40 +0000 (00:02 -0700)
Reimplement RTL thread graphics for dimp.

imp/js/src/DimpBase.js
imp/lib/Imap/Thread.php
imp/lib/Imap/Tree.php
imp/themes/graphics/tree/rev-join.png [new file with mode: 0644]
imp/themes/graphics/tree/rev-joinbottom-down.png [new file with mode: 0644]
imp/themes/graphics/tree/rev-joinbottom.png [new file with mode: 0644]
imp/themes/graphics/tree/rev-line.png [new file with mode: 0644]
imp/themes/screen-dimp.css
imp/themes/screen.css

index 1379fd2..6df32fa 100644 (file)
@@ -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()));
                     }
index 9a409ce..6dba5f9 100644 (file)
@@ -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.
+     * <pre>
+     * 0 - blank
+     * 1 - line
+     * 2 - join
+     * 3 - joinbottom-down
+     * 4 - joinbottom
+     * 5 - line (reverse)
+     * 6 - join (reverse)
+     * 7 - joinbottom-down (reverse)
+     * 8 - joinbottom (reverse)
+     * </pre>
      */
     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] .= '<span class="threadImg threadImg' . $v[$i] . '"></span>';
             }
         }
         return $tree;
index c8bc954..bb6d473 100644 (file)
@@ -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 (file)
index 0000000..6697b5f
Binary files /dev/null and b/imp/themes/graphics/tree/rev-join.png differ
diff --git a/imp/themes/graphics/tree/rev-joinbottom-down.png b/imp/themes/graphics/tree/rev-joinbottom-down.png
new file mode 100644 (file)
index 0000000..2cfce1e
Binary files /dev/null and b/imp/themes/graphics/tree/rev-joinbottom-down.png differ
diff --git a/imp/themes/graphics/tree/rev-joinbottom.png b/imp/themes/graphics/tree/rev-joinbottom.png
new file mode 100644 (file)
index 0000000..027f85a
Binary files /dev/null and b/imp/themes/graphics/tree/rev-joinbottom.png differ
diff --git a/imp/themes/graphics/tree/rev-line.png b/imp/themes/graphics/tree/rev-line.png
new file mode 100644 (file)
index 0000000..92745e5
Binary files /dev/null and b/imp/themes/graphics/tree/rev-line.png differ
index 01f1276..015530f 100644 (file)
@@ -1080,22 +1080,7 @@ span.dimpactionDrafts {
 /* 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 */
index 1a0ba13..08e4cbb 100644 (file)
@@ -24,9 +24,6 @@
     border: 1px solid #ddd;
     vertical-align: middle;
 }
-.messageList img {
-    padding-right: 1px;
-}
 .messageList td label input {
     vertical-align: middle;
 }
@@ -439,6 +436,39 @@ ul.nav-audio {
     text-decoration: underline;
 }
 
+/* Thread images */
+span.threadImg {
+    height: 20px;
+    width: 20px;
+    display: inline-block;
+    vertical-align: middle;
+}
+
+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");
+}
+span.threadImg5 {
+    background-image: url("graphics/tree/rev-line.png");
+}
+span.threadImg6 {
+    background-image: url("graphics/tree/rev-join.png");
+}
+span.threadImg7 {
+    background-image: url("graphics/tree/rev-joinbottom-down.png");
+}
+span.threadImg8 {
+    background-image: url("graphics/tree/rev-joinbottom.png");
+}
+
 /* MIME styles. */
 .mimeStatusMessage, .mimeStatusWarning, .mimeHeaders, .mimePartInfo {
     padding: 4px;