implemented profile loading interface
This commit is contained in:
parent
cec9d8cd4e
commit
630f65a639
|
@ -305,6 +305,22 @@ class baseModule {
|
||||||
return $messages;
|
return $messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the values of an account profile into internal variables.
|
||||||
|
*
|
||||||
|
* @param array $profile hash array with profile values (identifier => value)
|
||||||
|
*/
|
||||||
|
function load_profile($profile) {
|
||||||
|
if (isset($this->meta['profile_mappings'])) {
|
||||||
|
$identifiers = array_keys($this->meta['profile_mappings']);
|
||||||
|
for ($i = 0; $i < sizeof($identifiers); $i++) {
|
||||||
|
if (isset($profile[$identifiers[$i]])) {
|
||||||
|
$this->attributes[$this->meta['profile_mappings'][$identifiers[$i]]] = $profile[$identifiers[$i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of elements for the configuration.
|
* Returns a list of elements for the configuration.
|
||||||
*
|
*
|
||||||
|
|
|
@ -597,11 +597,10 @@ class accountContainer {
|
||||||
|
|
||||||
// load profile
|
// load profile
|
||||||
if ($post['selectLoadProfile'] && $post['loadProfile']) {
|
if ($post['selectLoadProfile'] && $post['loadProfile']) {
|
||||||
// *** fixme load*Profile must return array in the same way ldap_get_attributes does.
|
$profile = loadAccountProfile($post['selectLoadProfile'], $this->type);
|
||||||
$newattributes = loadAccountProfile($post['selectLoadProfile'], $scope);
|
// pass profile to each module
|
||||||
// pass newattributes to each module
|
|
||||||
$modules = array_keys($this->module);
|
$modules = array_keys($this->module);
|
||||||
foreach ($modules as $module) $this->module[$module]->load_attributes($newattributes);
|
foreach ($modules as $module) $this->module[$module]->load_profile($profile);
|
||||||
$result = 0;
|
$result = 0;
|
||||||
}
|
}
|
||||||
// save account
|
// save account
|
||||||
|
@ -611,17 +610,6 @@ class accountContainer {
|
||||||
// return name of subpage
|
// return name of subpage
|
||||||
$result = 'finish';
|
$result = 'finish';
|
||||||
}
|
}
|
||||||
// save profile
|
|
||||||
if ($post['saveProfile']) {
|
|
||||||
if ($post['selectSaveProfile']=='') $errors['saveProfile'][] = array('ERROR', _('Save profile'), _('No profilename given.'));
|
|
||||||
else {
|
|
||||||
//saveAccountProfile($scope); // TODO missing parameters, remove?
|
|
||||||
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)) $result = $errors;
|
|
||||||
else $result = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($this->subpage=='finish') {
|
if ($this->subpage=='finish') {
|
||||||
if ($post['createagain']) {
|
if ($post['createagain']) {
|
||||||
|
@ -747,17 +735,15 @@ class accountContainer {
|
||||||
// Get list of profiles
|
// Get list of profiles
|
||||||
$profilelist = getAccountProfiles($this->type);
|
$profilelist = getAccountProfiles($this->type);
|
||||||
if (count($profilelist)!=0) {
|
if (count($profilelist)!=0) {
|
||||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Load profile") ),
|
$return[] = array(
|
||||||
1 => array ( 'kind' => 'select', 'name' => 'selectLoadProfile', 'options' => $profilelist ),
|
0 => array('kind' => 'text', 'text' => _("Load profile")),
|
||||||
2 => array ('kind' => 'help', 'value' => 'selectLoadProfile'));
|
1 => array('kind' => 'table', 'value' => array(0 => array(
|
||||||
}
|
0 => array('kind' => 'select', 'name' => 'selectLoadProfile', 'options' => $profilelist),
|
||||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Save profile") ),
|
1 => array('kind' => 'input', 'type' => 'submit', 'name' => 'loadProfile', 'value' => _('Load profile'))
|
||||||
1 => array ( 'kind' => 'table', 'value' => array ( 0 => array (
|
)),
|
||||||
0 => array ( 'kind' => 'input', 'name' => 'selectSaveProfile', 'type' => 'text', 'size' => '30',
|
2 => array('kind' => 'help', 'value' => 'selectLoadProfile'))
|
||||||
'maxlength' => '255', ),
|
);
|
||||||
1 => array ('kind' => 'input', 'name' => 'saveProfile', 'type' => 'submit',
|
}
|
||||||
'value' => _('Save profile'), 'disabled' => $disabled))) ),
|
|
||||||
2 => array ('kind' => 'help', 'value' => 'saveProfile'));
|
|
||||||
if ($this->dn_orig!='') $text = _('Modify Account');
|
if ($this->dn_orig!='') $text = _('Modify Account');
|
||||||
else $text = _('Create Account');
|
else $text = _('Create Account');
|
||||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => $text ),
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => $text ),
|
||||||
|
|
|
@ -80,6 +80,10 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
'type' => 'ext_preg',
|
'type' => 'ext_preg',
|
||||||
'regex' => 'DNSname',
|
'regex' => 'DNSname',
|
||||||
'error_message' => $this->messages['host'][0]);
|
'error_message' => $this->messages['host'][0]);
|
||||||
|
// profile mappings
|
||||||
|
$return['profile_mappings'] = array(
|
||||||
|
'inetLocalMailRecipient_host' => 'mailHost'
|
||||||
|
);
|
||||||
// upload fields
|
// upload fields
|
||||||
$return['upload_columns'] = array(
|
$return['upload_columns'] = array(
|
||||||
array(
|
array(
|
||||||
|
@ -232,7 +236,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
if (isset($post['routingAdr']) && ($post['routingAdr'] != "")) {
|
if (isset($post['routingAdr']) && ($post['routingAdr'] != "")) {
|
||||||
// check if address has correct format
|
// check if address has correct format
|
||||||
if (get_preg($post['routingAdr'], 'email')) {
|
if (get_preg($post['routingAdr'], 'email')) {
|
||||||
$this->attributes['mailRoutingAddress'][] = $post['routingAdr'];
|
$this->attributes['mailRoutingAddress'][0] = $post['routingAdr'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['routingAdr'][0];
|
$message = $this->messages['routingAdr'][0];
|
||||||
|
@ -244,7 +248,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
if (isset($post['host']) && ($post['host'] != "")) {
|
if (isset($post['host']) && ($post['host'] != "")) {
|
||||||
// check if address has correct format
|
// check if address has correct format
|
||||||
if (get_preg($post['host'], 'DNSname')) {
|
if (get_preg($post['host'], 'DNSname')) {
|
||||||
$this->attributes['mailHost'][] = $post['host'];
|
$this->attributes['mailHost'][0] = $post['host'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['host'][0];
|
$message = $this->messages['host'][0];
|
||||||
|
|
Loading…
Reference in New Issue