New attribute: ImageAttribute

SVN:trunk[4129]
This commit is contained in:
Romain Quetiez
2016-05-24 15:29:44 +00:00
parent 2299d23099
commit 1e719b97d8
20 changed files with 730 additions and 15 deletions

File diff suppressed because one or more lines are too long

View File

@@ -458,6 +458,14 @@
</reconciliation>
</properties>
<fields>
<field id="picture" xsi:type="AttributeImage">
<display_max_width>96</display_max_width>
<display_max_height>96</display_max_height>
<storage_max_width>128</storage_max_width>
<storage_max_height>128</storage_max_height>
<default_image>images/silhouette.png</default_image>
<is_null_allowed>true</is_null_allowed>
</field>
<field id="first_name" xsi:type="AttributeString">
<sql>first_name</sql>
<default_value/>
@@ -568,6 +576,14 @@
<item id="col:col2">
<rank>50</rank>
<items>
<item id="fieldset:Person:personal_info">
<rank>5</rank>
<items>
<item id="picture">
<rank>10</rank>
</item>
</items>
</item>
<item id="fieldset:Person:notifiy">
<rank>10</rank>
<items>

View File

@@ -201,6 +201,8 @@ Dict::Add('EN US', 'English', 'English', array(
'Class:Person/Attribute:tickets_list+' => 'All the tickets this person is the caller',
'Class:Person/Attribute:manager_id_friendlyname' => 'Manager friendly name',
'Class:Person/Attribute:manager_id_friendlyname+' => '',
'Class:Person/Attribute:picture' => 'Picture',
'Class:Person/Attribute:picture+' => '',
));
//
@@ -1880,6 +1882,7 @@ Dict::Add('EN US', 'English', 'English', array(
'Server:otherinfo' => 'Other information',
'Server:power' => 'Power supply',
'Person:info' => 'General information',
'Person:personal_info' => 'Personal information',
'Person:notifiy' => 'Notification',
'Class:Subnet/Tab:IPUsage' => 'IP Usage',
'Class:Subnet/Tab:IPUsage-explain' => 'Interfaces having an IP in the range: <em>%1$s</em> to <em>%2$s</em>',

View File

@@ -146,6 +146,8 @@ Dict::Add('FR FR', 'French', 'Français', array(
'Class:Person/Attribute:tickets_list+' => '',
'Class:Person/Attribute:manager_id_friendlyname' => 'Manager friendly name',
'Class:Person/Attribute:manager_id_friendlyname+' => '',
'Class:Person/Attribute:picture' => 'Photo',
'Class:Person/Attribute:picture+' => '',
));
//
@@ -1850,6 +1852,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
'Server:otherinfo' => 'Autres informations',
'Server:power' => 'Alimentation électrique',
'Person:info' => 'Informations générales',
'Person:personal_info' => 'Informations personnelles',
'Person:notifiy' => 'Notification',
'Class:Subnet/Tab:IPUsage' => 'IP utilisées',
'Class:Subnet/Tab:IPUsage-explain' => 'Interfaces ayant une IP dans la plage: <em>%1$s</em> à <em>%2$s</em>',

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -424,6 +424,25 @@ class ApplicationHelper
}
$oApp['combodo.current_user'] = $oUser;
$sUrl = $oApp['combodo.portal.base.absolute_url'].'img/user-profile-default-256px.png';
$oContact = UserRights::GetContactObject();
if ($oContact)
{
if (MetaModel::IsValidAttCode(get_class($oContact), 'picture'))
{
$oImage = $oContact->Get('picture');
if (is_object($oImage) && !$oImage->IsEmpty())
{
$sUrl = $oImage->GetDownloadURL(get_class($oContact), $oContact->GetKey(), 'picture');
}
else
{
$sUrl = MetaModel::GetAttributeDef(get_class($oContact), 'picture')->Get('default_image');
}
}
}
$oApp['combodo.current_user_img'] = $sUrl;
}
/**

View File

@@ -5,8 +5,7 @@
{% set bUserConnected = true %}
{% set sUserFullname = app['combodo.current_user'].Get('first_name') ~ ' ' ~ app['combodo.current_user'].Get('last_name') %}
{% set sUserEmail = app['combodo.current_user'].Get('email') %}
{% set sUserPhotoUrl = app['combodo.portal.base.absolute_url'] ~ 'img/user-profile-default-256px.png' %}
{% set sUserPhotoUrl = 'https://scontent-fra3-1.xx.fbcdn.net/v/t1.0-9/11050099_10153305298138954_7206181025917413544_n.jpg?oh=728b8e7b1f073b81a2e6b43858c795f8&oe=57E2B0D3' %}
{% set sUserPhotoUrl = app['combodo.current_user_img'] %}
{% else %}
{% set bUserConnected = false %}
{% set sUserFullname = '' %}