From a3644638aaf0418598196a870204e0b632a4c8ad Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 17 Apr 2015 06:28:40 -0400
Subject: [PATCH] Allow preference sections to define CSS class names

---
 program/steps/mail/attachments.inc |   25 ++++---------------------
 1 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc
index 85bc36c..5eaa655 100644
--- a/program/steps/mail/attachments.inc
+++ b/program/steps/mail/attachments.inc
@@ -38,7 +38,7 @@
 
 
 // remove an attachment
-if ($RCMAIL->action=='remove-attachment') {
+if ($RCMAIL->action == 'remove-attachment') {
     $id = 'undefined';
 
     if (preg_match('/^rcmfile(\w+)$/', $_POST['_file'], $regs)) {
@@ -60,32 +60,14 @@
     exit;
 }
 
-if ($RCMAIL->action=='display-attachment') {
+if ($RCMAIL->action == 'display-attachment') {
     $id = 'undefined';
 
     if (preg_match('/^rcmfile(\w+)$/', $_GET['_file'], $regs)) {
         $id = $regs[1];
     }
 
-    if ($attachment = $COMPOSE['attachments'][$id]) {
-        $attachment = $RCMAIL->plugins->exec_hook('attachment_display', $attachment);
-    }
-
-    if ($attachment['status']) {
-        if (empty($attachment['size'])) {
-            $attachment['size'] = $attachment['data'] ? strlen($attachment['data']) : @filesize($attachment['path']);
-        }
-
-        header('Content-Type: ' . $attachment['mimetype']);
-        header('Content-Length: ' . $attachment['size']);
-
-        if ($attachment['data']) {
-            echo $attachment['data'];
-        }
-        else if ($attachment['path']) {
-            readfile($attachment['path']);
-        }
-    }
+    $RCMAIL->display_uploaded_file($COMPOSE['attachments'][$id]);
 
     exit;
 }
@@ -139,6 +121,7 @@
                 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", rcmail_output::JS_OBJECT_NAME, $id),
                 'title'   => $RCMAIL->gettext('delete'),
                 'class'   => 'delete',
+                'aria-label' => $RCMAIL->gettext('delete') . ' ' . $attachment['name'],
             ), $button);
 
             $content .= rcube::Q($attachment['name']);

--
Gitblit v1.9.1