From ce86f0f14f0cf1bf73f4f6045aea1fa00db432aa Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sun, 11 Dec 2011 13:12:33 -0500
Subject: [PATCH] Make string for unread count configureable by skin; add file type classes to attachments list

---
 program/include/main.inc    |    5 +++--
 program/steps/mail/show.inc |    8 +++++++-
 program/js/app.js           |    2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index 372e966..55f0a8a 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1170,7 +1170,7 @@
   global $RCMAIL;
   static $a_mailboxes;
 
-  $attrib += array('maxlength' => 100, 'realnames' => false);
+  $attrib += array('maxlength' => 100, 'realnames' => false, 'unreadwrap' => ' (%s)');
 
   // add some labels to client
   $RCMAIL->output->add_label('purgefolderconfirm', 'deletemessagesconfirm');
@@ -1217,6 +1217,7 @@
 
     $RCMAIL->output->add_gui_object('mailboxlist', $attrib['id']);
     $RCMAIL->output->set_env('mailboxes', $js_mailboxlist);
+    $RCMAIL->output->set_env('unreadwrap', $attrib['unreadwrap']);
     $RCMAIL->output->set_env('collapsed_folders', (string)$RCMAIL->config->get('collapsed_folders'));
   }
 
@@ -1372,7 +1373,7 @@
       $classes[] = 'unread';
 
     $js_name = JQ($folder['id']);
-    $html_name = Q($foldername) . ($unread ? html::span('unreadcount', " ($unread)") : '');
+    $html_name = Q($foldername) . ($unread ? html::span('unreadcount', sprintf($attrib['unreadwrap'], $unread)) : '');
     $link_attrib = $folder['virtual'] ? array() : array(
       'href' => rcmail_url('', array('_mbox' => $folder['id'])),
       'onclick' => sprintf("return %s.command('list','%s',this)", JS_OBJECT_NAME, $js_name),
diff --git a/program/js/app.js b/program/js/app.js
index b6c7d1d..da1e241 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -5624,7 +5624,7 @@
       }
 
       if (mycount && text_obj.length)
-        text_obj.html(' ('+mycount+')');
+        text_obj.html(this.env.unreadwrap.replace(/%[sd]/, mycount));
       else if (text_obj.length)
         text_obj.remove();
 
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index d7b9d4f..46a5597 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -130,7 +130,13 @@
         $title = '';
       }
 
-        $ol .= html::tag('li', null,
+        $classes = array($attach_prop->ctype_primary ? $attach_prop->ctype_primary : 'unknown');
+        if ($attach_prop->ctype_secondary)
+          $classes[] = $attach_prop->ctype_secondary;
+        if (preg_match('/\.([a-z0-9]+)$/', $attach_prop->filename, $m))
+          $classes[] = $m[1];
+        
+        $ol .= html::tag('li', join(' ', $classes),
           html::a(array(
             'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false),
             'onclick' => sprintf(

--
Gitblit v1.9.1