public function getPartName(Horde_Mime_Part $part, $use_descrip = false)
{
$name = $use_descrip ? $part->getDescription(true) : $part->getName(true);
if ($name) {
return $name;
}
switch ($ptype = $part->getPrimaryType()) {
case 'multipart':
if ($part->getSubType() == 'related' && ($view_id = $part->getMetaData('viewable_part')) && ($viewable = $this->getMimePart($view_id, array('nocontents' => true)))) {
return $this->getPartName($viewable, $use_descrip);
}
/* Fall-through. */
/* Fall-through. */
case 'application':
case 'model':
$ptype = $part->getSubType();
break;
}
switch ($ptype) {
case 'audio':
return _("Audio");
case 'image':
return _("Image");
case 'message':
case '':
case Horde_Mime_Part::UNKNOWN:
return _("Message");
case 'multipart':
return _("Multipart");
case 'text':
return _("Text");
case 'video':
return _("Video");
default:
// Attempt to translate this type, if possible. Odds are that
// it won't appear in the dictionary though.
return _(Horde_String::ucfirst($ptype));
}
}