From 4e2f35d4dcd96f7f19f0147b14fa1f917c759102 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 1 Sep 2009 14:41:48 +0000 Subject: [PATCH] added support for ms excel 2007 --- etemplate/inc/class.bo_merge.inc.php | 17 +++++++++++++++-- ...mats-officedocument.spreadsheetml.sheet.gif | Bin 0 -> 139 bytes phpgwapi/inc/class.mime_magic.inc.php | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 etemplate/templates/default/images/mime16_application_vnd.openxmlformats-officedocument.spreadsheetml.sheet.gif diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php index f41b11428d..49d39c61c0 100644 --- a/etemplate/inc/class.bo_merge.inc.php +++ b/etemplate/inc/class.bo_merge.inc.php @@ -87,8 +87,10 @@ abstract class bo_merge case 'application/vnd.oasis.opendocument.spreadsheet': // oo spreadsheet if (!$zip_available) break; return true; // open office write xml files - case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': + case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms word 2007 xml format case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': // ms excel 2007 xml format + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.shee': if (!$zip_available) break; return true; // ms word xml format default: @@ -315,7 +317,7 @@ abstract class bo_merge // remove not existing replacements (eg. from calendar array) if (strpos($content,'$$') !== null) { - $content = preg_replace('/\$\$[a-z0-9_]+\$\$/i','',$content); + $content = preg_replace('/\$\$[a-z0-9_\/]+\$\$/i','',$content); } if ($contentrepeat) $contentrep[$id] = $content; } @@ -350,6 +352,8 @@ abstract class bo_merge break; case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.shee': // todo ms word xml files break; } @@ -372,6 +376,8 @@ abstract class bo_merge break; case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.shee': // todo ms word xml files break; } @@ -429,6 +435,13 @@ abstract class bo_merge '([a-z]{2}-[A-Z]{2})'.preg_quote('"/>$$','/').'/i' => '$$\\2$$', ); break; + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.shee': + $mime_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': + $archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document,'.xlsx').'-').'.xlsx'; + copy($content_url,$archive); + $content_url = 'zip://'.$archive.'#'.($content_file = 'xl/sharedStrings.xml'); + break; } if (!($merged =& $this->merge($content_url,$ids,$err,$mime_type,$fix))) { diff --git a/etemplate/templates/default/images/mime16_application_vnd.openxmlformats-officedocument.spreadsheetml.sheet.gif b/etemplate/templates/default/images/mime16_application_vnd.openxmlformats-officedocument.spreadsheetml.sheet.gif new file mode 100644 index 0000000000000000000000000000000000000000..347c0c36cd2bdfe146bfae6d35de6b0dd6261c3e GIT binary patch literal 139 zcmZ?wbhEHb6krfwSj5Kg{rh)@Hil!zk1;SXw6wMS2Lm8m@h1x-0|Og_4v-C0DZs$M z9FXC4XWfMfPTH!@tedpwADvPw>&g2@%Au%~?yD)<_0MKkT&Hw-a literal 0 HcmV?d00001 diff --git a/phpgwapi/inc/class.mime_magic.inc.php b/phpgwapi/inc/class.mime_magic.inc.php index f40c0589ab..657fc8c1c8 100644 --- a/phpgwapi/inc/class.mime_magic.inc.php +++ b/phpgwapi/inc/class.mime_magic.inc.php @@ -415,6 +415,7 @@ class mime_magic 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', 'xls' => 'application/vnd.ms-excel', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // excel xml format 'xlt' => 'application/vnd.ms-excel', 'xml' => 'application/xml', 'xpm' => 'image/x-xpixmap',