/[cvs]/nfo/php/libs/org.netfrag.glib/DesignPattern/RemoteProxy.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/DesignPattern/RemoteProxy.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by joko, Fri Mar 28 03:05:54 2003 UTC revision 1.14 by joko, Wed Apr 9 02:06:45 2003 UTC
# Line 18  Line 18 
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
28     *    modified ErrorBoxing
29     *
30     *    Revision 1.11  2003/03/28 06:44:51  joko
31     *    VERBOSE mode
32     *
33   *    Revision 1.10  2003/03/28 03:05:54  joko   *    Revision 1.10  2003/03/28 03:05:54  joko
34   *    more fancy debugging-output   *    more fancy debugging-output
35   *   *
# Line 510  class DesignPattern_RemoteProxy extends Line 522  class DesignPattern_RemoteProxy extends
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", '.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);  
     }  
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
# Line 546  class DesignPattern_RemoteProxy extends Line 544  class DesignPattern_RemoteProxy extends
544        $this->flushState();        $this->flushState();
545            
546      } else {      } else {
547        print $style->render();        
548        print $statusbox->render();        if (constants::get('APP_MODE_DEBUG')) {
549            $this->draw_error_box($status);
550          } else {
551            php::maintenance('rpc', array( status => $status ) );
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    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.14

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed