read-only fields for inetOrgPerson
This commit is contained in:
parent
4a12632936
commit
681d855088
|
@ -1,5 +1,6 @@
|
||||||
March 2014 4.5
|
March 2014 4.5
|
||||||
- IMAP: allow dynamic admin user names by replacing wildcards with LDAP attributes
|
- IMAP: allow dynamic admin user names by replacing wildcards with LDAP attributes
|
||||||
|
- Personal: allow to set fields read-only
|
||||||
|
|
||||||
18.12.2013 4.4
|
18.12.2013 4.4
|
||||||
- PyKota support: users, groups, printers, billing codes
|
- PyKota support: users, groups, printers, billing codes
|
||||||
|
|
|
@ -1178,9 +1178,10 @@ abstract class baseModule {
|
||||||
* @param integer $length field length
|
* @param integer $length field length
|
||||||
* @param boolean $isTextArea show as text area (default false)
|
* @param boolean $isTextArea show as text area (default false)
|
||||||
* @param array $autoCompleteValues values for auto-completion
|
* @param array $autoCompleteValues values for auto-completion
|
||||||
|
* @param boolean $readOnly this field is read-only
|
||||||
* @return mixed reference to htmlTableExtendedInputField/htmlTableExtendedInputTextarea
|
* @return mixed reference to htmlTableExtendedInputField/htmlTableExtendedInputTextarea
|
||||||
*/
|
*/
|
||||||
protected function &addSimpleInputTextField(&$container, $attrName, $label, $required = false, $length = null, $isTextArea = false, $autoCompleteValues = null) {
|
protected function &addSimpleInputTextField(&$container, $attrName, $label, $required = false, $length = null, $isTextArea = false, $autoCompleteValues = null, $readOnly = false) {
|
||||||
$value = '';
|
$value = '';
|
||||||
if (isset($this->attributes[$attrName][0])) {
|
if (isset($this->attributes[$attrName][0])) {
|
||||||
$value = $this->attributes[$attrName][0];
|
$value = $this->attributes[$attrName][0];
|
||||||
|
@ -1221,8 +1222,10 @@ abstract class baseModule {
|
||||||
* @param boolean $isTextArea show as text area (default false)
|
* @param boolean $isTextArea show as text area (default false)
|
||||||
* @param array $autoCompleteValues values for auto-completion
|
* @param array $autoCompleteValues values for auto-completion
|
||||||
* @param integer $fieldSize field size
|
* @param integer $fieldSize field size
|
||||||
|
* @param array $htmlIDs reference to array where to add the generated HTML IDs of the input fields
|
||||||
*/
|
*/
|
||||||
protected function addMultiValueInputTextField(&$container, $attrName, $label, $required = false, $length = null, $isTextArea = false, $autoCompleteValues = null, $fieldSize = null) {
|
protected function addMultiValueInputTextField(&$container, $attrName, $label, $required = false, $length = null, $isTextArea = false,
|
||||||
|
$autoCompleteValues = null, $fieldSize = null, &$htmlIDs = null) {
|
||||||
$values = array();
|
$values = array();
|
||||||
if (isset($this->attributes[$attrName][0])) {
|
if (isset($this->attributes[$attrName][0])) {
|
||||||
$values = $this->attributes[$attrName];
|
$values = $this->attributes[$attrName];
|
||||||
|
@ -1260,6 +1263,9 @@ abstract class baseModule {
|
||||||
}
|
}
|
||||||
$subContainer->addElement(new htmlInputTextarea($attrName . '_' . $i, $values[$i], $cols, 3));
|
$subContainer->addElement(new htmlInputTextarea($attrName . '_' . $i, $values[$i], $cols, 3));
|
||||||
}
|
}
|
||||||
|
if (!empty($htmlIDs)) {
|
||||||
|
$htmlIDs[] = $attrName . '_' . $i;
|
||||||
|
}
|
||||||
if (!empty($values[$i])) {
|
if (!empty($values[$i])) {
|
||||||
$subContainer->addElement(new htmlButton('del_' . $attrName . '_' . $i, 'del.png', true));
|
$subContainer->addElement(new htmlButton('del_' . $attrName . '_' . $i, 'del.png', true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,10 +373,48 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
$configContainer->addElement($configContainerOptions, true);
|
$configContainer->addElement($configContainerOptions, true);
|
||||||
$advancedOptions = new htmlTable();
|
$advancedOptions = new htmlTable();
|
||||||
|
$advancedOptions->addElement(new htmlSubTitle(_('Read-only fields')), true);
|
||||||
|
$readOnlyOptions = array(
|
||||||
|
_('Description') => 'inetOrgPerson_readOnly_description', _('Street') => 'inetOrgPerson_readOnly_street',
|
||||||
|
_('First name') => 'inetOrgPerson_readOnly_givenName', _('Last name') => 'inetOrgPerson_readOnly_sn',
|
||||||
|
_('Post office box') => 'inetOrgPerson_readOnly_postOfficeBox', _('Postal code') => 'inetOrgPerson_readOnly_postalCode',
|
||||||
|
_('Location') => 'inetOrgPerson_readOnly_l', _('State') => 'inetOrgPerson_readOnly_st',
|
||||||
|
_('Postal address') => 'inetOrgPerson_readOnly_postalAddress', _('Registered address') => 'inetOrgPerson_readOnly_registeredAddress',
|
||||||
|
_('Office name') => 'inetOrgPerson_readOnly_physicalDeliveryOfficeName', _('Room number') => 'inetOrgPerson_readOnly_roomNumber',
|
||||||
|
_('Telephone number') => 'inetOrgPerson_readOnly_telephoneNumber', _('Home telephone number') => 'inetOrgPerson_readOnly_homePhone',
|
||||||
|
_('Mobile number') => 'inetOrgPerson_readOnly_mobile', _('Fax number') => 'inetOrgPerson_readOnly_facsimileTelephoneNumber',
|
||||||
|
_('Email address') => 'inetOrgPerson_readOnly_mail', _('Web site') => 'inetOrgPerson_readOnly_labeledURI',
|
||||||
|
_('Job title') => 'inetOrgPerson_readOnly_title', _('Car license') => 'inetOrgPerson_readOnly_carLicense',
|
||||||
|
_('Employee type') => 'inetOrgPerson_readOnly_employeeType', _('Business category') => 'inetOrgPerson_readOnly_businessCategory',
|
||||||
|
_('Department') => 'inetOrgPerson_readOnly_departmentNumber', _('Manager') => 'inetOrgPerson_readOnly_manager',
|
||||||
|
_('Organisation') => 'inetOrgPerson_readOnly_o', _('Organisational unit') => 'inetOrgPerson_readOnly_ou',
|
||||||
|
_('Employee number') => 'inetOrgPerson_readOnly_employeeNumber', _('Initials') => 'inetOrgPerson_readOnly_initials',
|
||||||
|
_('Photo') => 'inetOrgPerson_readOnly_jpegPhoto', _('Password') => 'inetOrgPerson_readOnly_userPassword'
|
||||||
|
);
|
||||||
|
if (isset($_SESSION['conf_config'])) {
|
||||||
|
$confActiveUnixUserModules = $_SESSION['conf_config']->get_AccountModules('user');
|
||||||
|
$readOnlyOptions[_('User name')] = 'inetOrgPerson_readOnly_uid';
|
||||||
|
$readOnlyOptions[_('Common name')] = 'inetOrgPerson_readOnly_cn';
|
||||||
|
}
|
||||||
|
ksort($readOnlyOptions);
|
||||||
|
$readOnlyCounter = 0;
|
||||||
|
$readOnlyOptionsTable = new htmlTable();
|
||||||
|
$readOnlyOptionsTable->colspan = 5;
|
||||||
|
foreach ($readOnlyOptions as $label => $id) {
|
||||||
|
$readOnlyOptionsTable->addElement(new htmlTableExtendedInputCheckbox($id, false, $label, null, false));
|
||||||
|
$readOnlyCounter++;
|
||||||
|
if (($readOnlyCounter % 5) == 0) {
|
||||||
|
$readOnlyOptionsTable->addNewLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$advancedOptions->addElement($readOnlyOptionsTable, true);
|
||||||
$advancedOptions->addElement(new htmlSubTitle(_('Photo')), true);
|
$advancedOptions->addElement(new htmlSubTitle(_('Photo')), true);
|
||||||
$advancedOptions->addElement(new htmlTableExtendedInputField(_('Maximum width (px)'), 'inetOrgPerson_jpegPhoto_maxWidth'), true);
|
$photoTable = new htmlTable();
|
||||||
$advancedOptions->addElement(new htmlTableExtendedInputField(_('Maximum height (px)'), 'inetOrgPerson_jpegPhoto_maxHeight'), true);
|
$photoTable->colspan = 2;
|
||||||
$advancedOptions->addElement(new htmlTableExtendedInputField(_('Maximum file size (kB)'), 'inetOrgPerson_jpegPhoto_maxSize'), true);
|
$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum width (px)'), 'inetOrgPerson_jpegPhoto_maxWidth'), true);
|
||||||
|
$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum height (px)'), 'inetOrgPerson_jpegPhoto_maxHeight'), true);
|
||||||
|
$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum file size (kB)'), 'inetOrgPerson_jpegPhoto_maxSize'), true);
|
||||||
|
$advancedOptions->addElement($photoTable, true);
|
||||||
$advancedOptionsAccordion = new htmlAccordion('inetOrgPersonAdvancedOptions', array(_('Advanced options') => $advancedOptions), false);
|
$advancedOptionsAccordion = new htmlAccordion('inetOrgPersonAdvancedOptions', array(_('Advanced options') => $advancedOptions), false);
|
||||||
$advancedOptionsAccordion->colspan = 5;
|
$advancedOptionsAccordion->colspan = 5;
|
||||||
$configContainer->addElement($advancedOptionsAccordion);
|
$configContainer->addElement($advancedOptionsAccordion);
|
||||||
|
@ -1052,17 +1090,23 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
// load and check attributes
|
// load and check attributes
|
||||||
// description
|
// description
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDescription')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDescription') && !$this->isAdminReadOnly('description')) {
|
||||||
$this->processMultiValueInputTextField('description', $errors);
|
$this->processMultiValueInputTextField('description', $errors);
|
||||||
}
|
}
|
||||||
$this->attributes['sn'][0] = trim($_POST['sn']);
|
// last name
|
||||||
if (!get_preg($this->attributes['sn'][0], 'realname')) $errors[] = $this->messages['lastname'][0];
|
if (!$this->isAdminReadOnly('sn')) {
|
||||||
$this->attributes['givenName'][0] = trim($_POST['givenName']);
|
$this->attributes['sn'][0] = trim($_POST['sn']);
|
||||||
if (($this->attributes['givenName'][0] != '') && !get_preg($this->attributes['givenName'][0], 'realname')) $errors[] = $this->messages['givenName'][0];
|
if (!get_preg($this->attributes['sn'][0], 'realname')) $errors[] = $this->messages['lastname'][0];
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle')) {
|
}
|
||||||
|
// first name
|
||||||
|
if (!$this->isAdminReadOnly('givenName')) {
|
||||||
|
$this->attributes['givenName'][0] = trim($_POST['givenName']);
|
||||||
|
if (($this->attributes['givenName'][0] != '') && !get_preg($this->attributes['givenName'][0], 'realname')) $errors[] = $this->messages['givenName'][0];
|
||||||
|
}
|
||||||
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle') && !$this->isAdminReadOnly('title')) {
|
||||||
$this->processMultiValueInputTextField('title', $errors, 'title');
|
$this->processMultiValueInputTextField('title', $errors, 'title');
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress') && !$this->isAdminReadOnly('mail')) {
|
||||||
$this->processMultiValueInputTextField('mail', $errors, 'email');
|
$this->processMultiValueInputTextField('mail', $errors, 'email');
|
||||||
if (!empty($this->attributes['mail'])) {
|
if (!empty($this->attributes['mail'])) {
|
||||||
foreach ($this->attributes['mail'] as &$mail) {
|
foreach ($this->attributes['mail'] as &$mail) {
|
||||||
|
@ -1074,28 +1118,28 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber') && !$this->isAdminReadOnly('telephoneNumber')) {
|
||||||
$this->processMultiValueInputTextField('telephoneNumber', $errors, 'telephone');
|
$this->processMultiValueInputTextField('telephoneNumber', $errors, 'telephone');
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideMobileNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideMobileNumber') && !$this->isAdminReadOnly('mobile')) {
|
||||||
$this->processMultiValueInputTextField('mobile', $errors, 'telephone');
|
$this->processMultiValueInputTextField('mobile', $errors, 'telephone');
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideFaxNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideFaxNumber') && !$this->isAdminReadOnly('facsimileTelephoneNumber')) {
|
||||||
$this->processMultiValueInputTextField('facsimileTelephoneNumber', $errors, 'telephone');
|
$this->processMultiValueInputTextField('facsimileTelephoneNumber', $errors, 'telephone');
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideHomeTelephoneNumber') && !$this->isAdminReadOnly('homePhone')) {
|
||||||
$this->processMultiValueInputTextField('homePhone', $errors, 'telephone');
|
$this->processMultiValueInputTextField('homePhone', $errors, 'telephone');
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet') && !$this->isAdminReadOnly('street')) {
|
||||||
$this->processMultiValueInputTextField('street', $errors, 'street');
|
$this->processMultiValueInputTextField('street', $errors, 'street');
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostOfficeBox')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostOfficeBox') && !$this->isAdminReadOnly('postOfficeBox')) {
|
||||||
$this->processMultiValueInputTextField('postOfficeBox', $errors);
|
$this->processMultiValueInputTextField('postOfficeBox', $errors);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostalCode')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostalCode') && !$this->isAdminReadOnly('postalCode')) {
|
||||||
$this->processMultiValueInputTextField('postalCode', $errors, 'postalCode');
|
$this->processMultiValueInputTextField('postalCode', $errors, 'postalCode');
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostalAddress')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostalAddress') && !$this->isAdminReadOnly('postalAddress')) {
|
||||||
$addressCounter = 0;
|
$addressCounter = 0;
|
||||||
while (isset($_POST['postalAddress' . $addressCounter])) {
|
while (isset($_POST['postalAddress' . $addressCounter])) {
|
||||||
$this->attributes['postalAddress'][$addressCounter] = implode('$', preg_split('/[\r][\n]/', $_POST['postalAddress' . $addressCounter]));
|
$this->attributes['postalAddress'][$addressCounter] = implode('$', preg_split('/[\r][\n]/', $_POST['postalAddress' . $addressCounter]));
|
||||||
|
@ -1110,10 +1154,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
$this->attributes['postalAddress'] = array_values($this->attributes['postalAddress']);
|
$this->attributes['postalAddress'] = array_values($this->attributes['postalAddress']);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLabeledURI')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLabeledURI') && !$this->isAdminReadOnly('labeledURI')) {
|
||||||
$this->processMultiValueInputTextField('labeledURI', $errors);
|
$this->processMultiValueInputTextField('labeledURI', $errors);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRegisteredAddress')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRegisteredAddress') && !$this->isAdminReadOnly('registeredAddress')) {
|
||||||
$addressCounter = 0;
|
$addressCounter = 0;
|
||||||
while (isset($_POST['registeredAddress' . $addressCounter])) {
|
while (isset($_POST['registeredAddress' . $addressCounter])) {
|
||||||
$this->attributes['registeredAddress'][$addressCounter] = implode('$', preg_split('/[\r][\n]/', $_POST['registeredAddress' . $addressCounter]));
|
$this->attributes['registeredAddress'][$addressCounter] = implode('$', preg_split('/[\r][\n]/', $_POST['registeredAddress' . $addressCounter]));
|
||||||
|
@ -1128,48 +1172,48 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
$this->attributes['registeredAddress'] = array_values($this->attributes['registeredAddress']);
|
$this->attributes['registeredAddress'] = array_values($this->attributes['registeredAddress']);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType') && !$this->isAdminReadOnly('employeeType')) {
|
||||||
$this->attributes['employeeType'][0] = $_POST['employeeType'];
|
$this->attributes['employeeType'][0] = $_POST['employeeType'];
|
||||||
if (!get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors[] = $this->messages['employeeType'][0];
|
if (!get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors[] = $this->messages['employeeType'][0];
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRoomNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRoomNumber') && !$this->isAdminReadOnly('roomNumber')) {
|
||||||
$this->attributes['roomNumber'][0] = $_POST['roomNumber'];
|
$this->attributes['roomNumber'][0] = $_POST['roomNumber'];
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLocation')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLocation') && !$this->isAdminReadOnly('l')) {
|
||||||
$this->processMultiValueInputTextField('l', $errors);
|
$this->processMultiValueInputTextField('l', $errors);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideState')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideState') && !$this->isAdminReadOnly('st')) {
|
||||||
$this->processMultiValueInputTextField('st', $errors);
|
$this->processMultiValueInputTextField('st', $errors);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense') && !$this->isAdminReadOnly('carLicense')) {
|
||||||
$this->attributes['carLicense'][0] = $_POST['carLicense'];
|
$this->attributes['carLicense'][0] = $_POST['carLicense'];
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOfficeName')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOfficeName') && !$this->isAdminReadOnly('physicalDeliveryOfficeName')) {
|
||||||
$this->processMultiValueInputTextField('physicalDeliveryOfficeName', $errors);
|
$this->processMultiValueInputTextField('physicalDeliveryOfficeName', $errors);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideBusinessCategory')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideBusinessCategory') && !$this->isAdminReadOnly('businessCategory')) {
|
||||||
$this->processMultiValueInputTextField('businessCategory', $errors, 'businessCategory');
|
$this->processMultiValueInputTextField('businessCategory', $errors, 'businessCategory');
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments') && !$this->isAdminReadOnly('departmentNumber')) {
|
||||||
$this->processMultiValueInputTextField('departmentNumber', $errors);
|
$this->processMultiValueInputTextField('departmentNumber', $errors);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeNumber') && !$this->isAdminReadOnly('employeeNumber')) {
|
||||||
$this->attributes['employeeNumber'][0] = $_POST['employeeNumber'];
|
$this->attributes['employeeNumber'][0] = $_POST['employeeNumber'];
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu') && !$this->isAdminReadOnly('ou')) {
|
||||||
$this->processMultiValueInputTextField('ou', $errors);
|
$this->processMultiValueInputTextField('ou', $errors);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO') && !$this->isAdminReadOnly('o')) {
|
||||||
$this->processMultiValueInputTextField('o', $errors);
|
$this->processMultiValueInputTextField('o', $errors);
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials') && !$this->isAdminReadOnly('initials')) {
|
||||||
$this->attributes['initials'] = preg_split('/;[ ]*/', $_POST['initials']);
|
$this->attributes['initials'] = preg_split('/;[ ]*/', $_POST['initials']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
if (!in_array('posixAccount', $modules)) {
|
if (!in_array('posixAccount', $modules)) {
|
||||||
// uid
|
// uid
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID') && !$this->isAdminReadOnly('uid')) {
|
||||||
if (isset($_POST['uid']) && ($_POST['uid'] != '')) {
|
if (isset($_POST['uid']) && ($_POST['uid'] != '')) {
|
||||||
if (!get_preg($_POST['uid'], 'username')) {
|
if (!get_preg($_POST['uid'], 'username')) {
|
||||||
$errors[] = $this->messages['uid'][0];
|
$errors[] = $this->messages['uid'][0];
|
||||||
|
@ -1183,32 +1227,36 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cn
|
// cn
|
||||||
if ($_POST['cn'] == '') {
|
if (!$this->isAdminReadOnly('cn')) {
|
||||||
if ($_POST['givenName'] != '') {
|
if ($_POST['cn'] == '') {
|
||||||
$this->attributes['cn'][0] = $_POST['givenName'] . " " . $_POST['sn'];
|
if ($_POST['givenName'] != '') {
|
||||||
|
$this->attributes['cn'][0] = $_POST['givenName'] . " " . $_POST['sn'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->attributes['cn'][0] = $_POST['sn'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['cn'][0] = $_POST['sn'];
|
$this->attributes['cn'][0] = $_POST['cn'];
|
||||||
|
}
|
||||||
|
if (!get_preg($this->attributes['cn'][0], 'cn')) {
|
||||||
|
$errors[] = $this->messages['cn'][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
if (!$this->isAdminReadOnly('userPassword')) {
|
||||||
$this->attributes['cn'][0] = $_POST['cn'];
|
if (isset($_POST['lockPassword'])) {
|
||||||
}
|
$this->attributes['userPassword'][0] = pwd_disable($this->attributes['userPassword'][0]);
|
||||||
if (!get_preg($this->attributes['cn'][0], 'cn')) {
|
}
|
||||||
$errors[] = $this->messages['cn'][0];
|
if (isset($_POST['unlockPassword'])) {
|
||||||
}
|
$this->attributes['userPassword'][0] = pwd_enable($this->attributes['userPassword'][0]);
|
||||||
if (isset($_POST['lockPassword'])) {
|
}
|
||||||
$this->attributes['userPassword'][0] = pwd_disable($this->attributes['userPassword'][0]);
|
if (isset($_POST['removePassword'])) {
|
||||||
}
|
unset($this->attributes['userPassword']);
|
||||||
if (isset($_POST['unlockPassword'])) {
|
}
|
||||||
$this->attributes['userPassword'][0] = pwd_enable($this->attributes['userPassword'][0]);
|
|
||||||
}
|
|
||||||
if (isset($_POST['removePassword'])) {
|
|
||||||
unset($this->attributes['userPassword']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidejpegPhoto') && isset($_POST['delPhoto'])) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidejpegPhoto') && isset($_POST['delPhoto']) && !$this->isAdminReadOnly('jpegPhoto')) {
|
||||||
$this->attributes['jpegPhoto'] = array();
|
$this->attributes['jpegPhoto'] = array();
|
||||||
}
|
}
|
||||||
// Return error-messages
|
// Return error-messages
|
||||||
|
@ -1227,32 +1275,59 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$fieldContainer = new htmlTable();
|
$fieldContainer = new htmlTable();
|
||||||
$container->addElement($fieldContainer);
|
$container->addElement($fieldContainer);
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
|
// uid
|
||||||
if (!in_array('posixAccount', $modules) && !$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID')) {
|
if (!in_array('posixAccount', $modules) && !$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID')) {
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'uid', _('User name'));
|
if ($this->isAdminReadOnly('uid')) {
|
||||||
$equalWidthElements[] = 'uid';
|
$this->addSimpleReadOnlyField($fieldContainer, 'uid', _('User name'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addSimpleInputTextField($fieldContainer, 'uid', _('User name'));
|
||||||
|
$equalWidthElements[] = 'uid';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'givenName', _('First name'));
|
// first name
|
||||||
$equalWidthElements[] = 'givenName';
|
if ($this->isAdminReadOnly('givenName')) {
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'sn', _('Last name'), true);
|
$this->addSimpleReadOnlyField($fieldContainer, 'givenName', _('First name'));
|
||||||
$equalWidthElements[] = 'sn';
|
}
|
||||||
|
else {
|
||||||
|
$this->addSimpleInputTextField($fieldContainer, 'givenName', _('First name'));
|
||||||
|
$equalWidthElements[] = 'givenName';
|
||||||
|
}
|
||||||
|
// last name
|
||||||
|
if ($this->isAdminReadOnly('sn')) {
|
||||||
|
$this->addSimpleReadOnlyField($fieldContainer, 'sn', _('Last name'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addSimpleInputTextField($fieldContainer, 'sn', _('Last name'), true);
|
||||||
|
$equalWidthElements[] = 'sn';
|
||||||
|
}
|
||||||
|
// initials
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials')) {
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'initials', _('Initials'));
|
if ($this->isAdminReadOnly('initials')) {
|
||||||
$equalWidthElements[] = 'initials';
|
$this->addSimpleReadOnlyField($fieldContainer, 'initials', _('Initials'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addSimpleInputTextField($fieldContainer, 'initials', _('Initials'));
|
||||||
|
$equalWidthElements[] = 'initials';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// common name
|
||||||
if (!in_array('posixAccount', $modules)) {
|
if (!in_array('posixAccount', $modules)) {
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'cn', _('Common name'), true);
|
if ($this->isAdminReadOnly('cn')) {
|
||||||
$equalWidthElements[] = 'cn';
|
$this->addSimpleReadOnlyField($fieldContainer, 'cn', _('Common name'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addSimpleInputTextField($fieldContainer, 'cn', _('Common name'), true);
|
||||||
|
$equalWidthElements[] = 'cn';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// description
|
// description
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDescription')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDescription')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'description', _('Description'));
|
if ($this->isAdminReadOnly('description')) {
|
||||||
if (!empty($this->attributes['description'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'description', _('Description'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['description']); $i++) {
|
|
||||||
$equalWidthElements[] = 'description_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'description_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'description', _('Description'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,61 +1339,52 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$fieldContainer->addElement(new htmlSubTitle(_('Address')), true);
|
$fieldContainer->addElement(new htmlSubTitle(_('Address')), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// street
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'street', _('Street'));
|
if ($this->isAdminReadOnly('street')) {
|
||||||
if (!empty($this->attributes['street'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'street', _('Street'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['street']); $i++) {
|
|
||||||
$equalWidthElements[] = 'street_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'street_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'street', _('Street'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// post office box
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostOfficeBox')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostOfficeBox')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'postOfficeBox', _('Post office box'));
|
if ($this->isAdminReadOnly('postOfficeBox')) {
|
||||||
if (!empty($this->attributes['postOfficeBox'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'postOfficeBox', _('Post office box'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['postOfficeBox']); $i++) {
|
|
||||||
$equalWidthElements[] = 'postOfficeBox_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'postOfficeBox_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'postOfficeBox', _('Post office box'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// postal code
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostalCode')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostalCode')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'postalCode', _('Postal code'));
|
if ($this->isAdminReadOnly('postalCode')) {
|
||||||
if (!empty($this->attributes['postalCode'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'postalCode', _('Postal code'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['postalCode']); $i++) {
|
|
||||||
$equalWidthElements[] = 'postalCode_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'postalCode_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'postalCode', _('Postal code'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// location
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLocation')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLocation')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'l', _('Location'));
|
if ($this->isAdminReadOnly('l')) {
|
||||||
if (!empty($this->attributes['l'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'l', _('Location'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['l']); $i++) {
|
|
||||||
$equalWidthElements[] = 'l_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'l_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'l', _('Location'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// state
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideState')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideState')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'st', _('State'));
|
if ($this->isAdminReadOnly('st')) {
|
||||||
if (!empty($this->attributes['st'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'st', _('State'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['st']); $i++) {
|
|
||||||
$equalWidthElements[] = 'st_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'st_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'st', _('State'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// postal address
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostalAddress')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostalAddress')) {
|
||||||
$postalAddresses = array();
|
$postalAddresses = array();
|
||||||
if (isset($this->attributes['postalAddress'][0])) {
|
if (isset($this->attributes['postalAddress'][0])) {
|
||||||
|
@ -1334,20 +1400,35 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$fieldContainer->addElement($addressLabel);
|
$fieldContainer->addElement($addressLabel);
|
||||||
$addressContainer = new htmlGroup();
|
$addressContainer = new htmlGroup();
|
||||||
for ($i = 0; $i < sizeof($postalAddresses); $i++) {
|
for ($i = 0; $i < sizeof($postalAddresses); $i++) {
|
||||||
$addressContainer->addElement(new htmlInputTextarea('postalAddress' . $i, $postalAddresses[$i], 30, 3));
|
if ($this->isAdminReadOnly('postalAddress')) {
|
||||||
$equalWidthElements[] = 'postalAddress' . $i;
|
$val = str_replace("\r\n", '<br>', htmlspecialchars($postalAddresses[$i]));
|
||||||
if ($i < (sizeof($postalAddresses) - 1)) {
|
$addressContainer->addElement(new htmlOutputText($val, false));
|
||||||
$addressContainer->addElement(new htmlOutputText('<br>', false));
|
if ($i < (sizeof($postalAddresses) - 1)) {
|
||||||
|
$addressContainer->addElement(new htmlOutputText('<br>', false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$addressContainer->addElement(new htmlButton('addPostalAddress', 'add.png', true));
|
$addressContainer->addElement(new htmlInputTextarea('postalAddress' . $i, $postalAddresses[$i], 30, 3));
|
||||||
|
$equalWidthElements[] = 'postalAddress' . $i;
|
||||||
|
if ($i < (sizeof($postalAddresses) - 1)) {
|
||||||
|
$addressContainer->addElement(new htmlOutputText('<br>', false));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$addressContainer->addElement(new htmlButton('addPostalAddress', 'add.png', true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldContainer->addElement($addressContainer);
|
$fieldContainer->addElement($addressContainer);
|
||||||
$addressHelp = new htmlHelpLink('postalAddress');
|
if ($this->isAdminReadOnly('postalAddress')) {
|
||||||
$addressHelp->alignment = htmlElement::ALIGN_TOP;
|
$fieldContainer->addNewLine();
|
||||||
$fieldContainer->addElement($addressHelp, true);
|
}
|
||||||
|
else {
|
||||||
|
$addressHelp = new htmlHelpLink('postalAddress');
|
||||||
|
$addressHelp->alignment = htmlElement::ALIGN_TOP;
|
||||||
|
$fieldContainer->addElement($addressHelp, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// registered address
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRegisteredAddress')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRegisteredAddress')) {
|
||||||
$registeredAddresses = array();
|
$registeredAddresses = array();
|
||||||
if (isset($this->attributes['registeredAddress'][0])) {
|
if (isset($this->attributes['registeredAddress'][0])) {
|
||||||
|
@ -1363,34 +1444,51 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$fieldContainer->addElement($registeredAddressLabel);
|
$fieldContainer->addElement($registeredAddressLabel);
|
||||||
$registeredAddressContainer = new htmlGroup();
|
$registeredAddressContainer = new htmlGroup();
|
||||||
for ($i = 0; $i < sizeof($registeredAddresses); $i++) {
|
for ($i = 0; $i < sizeof($registeredAddresses); $i++) {
|
||||||
$registeredAddressContainer->addElement(new htmlInputTextarea('registeredAddress' . $i, $registeredAddresses[$i], 30, 3));
|
if ($this->isAdminReadOnly('registeredAddress')) {
|
||||||
$equalWidthElements[] = 'registeredAddress' . $i;
|
$val = str_replace("\r\n", '<br>', htmlspecialchars($registeredAddresses[$i]));
|
||||||
if ($i < (sizeof($registeredAddresses) - 1)) {
|
$registeredAddressContainer->addElement(new htmlOutputText($val, false));
|
||||||
$registeredAddressContainer->addElement(new htmlOutputText('<br>', false));
|
if ($i < (sizeof($registeredAddresses) - 1)) {
|
||||||
|
$registeredAddressContainer->addElement(new htmlOutputText('<br>', false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$registeredAddressContainer->addElement(new htmlButton('addRegisteredAddress', 'add.png', true));
|
$registeredAddressContainer->addElement(new htmlInputTextarea('registeredAddress' . $i, $registeredAddresses[$i], 30, 3));
|
||||||
|
$equalWidthElements[] = 'registeredAddress' . $i;
|
||||||
|
if ($i < (sizeof($registeredAddresses) - 1)) {
|
||||||
|
$registeredAddressContainer->addElement(new htmlOutputText('<br>', false));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$registeredAddressContainer->addElement(new htmlButton('addRegisteredAddress', 'add.png', true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldContainer->addElement($registeredAddressContainer);
|
$fieldContainer->addElement($registeredAddressContainer);
|
||||||
$registeredAddressHelp = new htmlHelpLink('registeredAddress');
|
if ($this->isAdminReadOnly('registeredAddress')) {
|
||||||
$registeredAddressHelp->alignment = htmlElement::ALIGN_TOP;
|
$fieldContainer->addNewLine();
|
||||||
$fieldContainer->addElement($registeredAddressHelp, true);
|
|
||||||
}
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOfficeName')) {
|
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'physicalDeliveryOfficeName', _('Office name'));
|
|
||||||
if (!empty($this->attributes['physicalDeliveryOfficeName'])) {
|
|
||||||
for ($i = 0; $i < sizeof($this->attributes['physicalDeliveryOfficeName']); $i++) {
|
|
||||||
$equalWidthElements[] = 'physicalDeliveryOfficeName_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'physicalDeliveryOfficeName_0';
|
$registeredAddressHelp = new htmlHelpLink('registeredAddress');
|
||||||
|
$registeredAddressHelp->alignment = htmlElement::ALIGN_TOP;
|
||||||
|
$fieldContainer->addElement($registeredAddressHelp, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// office name
|
||||||
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOfficeName')) {
|
||||||
|
if ($this->isAdminReadOnly('physicalDeliveryOfficeName')) {
|
||||||
|
$this->addSimpleReadOnlyField($fieldContainer, 'physicalDeliveryOfficeName', _('Office name'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addMultiValueInputTextField($fieldContainer, 'physicalDeliveryOfficeName', _('Office name'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRoomNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRoomNumber')) {
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'roomNumber', _('Room number'));
|
if ($this->isAdminReadOnly('roomNumber')) {
|
||||||
$equalWidthElements[] = 'roomNumber';
|
$this->addSimpleReadOnlyField($fieldContainer, 'roomNumber', _('Room number'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addSimpleInputTextField($fieldContainer, 'roomNumber', _('Room number'));
|
||||||
|
$equalWidthElements[] = 'roomNumber';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideHomeTelephoneNumber')
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideHomeTelephoneNumber')
|
||||||
|
@ -1400,69 +1498,51 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'telephoneNumber', _('Telephone number'));
|
if ($this->isAdminReadOnly('telephoneNumber')) {
|
||||||
if (!empty($this->attributes['telephoneNumber'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'telephoneNumber', _('Telephone number'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['telephoneNumber']); $i++) {
|
|
||||||
$equalWidthElements[] = 'telephoneNumber_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'telephoneNumber_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'telephoneNumber', _('Telephone number'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'homePhone', _('Home telephone number'));
|
if ($this->isAdminReadOnly('homePhone')) {
|
||||||
if (!empty($this->attributes['homePhone'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'homePhone', _('Home telephone number'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['homePhone']); $i++) {
|
|
||||||
$equalWidthElements[] = 'homePhone_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'homePhone_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'homePhone', _('Home telephone number'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideMobileNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideMobileNumber')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'mobile', _('Mobile number'));
|
if ($this->isAdminReadOnly('mobile')) {
|
||||||
if (!empty($this->attributes['mobile'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'mobile', _('Mobile number'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['mobile']); $i++) {
|
|
||||||
$equalWidthElements[] = 'mobile_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'mobile_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'mobile', _('Mobile number'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideFaxNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideFaxNumber')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'facsimileTelephoneNumber', _('Fax number'));
|
if ($this->isAdminReadOnly('facsimileTelephoneNumber')) {
|
||||||
if (!empty($this->attributes['facsimileTelephoneNumber'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'facsimileTelephoneNumber', _('Fax number'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['facsimileTelephoneNumber']); $i++) {
|
|
||||||
$equalWidthElements[] = 'facsimileTelephoneNumber_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'facsimileTelephoneNumber_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'facsimileTelephoneNumber', _('Fax number'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'mail', _('Email address'));
|
if ($this->isAdminReadOnly('mail')) {
|
||||||
if (!empty($this->attributes['mail'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'mail', _('Email address'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['mail']); $i++) {
|
|
||||||
$equalWidthElements[] = 'mail_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'mail_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'mail', _('Email address'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLabeledURI')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLabeledURI')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'labeledURI', _('Web site'));
|
if ($this->isAdminReadOnly('labeledURI')) {
|
||||||
if (!empty($this->attributes['labeledURI'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'labeledURI', _('Web site'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['labeledURI']); $i++) {
|
|
||||||
$equalWidthElements[] = 'labeledURI_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'labeledURI_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'labeledURI', _('Web site'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1474,72 +1554,72 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'title', _('Job title'));
|
if ($this->isAdminReadOnly('title')) {
|
||||||
if (!empty($this->attributes['title'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'title', _('Job title'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['title']); $i++) {
|
|
||||||
$equalWidthElements[] = 'title_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'title_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'title', _('Job title'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')) {
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'carLicense', _('Car license'));
|
if ($this->isAdminReadOnly('carLicense')) {
|
||||||
$equalWidthElements[] = 'carLicense';
|
$this->addSimpleReadOnlyField($fieldContainer, 'carLicense', _('Car license'));
|
||||||
}
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeNumber')) {
|
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'employeeNumber', _('Employee number'));
|
|
||||||
$equalWidthElements[] = 'employeeNumber';
|
|
||||||
}
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType')) {
|
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'employeeType', _('Employee type'), false, null, false, $this->employeeTypeCache);
|
|
||||||
$equalWidthElements[] = 'employeeType';
|
|
||||||
}
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideBusinessCategory')) {
|
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'businessCategory', _('Business category'), false, null, false, $this->businessCategoryCache);
|
|
||||||
if (!empty($this->attributes['businessCategory'])) {
|
|
||||||
for ($i = 0; $i < sizeof($this->attributes['businessCategory']); $i++) {
|
|
||||||
$equalWidthElements[] = 'businessCategory_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'businessCategory_0';
|
$this->addSimpleInputTextField($fieldContainer, 'carLicense', _('Car license'));
|
||||||
|
$equalWidthElements[] = 'carLicense';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeNumber')) {
|
||||||
|
if ($this->isAdminReadOnly('employeeNumber')) {
|
||||||
|
$this->addSimpleReadOnlyField($fieldContainer, 'employeeNumber', _('Employee number'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addSimpleInputTextField($fieldContainer, 'employeeNumber', _('Employee number'));
|
||||||
|
$equalWidthElements[] = 'employeeNumber';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType')) {
|
||||||
|
if ($this->isAdminReadOnly('employeeType')) {
|
||||||
|
$this->addSimpleReadOnlyField($fieldContainer, 'employeeType', _('Employee type'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addSimpleInputTextField($fieldContainer, 'employeeType', _('Employee type'), false, null, false, $this->employeeTypeCache);
|
||||||
|
$equalWidthElements[] = 'employeeType';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideBusinessCategory')) {
|
||||||
|
if ($this->isAdminReadOnly('businessCategory')) {
|
||||||
|
$this->addSimpleReadOnlyField($fieldContainer, 'businessCategory', _('Business category'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->addMultiValueInputTextField($fieldContainer, 'businessCategory', _('Business category'), false, null, false, $this->businessCategoryCache, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'departmentNumber', _('Department'), false, null, false, $this->departmentCache);
|
if ($this->isAdminReadOnly('departmentNumber')) {
|
||||||
if (!empty($this->attributes['departmentNumber'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'departmentNumber', _('Department'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['departmentNumber']); $i++) {
|
|
||||||
$equalWidthElements[] = 'departmentNumber_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'departmentNumber_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'departmentNumber', _('Department'), false, null, false, $this->departmentCache, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// organisational unit
|
// organisational unit
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'ou', _('Organisational unit'), false, null, false, $this->ouCache);
|
if ($this->isAdminReadOnly('ou')) {
|
||||||
if (!empty($this->attributes['ou'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'ou', _('Organisational unit'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['ou']); $i++) {
|
|
||||||
$equalWidthElements[] = 'ou_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'ou_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'ou', _('Organisational unit'), false, null, false, $this->ouCache, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// organisation
|
// organisation
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO')) {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'o', _('Organisation'), false, null, false, $this->oCache);
|
if ($this->isAdminReadOnly('o')) {
|
||||||
if (!empty($this->attributes['o'])) {
|
$this->addSimpleReadOnlyField($fieldContainer, 'o', _('Organisation'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['o']); $i++) {
|
|
||||||
$equalWidthElements[] = 'o_' . $i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$equalWidthElements[] = 'o_0';
|
$this->addMultiValueInputTextField($fieldContainer, 'o', _('Organisation'), false, null, false, $this->oCache, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// user certificates
|
// user certificates
|
||||||
|
@ -1552,15 +1632,27 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
$userCertificateGroup->addElement(new htmlOutputText($userCertificateCount));
|
$userCertificateGroup->addElement(new htmlOutputText($userCertificateCount));
|
||||||
$userCertificateGroup->addElement(new htmlSpacer('10px', null));
|
$userCertificateGroup->addElement(new htmlSpacer('10px', null));
|
||||||
$userCertificateGroup->addElement(new htmlAccountPageButton(get_class($this), 'userCertificate', 'manage', _('Manage')));
|
if (!$this->isAdminReadOnly('manager')) {
|
||||||
|
$userCertificateGroup->addElement(new htmlAccountPageButton(get_class($this), 'userCertificate', 'manage', _('Manage')));
|
||||||
|
}
|
||||||
$fieldContainer->addElement($userCertificateGroup);
|
$fieldContainer->addElement($userCertificateGroup);
|
||||||
$fieldContainer->addElement(new htmlHelpLink('userCertificate'), true);
|
if ($this->isAdminReadOnly('manager')) {
|
||||||
|
$fieldContainer->addNewLine();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fieldContainer->addElement(new htmlHelpLink('userCertificate'), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// manager
|
// manager
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideManager')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideManager')) {
|
||||||
$fieldContainer->addElement(new htmlOutputText(_('Manager')));
|
$fieldContainer->addElement(new htmlOutputText(_('Manager')));
|
||||||
$fieldContainer->addElement(new htmlAccountPageButton(get_class($this), 'manager', 'change', _("Change")));
|
if ($this->isAdminReadOnly('manager')) {
|
||||||
$fieldContainer->addElement(new htmlHelpLink('manager'), true);
|
$fieldContainer->addNewLine();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fieldContainer->addElement(new htmlAccountPageButton(get_class($this), 'manager', 'change', _("Change")));
|
||||||
|
$fieldContainer->addElement(new htmlHelpLink('manager'), true);
|
||||||
|
}
|
||||||
if (isset($this->attributes['manager'][0])) {
|
if (isset($this->attributes['manager'][0])) {
|
||||||
$managerList = array();
|
$managerList = array();
|
||||||
for ($i = 0; $i < sizeof($this->attributes['manager']); $i++) {
|
for ($i = 0; $i < sizeof($this->attributes['manager']); $i++) {
|
||||||
|
@ -1580,7 +1672,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// password buttons
|
// password buttons
|
||||||
if (!in_array('posixAccount', $modules) && checkIfWriteAccessIsAllowed() && isset($this->attributes['userPassword'][0])) {
|
if (!in_array('posixAccount', $modules) && checkIfWriteAccessIsAllowed() && isset($this->attributes['userPassword'][0]) && !$this->isAdminReadOnly('userPassword')) {
|
||||||
$fieldContainer->addElement(new htmlSubTitle(_('Password')), true);
|
$fieldContainer->addElement(new htmlSubTitle(_('Password')), true);
|
||||||
$pwdContainer = new htmlTable();
|
$pwdContainer = new htmlTable();
|
||||||
if (pwd_is_enabled($this->attributes['userPassword'][0])) {
|
if (pwd_is_enabled($this->attributes['userPassword'][0])) {
|
||||||
|
@ -1608,11 +1700,13 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$noPhoto = false;
|
$noPhoto = false;
|
||||||
}
|
}
|
||||||
$imageContainer->addElement(new htmlImage($photoFile), true);
|
$imageContainer->addElement(new htmlImage($photoFile), true);
|
||||||
if ($noPhoto) {
|
if (!$this->isAdminReadOnly('jpegPhoto')) {
|
||||||
$imageContainer->addElement(new htmlAccountPageButton(get_class($this), 'photo', 'open', _('Add photo')));
|
if ($noPhoto) {
|
||||||
}
|
$imageContainer->addElement(new htmlAccountPageButton(get_class($this), 'photo', 'open', _('Add photo')));
|
||||||
else {
|
}
|
||||||
$imageContainer->addElement(new htmlButton('delPhoto', _('Delete photo')));
|
else {
|
||||||
|
$imageContainer->addElement(new htmlButton('delPhoto', _('Delete photo')));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$container->addElement(new htmlSpacer('50px', null));
|
$container->addElement(new htmlSpacer('50px', null));
|
||||||
$container->addElement($imageContainer, false);
|
$container->addElement($imageContainer, false);
|
||||||
|
@ -1629,6 +1723,9 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
$messages = array();
|
$messages = array();
|
||||||
|
if ($this->isAdminReadOnly('jpegPhoto')) {
|
||||||
|
return $messages;
|
||||||
|
}
|
||||||
if ($_FILES['photoFile'] && ($_FILES['photoFile']['size'] > 0)) {
|
if ($_FILES['photoFile'] && ($_FILES['photoFile']['size'] > 0)) {
|
||||||
$name = $_FILES['photoFile']['name'];
|
$name = $_FILES['photoFile']['name'];
|
||||||
$extension = strtolower(substr($name, strpos($name, '.') + 1));
|
$extension = strtolower(substr($name, strpos($name, '.') + 1));
|
||||||
|
@ -1778,6 +1875,9 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
*/
|
*/
|
||||||
function process_manager() {
|
function process_manager() {
|
||||||
$return = array();
|
$return = array();
|
||||||
|
if ($this->isAdminReadOnly('manager')) {
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
if (isset($_POST['form_subpage_' . get_class($this) . '_manager_remove']) && isset($_POST['manager'])) {
|
if (isset($_POST['form_subpage_' . get_class($this) . '_manager_remove']) && isset($_POST['manager'])) {
|
||||||
$managers = array_flip($this->attributes['manager']);
|
$managers = array_flip($this->attributes['manager']);
|
||||||
for ($i = 0; $i < sizeof($_POST['manager']); $i++) {
|
for ($i = 0; $i < sizeof($_POST['manager']); $i++) {
|
||||||
|
@ -1858,9 +1958,14 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new certificate or deletes old ones.
|
* Sets a new certificate or deletes old ones.
|
||||||
|
*
|
||||||
|
* @return array list of info/error messages
|
||||||
*/
|
*/
|
||||||
function process_userCertificate() {
|
function process_userCertificate() {
|
||||||
$messages = array();
|
$messages = array();
|
||||||
|
if ($this->isAdminReadOnly('userCertificate')) {
|
||||||
|
return $messages;
|
||||||
|
}
|
||||||
if (isset($_POST['form_subpage_' . get_class($this) . '_userCertificate_submit'])) {
|
if (isset($_POST['form_subpage_' . get_class($this) . '_userCertificate_submit'])) {
|
||||||
if ($_FILES['userCertificateUpload'] && ($_FILES['userCertificateUpload']['size'] > 0)) {
|
if ($_FILES['userCertificateUpload'] && ($_FILES['userCertificateUpload']['size'] > 0)) {
|
||||||
$handle = fopen($_FILES['userCertificateUpload']['tmp_name'], "r");
|
$handle = fopen($_FILES['userCertificateUpload']['tmp_name'], "r");
|
||||||
|
@ -3265,7 +3370,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
public function managesPasswordAttributes() {
|
public function managesPasswordAttributes() {
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
if (!in_array('posixAccount', $modules)) {
|
if (!in_array('posixAccount', $modules)) {
|
||||||
return true;
|
return !$this->isAdminReadOnly('userPassword');
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3384,6 +3489,42 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->businessCategoryCache = array_values(array_unique($businessCategories));
|
$this->businessCategoryCache = array_values(array_unique($businessCategories));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the attribute is read-only in admin interface.
|
||||||
|
*
|
||||||
|
* @param String $attrName attribute name
|
||||||
|
* @return boolean attribute is read-only
|
||||||
|
*/
|
||||||
|
private function isAdminReadOnly($attrName) {
|
||||||
|
// for new accounts all fields can be edited
|
||||||
|
if ($this->getAccountContainer()->isNewAccount) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $this->isBooleanConfigOptionSet('inetOrgPerson_readOnly_' . $attrName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a simple read-only field to the given container.
|
||||||
|
*
|
||||||
|
* @param htmlTable $container parent container
|
||||||
|
* @param String $attrName attribute name
|
||||||
|
* @param String $label field label
|
||||||
|
*/
|
||||||
|
private function addSimpleReadOnlyField(&$container, $attrName, $label) {
|
||||||
|
$val = '';
|
||||||
|
if (!empty($this->attributes[$attrName][0])) {
|
||||||
|
$values = $this->attributes[$attrName];
|
||||||
|
array_map('htmlspecialchars', $values);
|
||||||
|
$val = implode('<br>', $values);
|
||||||
|
}
|
||||||
|
$labelBox = new htmlOutputText($label);
|
||||||
|
if (!empty($this->attributes[$attrName]) && (sizeof($this->attributes[$attrName]) > 1)) {
|
||||||
|
$labelBox->alignment = htmlElement::ALIGN_TOP;
|
||||||
|
}
|
||||||
|
$container->addElement($labelBox);
|
||||||
|
$container->addElement(new htmlOutputText($val, false), true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue