info messages no longer block changing modules;
better messages if some required information is still missing
This commit is contained in:
parent
48cc835ade
commit
9728ab3556
|
@ -818,8 +818,21 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
else $result = call_user_func(array(&$this->module[$this->order[$this->current_page]], 'process_'.$this->subpage), $post);
|
else $result = call_user_func(array(&$this->module[$this->order[$this->current_page]], 'process_'.$this->subpage), $post);
|
||||||
}
|
}
|
||||||
if (is_string($result)) $this->subpage = $result;
|
// change to next page
|
||||||
if (is_int($result)) {
|
if (is_string($result)) $this->subpage = $result; // go to subpage of current module
|
||||||
|
$errorsOccured = false;
|
||||||
|
if (is_array($result)) { // messages were returned, check for errors
|
||||||
|
$errorKeys = array_keys($result);
|
||||||
|
for ($i = 0; $i < sizeof($errorKeys); $i++) {
|
||||||
|
for ($m = 0; $m < sizeof($result[$errorKeys[$i]]); $m++) {
|
||||||
|
if (($result[$errorKeys[$i]][$m][0] == 'ERROR') || ($result[$errorKeys[$i]][$m][0] == 'WARN')) {
|
||||||
|
$errorsOccured = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_int($result) || !$errorsOccured) { // numeric return value means to change to another module
|
||||||
if ($post['form_main_main']) {
|
if ($post['form_main_main']) {
|
||||||
$this->current_page = 0;
|
$this->current_page = 0;
|
||||||
$this->subpage='attributes';
|
$this->subpage='attributes';
|
||||||
|
@ -844,6 +857,24 @@ class accountContainer {
|
||||||
foreach ($result as $result2)
|
foreach ($result as $result2)
|
||||||
if (is_array($result2))
|
if (is_array($result2))
|
||||||
for ($i=0; $i<sizeof($result2); $i++) StatusMessage($result2[$i][0], $result2[$i][1], $result2[$i][2]);
|
for ($i=0; $i<sizeof($result2); $i++) StatusMessage($result2[$i][0], $result2[$i][1], $result2[$i][2]);
|
||||||
|
if ($this->current_page==0) {
|
||||||
|
if ($this->subpage=='attributes') {
|
||||||
|
$modules = array_keys($this->module);
|
||||||
|
$table = array();
|
||||||
|
$disabled = false;
|
||||||
|
$incompleteModules = array();
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
if (!$this->module[$module]->module_complete()) {
|
||||||
|
$disabled = true;
|
||||||
|
$incompleteModules[] = $this->module[$module]->get_alias();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sizeof($incompleteModules) > 0) {
|
||||||
|
StatusMessage('INFO', _('Some required information is missing'),
|
||||||
|
sprintf(_('Please set up all required attributes on page: %s'), implode(", ", $incompleteModules)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Create left module-menu
|
// Create left module-menu
|
||||||
echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >";
|
echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >";
|
||||||
echo "<table><tr>";
|
echo "<table><tr>";
|
||||||
|
@ -880,21 +911,8 @@ class accountContainer {
|
||||||
echo "</b></legend>\n";
|
echo "</b></legend>\n";
|
||||||
}
|
}
|
||||||
// display html-code from mdule
|
// display html-code from mdule
|
||||||
|
$return = array();
|
||||||
if ($this->current_page==0) {
|
if ($this->current_page==0) {
|
||||||
if ($this->subpage=='attributes') {
|
|
||||||
$modules = array_keys($this->module);
|
|
||||||
$table = array();
|
|
||||||
$disabled = false;
|
|
||||||
foreach ($modules as $module) {
|
|
||||||
if (!$this->module[$module]->module_complete()) {
|
|
||||||
$disabled = true;
|
|
||||||
$table[] = array ( 0 => array ( 'kind' => 'message', 'type' => 'ERROR', 'headline' => _('Some required information is missing'),
|
|
||||||
'text' => sprintf(_('Please set up all required attributes on page: %s'), $this->module[$module]->get_alias()) ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($table)!=0) $return[] = array ( 0 => array ( 'kind' => 'table', 'value' => $table ) );
|
|
||||||
// loop through all suffixes
|
// loop through all suffixes
|
||||||
$rootsuffix = $_SESSION['config']->get_Suffix($this->type);
|
$rootsuffix = $_SESSION['config']->get_Suffix($this->type);
|
||||||
foreach ($_SESSION['ldap']->search_units($rootsuffix) as $suffix) {
|
foreach ($_SESSION['ldap']->search_units($rootsuffix) as $suffix) {
|
||||||
|
@ -934,7 +952,7 @@ class accountContainer {
|
||||||
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 ),
|
||||||
1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'create', 'value' => $text ),
|
1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'create', 'value' => $text, 'disabled' => $disabled),
|
||||||
2 => array ('kind' => 'help', 'value' => 'create'));
|
2 => array ('kind' => 'help', 'value' => 'create'));
|
||||||
if ($this->subpage=='finish') {
|
if ($this->subpage=='finish') {
|
||||||
// Show success message
|
// Show success message
|
||||||
|
|
Loading…
Reference in New Issue