made some fixes

This commit is contained in:
katagia 2004-10-17 09:33:24 +00:00
parent e74999ea5b
commit e257ffcb5b
2 changed files with 73 additions and 61 deletions

View File

@ -567,7 +567,7 @@ class accountContainer {
if ($function) $errors['saveProfile'][] = array('INFO', _('Save profile'), _('New profile created.'));
else $errors['saveProfile'][] = array('ERROR', _('Save profile'), _('Wrong profilename given.'));
}
if (is_array($errors) && !$profile) $result = $errors;
if (is_array($errors)) $result = $errors;
else $result = 0;
}
}
@ -670,7 +670,6 @@ class accountContainer {
if ($this->subpage=='attributes') {
$modules = array_keys($this->module);
$table = array();
if (!$profile) {
$disabled = false;
foreach ($modules as $module) {
if (!$this->module[$module]->module_complete()) {
@ -693,7 +692,6 @@ class accountContainer {
'option_selected' => array($option_selected) ),
2 => array ('kind' => 'help', 'value' => 'suffix'));
if (!$profile) {
// Get list of profiles
$profilelist = getAccountProfiles($this->type);
if (count($profilelist)!=0) {
@ -713,14 +711,11 @@ class accountContainer {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => $text ),
1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'create', 'value' => $text ),
2 => array ('kind' => 'help', 'value' => 'create'));
}
}
if ($this->subpage=='finish') {
// Show success message
if ($this->dn_orig=='') $kind = _('created');
else $kind = _('modified');
$text = sprintf(_('%s has been %s.'), ucfirst($this->type), $kind);
if (!$profile) {
$return[] = array ( 0 => array ( 'kind' => 'message', 'type' => 'INFO', 'headline' => _('LDAP operation successful.'),
'text' => $text ));
@ -732,7 +727,6 @@ class accountContainer {
'value' => sprintf (_('Back to %s list'), $this->type) ));
}
}
}
else $return = call_user_func(array($this->module[$this->order[$this->current_page]], 'display_html_'.$this->subpage), &$post);
$this->parse_html($this->order[$this->current_page], $return);
// Display rest of html-page

View File

@ -431,7 +431,23 @@ class posixAccount extends baseModule {
*/
function save_attributes() {
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
// fill gecos with correct attributes frm inetOrgPerson when they are set
// TODO do we have t use 7bit ascci only?
// TODO change gecos evertime something in inetOrgPerson has changes
if (isset($_SESSION[$this->base]->modules['inetOrgPerson'])) {
if (isset($return[$_SESSION[$this->base]->dn]['add']['gecos']))
$return[$_SESSION[$this->base]->dn]['add']['gecos'] = $_SESSION[$this->base]->modules['inetOrgPerson']->attributes['givenName'][0] .
" " . $_SESSION[$this->base]->modules['inetOrgPerson']->attributes['sn'][0] . "," .
$_SESSION[$this->base]->modules['inetOrgPerson']->attributes['roomNumber'][0] . "," .
$_SESSION[$this->base]->modules['inetOrgPerson']->attributes['telephoneNumber'][0] . "," .
$_SESSION[$this->base]->modules['inetOrgPerson']->attributes['homePhone'][0] ;
if (isset($return[$_SESSION[$this->base]->dn]['modify']['gecos']))
$return[$_SESSION[$this->base]->dn]['modify']['gecos'] = $_SESSION[$this->base]->modules['inetOrgPerson']->attributes['givenName'][0] .
" " . $_SESSION[$this->base]->modules['inetOrgPerson']->attributes['sn'][0] . "," .
$_SESSION[$this->base]->modules['inetOrgPerson']->attributes['roomNumber'][0] . "," .
$_SESSION[$this->base]->modules['inetOrgPerson']->attributes['telephoneNumber'][0] . "," .
$_SESSION[$this->base]->modules['inetOrgPerson']->attributes['homePhone'][0] ;
}
// unset password when needed
if (isset($return[$_SESSION[$this->base]->dn]['add']['userPassword']))
unset($return[$_SESSION[$this->base]->dn]['add']['userPassword']);
@ -545,7 +561,7 @@ class posixAccount extends baseModule {
function proccess_attributes($post) {
$this->attributes['homeDirectory'][0] = $post['homeDirectory'];
$this->attributes['loginShell'][0] = $post['loginShell'];
$this->attributes['gecos'][0] = $post['gecos'];
if (isset($post['gecos'])) $this->attributes['gecos'][0] = $post['gecos'];
if ($post['createhomedir']) $this->createhomedir = true;
else $this->createhomedir = false;
if ($this->orig['uid'][0]!='' && $post['uid']!=$this->attributes['uid'][0])
@ -773,9 +789,11 @@ class posixAccount extends baseModule {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('UID number').'*' ),
1 => array ( 'kind' => 'input', 'name' => 'uidNumber', 'type' => 'text', 'size' => '6', 'maxlength' => '6', 'value' => $this->attributes['uidNumber'][0]),
2 => array ('kind' => 'help', 'value' => 'uidNumber'));
if (!isset($_SESSION[$this->base]->modules['inetOrgPerson'])) {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Gecos') ),
1 => array ( 'kind' => 'input', 'name' => 'gecos', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['gecos'][0]),
2 => array ('kind' => 'help', 'value' => 'gecos'));
}
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Primary group').'*' ),
1 => array ( 'kind' => 'select', 'name' => 'gidNumber', 'options' => $groups, 'options_selected' =>
array ($_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]))),