added title attribute for self service

This commit is contained in:
Roland Gruber 2011-05-22 14:22:00 +00:00
parent f89548419b
commit 2d70a55542
1 changed files with 17 additions and 1 deletions

View File

@ -123,7 +123,7 @@ class inetOrgPerson extends baseModule implements passwordService {
'postalCode' => _('Postal code'), 'postOfficeBox' => _('Post office box'), 'jpegPhoto' => _('Photo'), 'postalCode' => _('Postal code'), 'postOfficeBox' => _('Post office box'), 'jpegPhoto' => _('Photo'),
'homePhone' => _('Home telephone number'), 'roomNumber' => _('Room number'), 'carLicense' => _('Car license'), 'homePhone' => _('Home telephone number'), 'roomNumber' => _('Room number'), 'carLicense' => _('Car license'),
'location' => _('Location'), 'state' => _('State'), 'officeName' => _('Office name'), 'businessCategory' => _('Business category'), 'location' => _('Location'), 'state' => _('State'), 'officeName' => _('Office name'), 'businessCategory' => _('Business category'),
'departmentNumber' => _('Department(s)'), 'initials' => _('Initials')); 'departmentNumber' => _('Department(s)'), 'initials' => _('Initials'), 'title' => _('Job title'));
// profile elements // profile elements
$profileElements = array(); $profileElements = array();
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet')) {
@ -1883,6 +1883,13 @@ class inetOrgPerson extends baseModule implements passwordService {
new htmlTableExtendedInputField(_('Initials'), 'inetOrgPerson_initials', $initials) new htmlTableExtendedInputField(_('Initials'), 'inetOrgPerson_initials', $initials)
)); ));
} }
if (in_array('title', $fields)) {
$title = '';
if (isset($attributes['title'][0])) $title = $attributes['title'][0];
$return['title'] = new htmlTableRow(array(
new htmlTableExtendedInputField(_('Job title'), 'inetOrgPerson_title', $title)
));
}
return $return; return $return;
} }
@ -2095,6 +2102,15 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
elseif (isset($attributes['initials'])) unset($attributesNew['initials']); elseif (isset($attributes['initials'])) unset($attributesNew['initials']);
} }
// title
if (in_array('title', $fields)) {
$attributeNames[] = 'title';
if (isset($_POST['inetOrgPerson_title']) && ($_POST['inetOrgPerson_title'] != '')) {
if (!get_preg($_POST['inetOrgPerson_title'], 'title')) $return['messages'][] = $this->messages['title'][0];
else $attributesNew['title'][0] = $_POST['inetOrgPerson_title'];
}
elseif (isset($attributes['title'])) unset($attributesNew['title']);
}
// find differences // find differences
for ($i = 0; $i < sizeof($attributeNames); $i++) { for ($i = 0; $i < sizeof($attributeNames); $i++) {
$attrName = $attributeNames[$i]; $attrName = $attributeNames[$i];