Mobile theme W.I.P.:

- Activate SVGs in framework
This commit is contained in:
Hadi Nategh 2016-02-24 16:47:32 +00:00
parent 5b10bde980
commit 5467b3bdf4
3 changed files with 5 additions and 13 deletions

View File

@ -766,6 +766,7 @@ class common
*/ */
static function image($app,$image,$extension='',$svg=false) static function image($app,$image,$extension='',$svg=false)
{ {
$svg = html::$ua_mobile?null:$svg; // ATM we use svg icons only for mobile theme
static $image_map_no_svg = null, $image_map_svg = null; static $image_map_no_svg = null, $image_map_svg = null;
if (is_null($svg)) $svg = self::svg_usable (); if (is_null($svg)) $svg = self::svg_usable ();
if ($svg) if ($svg)

View File

@ -1531,7 +1531,7 @@ abstract class egw_framework
self::validate_file('/phpgwapi/images.php', array( self::validate_file('/phpgwapi/images.php', array(
'template' => $GLOBALS['egw_info']['server']['template_set'], 'template' => $GLOBALS['egw_info']['server']['template_set'],
'etag' => md5(json_encode(common::image_map($GLOBALS['egw_info']['server']['template_set']))), 'etag' => md5(json_encode(common::image_map($GLOBALS['egw_info']['server']['template_set']))),
'svg' => 0, // always load non-svg image map 'svg' => html::$ua_mobile, // always load non-svg image map, ATM we use svg icons only for mobile theme
)); ));
self::validate_file('/phpgwapi/user.php', array( self::validate_file('/phpgwapi/user.php', array(
'user' => $GLOBALS['egw_info']['user']['account_lid'], 'user' => $GLOBALS['egw_info']['user']['account_lid'],

View File

@ -172,18 +172,9 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
image_element: function(_url, _alt) image_element: function(_url, _alt)
{ {
var icon; var icon;
if (typeof _url == 'string' && _url.match(/\.svg$/))
{
icon = document.createElement('object');
icon.type = 'image/svg+xml';
icon.data = _url;
}
else
{
icon = document.createElement('img'); icon = document.createElement('img');
if (_url) icon.src = _url; if (_url) icon.src = _url;
if (_alt) icon.alt = _alt; if (_alt) icon.alt = _alt;
}
return icon; return icon;
} }
}; };