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.11 2003/03/28 06:45:26 joko |
19 |
|
* VERBOSE mode |
20 |
|
* |
21 |
|
* Revision 1.10 2003/03/28 03:01:02 joko |
22 |
|
* more fancy debugging-output |
23 |
|
* |
24 |
|
* Revision 1.9 2003/03/27 16:24:26 jonen |
25 |
|
* + mugled namespace |
26 |
|
* + added enhanced 'queryData' |
27 |
|
* |
28 |
|
* Revision 1.8 2003/03/20 07:22:14 jonen |
29 |
|
* + modified case 'object' to 'objects' |
30 |
|
* (cause its loads all *objects* of a given classname) |
31 |
|
* |
32 |
|
* Revision 1.7 2003/03/11 01:43:00 joko |
33 |
|
* + fixed metadata for phpDocumentor |
34 |
|
* |
35 |
|
* Revision 1.6 2003/03/11 01:22:25 joko |
36 |
|
* + fixed metadata for phpDocumentor |
37 |
|
* |
38 |
|
* Revision 1.5 2003/03/11 00:12:49 joko |
39 |
|
* + fixed metadata for phpDocumentor |
40 |
|
* |
41 |
|
* Revision 1.4 2003/03/10 23:25:03 joko |
42 |
|
* + fixed metadata for phpDocumentor |
43 |
|
* |
44 |
|
* Revision 1.3 2003/03/09 15:50:36 joko |
45 |
|
* + additional metadata for Autodia |
46 |
|
* |
47 |
|
* Revision 1.2 2003/03/05 17:28:43 joko |
48 |
|
* updated docu (phpDocumentor testing....) |
49 |
|
* |
50 |
* Revision 1.1 2003/03/05 12:04:00 joko |
* Revision 1.1 2003/03/05 12:04:00 joko |
51 |
* + initial commit, from GenericDataSource |
* + initial commit, from GenericDataSource |
52 |
* |
* |
73 |
* |
* |
74 |
* Revision 1.1 2003/03/01 03:10:40 joko |
* Revision 1.1 2003/03/01 03:10:40 joko |
75 |
* + initial commit |
* + initial commit |
76 |
* |
* </pre> |
77 |
* |
* |
78 |
*/ |
*/ |
79 |
|
|
101 |
// require_once("PEAR.php"); // FIXME: what about PEAR::XML::RPC? |
// require_once("PEAR.php"); // FIXME: what about PEAR::XML::RPC? |
102 |
// require_once("DB.php"); |
// require_once("DB.php"); |
103 |
|
|
104 |
|
|
105 |
|
loadModule('DesignPattern::Proxy'); |
106 |
|
loadModule('DesignPattern::TransparentProxy'); |
107 |
|
loadModule('DesignPattern::RemoteProxy'); |
108 |
|
|
109 |
|
//class GenericDataSource extends MemoryDataSource { |
110 |
|
//class GenericDataSource extends DesignPattern_Proxy { |
111 |
|
//class GenericDataSource extends DesignPattern_RemoteProxy { |
112 |
|
//class GenericDataSource extends DesignPattern_TransparentProxy { |
113 |
|
|
114 |
|
//class GenericDataSource extends MemoryDataSource { |
115 |
|
//loadModule("DataSource::Proxy::Memory"); |
116 |
|
//class GenericDataSource extends DataSource_Proxy_Memory { |
117 |
|
//class DataSource_GenericDataSource extends DataSource_Proxy_Memory { |
118 |
|
//class DataSource_GenericDataSource extends DesignPattern_Proxy { |
119 |
|
//class DataSource_GenericDataSource extends DataSource_Proxy_Memory { |
120 |
|
|
121 |
|
// now independent!!! new class-inheritance-tree possible now! |
122 |
|
// solved by having an Adapter *and* a Proxy here! |
123 |
|
//class GenericDataSource { |
124 |
|
|
125 |
|
loadModule('DesignPattern::AdapterProxy'); |
126 |
|
|
127 |
|
|
128 |
|
|
129 |
/** |
/** |
130 |
* This GenericDataSource child class is *completely* independent |
* This GenericDataSource child class is *completely* independent |
131 |
* of a specific storage implementation and intended to be a wrapper |
* of a specific storage implementation and intended to be a wrapper |
132 |
* class on the way from phpHtmlLib to Xyz. |
* class on the way from phpHtmlLib to Xyz. <br> |
133 |
* ("Yyz" gets represented by Data::Storage by now.....) |
* ("Yyz" gets represented by Data::Storage by now.....) |
134 |
* |
* |
135 |
* GenericDataSource interacts with an intermediate "proxy" object |
* GenericDataSource interacts with an intermediate "proxy" object |
136 |
* (e.g. Data::Driver::Proxy) when doing queries. |
* (e.g. Data::Driver::Proxy) when doing queries. <br> |
137 |
|
* <pre> |
138 |
* Don't mix this up with a persistent database handle which gets |
* Don't mix this up with a persistent database handle which gets |
139 |
* reused each and every time for different queries. |
* reused each and every time for different queries. |
140 |
* Here *is* a new instance of Data::Driver::Proxy for *each* query. |
* Here *is* a new instance of Data::Driver::Proxy for *each* query. |
141 |
|
* </pre> |
142 |
* |
* |
143 |
* But the point is: Caching! The actual *data* isn't read redundant! |
* But the point is: Caching! The actual *data* isn't read redundant! |
144 |
* |
* |
145 |
|
* <pre> |
146 |
|
* --- snipped into here from above --- |
147 |
|
* that may use arbitrary code modules as database handlers. |
148 |
|
* It's aims are to get together: |
149 |
|
* o phpHtmlLibs "source-handlers" |
150 |
|
* o PEAR's database handlers |
151 |
|
* o custom ones (e.g. Data::Driver::Proxy object, which talks to a remote rpc server) |
152 |
|
* --- snipped into here from above --- |
153 |
|
* </pre> |
154 |
* |
* |
155 |
|
* <p> |
156 |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
157 |
* |
* |
158 |
* Data::Driver::Proxy instantiates "handlers" below itself |
* Data::Driver::Proxy instantiates "handlers" below itself |
162 |
* One worker already implemented is Data::Driver::RPC::Remote, which |
* One worker already implemented is Data::Driver::RPC::Remote, which |
163 |
* 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. |
164 |
* |
* |
165 |
|
* <pre> |
166 |
* --- refactored here, but: redundant somehow --- |
* --- refactored here, but: redundant somehow --- |
167 |
* Data::Driver::Proxy uses a PEAR XML::RPC object to actually |
* Data::Driver::Proxy uses a PEAR XML::RPC object to actually |
168 |
* talk HTTP and serialize data chunks to and from XML, |
* talk HTTP and serialize data chunks to and from XML, |
170 |
* It "proxies" arbitrary data chunks a) inside a native php4 session, |
* It "proxies" arbitrary data chunks a) inside a native php4 session, |
171 |
* 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. |
172 |
* --- refactored here, but: redundant somehow --- |
* --- refactored here, but: redundant somehow --- |
173 |
|
* </pre> |
174 |
* |
* |
175 |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
176 |
|
* </p> |
177 |
* |
* |
178 |
* |
* |
179 |
* How to use? |
* <p> |
180 |
|
* <b>How to use?</b> |
181 |
* |
* |
182 |
* Pass an array holding "locator metadata" to the constructor. |
* Pass an array holding "locator metadata" to the constructor. |
183 |
* GenericDataSource takes care of the rest. |
* GenericDataSource takes care of the rest. |
184 |
* |
* |
185 |
|
* <pre> |
186 |
* Pass an array to the constructor: (e.g.) |
* Pass an array to the constructor: (e.g.) |
187 |
* |
* |
188 |
* 1. doing rpc-calls.... |
* 1. doing rpc-calls.... |
189 |
|
* <code> |
190 |
* $locator = array( |
* $locator = array( |
191 |
* type => 'rpc', |
* type => 'rpc', |
192 |
* metadata => array( Host => 'localhost', Port => '8765' ), |
* metadata => array( Host => 'localhost', Port => '8765' ), |
193 |
* ); |
* ); |
194 |
* $source = new GenericDataSource($locator); |
* $source = ne w GenericDataSource($locator); |
195 |
* $this->set_data_source( &$source ); |
* $this->set_data_source( &$source ); |
196 |
|
* </code> |
197 |
* |
* |
198 |
* 2. [proposal] common datahandles.... |
* 2. [proposal] common datahandles.... |
199 |
|
* <code> |
200 |
* $locator = array( |
* $locator = array( |
201 |
* type => 'mysql', |
* type => 'mysql', |
202 |
* dsn => 'known dsn markup', |
* dsn => 'known dsn markup', |
203 |
* ); |
* ); |
204 |
* $source = new GenericDataSource($locator); |
* $source = ne w GenericDataSource($locator); |
205 |
* $this->set_data_source( &$source ); |
* $this->set_data_source( &$source ); |
206 |
|
* </code> |
207 |
|
* </pre> |
208 |
|
* </p> |
209 |
* |
* |
210 |
|
* |
211 |
|
* @link http://www.netfrag.org/~joko/ |
212 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
213 |
|
* |
214 |
|
* @link http://www.netfrag.org/~jonen/ |
215 |
* @author Sebastian Utz <seut@tunemedia.de> |
* @author Sebastian Utz <seut@tunemedia.de> |
216 |
|
* |
217 |
* @copyright (c) 2003 - All Rights reserved. |
* @copyright (c) 2003 - All Rights reserved. |
218 |
|
* |
219 |
|
* @link http://www.gnu.org/licenses/lgpl.txt |
220 |
* @license GNU LGPL (GNU Lesser General Public License) |
* @license GNU LGPL (GNU Lesser General Public License) |
221 |
* |
* |
|
* @author-url http://www.netfrag.org/~joko/ |
|
|
* @author-url http://www.netfrag.org/~jonen/ |
|
|
* @license-url http://www.gnu.org/licenses/lgpl.txt |
|
222 |
* |
* |
223 |
* @package phpHtmlLib |
* @package org.netfrag.glib |
224 |
* @module GenericDataSource |
* @subpackage DataSource |
225 |
|
* @name DataSource::Generic |
226 |
|
* |
227 |
|
* @todo this: |
228 |
|
* o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles |
229 |
|
* o implement another Data::Driver::Proxy container |
230 |
|
* |
231 |
|
* <pre> |
232 |
|
* !!!!!!!! THIS IS THE PROBLEM !!!!!!!! |
233 |
|
* !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
234 |
|
* |
235 |
|
* THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy |
236 |
|
* inheritance trees at the same time, which is *not* possible at |
237 |
|
* declare-time. We *do* need some runtime-infrastructure to solve this! |
238 |
|
* |
239 |
|
* TODO: move build- and check-locator stuff from ObjectList to this place!!! |
240 |
|
* |
241 |
|
* ABOUT: |
242 |
|
* 1. otherwhere: WebApp - scope: |
243 |
|
* x handles page vs. block vs. widget; dispatches MVC-View |
244 |
|
* 2. here: DataSource - scope: |
245 |
|
* x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.)) |
246 |
|
* o clean implementation using a DesignPattern::AdapterProxy |
247 |
|
* </pre> |
248 |
* |
* |
|
*/ |
|
|
|
|
|
/** |
|
|
* Todo: |
|
|
* |
|
|
* o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles |
|
|
* o implement another Data::Driver::Proxy container |
|
249 |
* |
* |
250 |
*/ |
*/ |
|
|
|
|
|
|
|
// !!!!!!!! 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'); |
|
251 |
class DataSource_Generic extends DesignPattern_AdapterProxy { |
class DataSource_Generic extends DesignPattern_AdapterProxy { |
252 |
|
|
253 |
// !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
// !!!!!!!! here is it where we have to break inheritance again !!!!!!!! |
363 |
//$this->_locator->_datasource_type = $query[datasource]; |
//$this->_locator->_datasource_type = $query[datasource]; |
364 |
//$locator[_datasource_type] = $query[datasource]; |
//$locator[_datasource_type] = $query[datasource]; |
365 |
|
|
366 |
|
/** |
367 |
|
* <!-- Autodia --> |
368 |
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
369 |
|
* $this->_locator = new DataSource_Locator() |
370 |
|
* |
371 |
|
*/ |
372 |
|
|
373 |
// build master locator |
// build master locator |
374 |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) ); |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) ); |
375 |
//exit; |
//exit; |
416 |
//exit; |
//exit; |
417 |
|
|
418 |
|
|
419 |
|
/** |
420 |
|
* <!-- Autodia --> |
421 |
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
422 |
|
* $proxy = new DesignPattern_RemoteProxy() |
423 |
|
* |
424 |
|
*/ |
425 |
|
|
426 |
|
|
427 |
// --- Proxy selector/dispatcher ... |
// --- Proxy selector/dispatcher ... |
428 |
|
|
429 |
switch ($this->_locator->_datasource_type) { |
switch ($this->_locator->_datasource_type) { |
472 |
case 'phpHtmlLib': |
case 'phpHtmlLib': |
473 |
//$adapter_arguments = $args[title]; |
//$adapter_arguments = $args[title]; |
474 |
|
|
475 |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataListSource'); |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); |
476 |
|
|
477 |
// in order to let the Adapter communicate with the Proxy, |
// in order to let the Adapter communicate with the Proxy, |
478 |
// instantiate a wrapper method in a third namespace via |
// instantiate a wrapper method in a third namespace via |
519 |
// $this->create_handler(); |
// $this->create_handler(); |
520 |
|
|
521 |
|
|
522 |
|
/** |
523 |
|
* <!-- Autodia --> |
524 |
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
525 |
|
* $adapter = new DataSource_Adapter_phpHtmlLib_DataListSource() |
526 |
|
* |
527 |
|
*/ |
528 |
|
|
529 |
// V1: |
// V1: |
530 |
//$this->create_adapter($adapter_module, $this->function, $this->arguments); |
//$this->create_adapter($adapter_module, $this->function, $this->arguments); |
531 |
|
|
677 |
// FIXME: abstract this some more (e.g. via a CommandMapper|Registry) |
// FIXME: abstract this some more (e.g. via a CommandMapper|Registry) |
678 |
switch ($this->_query[metatype]) { |
switch ($this->_query[metatype]) { |
679 |
case 'data': |
case 'data': |
680 |
//$command = 'queryData'; |
$command = 'queryData'; |
681 |
$command = 'getObjects'; // FIXME!!! |
//$command = 'getObjects'; // FIXME!!! |
682 |
//$this->_locator->set_option('metadata.command', $command); |
//$this->_locator->set_option('metadata.command', $command); |
683 |
|
/* |
684 |
$args = array(); |
$args = array(); |
685 |
switch ($this->_query[vartype]) { |
switch ($this->_query[vartype]) { |
686 |
case 'object': |
case 'objects': |
687 |
if (!$this->_query[classname]) { |
if (!$this->_query[classname]) { |
688 |
$msg = "_query[vartype] == 'object' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
689 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
690 |
} |
} |
691 |
array_push($args, $this->_query[classname]); |
array_push($args, $this->_query[classname]); |
692 |
break; |
break; |
693 |
} |
} |
694 |
break; |
*/ |
695 |
|
$query_args = array(); |
696 |
|
switch ($this->_query[abstract_type]) { |
697 |
|
case 'list': |
698 |
|
if (!$this->_query[classname]) { |
699 |
|
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
700 |
|
user_error("GenericDataSource::query_data() - failed: " . $msg); |
701 |
|
} |
702 |
|
//array_push($query_args, $this->_query[classname]); |
703 |
|
$query_args[classname] = $this->_query[classname]; |
704 |
|
break; |
705 |
|
case 'item': |
706 |
|
if (!$this->_query[classname]) { |
707 |
|
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
708 |
|
user_error("GenericDataSource::query_data() - failed: " . $msg); |
709 |
|
} |
710 |
|
$query_args[guid] = $this->_query[ident]; |
711 |
|
$query_args[classname] = $this->_query[classname]; |
712 |
|
break; |
713 |
|
} |
714 |
|
$args = array( |
715 |
|
'data_type' => $this->_query[abstract_type], |
716 |
|
'query_args' => $query_args |
717 |
|
); |
718 |
|
break; |
719 |
|
|
720 |
|
// querySchema |
721 |
case 'schema': |
case 'schema': |
722 |
|
//print "Testing schema:" . "<br>"; |
723 |
$command = 'querySchema'; |
$command = 'querySchema'; |
724 |
break; |
break; |
725 |
} |
} |
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 |
} |
} |
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 |
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 "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>"; |
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/>"; |
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 |
|
|