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/include/main.inc |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index 55f0a8a..012ee8d 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1608,6 +1608,26 @@
 
 
 /**
+ * Generate CSS classes from mimetype and filename extension
+ *
+ * @param string Mimetype
+ * @param string The filename
+ * @return string CSS classes separated by space
+ */
+function rcmail_filetype2classname($mimetype, $filename)
+{
+  list($primary, $secondary) = explode('/', $mimetype);
+
+  $classes = array($primary ? $primary : 'unknown');
+  if ($secondary)
+    $classes[] = $secondary;
+  if (preg_match('/\.([a-z0-9]+)$/', $filename, $m))
+    $classes[] = $m[1];
+
+  return join(" ", $classes);
+}
+
+/**
  * Output HTML editor scripts
  *
  * @param string Editor mode

--
Gitblit v1.9.1