From f94e442469deca30b39f3fa08aade83cbd0ede70 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 16 Dec 2011 13:38:59 -0500
Subject: [PATCH] Add more classes and options to HTML elements for better styleability

---
 program/steps/mail/func.inc |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 2bc0091..d44e9c3 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -379,6 +379,8 @@
     // make sort links
     if (in_array($col, $a_sort_cols))
       $col_name = html::a(array('href'=>"./#sort", 'onclick' => 'return '.JS_OBJECT_NAME.".command('sort','".$col."',this)", 'title' => rcube_label('sortby')), $col_name);
+    else if ($col_name[0] != '<')
+      $col_name = '<span class="' . $col .'">' . $col_name . '</span>';
 
     $sort_class = $col == $sort_col ? " sorted$sort_order" : '';
     $class_name = $col.$sort_class;
@@ -890,6 +892,7 @@
   // show these headers
   $standard_headers = array('subject', 'from', 'to', 'cc', 'bcc', 'replyto',
     'mail-reply-to', 'mail-followup-to', 'date');
+  $exclude_headers = $attrib['exclude'] ? explode(',', $attrib['exclude']) : array();
   $output_headers = array();
 
   foreach ($standard_headers as $hkey) {
@@ -898,6 +901,9 @@
     else if ($headers['others'][$hkey])
       $value = $headers['others'][$hkey];
     else
+      continue;
+
+    if (in_array($hkey, $exclude_headers))
       continue;
 
     if ($hkey == 'date') {
@@ -937,7 +943,11 @@
   }
 
   $plugin = $RCMAIL->plugins->exec_hook('message_headers_output',
-    array('output' => $output_headers, 'headers' => $MESSAGE->headers));
+    array('output' => $output_headers, 'headers' => $MESSAGE->headers, 'exclude' => $exclude_headers));
+
+  // single header value is requested
+  if (!empty($attrib['valueof']))
+    return Q($plugin['output'][$attrib['valueof']]['value'], ($hkey == 'subject' ? 'strict' : 'show'));
 
   // compose html table
   $table = new html_table(array('cols' => 2));
@@ -1062,6 +1072,11 @@
   // list images after mail body
   if ($CONFIG['inline_images'] && !empty($MESSAGE->attachments)) {
     foreach ($MESSAGE->attachments as $attach_prop) {
+      // skip inline images
+      if ($attach_prop->content_id && $attach_prop->disposition == 'inline') {
+        continue;
+      }
+
       // Content-Type: image/*...
       if (preg_match('/^image\//i', $attach_prop->mimetype) ||
         // ...or known file extension: many clients are using application/octet-stream
@@ -1391,7 +1406,7 @@
 }
 
 
-function rcmail_message_part_controls()
+function rcmail_message_part_controls($attrib)
 {
   global $MESSAGE;
 
@@ -1404,13 +1419,13 @@
 
   if (!empty($part->filename)) {
     $table->add('title', Q(rcube_label('filename')));
-    $table->add(null, Q($part->filename));
-    $table->add(null, '[' . html::a('?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), Q(rcube_label('download'))) . ']');
+    $table->add('header', Q($part->filename));
+    $table->add('download-link', html::a(array('href' => './?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING'])), Q(rcube_label('download'))));
   }
 
   if (!empty($part->size)) {
     $table->add('title', Q(rcube_label('filesize')));
-    $table->add(null, Q(show_bytes($part->size)));
+    $table->add('header', Q(show_bytes($part->size)));
   }
 
   return $table->show($attrib);

--
Gitblit v1.9.1