made description multi-valued (RFE 3446363)

This commit is contained in:
Roland Gruber 2012-01-03 19:31:29 +00:00
parent 278cd6b8ac
commit e8baa8d4fd
2 changed files with 42 additions and 8 deletions

View File

@ -1,6 +1,6 @@
March 2012 3.7 March 2012 3.7
- Login: support bind user for login search - Login: support bind user for login search
- Personal: added labeledURI and cosmetic changes - Personal: added labeledURI and cosmetic changes, description is now multi-valued (RFE 3446363)
- New translation: Slovakian - New translation: Slovakian
- Fixed bugs: - Fixed bugs:
-> DHCP: error message not displayed properly (3441975) -> DHCP: error message not displayed properly (3441975)

View File

@ -4,7 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2006 Tilo Lutz Copyright (C) 2003 - 2006 Tilo Lutz
2005 - 2011 Roland Gruber 2005 - 2012 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -836,9 +836,21 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->attributes['objectClass'][] = 'person'; $this->attributes['objectClass'][] = 'person';
} }
} }
// Load and check attributes // load and check attributes
// description
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDescription')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDescription')) {
$this->attributes['description'][0] = $_POST['description']; $descriptionCounter = 0;
while (isset($_POST['description' . $descriptionCounter])) {
$this->attributes['description'][$descriptionCounter] = $_POST['description' . $descriptionCounter];
if ($this->attributes['description'][$descriptionCounter] == '') {
unset($this->attributes['description'][$descriptionCounter]);
}
$descriptionCounter++;
}
if (isset($_POST['addDescription'])) {
$this->attributes['description'][] = '';
}
$this->attributes['description'] = array_values($this->attributes['description']);
} }
$this->attributes['sn'][0] = $_POST['sn']; $this->attributes['sn'][0] = $_POST['sn'];
if (!get_preg($this->attributes['sn'][0], 'realname')) $errors[] = $this->messages['lastname'][0]; if (!get_preg($this->attributes['sn'][0], 'realname')) $errors[] = $this->messages['lastname'][0];
@ -1086,10 +1098,32 @@ class inetOrgPerson extends baseModule implements passwordService {
$cnElement->setRequired(true); $cnElement->setRequired(true);
$fieldContainer->addElement($cnElement, true); $fieldContainer->addElement($cnElement, true);
} }
// description
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDescription')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDescription')) {
$description = ''; $descriptions = array();
if (isset($this->attributes['description'][0])) $description = $this->attributes['description'][0]; if (isset($this->attributes['description'][0])) {
$fieldContainer->addElement(new htmlTableExtendedInputField(_('Description'), 'description', $description, 'description'), true); $descriptions = $this->attributes['description'];
}
if (sizeof($descriptions) == 0) {
$descriptions[] = '';
}
$descriptionLabel = new htmlOutputText(_('Description'));
$descriptionLabel->alignment = htmlElement::ALIGN_TOP;
$fieldContainer->addElement($descriptionLabel);
$descriptionContainer = new htmlGroup();
for ($i = 0; $i < sizeof($descriptions); $i++) {
$descriptionContainer->addElement(new htmlInputField('description' . $i, $descriptions[$i]));
if ($i < (sizeof($descriptions) - 1)) {
$descriptionContainer->addElement(new htmlOutputText('<br>', false));
}
else {
$descriptionContainer->addElement(new htmlButton('addDescription', 'add.png', true));
}
}
$fieldContainer->addElement($descriptionContainer);
$descriptionHelp = new htmlHelpLink('description');
$descriptionHelp->alignment = htmlElement::ALIGN_TOP;
$fieldContainer->addElement($descriptionHelp, true);
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostOfficeBox') if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideStreet') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hidePostOfficeBox')
@ -1490,7 +1524,7 @@ class inetOrgPerson extends baseModule implements passwordService {
*/ */
function get_pdfEntries() { function get_pdfEntries() {
$description = ''; $description = '';
if (isset($this->attributes['description'][0])) $description = $this->attributes['description'][0]; if (isset($this->attributes['description'][0])) $description = implode(', ', $this->attributes['description']);
$title = ''; $title = '';
if (isset($this->attributes['title'][0])) $title = $this->attributes['title'][0]; if (isset($this->attributes['title'][0])) $title = $this->attributes['title'][0];
$givenName = ''; $givenName = '';