From 36b7f1dcf3d90540336836535925dc0971ad89c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 May 2015 19:50:07 +0200 Subject: [PATCH] NEW Show photo of logged user into login top right block. NEW If no photo is available for user, we show a generic photo depending on gender --- htdocs/comm/askpricesupplier/card.php | 4 ++-- htdocs/comm/propal.php | 4 ++-- htdocs/commande/card.php | 4 ++-- htdocs/compta/facture.php | 4 ++-- htdocs/core/class/html.form.class.php | 18 +++++++++++----- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/main.inc.php | 14 ++++++++++--- htdocs/theme/common/ical.gif | Bin htdocs/theme/common/rss.gif | Bin htdocs/theme/common/user_anonymous.png | Bin 0 -> 16334 bytes htdocs/theme/common/user_man.png | Bin 0 -> 19908 bytes htdocs/theme/common/user_woman.png | Bin 0 -> 24554 bytes htdocs/theme/common/vcal.gif | Bin htdocs/theme/eldy/img/delete.png | Bin 130 -> 267 bytes htdocs/theme/eldy/img/object_printer.png | Bin 167 -> 296 bytes htdocs/theme/eldy/img/printer.png | Bin 167 -> 329 bytes htdocs/theme/eldy/style.css.php | 10 ++++++--- htdocs/user/card.php | 2 +- htdocs/user/class/user.class.php | 25 +++++++++++++++++++++++ 19 files changed, 67 insertions(+), 22 deletions(-) mode change 100755 => 100644 htdocs/theme/common/ical.gif mode change 100755 => 100644 htdocs/theme/common/rss.gif create mode 100644 htdocs/theme/common/user_anonymous.png create mode 100644 htdocs/theme/common/user_man.png create mode 100644 htdocs/theme/common/user_woman.png mode change 100755 => 100644 htdocs/theme/common/vcal.gif diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php index c49881ba542..6759ae22196 100644 --- a/htdocs/comm/askpricesupplier/card.php +++ b/htdocs/comm/askpricesupplier/card.php @@ -1737,7 +1737,7 @@ if ($action == 'create') $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; // Define output language $outputlangs = $langs; @@ -1763,7 +1763,7 @@ if ($action == 'create') exit(); } $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; } print '
'; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 5be006c0053..9d25daa8091 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2312,7 +2312,7 @@ if ($action == 'create') $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; // Define output language $outputlangs = $langs; @@ -2337,7 +2337,7 @@ if ($action == 'create') exit(); } $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; } print '
'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4b7d0104ec9..5a4b434286c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2325,7 +2325,7 @@ if ($action == 'create' && $user->rights->commande->creer) $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; // Define output language $outputlangs = $langs; @@ -2350,7 +2350,7 @@ if ($action == 'create' && $user->rights->commande->creer) exit(); } $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; } print '
'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 59b5715402f..410377c5683 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3885,7 +3885,7 @@ if ($action == 'create') $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; // Define output language $outputlangs = $langs; @@ -3910,7 +3910,7 @@ if ($action == 'create') exit(); } $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; } print '
'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0e22145157c..3a9c716dd7a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4844,16 +4844,24 @@ class Form $ret.=''; } else - { - if (! empty($conf->gravatar->enabled) && $email) + { + $nophoto='/theme/common/nophoto.jpg'; + if (in_array($modulepart,array('userphoto','contact'))) // For module thar are "physical" users + { + $nophoto='/theme/common/user_anonymous.png'; + if ($object->gender == 'man') $nophoto='/theme/common/user_man.png'; + if ($object->gender == 'woman') $nophoto='/theme/common/user_woman.png'; + } + + if (! empty($conf->gravatar->enabled) && $email) { global $dolibarr_main_url_root; $ret.=''; - $ret.='Photo found on Gravatar'; // gravatar need md5 hash + $ret.='Photo found on Gravatar'; // gravatar need md5 hash } else - { - $ret.='No photo'; + { + $ret.='No photo'; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8b6dfa38657..ce5e7bbf33d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -789,7 +789,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if ($displaytab > $limittoshow) { - $tabsname=str_replace ("@", "", $picto); + $tabsname=str_replace ("@", "", $picto); $out.='
'; $out.=''.$langs->trans("More").'...'; $out.='
'.$outmore.'
'; @@ -2217,7 +2217,7 @@ function img_warning($titlealt = 'default', $float = 0) if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); - return img_picto($titlealt, 'warning.png', ($float ? 'style="float: right"' : '')); + return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($float ? ' style="float: right"' : '')); } /** diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6df0f77f500..1e9f418a594 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1436,8 +1436,16 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a // Add login user link $toprightmenu.=''; $toprightmenu.='