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