Merge pull request #4636 from aternatik/label_cat

FIX : check contrast of link when using background color for category
This commit is contained in:
Laurent Destailleur 2016-02-16 13:59:03 +01:00
commit 6c7fc55988
2 changed files with 25 additions and 18 deletions

View File

@ -229,7 +229,7 @@ class Categorie extends CommonObject
$error=0;
dol_syslog(get_class($this).'::create', LOG_DEBUG);
// Clean parameters
$this->label = trim($this->label);
$this->description = trim($this->description);
@ -405,7 +405,7 @@ class Categorie extends CommonObject
// End call triggers
$this->db->commit();
return 1;
}
else
@ -571,12 +571,12 @@ class Categorie extends CommonObject
if ($this->id == -1) return -2;
// For backward compatibility
if ($type == 'societe')
if ($type == 'societe')
{
$type = 'customer';
dol_syslog(get_class($this) . "::add_type(): type 'societe' is deprecated, please use 'customer' instead", LOG_WARNING);
}
elseif ($type == 'fournisseur')
elseif ($type == 'fournisseur')
{
$type = 'supplier';
dol_syslog(get_class($this) . "::add_type(): type 'fournisseur' is deprecated, please use 'supplier' instead", LOG_WARNING);
@ -1362,7 +1362,14 @@ class Categorie extends CommonObject
$result='';
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
// Check contrast with background and correct text color
$color = colorArrayToHex(colorStringToArray($this->color,array()),'');
$forced_color='000';
$tmpcolorweight=0;
foreach(colorStringToArray($color,array()) as $x) $tmpcolorweight+=$x;
if ($tmpcolorweight < 400) $forced_color='FFF';
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip"' . ( $forced_color ? ' style="color: #'.$forced_color.'"' : '' ) .'>';
$linkend='</a>';
$picto='category';

View File

@ -653,7 +653,7 @@ div.arearef {
margin-bottom: 10px;
}
div.heightref {
min-height: 80px;
min-height: 80px;
}
div.divphotoref {
padding-right: 20px;
@ -1177,8 +1177,8 @@ div.vmenu, td.vmenu {
width: 188px;
}
.menu_contenu {
padding-top: 5px;
.menu_contenu {
padding-top: 5px;
padding-bottom: 2px;
}
#menu_contenu_logo { padding-right: 4px; }
@ -1247,7 +1247,7 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmen
-moz-box-shadow: 3px 3px 4px #DDD;
-webkit-box-shadow: 3px 3px 4px #DDD;
box-shadow: 3px 3px 4px #DDD;
*/
*/
}
div.blockvmenusearch
@ -2078,7 +2078,7 @@ table.liste, table.noborder, table.formdoc, div.noborder {
border-bottom-width: 1px;
border-bottom-color: #BBB;
border-bottom-style: solid;
margin: 0px 0px 5px 0px;
-moz-box-shadow: 2px 2px 4px #CCC;
@ -3661,10 +3661,10 @@ a span.select2-chosen
box-shadow: none;
-webkit-box-shadow: none !important;
box-shadow: none !important;
color: #fff !important;
color: #fff;
}
span.noborderoncategories a, li.noborderoncategories a {
color: #fff !important;
color: #fff;
line-height: normal;
vertical-align: top;
}
@ -3772,10 +3772,10 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i
}
select {
/* display: inline-block; */ /* We can't set this. This disable ability to make */
/* TODO added by jmobile, replace jmobile with pure css*/
/* TODO added by jmobile, replace jmobile with pure css*/
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
text-overflow: ellipsis;
}
.fiche .ui-controlgroup {
margin: 0px;
@ -3953,11 +3953,11 @@ border-top-right-radius: 6px;
@media only screen and (max-width: 767px)
{
.imgopensurveywizard { width:95%; height: auto; }
#tooltip {
position: absolute;
width: <?php print dol_size(350,'width'); ?>px;
}
}
}
@ -3997,14 +3997,14 @@ border-top-right-radius: 6px;
top: 4px;
max-width: 82px;
}
div.mainmenu {
min-width: 20px;
}
.topmenuimage {
background-size: 20px auto;
}
#tooltip {
position: absolute;
width: <?php print dol_size(300,'width'); ?>px;