/[cvs]/nfo/php/libs/org.netfrag.glib/DataSource/Generic.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/DataSource/Generic.php

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

revision 1.10 by joko, Fri Mar 28 03:01:02 2003 UTC revision 1.11 by joko, Fri Mar 28 06:45:26 2003 UTC
# Line 15  Line 15 
15   * $Id$   * $Id$
16   *   *
17   * $Log$   * $Log$
18     * Revision 1.11  2003/03/28 06:45:26  joko
19     * VERBOSE mode
20     *
21   * Revision 1.10  2003/03/28 03:01:02  joko   * Revision 1.10  2003/03/28 03:01:02  joko
22   * more fancy debugging-output   * more fancy debugging-output
23   *   *
# Line 753  class DataSource_Generic extends DesignP Line 756  class DataSource_Generic extends DesignP
756                
757    }    }
758    
759    
760    
761          function &fetch_result() {          function &fetch_result() {
762                
763        $this->datasource_handler_buildoptions();        $this->datasource_handler_buildoptions();
764    
765        $method = $this->_locator->_call[_method];        $call = $this->_locator->get_call();
766        $args = $this->_locator->_call[_arguments];        //print Dumper($call);
767          
768        // pre-flight checks        // pre-flight checks
769          if (!$method) {          if (!$call[method]) {
770            $msg = "Remote command could not be resolved, please pass in or check configuration.";            $msg = "Remote method is empty, please pass in proper metadata or check configuration.";
771                          user_error("GenericDataSource::query_data() - failed: " . $msg);                          user_error("GenericDataSource::query_data() - failed: " . $msg);
772            return;            return;
773          }          }
# Line 771  class DataSource_Generic extends DesignP Line 776  class DataSource_Generic extends DesignP
776    
777        // do remote call here and get result        // do remote call here and get result
778        // FIXME: handle synchronous/asynchronous mode here!!!        // FIXME: handle synchronous/asynchronous mode here!!!
779          $this->datasource_handler_call($method, $args);          $this->datasource_handler_call($call[method], $call[args]);
780                    
781                    
782          // TODO: ... = $this->poll_handler_result  and  $this->get_handler_result          // TODO: ... = $this->poll_handler_result  and  $this->get_handler_result
# Line 782  class DataSource_Generic extends DesignP Line 787  class DataSource_Generic extends DesignP
787          $this->_result_count = sizeof($this->_result);          $this->_result_count = sizeof($this->_result);
788    
789        // trace        // trace
790          if ($this->_debug[notice]) {          //if (constants::get('VERBOSE') && $this->_debug[notice]) {
791            if (constants::get('VERBOSE')) {
792            //print "_result = " . Dumper($this->_result);            //print "_result = " . Dumper($this->_result);
793            print "<div><b><font color=\"darkgreen\">Debug:</font></b> DataSource::Generic->_result_count = <b>" . $this->_result_count . "</b></div>";            //print "<div><b><font color=\"darkgreen\">Debug:</font></b> DataSource::Generic->_result_count = <b>" . $this->_result_count . "</b></div>";
794              $this->draw_status_box();
795          }          }
796            
797          return $this->_result;          return $this->_result;
798    
799          }          }
800    
801      function draw_status_box() {
802    
803        static $boxcount;
804        
805        $boxcount++;
806    
807        // box client code (javascript)
808        $code_js = "
809        <script language=\"javascript\">
810        function toggle_vis(id) {
811          elem = eval('document.all.' + id);
812          status = elem.style.getAttribute('display');
813          if (status == 'none') {
814            elem.style.setAttribute('display', 'block');
815          } else {
816            elem.style.setAttribute('display', 'none');
817          }
818        }
819        </script>
820        ";
821        //$script = html_script($code_js);
822        //print $script->render();
823        print $code_js;
824        
825        // box style
826        $style = container(
827          html_style("text/css", '.boxlabel_darkgreen { color: darkgreen; font-weight:bold; }'),
828          html_style("text/css", '.box_dsg { background: #20ab39; color: white; border: 2px black groove; width:640px; padding:10px; margin:40px; }')
829        );
830        print $style->render();
831        
832        // box content
833        $statusbox = html_div('box_dsg');
834        $statusbox->add( html_b("DataSource::Generic"), html_br() );
835        $locatorbox = html_div('box_dsg');
836        $locatorbox->set_id("locatorbox_$boxcount");
837        $locatorbox->add( Dumper($this->_locator) );
838        //$locatorbox->set_style('visibility:false;');
839        $locatorbox->set_style('display:none;');
840        
841        $statusbox->add( html_span('boxlabel_darkgreen', "Locator:"), html_a("javascript:toggle_vis('locatorbox_$boxcount');", '[show]'), $locatorbox, html_br() );
842        $call = $this->_locator->get_call();
843        $statusbox->add( html_span('boxlabel_darkgreen', "Method:"), $call[method], html_br() );
844        if (sizeof($call[args])) {
845          $statusbox->add( html_span('boxlabel_darkgreen', "Arguments:"), Dumper($call[args]), html_br() );
846        }
847        $statusbox->add( html_span('boxlabel_darkgreen', "Count:"), $this->get_result_count(), html_br() );
848        print $statusbox->render();
849    
850      }
851    
852    
853    function &query_data() {    function &query_data() {
854      //print "query!<br/>";      //print "query!<br/>";
# Line 806  class DataSource_Generic extends DesignP Line 864  class DataSource_Generic extends DesignP
864    function &get_result() {    function &get_result() {
865      return $this->_result;      return $this->_result;
866    }    }
867      
868      function get_result_count() {
869        return $this->_result_count;
870      }
871                    
872  }  }
873    

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

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