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
This commit is contained in:
Laurent Destailleur 2015-05-30 19:50:07 +02:00
parent 0b372a4017
commit 36b7f1dcf3
19 changed files with 67 additions and 22 deletions

View File

@ -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 '<br>';

View File

@ -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 '<br>';

View File

@ -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 '<br>';

View File

@ -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 '<br>';

View File

@ -4844,16 +4844,24 @@ class Form
$ret.='</a>';
}
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.='<!-- Put link to gravatar -->';
$ret.='<img alt="Photo found on Gravatar" title="Photo Gravatar.com - email '.$email.'" border="0"'.($width?' width="'.$width:'').'" src="http://www.gravatar.com/avatar/'.dol_hash($email,3).'?s='.$width.'&d='.urlencode(dol_buildpath('/theme/common/nophoto.jpg',2)).'">'; // gravatar need md5 hash
$ret.='<img class="photo'.$modulepart.'" alt="Photo found on Gravatar" title="Photo Gravatar.com - email '.$email.'" border="0"'.($width?' width="'.$width:'').'" src="http://www.gravatar.com/avatar/'.dol_hash($email,3).'?s='.$width.'&d='.urlencode(dol_buildpath($nophoto,2)).'">'; // gravatar need md5 hash
}
else
{
$ret.='<img alt="No photo" border="0"'.($width?' width="'.$width:'').'" src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">';
{
$ret.='<img class="photo'.$modulepart.'" alt="No photo" border="0"'.($width?' width="'.$width:'').'" src="'.DOL_URL_ROOT.$nophoto.'">';
}
}

View File

@ -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.='<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">';
$out.='<a href="" data-role="button" style="background-color: #f0f0f0;" class="tab inline-block">'.$langs->trans("More").'...</a>';
$out.='<div id="moretabsList'.$tabsname.'" style="position: absolute; left: -999em;text-align: left;margin:0px;padding:2px">'.$outmore.'</div>';
@ -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"' : ''));
}
/**

View File

@ -1436,8 +1436,16 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
// Add login user link
$toprightmenu.='<div class="login_block_user">';
//$toprightmenu.=$form->textwithtooltip('',$loginhtmltext,2,1,$logintext,'login_block_elem2',2); // This include div class="login"
$toprightmenu.= $user->getNomurl(0, '', true, 0, 11);
// User photo
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem" style="padding: 0px;">';
$toprightmenu.=$user->getPhotoUrl();
$toprightmenu.='</div></div>';
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem" style="padding: 0px;">';
$toprightmenu.=$user->getNomurl(0, '', true, 0, 11);
$toprightmenu.='</div></div>';
$toprightmenu.='</div>';
$toprightmenu.='<div class="login_block_other">';
@ -1451,7 +1459,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
}
else $toprightmenu.=$result; // For backward compatibility
// Logout link
// Logout link
$toprightmenu.=$form->textwithtooltip('',$logouthtmltext,2,1,$logouttext,'login_block_elem',2);
// Link to print main content area

0
htdocs/theme/common/ical.gif Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 460 B

0
htdocs/theme/common/rss.gif Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 476 B

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

0
htdocs/theme/common/vcal.gif Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 329 B

View File

@ -281,6 +281,7 @@ input.liste_titre {
input.removedfile {
padding: 0px !important;
border: 0px !important;
vertical-align: text-bottom;
}
textarea:disabled {
background:#ddd;
@ -555,6 +556,9 @@ margin : 0px auto;
padding-left: 2px;
padding-right: 2px;
}
.pictowarning {
padding-left: 3px;
}
/* ============================================================================== */
@ -1787,7 +1791,7 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd
table.border, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border {
border: 1px solid #D0D0D0;
border: 1px solid #E0E0E0;
border-collapse: collapse;
padding: 1px 2px 1px 3px; /* t r b l */
}
@ -1796,7 +1800,7 @@ table.border, table.dataTable, .table-border, .table-border-col, .table-key-bord
height: 20px;
}
div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col {
height: 24px;
height: 20px;
}
div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col {
vertical-align: middle;
@ -1808,7 +1812,7 @@ div.tabBar .tdtop {
table.border td, div.border div div.tagtd {
padding: 2px 2px 2px 2px;
border: 1px solid #D0D0D0;
border: 1px solid #E0E0E0;
border-collapse: collapse;
}

View File

@ -1740,7 +1740,7 @@ else
// Photo
print '<td align="center" valign="middle" width="25%" rowspan="'.$rowspan.'">';
print $form->showphoto('userphoto',$object,0,$caneditfield);
print $form->showphoto('userphoto',$object,100,$caneditfield);
print '</td>';
print '</tr>';

View File

@ -1779,6 +1779,31 @@ class User extends CommonObject
}
}
/**
* Return a link to the user card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to
* @param integer $infologin Add connection info to the tooltip
* @param integer $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name
* @return string String with URL
*/
function getPhotoUrl($with=0)
{
global $form;
$result='';
$result.='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
$result.=$form->showphoto('userphoto', $this, ($with?$with:16));
$result.='</a>';
return $result;
}
/**
* Return a link to the user card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname