mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 02:43:22 +01:00
Api - Turn on merge for presentations, text templates, spreadsheet templates and presentation templates
This commit is contained in:
parent
27be21d688
commit
01013dd898
@ -174,6 +174,10 @@ abstract class Merge
|
|||||||
return true; // rtf files
|
return true; // rtf files
|
||||||
case 'application/vnd.oasis.opendocument.text': // oo text
|
case 'application/vnd.oasis.opendocument.text': // oo text
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet': // oo spreadsheet
|
case 'application/vnd.oasis.opendocument.spreadsheet': // oo spreadsheet
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
if (!$zip_available) break;
|
if (!$zip_available) break;
|
||||||
return true; // open office write xml files
|
return true; // open office write xml files
|
||||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms word 2007 xml format
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms word 2007 xml format
|
||||||
@ -592,8 +596,12 @@ abstract class Merge
|
|||||||
$replace_tags = array();
|
$replace_tags = array();
|
||||||
switch($mimetype.$mso_application_progid)
|
switch($mimetype.$mso_application_progid)
|
||||||
{
|
{
|
||||||
case 'application/vnd.oasis.opendocument.text': // open office
|
case 'application/vnd.oasis.opendocument.text': // oo text
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
case 'application/vnd.oasis.opendocument.spreadsheet': // oo spreadsheet
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
// It seems easier to split the parent tags here
|
// It seems easier to split the parent tags here
|
||||||
$replace_tags = array(
|
$replace_tags = array(
|
||||||
'/<(ol|ul|table)( [^>]*)?>/' => '</text:p><$1$2>',
|
'/<(ol|ul|table)( [^>]*)?>/' => '</text:p><$1$2>',
|
||||||
@ -734,7 +742,7 @@ abstract class Merge
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($mimetype == 'application/vnd.oasis.opendocument.text' && count($ids) > 1)
|
if (in_array($mimetype, array('application/vnd.oasis.opendocument.text','application/vnd.oasis.opendocument.text-template')) && count($ids) > 1)
|
||||||
{
|
{
|
||||||
if(strpos($content, '$$pagerepeat') === false)
|
if(strpos($content, '$$pagerepeat') === false)
|
||||||
{
|
{
|
||||||
@ -786,8 +794,12 @@ abstract class Merge
|
|||||||
case 'text/rtf':
|
case 'text/rtf':
|
||||||
$joiner = '\\par \\page\\pard\\plain';
|
$joiner = '\\par \\page\\pard\\plain';
|
||||||
break;
|
break;
|
||||||
case 'application/vnd.oasis.opendocument.text':
|
case 'application/vnd.oasis.opendocument.text': // oo text
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
case 'application/vnd.oasis.opendocument.spreadsheet': // oo spreadsheet
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
case 'application/xml':
|
case 'application/xml':
|
||||||
case 'text/html':
|
case 'text/html':
|
||||||
$joiner = '';
|
$joiner = '';
|
||||||
@ -898,8 +910,12 @@ abstract class Merge
|
|||||||
case 'text/rtf':
|
case 'text/rtf':
|
||||||
return $contentstart.implode('\\par \\page\\pard\\plain',$contentrepeatpages).$contentend;
|
return $contentstart.implode('\\par \\page\\pard\\plain',$contentrepeatpages).$contentend;
|
||||||
case 'application/vnd.oasis.opendocument.text':
|
case 'application/vnd.oasis.opendocument.text':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
return $contentstart.implode('<text:line-break />',$contentrepeatpages).$contentend;
|
return $contentstart.implode('<text:line-break />',$contentrepeatpages).$contentend;
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
return $contentstart.implode('</text:p><text:p>',$contentrepeatpages).$contentend;
|
return $contentstart.implode('</text:p><text:p>',$contentrepeatpages).$contentend;
|
||||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
||||||
case 'application/vnd.ms-word.document.macroenabled.12':
|
case 'application/vnd.ms-word.document.macroenabled.12':
|
||||||
@ -940,6 +956,10 @@ abstract class Merge
|
|||||||
{
|
{
|
||||||
case 'application/vnd.oasis.opendocument.text': // open office
|
case 'application/vnd.oasis.opendocument.text': // open office
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms office 2007
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms office 2007
|
||||||
case 'application/vnd.ms-word.document.macroenabled.12':
|
case 'application/vnd.ms-word.document.macroenabled.12':
|
||||||
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
||||||
@ -1007,6 +1027,10 @@ abstract class Merge
|
|||||||
break;
|
break;
|
||||||
case 'application/vnd.oasis.opendocument.text': // open office
|
case 'application/vnd.oasis.opendocument.text': // open office
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
$replace_tags = array(
|
$replace_tags = array(
|
||||||
'<b>','<strong>','<i>','<em>','<u>','<span>','<ol>','<ul>','<li>',
|
'<b>','<strong>','<i>','<em>','<u>','<span>','<ol>','<ul>','<li>',
|
||||||
'<table>','<tr>','<td>','<a>',
|
'<table>','<tr>','<td>','<a>',
|
||||||
@ -1118,9 +1142,13 @@ abstract class Merge
|
|||||||
switch($mimetype.$mso_application_progid)
|
switch($mimetype.$mso_application_progid)
|
||||||
{
|
{
|
||||||
case 'application/vnd.oasis.opendocument.text': // open office writer
|
case 'application/vnd.oasis.opendocument.text': // open office writer
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
$break = '<text:line-break/>';
|
$break = '<text:line-break/>';
|
||||||
break;
|
break;
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet': // open office calc
|
case 'application/vnd.oasis.opendocument.spreadsheet': // open office calc
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
$break = '</text:p><text:p>';
|
$break = '</text:p><text:p>';
|
||||||
break;
|
break;
|
||||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms word 2007
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms word 2007
|
||||||
@ -1193,10 +1221,14 @@ abstract class Merge
|
|||||||
switch($mimetype)
|
switch($mimetype)
|
||||||
{
|
{
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet': // open office calc
|
case 'application/vnd.oasis.opendocument.spreadsheet': // open office calc
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)(?:calcext:value-type="[^"]+")?>.?<([a-z].*?)[^>]*>('.implode('|',$names).')<\/\3>.?<\/table:table-cell>/s';
|
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)(?:calcext:value-type="[^"]+")?>.?<([a-z].*?)[^>]*>('.implode('|',$names).')<\/\3>.?<\/table:table-cell>/s';
|
||||||
$replacement = '<table:table-cell$1office:value-type="float" office:value="$4"$2><$3>$4</$3></table:table-cell>';
|
$replacement = '<table:table-cell$1office:value-type="float" office:value="$4"$2><$3>$4</$3></table:table-cell>';
|
||||||
break;
|
break;
|
||||||
case 'application/vnd.oasis.opendocument.text': // tables in open office writer
|
case 'application/vnd.oasis.opendocument.text': // tables in open office writer
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)>.?<([a-z].*?)[^>]*>('.implode('|',$names).')<\/\3>.?<\/table:table-cell>/s';
|
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)>.?<([a-z].*?)[^>]*>('.implode('|',$names).')<\/\3>.?<\/table:table-cell>/s';
|
||||||
$replacement = '<table:table-cell$1office:value-type="float" office:value="$4"$2><text:p text:style-name="Standard">$4</text:p></table:table-cell>';
|
$replacement = '<table:table-cell$1office:value-type="float" office:value="$4"$2><text:p text:style-name="Standard">$4</text:p></table:table-cell>';
|
||||||
break;
|
break;
|
||||||
@ -1505,6 +1537,10 @@ abstract class Merge
|
|||||||
{
|
{
|
||||||
case 'application/vnd.oasis.opendocument.text': // open office
|
case 'application/vnd.oasis.opendocument.text': // open office
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms office 2007
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms office 2007
|
||||||
case 'application/vnd.ms-word.document.macroenabled.12':
|
case 'application/vnd.ms-word.document.macroenabled.12':
|
||||||
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
||||||
@ -1523,9 +1559,13 @@ abstract class Merge
|
|||||||
$LF = '}\par \pard\plain{';
|
$LF = '}\par \pard\plain{';
|
||||||
break;
|
break;
|
||||||
case 'application/vnd.oasis.opendocument.text':
|
case 'application/vnd.oasis.opendocument.text':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
$LF ='<text:line-break/>';
|
$LF ='<text:line-break/>';
|
||||||
break;
|
break;
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet': // open office calc
|
case 'application/vnd.oasis.opendocument.spreadsheet': // open office calc
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
$LF = '</text:p><text:p>';
|
$LF = '</text:p><text:p>';
|
||||||
break;
|
break;
|
||||||
case 'application/xmlExcel.Sheet': // Excel 2003
|
case 'application/xmlExcel.Sheet': // Excel 2003
|
||||||
@ -1641,7 +1681,19 @@ abstract class Merge
|
|||||||
return $retString;
|
return $retString;
|
||||||
case 'application/vnd.oasis.opendocument.text':
|
case 'application/vnd.oasis.opendocument.text':
|
||||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
||||||
$ext = $mimetype == 'application/vnd.oasis.opendocument.text' ? '.odt' : '.ods';
|
case 'application/vnd.oasis.opendocument.presentation':
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||||
|
switch($mimetype)
|
||||||
|
{
|
||||||
|
case 'application/vnd.oasis.opendocument.text': $ext = '.odt'; break;
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet': $ext = '.ods'; break;
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation': $ext = '.odp'; break;
|
||||||
|
case 'application/vnd.oasis.opendocument.text-template': $ext = '.ott'; break;
|
||||||
|
case 'application/vnd.oasis.opendocument.spreadsheet-template': $ext = '.ots'; break;
|
||||||
|
case 'application/vnd.oasis.opendocument.presentation-template': $ext = '.otp'; break;
|
||||||
|
}
|
||||||
$archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document,$ext).'-').$ext;
|
$archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document,$ext).'-').$ext;
|
||||||
copy($content_url,$archive);
|
copy($content_url,$archive);
|
||||||
$content_url = 'zip://'.$archive.'#'.($content_file = 'content.xml');
|
$content_url = 'zip://'.$archive.'#'.($content_file = 'content.xml');
|
||||||
|
Loading…
Reference in New Issue
Block a user