Api\Vfs::mime_icon() only returns url or eTemplate app/name string, no more html image tag, egw_vfs compatibility class still implements that

This commit is contained in:
Ralf Becker 2016-03-05 15:59:20 +00:00
parent 49c45ff53a
commit f7441c2e2e
2 changed files with 27 additions and 13 deletions

View File

@ -14,7 +14,6 @@
namespace EGroupware\Api;
// explicitly import old phpgwapi classes used:
use html;
use HTTP_WebDAV_Server;
/**
@ -1192,7 +1191,7 @@ class Vfs extends Vfs\StreamWrapper
* Get the closest mime icon
*
* @param string $mime_type
* @param boolean $et_image =true return $app/$icon string for etemplate (default) or html img tag if false
* @param boolean $et_image =true return $app/$icon string for etemplate (default) or url for false
* @param int $size =128
* @return string
*/
@ -1217,15 +1216,7 @@ class Vfs extends Vfs\StreamWrapper
{
$img = Image::find('etemplate',$icon='mime'.$size.'_unknown');
}
if ($et_image === 'url')
{
return $img;
}
if ($et_image)
{
return 'etemplate/'.$icon;
}
return html::image('etemplate',$icon,MimeMagic::mime2label($mime_type));
return $et_image ? 'etemplate/'.$icon : $img;
}
/**

View File

@ -7,13 +7,36 @@
* @package api
* @subpackage vfs
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2008-15 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2008-16 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @version $Id$
*/
use EGroupware\Api\Vfs;
use EGroupware\Api;
/**
* @deprecated use EGroupware\Api\Vfs
*/
class egw_vfs extends Vfs {}
class egw_vfs extends Vfs
{
/**
* Get the closest mime icon
*
* @param string $mime_type
* @param boolean $et_image =true return $app/$icon string for etemplate (default),
* 'url' for 'url' or false for an html image tag (deprecated)
* @param int $size =128
* @return string
*/
static function mime_icon($mime_type, $et_image=true, $size=128)
{
$img = parent::mime_icon($mime_type, $et_image && $et_image !== 'url', $size);
if (!$et_image)
{
list(,$img) = explode('/', $img);
return html::image('etemplate', $img, Api\MimeMagic::mime2label($mime_type));
}
return $img;
}
}