2
0
forked from Wavyzz/dolibarr

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'; $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; $fakey = $pictowithoutext;
$facolor = ''; $fasize = ''; $facolor = ''; $fasize = '';
$marginleftonlyshort = 2; $marginleftonlyshort = 2;
@@ -3021,14 +3021,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithoutext == 'edit') { elseif ($pictowithoutext == 'edit') {
$fakey = 'fa-pencil'; $fakey = 'fa-pencil';
$facolor = '#444'; $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') { elseif ($pictowithoutext == 'filter') {
$fakey = 'fa-'.$pictowithoutext; $fakey = 'fa-'.$pictowithoutext;
} }
elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') { elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') {
$fakey = 'fa-arrows'; $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') { elseif ($pictowithoutext == 'listlight') {
$fakey = 'fa-download'; $fakey = 'fa-download';
@@ -3062,7 +3062,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithoutext == 'sign-out') { elseif ($pictowithoutext == 'sign-out') {
$fakey = 'fa-sign-out'; $fakey = 'fa-sign-out';
$marginleftonlyshort=0; $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') { elseif ($pictowithoutext == 'unlink') {
$fakey = 'fa-chain-broken'; $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'))) { elseif (in_array($pictowithoutext, array('skype', 'twitter', 'facebook', 'linkedin'))) {
$fakey = 'fa-'.$pictowithoutext; $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') { elseif ($pictowithoutext == 'split') {
$fakey = 'fa-code-fork'; $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 '<!-- 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"; 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/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"; 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 */ /* Do not load menu img for other if hidden to save bandwidth */
<?php if (empty($dol_hide_topmenu)) { ?> <?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 include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
<?php } else { ?> <?php } else { ?>
div.mainmenu.home{ 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) ?>); 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 { div.mainmenu.project {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project_over.png', 1) ?>); 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; $generic=1;
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined // 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 // 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'); $divnotrequired=array('multicurrency','salaries','ticket','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition');
foreach($mainmenuusedarray as $val) foreach($mainmenuusedarray as $val)
@@ -1617,26 +1621,28 @@ a.tmenuimage:hover{
// Img file not found // Img file not found
if (! $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"; 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 "div.mainmenu.".$val." {\n";
print " background-image: url(".$url.");\n"; print " background-image: url(".$url.");\n";
print "}\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 // End of part to add more div class css
?> ?>
<?php } // End test if $dol_hide_topmenu ?> <?php } // End test if $dol_hide_topmenu ?>

View File

@@ -1769,7 +1769,8 @@ div.mainmenu.website {
<?php <?php
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div') // 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', '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', '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', 'contrat'=>'commercial','ficheinter'=>'commercial','ticket'=>'ticket','deplacement'=>'commercial',
@@ -1781,12 +1782,11 @@ foreach($conf->modules as $val)
{ {
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val); $mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
} }
//var_dump($mainmenuused);
$mainmenuusedarray=array_unique(explode(',', $mainmenuused)); $mainmenuusedarray=array_unique(explode(',', $mainmenuused));
$generic=1; $generic=1;
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined // 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 // 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'); $divnotrequired=array('multicurrency','salaries','ticket','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition');
foreach($mainmenuusedarray as $val) foreach($mainmenuusedarray as $val)
@@ -1799,13 +1799,13 @@ foreach($mainmenuusedarray as $val)
$found=0; $url=''; $found=0; $url='';
foreach($conf->file->dol_document_root as $dirroot) foreach($conf->file->dol_document_root as $dirroot)
{ {
if (file_exists($dirroot."/".$val."/img/".$val.".png")) if (file_exists($dirroot."/".$val."/img/".$val."_over.png"))
{ {
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); $url=dol_buildpath('/'.$val.'/img/'.$val.'_over.png', 1);
$found=1; $found=1;
break; break;
} }
elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
{ {
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); $url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
$found=1; $found=1;
@@ -1815,32 +1815,32 @@ foreach($mainmenuusedarray as $val)
// Img file not found // Img file not found
if (! $found) if (! $found)
{ {
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png", 1); 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";
$found=1; if (! defined('DISABLE_FONT_AWSOME') && empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) {
if ($generic < 4) $generic++; print 'div.mainmenu.'.$val.'::before {
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"; 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 "div.mainmenu.".$val." {\n";
print " background-image: url(".$url.");\n"; print " background-image: url(".$url.");\n";
print "}\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 // End of part to add more div class css
?> ?>
<?php <?php } // End test if $dol_hide_topmenu ?>
} // End test if $dol_hide_topmenu
?>
.tmenuimage { .tmenuimage {
padding:0 0 0 0 !important; padding:0 0 0 0 !important;