0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-03-16 06:13:34 +00:00

Review - Fixing Icons and svg loading

This commit is contained in:
Daniel Samson 2016-08-22 19:49:49 +01:00
parent f0b2b81083
commit 435c2ece52
9 changed files with 31 additions and 15 deletions
include
modules/Calendar/Dashlets/CalendarDashlet
themes
Suite7/images
SuiteP
SuiteR/images
default/images

View file

@ -712,12 +712,19 @@ EOHTML;
*/
public function getImage($imageName, $other_attributes = '', $width = null, $height = null, $ext = null, $alt = '') {
static $cached_results = array();
// Look for SVG first
$imagePath = SugarThemeRegistry::current()->getImagePath().DIRECTORY_SEPARATOR.$imageName.'.svg';
if(file_exists($imagePath)) {
$ext = '.svg';
// look for .svg first
if(strpos($imageName, '.svg') !== false) {
$ext = '';
} else {
// Look for SVG first
$imagePath = SugarThemeRegistry::current()->getImagePath().DIRECTORY_SEPARATOR.$imageName.'.svg';
if(file_exists($imagePath)) {
$ext = '.svg';
}
}
// trap deprecated use of image extension
if(is_null($ext)) {
$imageNameExp = explode('.',$imageName);
@ -764,10 +771,12 @@ EOHTML;
$attr_width = (is_null($width)) ? "" : "width=\"$width\"";
$attr_height = (is_null($height)) ? "" : "height=\"$height\"";
if(strpos($cached_results[$imageName], 'svg') !== false){
if(strpos($cached_results[$imageName], 'svg') !== false) {
return $cached_results[$imageName];
}
return $cached_results[$imageName] . " $attr_width $attr_height $other_attributes alt=\"$alt\" />";
$imgHTML = $cached_results[$imageName] . " {$attr_width} {$attr_height} {$other_attributes} alt='$alt' />";
return $imgHTML;
}
/**

View file

@ -4287,8 +4287,16 @@ function createGroupUser($name)
function _getIcon($iconFileName)
{
$iconName = "icon_{$iconFileName}.gif";
$iconFound = SugarThemeRegistry::current()->getImageURL($iconName, false);
if(file_exists(SugarThemeRegistry::current()->getImagePath().DIRECTORY_SEPARATOR.'icon_'.$iconFileName.'.svg')) {
$iconName = "icon_{$iconFileName}.svg";
$iconFound = SugarThemeRegistry::current()->getImageURL($iconName, false);
}
else {
$iconName = "icon_{$iconFileName}.gif";
$iconFound = SugarThemeRegistry::current()->getImageURL($iconName, false);
}
//First try un-ucfirst-ing the icon name
if (empty($iconFound)) {

View file

@ -41,10 +41,9 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $app_strings, $current_language;
$dashletMeta['CalendarDashlet'] = array(
'title' => 'LBL_TITLE', // array index in language pack
$dashletMeta['CalendarDashlet'] = array('module' => 'Calendar',
'title' => 'LBL_TITLE', // array index in language pack
'description' => 'LBL_DESCRIPTION', // array index in language pack
'icon' => 'icon_Calendar_32.gif',
'category' => 'Module Views',
);
?>

Binary file not shown.

Before

(image error) Size: 375 B

After

(image error) Size: 148 B

View file

@ -363,9 +363,9 @@ div#pageContainer td.dashletcontainer div.hd .icon {
background-image: url("../../../../themes/SuiteP/images/sidebar/List_Maps.svg");
}
#actionMenuSidebar li a.side-bar-Quick_Radius_Maps {
background-image: url("../../../../themes/SuiteP/images/sidebar/Quick_Radius_Maps.png");
background-image: url("../../../../themes/SuiteP/images/sidebar/Quick_Radius_Maps.svg");
#actionMenuSidebar li a.side-bar-Quick_Radius_Map {
background-image: url("../../../../themes/SuiteP/images/sidebar/Quick_Radius_Map.png");
background-image: url("../../../../themes/SuiteP/images/sidebar/Quick_Radius_Map.svg");
}
#actionMenuSidebar li a.side-bar-Resource_Chart {

View file

@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="acc_calendar" fill="#FFFFFF">
<g id="acc_calendar" fill="#778591">
<path d="M21.0610286,1.28 L19.2389939,1.28 L19.2389939,4.51503269 L10.7610061,4.51503269 L10.7610061,1.28 L8.93897137,1.28 L8.93897137,4.51503269 L2,4.51503269 L2,27.4989624 L28,27.4989624 L28,4.51503269 L21.0610286,4.51503269 L21.0610286,1.28 Z M3.82203472,25.679021 L3.82203472,12.8360207 L26.1779653,12.8360207 L26.1779653,25.679021 L3.82203472,25.679021 Z M26.1779653,6.33497407 L26.1779653,10.9830047 L3.82203472,10.9830047 L3.82203472,6.33497407 L8.94064603,6.33497407 L8.94064603,8.53297092 L10.7626808,8.53297092 L10.7626808,6.33497407 L19.2096873,6.33497407 L19.2096873,8.53297092 L21.0313033,8.53297092 L21.0313033,6.33497407 L26.1779653,6.33497407 Z" id="Page-1"></path>
</g>
</g>

Before

(image error) Size: 1.2 KiB

After

(image error) Size: 1.2 KiB

Binary file not shown.

Before

(image error) Size: 375 B

After

(image error) Size: 148 B

Binary file not shown.

Before

(image error) Size: 375 B

After

(image error) Size: 148 B

Binary file not shown.

Before

(image error) Size: 564 B

After

(image error) Size: 219 B