forked from Wavyzz/dolibarr
Merge pull request #8503 from ruistrecht-alt/FIX_pictos_in_agenda
FIX: img_pictos for remove assigned user in agenda card
This commit is contained in:
@@ -1703,7 +1703,7 @@ class Form
|
|||||||
$userstatic->fetch($value['id']);
|
$userstatic->fetch($value['id']);
|
||||||
$out.= $userstatic->getNomUrl(-1);
|
$out.= $userstatic->getNomUrl(-1);
|
||||||
if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; }
|
if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; }
|
||||||
if ($nbassignetouser > 1 && $action != 'view') $out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
|
if ($nbassignetouser > 1 && $action != 'view') $out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 1, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
|
||||||
// Show my availability
|
// Show my availability
|
||||||
if ($showproperties)
|
if ($showproperties)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3071,68 +3071,124 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
||||||
|
$url = DOL_URL_ROOT;
|
||||||
|
$theme = $conf->theme;
|
||||||
|
$path = 'theme/'.$theme;
|
||||||
|
|
||||||
// Define fullpathpicto to use into src
|
// Define fullpathpicto to use into src
|
||||||
if ($pictoisfullpath)
|
if ($pictoisfullpath) {
|
||||||
{
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
|
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) {
|
||||||
$fullpathpicto = $picto;
|
$picto .= '.png';
|
||||||
|
}
|
||||||
|
$fullpathpicto = $url.'/'.$path.'/img/'.$picto;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
|
$pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
|
||||||
|
|
||||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||||
if (in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow')))
|
if (in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) {
|
||||||
{
|
$fakey = $pictowithoutext;
|
||||||
$fakey = $pictowithoutext; $facolor=''; $fasize='';
|
$facolor = '';
|
||||||
if ($pictowithoutext == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; }
|
$fasize = '';
|
||||||
elseif ($pictowithoutext == 'switch_on') { $fakey = 'fa-toggle-on'; $facolor='#227722'; $fasize='2em'; }
|
if ($pictowithoutext == 'switch_off') {
|
||||||
elseif ($pictowithoutext == 'off') { $fakey = 'fa-square-o'; $fasize='1.3em'; }
|
$fakey = 'fa-toggle-off';
|
||||||
elseif ($pictowithoutext == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; }
|
$facolor = '#999';
|
||||||
elseif ($pictowithoutext == 'bank') { $fakey = 'fa-bank'; $facolor='#444'; }
|
$fasize = '2em';
|
||||||
elseif ($pictowithoutext == 'delete') { $fakey = 'fa-trash'; $facolor='#444'; }
|
}
|
||||||
elseif ($pictowithoutext == 'edit') { $fakey = 'fa-pencil'; $facolor='#444'; }
|
elseif ($pictowithoutext == 'switch_on') {
|
||||||
elseif ($pictowithoutext == 'printer') { $fakey = 'fa-print'; $fasize='1.2em'; $facolor='#444'; }
|
$fakey = 'fa-toggle-on';
|
||||||
elseif ($pictowithoutext == 'resize') { $fakey = 'fa-crop'; $facolor='#444'; }
|
$facolor = '#227722';
|
||||||
elseif ($pictowithoutext == 'uparrow') { $fakey = 'fa-mail-forward'; $facolor='#555'; }
|
$fasize = '2em';
|
||||||
elseif ($pictowithoutext == 'unlink') { $fakey = 'fa-chain-broken'; $facolor='#555'; }
|
}
|
||||||
elseif ($pictowithoutext == 'playdisabled') { $fakey = 'fa-play'; $facolor='#ccc'; }
|
elseif ($pictowithoutext == 'off') {
|
||||||
else { $fakey = 'fa-'.$pictowithoutext; $facolor='#444'; }
|
$fakey = 'fa-square-o';
|
||||||
|
$fasize = '1.3em';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'on') {
|
||||||
|
$fakey = 'fa-check-square-o';
|
||||||
|
$fasize = '1.3em';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'bank') {
|
||||||
|
$fakey = 'fa-bank';
|
||||||
|
$facolor = '#444';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'delete') {
|
||||||
|
$fakey = 'fa-trash';
|
||||||
|
$facolor = '#444';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'edit') {
|
||||||
|
$fakey = 'fa-pencil';
|
||||||
|
$facolor = '#444';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'printer') {
|
||||||
|
$fakey = 'fa-print';
|
||||||
|
$fasize = '1.2em';
|
||||||
|
$facolor = '#444';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'resize') {
|
||||||
|
$fakey = 'fa-crop';
|
||||||
|
$facolor = '#444';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'uparrow') {
|
||||||
|
$fakey = 'fa-mail-forward';
|
||||||
|
$facolor = '#555';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'unlink') {
|
||||||
|
$fakey = 'fa-chain-broken';
|
||||||
|
$facolor = '#555';
|
||||||
|
}
|
||||||
|
elseif ($pictowithoutext == 'playdisabled') {
|
||||||
|
$fakey = 'fa-play';
|
||||||
|
$facolor = '#ccc';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fakey = 'fa-'.$pictowithoutext;
|
||||||
|
$facolor = '#444';
|
||||||
|
}
|
||||||
|
|
||||||
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { $morecss.=($morecss?' ':'').$reg[1]; }
|
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
|
||||||
$enabledisablehtml ='<span class="fa '.$fakey.' marginleftonly valignmiddle'.($morecss?' '.$morecss:'').'" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'"'.($moreatt?' '.$moreatt:'').'">';
|
$morecss.= ($morecss?' ':'').$reg[1];
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$titlealt;
|
}
|
||||||
$enabledisablehtml.='</span>';
|
$enabledisablehtml = '<span class="fa '.$fakey.' marginleftonly valignmiddle'.($morecss?' '.$morecss:'').'" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'"'.($moreatt?' '.$moreatt:'').'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
|
$enabledisablehtml.= $titlealt;
|
||||||
|
}
|
||||||
|
$enabledisablehtml.= '</span>';
|
||||||
|
|
||||||
return $enabledisablehtml;
|
return $enabledisablehtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) {
|
||||||
$url = DOL_URL_ROOT;
|
$path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
|
||||||
$theme = $conf->theme;
|
}
|
||||||
|
else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
|
||||||
$path = 'theme/'.$theme;
|
$path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
|
||||||
if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
|
}
|
||||||
else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
|
else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) {
|
||||||
else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
|
$path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
|
||||||
|
}
|
||||||
|
|
||||||
// If we ask an image into $url/$mymodule/img (instead of default path)
|
// If we ask an image into $url/$mymodule/img (instead of default path)
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) {
|
||||||
{
|
|
||||||
$picto = $regs[1];
|
$picto = $regs[1];
|
||||||
$path = $regs[2]; // $path is $mymodule
|
$path = $regs[2]; // $path is $mymodule
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
|
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) {
|
||||||
|
$picto .= '.png';
|
||||||
|
}
|
||||||
// If alt path are defined, define url where img file is, according to physical path
|
// If alt path are defined, define url where img file is, according to physical path
|
||||||
foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...)
|
// ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...)
|
||||||
{
|
foreach ($conf->file->dol_document_root as $type => $dirroot) {
|
||||||
if ($type == 'main') continue;
|
if ($type == 'main') {
|
||||||
if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded
|
continue;
|
||||||
{
|
}
|
||||||
$url=DOL_URL_ROOT.$conf->file->dol_url_root[$type];
|
// This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded
|
||||||
|
if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) {
|
||||||
|
$url = DOL_URL_ROOT.$conf->file->dol_url_root[$type];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3141,15 +3197,16 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
$fullpathpicto = $url.'/'.$path.'/img/'.$picto;
|
$fullpathpicto = $url.'/'.$path.'/img/'.$picto;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($srconly) return $fullpathpicto;
|
if ($srconly) {
|
||||||
else
|
return $fullpathpicto;
|
||||||
{
|
}
|
||||||
|
else {
|
||||||
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people
|
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people
|
||||||
//$tmparray=array(0=>$titlealt);
|
//$tmparray=array(0=>$titlealt);
|
||||||
//if (empty($notitle) && preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
|
//if (empty($notitle) && preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
|
||||||
//$title=$tmparray[0];
|
//$title=$tmparray[0];
|
||||||
//$alt=empty($tmparray[1])?'':$tmparray[1];
|
//$alt=empty($tmparray[1])?'':$tmparray[1];
|
||||||
$title=$titlealt;
|
$title = $titlealt;
|
||||||
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($title))?'':' title="'.dol_escape_htmltag($title).'"').($moreatt?' '.$moreatt:' class="inline-block"').'>'; // Alt is used for accessibility, title for popup
|
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($title))?'':' title="'.dol_escape_htmltag($title).'"').($moreatt?' '.$moreatt:' class="inline-block"').'>'; // Alt is used for accessibility, title for popup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user