Dynamically create thread images
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Feb 2009 08:09:33 +0000 (01:09 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Feb 2009 08:09:33 +0000 (01:09 -0700)
imp/js/src/DimpBase.js
imp/lib/IMAP/Thread.php
imp/templates/index/index-dimp.inc
imp/themes/graphics/tree/join.png [new file with mode: 0644]
imp/themes/graphics/tree/joinbottom-down.png [new file with mode: 0644]
imp/themes/graphics/tree/joinbottom.png [new file with mode: 0644]
imp/themes/graphics/tree/line.png [new file with mode: 0644]
imp/themes/screen-dimp.css

index 9b2d775..cc69d2d 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($($('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();
index 911ccff..763c53d 100644 (file)
@@ -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;
-    }
 }
index 477f6b5..5668833 100644 (file)
@@ -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)
 </div>
 
 <div style="display:none">
- <?php foreach ($thread_imgs as $val) { echo $val; } ?>
  <span id="largeaddrspan">
   <span class="largeaddrtoggle">
    <span class="largeaddrlist">[<?php echo _("Show Addresses - %d recipients") ?>]</span>
diff --git a/imp/themes/graphics/tree/join.png b/imp/themes/graphics/tree/join.png
new file mode 100644 (file)
index 0000000..927a988
Binary files /dev/null and b/imp/themes/graphics/tree/join.png differ
diff --git a/imp/themes/graphics/tree/joinbottom-down.png b/imp/themes/graphics/tree/joinbottom-down.png
new file mode 100644 (file)
index 0000000..e97be02
Binary files /dev/null and b/imp/themes/graphics/tree/joinbottom-down.png differ
diff --git a/imp/themes/graphics/tree/joinbottom.png b/imp/themes/graphics/tree/joinbottom.png
new file mode 100644 (file)
index 0000000..7c39cd9
Binary files /dev/null and b/imp/themes/graphics/tree/joinbottom.png differ
diff --git a/imp/themes/graphics/tree/line.png b/imp/themes/graphics/tree/line.png
new file mode 100644 (file)
index 0000000..3360753
Binary files /dev/null and b/imp/themes/graphics/tree/line.png differ
index 6fb17a4..7761df8 100644 (file)
@@ -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");