/[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.1 by joko, Wed Mar 5 12:04:00 2003 UTC revision 1.16 by joko, Tue Apr 8 17:55:20 2003 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /**  /**
3   * This file contains the GenericDataSource child class   * This file contains the GenericDataSource child class
  * that may use arbitrary code modules as database handlers.  
  * It's aims are to get together:  
  *   o phpHtmlLibs "source-handlers"  
  *   o PEAR's database handlers  
  *   o custom ones (e.g. Data::Driver::Proxy object, which talks to a remote rpc server)  
4   *   *
5   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
6   * @package phpHtmlLib   * @package org.netfrag.glib
7   * @module GenericDataSource   * @name DataSource::Generic
8   *   *
9   */   */
10    
11  /**  /**
12     * <b>Cvs-Log:</b>
13     *
14     * <pre>
15   * $Id$   * $Id$
16   *   *
17   * $Log$   * $Log$
18     * Revision 1.16  2003/04/08 17:55:20  joko
19     * CHANGE: renamed property 'datasource' to 'transport'
20     * NEW: new case 'method' in 'function datasource_handler_buildoptions'
21     * minor fixes: updated logging/debugging messages
22     *
23     * Revision 1.15  2003/04/06 04:46:33  joko
24     * renamed linking function
25     * mozilla fixes
26     *
27     * Revision 1.14  2003/04/04 21:19:21  joko
28     * modified exception handling (enhanced, purged redundant code)
29     *
30     * Revision 1.13  2003/04/04 02:37:14  jonen
31     * _query[action] == write
32     *
33     * Revision 1.12  2003/03/29 08:00:48  joko
34     * modified ErrorBoxing
35     *
36     * Revision 1.11  2003/03/28 06:45:26  joko
37     * VERBOSE mode
38     *
39     * Revision 1.10  2003/03/28 03:01:02  joko
40     * more fancy debugging-output
41     *
42     * Revision 1.9  2003/03/27 16:24:26  jonen
43     * + mugled namespace
44     * + added enhanced 'queryData'
45     *
46     * Revision 1.8  2003/03/20 07:22:14  jonen
47     * + modified case 'object' to 'objects'
48     *   (cause its loads all *objects* of a given classname)
49     *
50     * Revision 1.7  2003/03/11 01:43:00  joko
51     * + fixed metadata for phpDocumentor
52     *
53     * Revision 1.6  2003/03/11 01:22:25  joko
54     * + fixed metadata for phpDocumentor
55     *
56     * Revision 1.5  2003/03/11 00:12:49  joko
57     * + fixed metadata for phpDocumentor
58     *
59     * Revision 1.4  2003/03/10 23:25:03  joko
60     * + fixed metadata for phpDocumentor
61     *
62     * Revision 1.3  2003/03/09 15:50:36  joko
63     * + additional metadata for Autodia
64     *
65     * Revision 1.2  2003/03/05 17:28:43  joko
66     * updated docu (phpDocumentor testing....)
67     *
68   * Revision 1.1  2003/03/05 12:04:00  joko   * Revision 1.1  2003/03/05 12:04:00  joko
69   * + initial commit, from GenericDataSource   * + initial commit, from GenericDataSource
70   *   *
# Line 43  Line 91 
91   *   *
92   * Revision 1.1  2003/03/01 03:10:40  joko   * Revision 1.1  2003/03/01 03:10:40  joko
93   * + initial commit   * + initial commit
94   *   * </pre>
95   *   *
96   */   */
97    
# Line 71  Line 119 
119    // require_once("PEAR.php");   // FIXME: what about PEAR::XML::RPC?    // require_once("PEAR.php");   // FIXME: what about PEAR::XML::RPC?
120    // require_once("DB.php");    // require_once("DB.php");
121    
122    
123    loadModule('DesignPattern::Proxy');
124    loadModule('DesignPattern::TransparentProxy');
125    loadModule('DesignPattern::RemoteProxy');
126    
127    //class GenericDataSource extends MemoryDataSource {
128    //class GenericDataSource extends DesignPattern_Proxy {
129    //class GenericDataSource extends DesignPattern_RemoteProxy {
130    //class GenericDataSource extends DesignPattern_TransparentProxy {
131    
132    //class GenericDataSource extends MemoryDataSource {
133    //loadModule("DataSource::Proxy::Memory");
134    //class GenericDataSource extends DataSource_Proxy_Memory {
135    //class DataSource_GenericDataSource extends DataSource_Proxy_Memory {
136    //class DataSource_GenericDataSource extends DesignPattern_Proxy {
137    //class DataSource_GenericDataSource extends DataSource_Proxy_Memory {
138    
139    // now independent!!! new class-inheritance-tree possible now!
140    // solved by having an Adapter *and* a Proxy here!
141    //class GenericDataSource {
142    
143    loadModule('DesignPattern::AdapterProxy');
144    
145    
146    
147  /**  /**
148   * This GenericDataSource child class is *completely* independent   * This GenericDataSource child class is *completely* independent
149   * of a specific storage implementation and intended to be a wrapper   * of a specific storage implementation and intended to be a wrapper
150   * class on the way from phpHtmlLib to Xyz.   * class on the way from phpHtmlLib to Xyz. <br>
151   *    ("Yyz" gets represented by Data::Storage by now.....)   *    ("Yyz" gets represented by Data::Storage by now.....)
152   *   *
153   * GenericDataSource interacts with an intermediate "proxy" object   * GenericDataSource interacts with an intermediate "proxy" object
154   * (e.g. Data::Driver::Proxy) when doing queries.   * (e.g. Data::Driver::Proxy) when doing queries. <br>
155     * <pre>
156   *    Don't mix this up with a persistent database handle which gets   *    Don't mix this up with a persistent database handle which gets
157   *    reused each and every time for different queries.   *    reused each and every time for different queries.
158   *    Here *is* a new instance of Data::Driver::Proxy for *each* query.   *    Here *is* a new instance of Data::Driver::Proxy for *each* query.
159     * </pre>
160   *   *
161   * But the point is: Caching! The actual *data* isn't read redundant!   * But the point is: Caching! The actual *data* isn't read redundant!
162   *   *
163     * <pre>
164     * --- snipped into here from above ---
165     * that may use arbitrary code modules as database handlers.
166     * It's aims are to get together:
167     *   o phpHtmlLibs "source-handlers"
168     *   o PEAR's database handlers
169     *   o custom ones (e.g. Data::Driver::Proxy object, which talks to a remote rpc server)
170     * --- snipped into here from above ---
171     * </pre>
172   *   *
173     * <p>
174   * !!!!!!  refactor this to Data::Driver::Proxy  !!!!!!     <-----------------   * !!!!!!  refactor this to Data::Driver::Proxy  !!!!!!     <-----------------
175   *   *
176   * Data::Driver::Proxy instantiates "handlers" below itself   * Data::Driver::Proxy instantiates "handlers" below itself
# Line 95  Line 180 
180   * One worker already implemented is Data::Driver::RPC::Remote, which   * One worker already implemented is Data::Driver::RPC::Remote, which
181   * talks to a RPC::XML server (todo: talk SOAP!) using PEAR::XML::RPC.   * talks to a RPC::XML server (todo: talk SOAP!) using PEAR::XML::RPC.
182   *   *
183     * <pre>
184   * ---  refactored here, but: redundant somehow  ---   * ---  refactored here, but: redundant somehow  ---
185   * Data::Driver::Proxy uses a PEAR XML::RPC object to actually   * Data::Driver::Proxy uses a PEAR XML::RPC object to actually
186   * talk HTTP and serialize data chunks to and from XML,   * talk HTTP and serialize data chunks to and from XML,
# Line 102  Line 188 
188   * It "proxies" arbitrary data chunks a) inside a native php4 session,   * It "proxies" arbitrary data chunks a) inside a native php4 session,
189   * b) by talking to a rdbms (single proxy-table) or c) [TODO] using PEAR::Cache.   * b) by talking to a rdbms (single proxy-table) or c) [TODO] using PEAR::Cache.
190   * ---  refactored here, but: redundant somehow  ---   * ---  refactored here, but: redundant somehow  ---
191     * </pre>
192   *   *
193   * !!!!!!  refactor this to Data::Driver::Proxy  !!!!!!     <-----------------   * !!!!!!  refactor this to Data::Driver::Proxy  !!!!!!     <-----------------
194     * </p>
195   *   *
196   *   *
197   * How to use?   * <p>
198     * <b>How to use?</b>
199   *   *
200   * Pass an array holding "locator metadata" to the constructor.   * Pass an array holding "locator metadata" to the constructor.
201   * GenericDataSource takes care of the rest.   * GenericDataSource takes care of the rest.
202   *   *
203     * <pre>
204   * Pass an array to the constructor: (e.g.)   * Pass an array to the constructor: (e.g.)
205   *   *
206   *  1. doing rpc-calls....   *  1. doing rpc-calls....
207     *    <code>
208   *    $locator = array(   *    $locator = array(
209   *      type => 'rpc',   *      type => 'rpc',
210   *      metadata => array( Host => 'localhost', Port => '8765' ),   *      metadata => array( Host => 'localhost', Port => '8765' ),
211   *    );   *    );
212   *    $source = new GenericDataSource($locator);   *    $source = ne w GenericDataSource($locator);
213   *    $this->set_data_source( &$source );   *    $this->set_data_source( &$source );
214     *    </code>
215   *   *
216   *  2. [proposal] common datahandles....   *  2. [proposal] common datahandles....
217     *    <code>
218   *    $locator = array(   *    $locator = array(
219   *      type => 'mysql',   *      type => 'mysql',
220   *      dsn => 'known dsn markup',   *      dsn => 'known dsn markup',
221   *    );   *    );
222   *    $source = new GenericDataSource($locator);   *    $source = ne w GenericDataSource($locator);
223   *    $this->set_data_source( &$source );   *    $this->set_data_source( &$source );
224     *    </code>
225     * </pre>
226     * </p>
227     *
228   *   *
229     * @link http://www.netfrag.org/~joko/
230   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
231     *
232     * @link http://www.netfrag.org/~jonen/
233   * @author Sebastian Utz <seut@tunemedia.de>   * @author Sebastian Utz <seut@tunemedia.de>
234     *
235   * @copyright (c) 2003 - All Rights reserved.   * @copyright (c) 2003 - All Rights reserved.
  * @license GNU LGPL (GNU Lesser General Public License)  
236   *   *
237   * @author-url http://www.netfrag.org/~joko/   * @link http://www.gnu.org/licenses/lgpl.txt
238   * @author-url http://www.netfrag.org/~jonen/   * @license GNU LGPL (GNU Lesser General Public License)
  * @license-url http://www.gnu.org/licenses/lgpl.txt  
239   *   *
  * @package phpHtmlLib  
  * @module GenericDataSource  
240   *   *
241   */   * @package org.netfrag.glib
242     * @subpackage DataSource
243  /**   * @name DataSource::Generic
244   * Todo:   *
245     * @todo this:
246     * o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles
247     * o implement another Data::Driver::Proxy container
248     *
249     * <pre>
250     *              !!!!!!!!          THIS IS THE PROBLEM          !!!!!!!!
251     *    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!
252     *
253     *    THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy
254     *    inheritance trees at the same time, which is *not* possible at
255     *    declare-time. We *do* need some runtime-infrastructure to solve this!
256     *
257     *    TODO: move build- and check-locator stuff from ObjectList to this place!!!
258     *
259     *    ABOUT:
260     *      1. otherwhere: WebApp - scope:
261     *          x handles page vs. block vs. widget; dispatches MVC-View
262     *      2. here: DataSource - scope:
263     *          x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.))
264     *          o clean implementation using a DesignPattern::AdapterProxy
265     * </pre>
266   *   *
  *  o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles  
  *  o implement another Data::Driver::Proxy container  
267   *   *
268   */   */
   
   
 //              !!!!!!!!          THIS IS THE PROBLEM          !!!!!!!!  
 //    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!  
 //  
 //    THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy  
 //    inheritance trees at the same time, which is *not* possible at  
 //    declare-time. We *do* need some runtime-infrastructure to solve this!  
 //  
 //    TODO: move build- and check-locator stuff from ObjectList to this place!!!  
 //  
 //    ABOUT:  
 //      1. otherwhere: WebApp - scope:  
 //          x handles page vs. block vs. widget; dispatches MVC-View  
 //      2. here: DataSource - scope:  
 //          x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.))  
 //          o clean implementation using a DesignPattern::AdapterProxy  
 //  
   
 loadModule('DesignPattern::Proxy');  
 loadModule('DesignPattern::TransparentProxy');  
 loadModule('DesignPattern::RemoteProxy');  
   
 //class GenericDataSource extends MemoryDataSource {  
 //class GenericDataSource extends DesignPattern_Proxy {  
 //class GenericDataSource extends DesignPattern_RemoteProxy {  
 //class GenericDataSource extends DesignPattern_TransparentProxy {  
   
 //class GenericDataSource extends MemoryDataSource {  
 //loadModule("DataSource::Proxy::Memory");  
 //class GenericDataSource extends DataSource_Proxy_Memory {  
 //class DataSource_GenericDataSource extends DataSource_Proxy_Memory {  
 //class DataSource_GenericDataSource extends DesignPattern_Proxy {  
 //class DataSource_GenericDataSource extends DataSource_Proxy_Memory {  
   
 // now independent!!! new class-inheritance-tree possible now!  
 // solved by having an Adapter *and* a Proxy here!  
 //class GenericDataSource {  
   
 loadModule('DesignPattern::AdapterProxy');  
269  class DataSource_Generic extends DesignPattern_AdapterProxy {  class DataSource_Generic extends DesignPattern_AdapterProxy {
270    
271  //    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!  //    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!
# Line 212  class DataSource_Generic extends DesignP Line 288  class DataSource_Generic extends DesignP
288      * other presets.      * other presets.
289      *      *
290      * See '_buildLocator' which acts as a dispatcher      * See '_buildLocator' which acts as a dispatcher
291      * depending on $_options[datasource].      * depending on $_options[transport].
292      * (main dispatching level)      * (main dispatching level)
293      *      *
294      * The structure of a full blown locator looks like this:      * The structure of a full blown locator looks like this:
# Line 301  class DataSource_Generic extends DesignP Line 377  class DataSource_Generic extends DesignP
377          function DataSource_Generic( &$locator, $query ) {          function DataSource_Generic( &$locator, $query ) {
378    
379                  // copy parameter from query to locator                  // copy parameter from query to locator
380                  //$this->_locator->merge_to($this->_locator, array( datasource_type => $query[datasource] ), '_');                  //$this->_locator->merge_to($this->_locator, array( datasource_type => $query[transport] ), '_');
381                  //$this->_locator->_datasource_type = $query[datasource];                  //$this->_locator->_datasource_type = $query[transport];
382                  //$locator[_datasource_type] = $query[datasource];                  //$locator[_datasource_type] = $query[transport];
383                                    
384          /**
385           * <!-- Autodia -->
386           * can do: (this is metadata supplied for Autodia, don't delete!)
387           *  $this->_locator = new DataSource_Locator()
388           *
389           */
390    
391                  // build master locator                  // build master locator
392                  $this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) );                  $this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[transport] ) );
393                  //exit;                  //exit;
394                  //$this->_locator = php::mkComponent('DataSource::Locator');                  //$this->_locator = php::mkComponent('DataSource::Locator');
395                                    
# Line 343  class DataSource_Generic extends DesignP Line 426  class DataSource_Generic extends DesignP
426      // pre-flight: check locator metadata      // pre-flight: check locator metadata
427        //$locator->build();        //$locator->build();
428        if (!$this->_locator->check()) {        if (!$this->_locator->check()) {
429          user_error("locator-check failed.");          user_error("DataSource::Generic: locator-check failed." . "<br/>" . "Locator was: " . Dumper($this->_locator) );
430          exit;          //exit;
431           //return;           return;
432        }        }
433    
434  //exit;  //exit;
435    
436    
437        /**
438         * <!-- Autodia -->
439         * can do: (this is metadata supplied for Autodia, don't delete!)
440         *  $proxy = new DesignPattern_RemoteProxy()
441         *
442         */
443    
444    
445      // --- Proxy selector/dispatcher ...      // --- Proxy selector/dispatcher ...
446            
447      switch ($this->_locator->_datasource_type) {      switch ($this->_locator->_datasource_type) {
# Line 399  class DataSource_Generic extends DesignP Line 490  class DataSource_Generic extends DesignP
490            case 'phpHtmlLib':            case 'phpHtmlLib':
491              //$adapter_arguments = $args[title];              //$adapter_arguments = $args[title];
492    
493              $this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataListSource');              $this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource');
494                            
495              // in order to let the Adapter communicate with the Proxy,              // in order to let the Adapter communicate with the Proxy,
496              // instantiate a wrapper method in a third namespace via              // instantiate a wrapper method in a third namespace via
# Line 409  class DataSource_Generic extends DesignP Line 500  class DataSource_Generic extends DesignP
500    
501              break;              break;
502            default:            default:
503              user_error("DataSource::GenericDataSource: no Adapter could be selected!");              user_error("DataSource::Generic: no Adapter could be selected!");
504              break;              break;
505          }          }
506    
# Line 446  class DataSource_Generic extends DesignP Line 537  class DataSource_Generic extends DesignP
537        // $this->create_handler();        // $this->create_handler();
538    
539    
540          /**
541           * <!-- Autodia -->
542           * can do: (this is metadata supplied for Autodia, don't delete!)
543           *  $adapter = new DataSource_Adapter_phpHtmlLib_DataListSource()
544           *
545           */
546    
547        // V1:        // V1:
548        //$this->create_adapter($adapter_module, $this->function, $this->arguments);        //$this->create_adapter($adapter_module, $this->function, $this->arguments);
549    
# Line 597  class DataSource_Generic extends DesignP Line 695  class DataSource_Generic extends DesignP
695        // FIXME: abstract this some more (e.g. via a CommandMapper|Registry)        // FIXME: abstract this some more (e.g. via a CommandMapper|Registry)
696          switch ($this->_query[metatype]) {          switch ($this->_query[metatype]) {
697            case 'data':            case 'data':
698              //$command = 'queryData';              $command = 'queryData';
699              $command = 'getObjects';   // FIXME!!!              
700                //$command = 'getObjects';   // FIXME!!!
701              //$this->_locator->set_option('metadata.command', $command);              //$this->_locator->set_option('metadata.command', $command);
702    /*
703              $args = array();              $args = array();
704              switch ($this->_query[vartype]) {              switch ($this->_query[vartype]) {
705                case 'object':                case 'objects':
706                  if (!$this->_query[classname]) {                  if (!$this->_query[classname]) {
707                    $msg = "_query[vartype] == 'object' requires _query[classname]";                    $msg = "_query[vartype] == 'objects' requires _query[classname]";
708                    user_error("GenericDataSource::query_data() - failed: " . $msg);                    user_error("DataSource::Generic: query_data() - failed: " . $msg);
709                  }                  }
710                  array_push($args, $this->_query[classname]);                  array_push($args, $this->_query[classname]);
711                  break;                  break;
712              }              }
713              break;   */
714                $query_args = array();
715                 switch ($this->_query[abstract_type]) {
716                  case 'list':
717                    if (!$this->_query[classname]) {
718                      $msg = "_query[vartype] == 'objects' requires _query[classname]";
719                      user_error("DataSource::Generic: query_data() - failed: " . $msg);
720                    }
721                    //array_push($query_args, $this->_query[classname]);
722                    $query_args[classname] = $this->_query[classname];
723                    break;
724                  case 'item':
725                    if (!$this->_query[classname]) {
726                      $msg = "_query[vartype] == 'objects' requires _query[classname]";
727                      user_error("DataSource::Generic: query_data() - failed: " . $msg);
728                    }
729                    $query_args[guid] = $this->_query[ident];
730                    $query_args[classname] = $this->_query[classname];
731                    break;              
732                }
733                if($this->_query[action] == 'write') {
734                 $query_args[action] = $this->_query[action];
735                 $query_args[data] = $this->_query[data];
736                }
737                $args = array(
738                              'data_type' => $this->_query[abstract_type],
739                              'query_args' => $query_args
740                              );
741               break;
742    
743              // querySchema
744            case 'schema':            case 'schema':
745                //print "Testing schema:" . "<br>";
746              $command = 'querySchema';              $command = 'querySchema';
747                $args = array( $this->_query[filter] );
748                break;
749                
750              // remoteMethod
751              case 'method':
752                $command = $this->_query[method];
753                $args = $this->_query[args];
754              break;              break;
755    
756          }          }
757                
758          
759            // FIXME: bad behaviour?
760            if (!is_array($args)) { $args = array( $args ); }
761                    
762          /*          /*
763          $this->_query[rpc_command] = $command;          $this->_query[rpc_command] = $command;
# Line 648  class DataSource_Generic extends DesignP Line 790  class DataSource_Generic extends DesignP
790                
791    }    }
792    
793    
794    
795          function &fetch_result() {          function &fetch_result() {
796                
797        $this->datasource_handler_buildoptions();        $this->datasource_handler_buildoptions();
798    
799        $method = $this->_locator->_call[_method];        $call = $this->_locator->get_call();
800        $args = $this->_locator->_call[_arguments];        //print Dumper($call);
801          
802        // pre-flight checks        // pre-flight checks
803          if (!$method) {          if (!$call[method]) {
804            $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.";
805                          user_error("GenericDataSource::query_data() - failed: " . $msg);                          user_error("DataSource::Generic: query_data() - failed: " . $msg);
806            return;            return;
807          }          }
808    
# Line 666  class DataSource_Generic extends DesignP Line 810  class DataSource_Generic extends DesignP
810    
811        // do remote call here and get result        // do remote call here and get result
812        // FIXME: handle synchronous/asynchronous mode here!!!        // FIXME: handle synchronous/asynchronous mode here!!!
813          $this->datasource_handler_call($method, $args);          $this->datasource_handler_call($call[method], $call[args]);
814                    
815                    
816          // TODO: ... = $this->poll_handler_result  and  $this->get_handler_result          // TODO: ... = $this->poll_handler_result  and  $this->get_handler_result
# Line 677  class DataSource_Generic extends DesignP Line 821  class DataSource_Generic extends DesignP
821          $this->_result_count = sizeof($this->_result);          $this->_result_count = sizeof($this->_result);
822    
823        // trace        // trace
824          if ($this->_debug[notice]) {          //if (constants::get('VERBOSE') && $this->_debug[notice]) {
825            if (constants::get('VERBOSE') or constants::get('ERRORS_ONLY')) {
826            //print "_result = " . Dumper($this->_result);            //print "_result = " . Dumper($this->_result);
827            print "DataSource::Generic->_result_count = " . $this->_result_count . "<br/>";            //print "<div><b><font color=\"darkgreen\">Debug:</font></b> DataSource::Generic->_result_count = <b>" . $this->_result_count . "</b></div>";
828              $this->draw_status_box();
829          }          }
830            
831          return $this->_result;          return $this->_result;
832    
833          }          }
834    
835      function draw_status_box() {
836    
837        static $boxcount;
838        
839        $boxcount++;
840    
841        $box = container();
842    
843        // box style
844        $style = container(
845          html_style("text/css", '.boxlabel_darkgreen { color: darkgreen; font-weight:bold; }'),
846          html_style("text/css", '.box_dsg { background: #20ab39; color: white; border: 2px black groove; width:640px; padding:10px; margin:40px; }')
847        );
848        $box->add( $style );
849        
850        // box content
851        $statusbox = html_div('box_dsg');
852        $statusbox->add( html_b("DataSource::Generic"), html_br() );
853        $locatorbox = html_div('box_dsg');
854        $locatorbox->set_id("locatorbox_$boxcount");
855        $locatorbox->add( Dumper($this->_locator) );
856        
857        // FIXME: ie/mozilla?
858        //$locatorbox->set_style('display:none;');
859        //$locatorbox->set_style('visibility:hidden;');
860        // already duplicate inside Tracer!!!
861        $locatorbox->set_style('visibility:hidden; position:absolute; z-index:1; margin-top:30px; padding:5px;');
862        
863        $statusbox->add( html_span('boxlabel_darkgreen', "Locator:"), link::js_function( 'toggleVisibility', array("locatorbox_$boxcount"), '[show]'), $locatorbox, html_br() );
864        $call = $this->_locator->get_call();
865        $statusbox->add( html_span('boxlabel_darkgreen', "Method:"), $call[method], html_br() );
866        if (sizeof($call[args])) {
867          $statusbox->add( html_span('boxlabel_darkgreen', "Arguments:"), Dumper($call[args]), html_br() );
868        }
869        $statusbox->add( html_span('boxlabel_darkgreen', "Count:"), $this->get_result_count(), html_br() );
870        $box->add( $statusbox );
871    
872        //print $box->render();
873        trace( $box );
874    
875      }
876    
877    
878    function &query_data() {    function &query_data() {
879      //print "query!<br/>";      //print "query!<br/>";
# Line 701  class DataSource_Generic extends DesignP Line 889  class DataSource_Generic extends DesignP
889    function &get_result() {    function &get_result() {
890      return $this->_result;      return $this->_result;
891    }    }
892      
893      function get_result_count() {
894        return $this->_result_count;
895      }
896                    
897  }  }
898    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.16

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