remove not necessary mime_(type|size|name)

This commit is contained in:
Ralf Becker 2012-03-20 16:02:00 +00:00
parent 8a5d64301c
commit c7b52a8928
3 changed files with 5 additions and 20 deletions

View File

@ -85,9 +85,6 @@ class felamimail_hooks
'menuaction' => 'felamimail.uifelamimail.importMessageFromVFS2DraftAndDisplay', 'menuaction' => 'felamimail.uifelamimail.importMessageFromVFS2DraftAndDisplay',
'mime_popup' => '850xegw_getWindowOuterHeight()', 'mime_popup' => '850xegw_getWindowOuterHeight()',
'mime_url' => 'formData[file]', 'mime_url' => 'formData[file]',
'mime_name' => 'formData[name]', // why are these required?
'mime_type' => 'formData[type]',
'mime_size' => 'formData[size]',
), ),
), ),
); );

View File

@ -617,7 +617,7 @@ class uifelamimail
/** /**
* importMessageFromVFS2DraftAndDisplay * importMessageFromVFS2DraftAndDisplay
* *
* @param array $_formData Array with information of name, type, file and size; file is required, * @param array $formData Array with information of name, type, file and size; file is required,
* name, type and size may be set here to meet the requirements * name, type and size may be set here to meet the requirements
* Example: $formData['name'] = 'a_email.eml'; * Example: $formData['name'] = 'a_email.eml';
* $formData['type'] = 'message/rfc822'; * $formData['type'] = 'message/rfc822';
@ -634,14 +634,14 @@ class uifelamimail
// name should be set to meet the requirements of checkFileBasics // name should be set to meet the requirements of checkFileBasics
if (parse_url($formData['file'],PHP_URL_SCHEME) == 'vfs' && (!isset($formData['name']) || empty($formData['name']))) if (parse_url($formData['file'],PHP_URL_SCHEME) == 'vfs' && (!isset($formData['name']) || empty($formData['name'])))
{ {
$buff = explode('/',$_formData['file']); $buff = explode('/',$formData['file']);
$suffix = ''; $suffix = '';
if (is_array($buff)) $formData['name'] = array_pop($buff); // take the last part as name if (is_array($buff)) $formData['name'] = array_pop($buff); // take the last part as name
} }
// type should be set to meet the requirements of checkFileBasics // type should be set to meet the requirements of checkFileBasics
if (parse_url($formData['file'],PHP_URL_SCHEME) == 'vfs' && (!isset($formData['type']) || empty($formData['type']))) if (parse_url($formData['file'],PHP_URL_SCHEME) == 'vfs' && (!isset($formData['type']) || empty($formData['type'])))
{ {
$buff = explode('.',$_formData['file']); $buff = explode('.',$formData['file']);
$suffix = ''; $suffix = '';
if (is_array($buff)) $suffix = array_pop($buff); // take the last extension to check with ext2mime if (is_array($buff)) $suffix = array_pop($buff); // take the last extension to check with ext2mime
if (!empty($suffix)) $formData['type'] = mime_magic::ext2mime($suffix); if (!empty($suffix)) $formData['type'] = mime_magic::ext2mime($suffix);

View File

@ -227,6 +227,7 @@ class egw_link extends solink
'edit','edit_id','edit_popup', 'edit','edit_id','edit_popup',
'list','list_popup', 'list','list_popup',
'name','icon','query', 'name','icon','query',
'mime',
))); )));
} }
return json_encode($to_json); return json_encode($to_json);
@ -951,19 +952,6 @@ class egw_link extends solink
{ {
throw egw_exception_assertion_failed("Missing 'mime_id' or 'mime_url' for mime-type '$type'!"); throw egw_exception_assertion_failed("Missing 'mime_id' or 'mime_url' for mime-type '$type'!");
} }
// some optional values fmail needs ...
foreach(array(
'mime_type' => $type,
'mime_size' => null, // filesize(egw_vfs::PREFIX.$path),
'mime_name' => basename($path),
) as $name => $value)
{
if (isset($data[$name]))
{
$data[$data[$name]] = $name == 'mime_size' ? filesize(egw_vfs::PREFIX.$path) : $value;
unset($data[$name]);
}
}
$popup = $data['mime_popup']; $popup = $data['mime_popup'];
unset($data['mime_popup']); unset($data['mime_popup']);
} }