Font awesome 5 by default

This commit is contained in:
Laurent Destailleur 2019-03-12 10:11:34 +01:00
parent ec0ff62ce0
commit d762766a56
4 changed files with 52 additions and 46 deletions

View File

@ -2985,7 +2985,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
)
)) {
$fa='fa';
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa='fas';
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fa='fas';
$fakey = $pictowithoutext;
$facolor = ''; $fasize = '';
$marginleftonlyshort = 2;
@ -3021,14 +3021,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithoutext == 'edit') {
$fakey = 'fa-pencil';
$facolor = '#444';
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fakey = 'fa-pencil-alt';
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fakey = 'fa-pencil-alt';
}
elseif ($pictowithoutext == 'filter') {
$fakey = 'fa-'.$pictowithoutext;
}
elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') {
$fakey = 'fa-arrows';
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fakey = 'fa-arrows-alt';
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fakey = 'fa-arrows-alt';
}
elseif ($pictowithoutext == 'listlight') {
$fakey = 'fa-download';
@ -3062,7 +3062,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithoutext == 'sign-out') {
$fakey = 'fa-sign-out';
$marginleftonlyshort=0;
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fakey = 'fa-sign-out-alt';
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fakey = 'fa-sign-out-alt';
}
elseif ($pictowithoutext == 'unlink') {
$fakey = 'fa-chain-broken';
@ -3081,7 +3081,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
}
elseif (in_array($pictowithoutext, array('skype', 'twitter', 'facebook', 'linkedin'))) {
$fakey = 'fa-'.$pictowithoutext;
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa = 'fab';
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fa = 'fab';
}
elseif ($pictowithoutext == 'split') {
$fakey = 'fa-code-fork';

View File

@ -1285,7 +1285,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
{
print '<!-- Includes CSS for font awesome -->'."\n";
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/fontawesome/css/font-awesome.min.css'.($ext?'?'.$ext:'').'">'."\n";
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5))
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5))
{
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/fontawesome-5/css/all.min.css'.($ext?'?'.$ext:'').'">'."\n";
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/fontawesome-5/css/v4-shims.min.css'.($ext?'?'.$ext:'').'">'."\n";

View File

@ -1487,7 +1487,7 @@ a.tmenuimage:hover{
/* Do not load menu img for other if hidden to save bandwidth */
<?php if (empty($dol_hide_topmenu)) { ?>
<?php if (! defined('DISABLE_FONT_AWSOME') && !empty($conf->global->MAIN_USE_FONT_AWESOME_5)) { ?>
<?php if (! defined('DISABLE_FONT_AWSOME') && empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) { ?>
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
<?php } else { ?>
div.mainmenu.home{
@ -1551,6 +1551,10 @@ a.tmenuimage:hover{
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products_over.png', 1) ?>);
}
div.mainmenu.mrp {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products_over.png', 1) ?>);
}
div.mainmenu.project {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project_over.png', 1) ?>);
}
@ -1588,7 +1592,7 @@ a.tmenuimage:hover{
$generic=1;
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined
$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','takepos','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website');
$divalreadydefined=array('home','companies','products','mrp','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','takepos','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website');
// Put here list of menu entries we are sure we don't want
$divnotrequired=array('multicurrency','salaries','ticket','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition');
foreach($mainmenuusedarray as $val)
@ -1617,26 +1621,28 @@ a.tmenuimage:hover{
// Img file not found
if (! $found)
{
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic."_over.png", 1);
$found=1;
if ($generic < 4) $generic++;
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
if (! defined('DISABLE_FONT_AWSOME') && empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) {
print 'div.mainmenu.'.$val.'::before {
content: "\f249";
}';
}
else
{
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.(min($generic,4))."_over.png", 1);
print "div.mainmenu.generic".$generic." {\n";
print " background-image: url(".$url.");\n";
print "}\n";
}
$generic++;
}
if ($found)
else
{
print "div.mainmenu.".$val." {\n";
print " background-image: url(".$url.");\n";
print "}\n";
}
}
$j=0;
while ($j++ < 4)
{
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$j."_over.png", 1);
print "div.mainmenu.generic".$j." {\n";
print " background-image: url(".$url.");\n";
print "}\n";
}
// End of part to add more div class css
?>
<?php } // End test if $dol_hide_topmenu ?>

View File

@ -1769,7 +1769,8 @@ div.mainmenu.website {
<?php
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
$moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'=>'project','propale'=>'commercial','commande'=>'commercial',
$moduletomainmenu=array(
'user'=>'','syslog'=>'','societe'=>'companies','projet'=>'project','propale'=>'commercial','commande'=>'commercial',
'produit'=>'products','service'=>'products','stock'=>'products',
'don'=>'accountancy','tax'=>'accountancy','banque'=>'accountancy','facture'=>'accountancy','compta'=>'accountancy','accounting'=>'accountancy','adherent'=>'members','import'=>'tools','export'=>'tools','mailing'=>'tools',
'contrat'=>'commercial','ficheinter'=>'commercial','ticket'=>'ticket','deplacement'=>'commercial',
@ -1781,12 +1782,11 @@ foreach($conf->modules as $val)
{
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
}
//var_dump($mainmenuused);
$mainmenuusedarray=array_unique(explode(',', $mainmenuused));
$generic=1;
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined
$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','takepos','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website');
$divalreadydefined=array('home','companies','products','mrp','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','takepos','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website');
// Put here list of menu entries we are sure we don't want
$divnotrequired=array('multicurrency','salaries','ticket','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition');
foreach($mainmenuusedarray as $val)
@ -1799,13 +1799,13 @@ foreach($mainmenuusedarray as $val)
$found=0; $url='';
foreach($conf->file->dol_document_root as $dirroot)
{
if (file_exists($dirroot."/".$val."/img/".$val.".png"))
{
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
$found=1;
break;
}
elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
if (file_exists($dirroot."/".$val."/img/".$val."_over.png"))
{
$url=dol_buildpath('/'.$val.'/img/'.$val.'_over.png', 1);
$found=1;
break;
}
elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
{
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
$found=1;
@ -1815,32 +1815,32 @@ foreach($mainmenuusedarray as $val)
// Img file not found
if (! $found)
{
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png", 1);
$found=1;
if ($generic < 4) $generic++;
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
if (! defined('DISABLE_FONT_AWSOME') && empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) {
print 'div.mainmenu.'.$val.'::before {
content: "\f249";
}';
}
else
{
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.(min($generic,4))."_over.png", 1);
print "div.mainmenu.generic".$generic." {\n";
print " background-image: url(".$url.");\n";
print "}\n";
}
$generic++;
}
if ($found)
else
{
print "div.mainmenu.".$val." {\n";
print " background-image: url(".$url.");\n";
print "}\n";
}
}
$j=0;
while ($j++ < 4)
{
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$j."_over.png", 1);
print "div.mainmenu.generic".$j." {\n";
print " background-image: url(".$url.");\n";
print "}\n";
}
// End of part to add more div class css
?>
<?php
} // End test if $dol_hide_topmenu
?>
<?php } // End test if $dol_hide_topmenu ?>
.tmenuimage {
padding:0 0 0 0 !important;