| 18 |
* $Id$ |
* $Id$ |
| 19 |
* ------------------------------------------------------------------------- |
* ------------------------------------------------------------------------- |
| 20 |
* $Log$ |
* $Log$ |
| 21 |
|
* Revision 1.14 2003/04/09 02:06:45 joko |
| 22 |
|
* errormessage now shown preformatted |
| 23 |
|
* |
| 24 |
|
* Revision 1.13 2003/04/04 17:38:03 joko |
| 25 |
|
* modifications regarding error-/exception-handling and -tracing |
| 26 |
|
* |
| 27 |
* Revision 1.12 2003/03/29 08:01:21 joko |
* Revision 1.12 2003/03/29 08:01:21 joko |
| 28 |
* modified ErrorBoxing |
* modified ErrorBoxing |
| 29 |
* |
* |
| 522 |
|
|
| 523 |
//print "result: " . dumpVar($result) . "<br>"; |
//print "result: " . dumpVar($result) . "<br>"; |
| 524 |
|
|
| 525 |
$status = $this->backend->getStatus(); |
$status = $this->backend->status(); |
| 526 |
//print Dumper($status); |
//print Dumper($status); |
| 527 |
|
|
| 528 |
$style = html_style("text/css", '.boxlabel_yellow { color: yellow; font-weight:bold; }'); |
$good = is_array($result) && sizeof($result) && $status[connected]; |
|
$statusbox = html_div(); |
|
|
$statusbox->set_style('background: red; border: 2px black groove; width:640px; padding:10px; margin:40px;'); |
|
|
$statusbox->add( html_span('boxlabel_yellow', "Connected:"), $status[connected], html_br() ); |
|
|
foreach ($status[errors] as $error) { |
|
|
$statusbox->add( html_span('boxlabel_yellow', "Error($error[code]):"), $error[message], html_br() ); |
|
|
} |
|
|
|
|
|
if (is_array($result)) { |
|
|
$good = 1; |
|
|
} else { |
|
|
$message = get_class($this) . "->_loadRemote: Error while trying to talk to remote side. Please check wire, socket or api."; |
|
|
logp($message, PEAR_LOG_CRIT); |
|
|
$statusbox->add( html_span('boxlabel_yellow', "Critical:"), $message, html_br() ); |
|
|
} |
|
| 529 |
|
|
| 530 |
if ($good && sizeof($result)) { |
if ($good) { |
| 531 |
|
|
| 532 |
// FIXME: this is dangerous! |
// FIXME: this is dangerous! |
| 533 |
|
/* |
| 534 |
if ($_GET[debug]) { |
if ($_GET[debug]) { |
| 535 |
print Dumper($result); |
print Dumper($result); |
| 536 |
} |
} |
| 537 |
|
*/ |
| 538 |
|
|
| 539 |
$this->payload = serialize($result); |
$this->payload = serialize($result); |
| 540 |
// ----- move this to _encode some times |
// ----- move this to _encode some times |
| 544 |
$this->flushState(); |
$this->flushState(); |
| 545 |
|
|
| 546 |
} else { |
} else { |
| 547 |
if (constants::get('VERBOSE') || constants::get('ERRORS_ONLY')) { |
|
| 548 |
print $style->render(); |
if (constants::get('APP_MODE_DEBUG')) { |
| 549 |
print $statusbox->render(); |
$this->draw_error_box($status); |
| 550 |
} else { |
} else { |
| 551 |
foreach ($status[errors] as $error) { |
php::maintenance('rpc', array( status => $status ) ); |
|
print Dumper($error); |
|
|
} |
|
| 552 |
} |
} |
| 553 |
|
|
| 554 |
} |
} |
| 555 |
|
|
| 556 |
} |
} |
| 557 |
|
|
| 558 |
|
function draw_error_box($status) { |
| 559 |
|
$style = html_style("text/css", '.boxlabel_yellow { color: yellow; font-weight:bold; }'); |
| 560 |
|
$statusbox = html_div(); |
| 561 |
|
$statusbox->set_style('background: red; border: 2px black groove; width:640px; padding:10px; margin:40px;'); |
| 562 |
|
$statusbox->add( html_span('boxlabel_yellow', "Method:"), get_class($this) . "->_loadRemote", html_br() ); |
| 563 |
|
$statusbox->add( html_span('boxlabel_yellow', "Connected:"), $status[connected], html_br() ); |
| 564 |
|
$statusbox->add( html_span('boxlabel_yellow', "RPCSESSID:"), $status[RPCSESSID], html_br() ); |
| 565 |
|
foreach ($status[errors] as $error) { |
| 566 |
|
$msg = html_pre($error[message]); |
| 567 |
|
$statusbox->add( html_span('boxlabel_yellow', "Error($error[code]):"), $msg ); |
| 568 |
|
} |
| 569 |
|
|
| 570 |
|
$message = "Error while talking to remote side. Please check wire, socket or api."; |
| 571 |
|
logp($message, PEAR_LOG_CRIT); |
| 572 |
|
$statusbox->add( html_span('boxlabel_yellow', "Critical:"), $message, html_br() ); |
| 573 |
|
|
| 574 |
|
// V1 |
| 575 |
|
/* |
| 576 |
|
if (constants::get('VERBOSE') || constants::get('ERRORS_ONLY')) { |
| 577 |
|
print $style->render(); |
| 578 |
|
print $statusbox->render(); |
| 579 |
|
} else { |
| 580 |
|
foreach ($status[errors] as $error) { |
| 581 |
|
print Dumper($error); |
| 582 |
|
} |
| 583 |
|
} |
| 584 |
|
*/ |
| 585 |
|
|
| 586 |
|
// V2 |
| 587 |
|
trace( container($style, $statusbox) ); |
| 588 |
|
|
| 589 |
|
} |
| 590 |
|
|
| 591 |
|
|
| 592 |
function _saveBackend($result) { |
function _saveBackend($result) { |
| 593 |
logp(get_class($this) . "->_saveBackend()"); |
logp(get_class($this) . "->_saveBackend()"); |
| 594 |
|
|