| 15 |
* $Id$ |
* $Id$ |
| 16 |
* |
* |
| 17 |
* $Log$ |
* $Log$ |
| 18 |
|
* Revision 1.12 2003/03/29 08:00:48 joko |
| 19 |
|
* modified ErrorBoxing |
| 20 |
|
* |
| 21 |
|
* Revision 1.11 2003/03/28 06:45:26 joko |
| 22 |
|
* VERBOSE mode |
| 23 |
|
* |
| 24 |
* Revision 1.10 2003/03/28 03:01:02 joko |
* Revision 1.10 2003/03/28 03:01:02 joko |
| 25 |
* more fancy debugging-output |
* more fancy debugging-output |
| 26 |
* |
* |
| 759 |
|
|
| 760 |
} |
} |
| 761 |
|
|
| 762 |
|
|
| 763 |
|
|
| 764 |
function &fetch_result() { |
function &fetch_result() { |
| 765 |
|
|
| 766 |
$this->datasource_handler_buildoptions(); |
$this->datasource_handler_buildoptions(); |
| 767 |
|
|
| 768 |
$method = $this->_locator->_call[_method]; |
$call = $this->_locator->get_call(); |
| 769 |
$args = $this->_locator->_call[_arguments]; |
//print Dumper($call); |
| 770 |
|
|
| 771 |
// pre-flight checks |
// pre-flight checks |
| 772 |
if (!$method) { |
if (!$call[method]) { |
| 773 |
$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."; |
| 774 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
| 775 |
return; |
return; |
| 776 |
} |
} |
| 779 |
|
|
| 780 |
// do remote call here and get result |
// do remote call here and get result |
| 781 |
// FIXME: handle synchronous/asynchronous mode here!!! |
// FIXME: handle synchronous/asynchronous mode here!!! |
| 782 |
$this->datasource_handler_call($method, $args); |
$this->datasource_handler_call($call[method], $call[args]); |
| 783 |
|
|
| 784 |
|
|
| 785 |
// TODO: ... = $this->poll_handler_result and $this->get_handler_result |
// TODO: ... = $this->poll_handler_result and $this->get_handler_result |
| 790 |
$this->_result_count = sizeof($this->_result); |
$this->_result_count = sizeof($this->_result); |
| 791 |
|
|
| 792 |
// trace |
// trace |
| 793 |
if ($this->_debug[notice]) { |
//if (constants::get('VERBOSE') && $this->_debug[notice]) { |
| 794 |
|
if (constants::get('VERBOSE') or constants::get('ERRORS_ONLY')) { |
| 795 |
//print "_result = " . Dumper($this->_result); |
//print "_result = " . Dumper($this->_result); |
| 796 |
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>"; |
| 797 |
|
$this->draw_status_box(); |
| 798 |
} |
} |
| 799 |
|
|
| 800 |
return $this->_result; |
return $this->_result; |
| 801 |
|
|
| 802 |
} |
} |
| 803 |
|
|
| 804 |
|
function draw_status_box() { |
| 805 |
|
|
| 806 |
|
static $boxcount; |
| 807 |
|
|
| 808 |
|
$boxcount++; |
| 809 |
|
|
| 810 |
|
$box = container(); |
| 811 |
|
|
| 812 |
|
// box client code (javascript) |
| 813 |
|
$code_js = " |
| 814 |
|
<script language=\"javascript\"> |
| 815 |
|
function toggle_vis(id) { |
| 816 |
|
elem = eval('document.all.' + id); |
| 817 |
|
status = elem.style.getAttribute('display'); |
| 818 |
|
if (status == 'none') { |
| 819 |
|
elem.style.setAttribute('display', 'block'); |
| 820 |
|
} else { |
| 821 |
|
elem.style.setAttribute('display', 'none'); |
| 822 |
|
} |
| 823 |
|
} |
| 824 |
|
</script> |
| 825 |
|
"; |
| 826 |
|
//$script = html_script($code_js); |
| 827 |
|
//print $script->render(); |
| 828 |
|
$box->add( $code_js ); |
| 829 |
|
|
| 830 |
|
// box style |
| 831 |
|
$style = container( |
| 832 |
|
html_style("text/css", '.boxlabel_darkgreen { color: darkgreen; font-weight:bold; }'), |
| 833 |
|
html_style("text/css", '.box_dsg { background: #20ab39; color: white; border: 2px black groove; width:640px; padding:10px; margin:40px; }') |
| 834 |
|
); |
| 835 |
|
$box->add( $style ); |
| 836 |
|
|
| 837 |
|
// box content |
| 838 |
|
$statusbox = html_div('box_dsg'); |
| 839 |
|
$statusbox->add( html_b("DataSource::Generic"), html_br() ); |
| 840 |
|
$locatorbox = html_div('box_dsg'); |
| 841 |
|
$locatorbox->set_id("locatorbox_$boxcount"); |
| 842 |
|
$locatorbox->add( Dumper($this->_locator) ); |
| 843 |
|
//$locatorbox->set_style('visibility:false;'); |
| 844 |
|
$locatorbox->set_style('display:none;'); |
| 845 |
|
|
| 846 |
|
$statusbox->add( html_span('boxlabel_darkgreen', "Locator:"), html_a("javascript:toggle_vis('locatorbox_$boxcount');", '[show]'), $locatorbox, html_br() ); |
| 847 |
|
$call = $this->_locator->get_call(); |
| 848 |
|
$statusbox->add( html_span('boxlabel_darkgreen', "Method:"), $call[method], html_br() ); |
| 849 |
|
if (sizeof($call[args])) { |
| 850 |
|
$statusbox->add( html_span('boxlabel_darkgreen', "Arguments:"), Dumper($call[args]), html_br() ); |
| 851 |
|
} |
| 852 |
|
$statusbox->add( html_span('boxlabel_darkgreen', "Count:"), $this->get_result_count(), html_br() ); |
| 853 |
|
$box->add( $statusbox ); |
| 854 |
|
|
| 855 |
|
print $box->render(); |
| 856 |
|
|
| 857 |
|
} |
| 858 |
|
|
| 859 |
|
|
| 860 |
function &query_data() { |
function &query_data() { |
| 861 |
//print "query!<br/>"; |
//print "query!<br/>"; |
| 871 |
function &get_result() { |
function &get_result() { |
| 872 |
return $this->_result; |
return $this->_result; |
| 873 |
} |
} |
| 874 |
|
|
| 875 |
|
function get_result_count() { |
| 876 |
|
return $this->_result_count; |
| 877 |
|
} |
| 878 |
|
|
| 879 |
} |
} |
| 880 |
|
|