From 2d70a55542a0dc3a08baee003a1e50cc41c4e0cd Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 22 May 2011 14:22:00 +0000 Subject: [PATCH] added title attribute for self service --- lam/lib/modules/inetOrgPerson.inc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index f3765eb4..4da1403e 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -123,7 +123,7 @@ class inetOrgPerson extends baseModule implements passwordService { 'postalCode' => _('Postal code'), 'postOfficeBox' => _('Post office box'), 'jpegPhoto' => _('Photo'), 'homePhone' => _('Home telephone number'), 'roomNumber' => _('Room number'), 'carLicense' => _('Car license'), '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 $profileElements = array(); if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet')) { @@ -1883,6 +1883,13 @@ class inetOrgPerson extends baseModule implements passwordService { 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; } @@ -2095,6 +2102,15 @@ class inetOrgPerson extends baseModule implements passwordService { } 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 for ($i = 0; $i < sizeof($attributeNames); $i++) { $attrName = $attributeNames[$i];