|
[Lam-cvs] lam/lib modules.inc,1.98,1.99
From: Roland Gruber <gruberroland@us...> - 2005-05-07 14:32
|
Update of /cvsroot/lam/lam/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2265/lib
Modified Files:
modules.inc
Log Message:
info messages no longer block changing modules;
better messages if some required information is still missing
Index: modules.inc
===================================================================
RCS file: /cvsroot/lam/lam/lib/modules.inc,v
retrieving revision 1.98
retrieving revision 1.99
diff -C2 -d -r1.98 -r1.99
*** modules.inc 2 May 2005 17:41:09 -0000 1.98
--- modules.inc 7 May 2005 14:32:18 -0000 1.99
***************
*** 819,834 ****
else $result = call_user_func(array(&$this->module[$this->order[$this->current_page]], 'process_'.$this->subpage), $post);
}
! if (is_string($result)) $this->subpage = $result;
! if (is_int($result)) {
if ($post['form_main_main']) {
$this->current_page = 0;
$this->subpage='attributes';
! }
else for ($i=1; $i<count($this->order); $i++ )
if (isset($post['form_main_'.$this->order[$i]]) && ($this->module[$this->order[$i]]->module_ready())) {
$this->current_page = $i;
$this->subpage='attributes';
! }
! }
// Write HTML-Code
echo $_SESSION['header'];
--- 819,847 ----
else $result = call_user_func(array(&$this->module[$this->order[$this->current_page]], 'process_'.$this->subpage), $post);
}
! // change to next page
! 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']) {
$this->current_page = 0;
$this->subpage='attributes';
! }
else for ($i=1; $i<count($this->order); $i++ )
if (isset($post['form_main_'.$this->order[$i]]) && ($this->module[$this->order[$i]]->module_ready())) {
$this->current_page = $i;
$this->subpage='attributes';
! }
! }
// Write HTML-Code
echo $_SESSION['header'];
***************
*** 845,848 ****
--- 858,879 ----
if (is_array($result2))
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
echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >";
***************
*** 881,899 ****
}
// display html-code from mdule
! 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
$rootsuffix = $_SESSION['config']->get_Suffix($this->type);
--- 912,917 ----
}
// display html-code from mdule
! $return = array();
! if ($this->current_page==0) {
// loop through all suffixes
$rootsuffix = $_SESSION['config']->get_Suffix($this->type);
***************
*** 935,939 ****
else $text = _('Create Account');
$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') {
--- 953,957 ----
else $text = _('Create Account');
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => $text ),
! 1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'create', 'value' => $text, 'disabled' => $disabled),
2 => array ('kind' => 'help', 'value' => 'create'));
if ($this->subpage=='finish') {
|
| Thread | Author | Date |
|---|---|---|
| [Lam-cvs] lam/lib modules.inc,1.98,1.99 | Roland Gruber <gruberroland@us...> |