| 9 |
*/ |
*/ |
| 10 |
|
|
| 11 |
/** |
/** |
| 12 |
* <b>Cvs-Log:</b> |
* Cvs-Log: |
| 13 |
* |
* |
|
* <pre> |
|
| 14 |
* $Id$ |
* $Id$ |
| 15 |
* |
* |
| 16 |
* $Log$ |
* $Log$ |
| 17 |
|
* Revision 1.23 2003/07/14 10:02:32 jonen |
| 18 |
|
* removed debug dumper |
| 19 |
|
* |
| 20 |
|
* Revision 1.22 2003/06/06 04:25:45 joko |
| 21 |
|
* fix: query args get encapsulated once more |
| 22 |
|
* |
| 23 |
|
* Revision 1.21 2003/05/10 18:14:50 jonen |
| 24 |
|
* + implements 'create' of item (query mapping part) |
| 25 |
|
* |
| 26 |
|
* Revision 1.20 2003/04/19 16:07:15 jonen |
| 27 |
|
* + added '_query[list_meta]' at 'queryData' needed for meta query args |
| 28 |
|
* (e.g. at UserManagment) |
| 29 |
|
* |
| 30 |
|
* Revision 1.19 2003/04/18 15:40:51 joko |
| 31 |
|
* NEW: tree data handling |
| 32 |
|
* introduced new adapter: DataSource::Adapter::Free |
| 33 |
|
* enhanced datasource_handler_buildoptions: now handles a) case 'tree' b) _query[filter] |
| 34 |
|
* |
| 35 |
|
* Revision 1.18 2003/04/11 00:55:49 joko |
| 36 |
|
* updated 'datasource_handler_buildoptions': action dispatcher now aware of 'delete' |
| 37 |
|
* |
| 38 |
|
* Revision 1.17 2003/04/09 02:07:33 joko |
| 39 |
|
* CHANGE: renamed key 'classname' through 'nodename' |
| 40 |
|
* |
| 41 |
* Revision 1.16 2003/04/08 17:55:20 joko |
* Revision 1.16 2003/04/08 17:55:20 joko |
| 42 |
* CHANGE: renamed property 'datasource' to 'transport' |
* CHANGE: renamed property 'datasource' to 'transport' |
| 43 |
* NEW: new case 'method' in 'function datasource_handler_buildoptions' |
* NEW: new case 'method' in 'function datasource_handler_buildoptions' |
| 114 |
* |
* |
| 115 |
* Revision 1.1 2003/03/01 03:10:40 joko |
* Revision 1.1 2003/03/01 03:10:40 joko |
| 116 |
* + initial commit |
* + initial commit |
|
* </pre> |
|
| 117 |
* |
* |
| 118 |
*/ |
*/ |
| 119 |
|
|
| 509 |
// ... resolves this._modules.adapter._id to this._modules.adapter._module |
// ... resolves this._modules.adapter._id to this._modules.adapter._module |
| 510 |
|
|
| 511 |
switch ($locator->_adapter_type) { |
switch ($locator->_adapter_type) { |
| 512 |
|
|
| 513 |
case 'phpHtmlLib': |
case 'phpHtmlLib': |
| 514 |
//$adapter_arguments = $args[title]; |
//$adapter_arguments = $args[title]; |
|
|
|
| 515 |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); |
| 516 |
|
|
| 517 |
// in order to let the Adapter communicate with the Proxy, |
// in order to let the Adapter communicate with the Proxy, |
| 518 |
// instantiate a wrapper method in a third namespace via |
// instantiate a wrapper method in a third namespace via |
| 519 |
// Exporter::export_symbol(from, to) |
// Exporter::export_symbol(from, to) |
| 520 |
$this->set_adapter_options($this); |
$this->set_adapter_options($this); |
| 521 |
|
break; |
| 522 |
|
|
| 523 |
|
// NEW [2003-04-17]: Freedom for the adapter! |
| 524 |
|
// phpHtmlLib didn't have a tree widget, but PEAR does. |
| 525 |
|
// So: Free us from the phpHtmlLib-adapter in this case. |
| 526 |
|
case 'free': |
| 527 |
|
$this->set_adapter_module('DataSource::Adapter::Free'); |
| 528 |
|
$this->set_adapter_options($this); |
| 529 |
break; |
break; |
| 530 |
|
|
| 531 |
default: |
default: |
| 532 |
user_error("DataSource::Generic: no Adapter could be selected!"); |
user_error("DataSource::Generic: no Adapter could be selected: \$locator->_adapter_type='$locator->_adapter_type'"); |
| 533 |
break; |
break; |
| 534 |
} |
} |
| 535 |
|
|
| 741 |
} |
} |
| 742 |
*/ |
*/ |
| 743 |
$query_args = array(); |
$query_args = array(); |
| 744 |
|
|
| 745 |
|
$msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: "; |
| 746 |
switch ($this->_query[abstract_type]) { |
switch ($this->_query[abstract_type]) { |
| 747 |
|
case 'item': |
| 748 |
|
if (!$this->_query[nodename] && $this->_query[action] != 'create') { |
| 749 |
|
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
| 750 |
|
user_error($msg_prefix . $msg); |
| 751 |
|
} elseif($this->_query[action] == 'create' && $this->_query[parent]) { |
| 752 |
|
if($this->_query[nodename]) { $query_args[node_class] = $this->_query[nodename]; } |
| 753 |
|
if($this->_query['hash_key']) { $query_args['hash_key'] = $this->_query['hash_key']; } |
| 754 |
|
$query_args[nodename] = $this->_query[ident]; |
| 755 |
|
$query_args[parent][guid] = $this->_query[parent][guid]; |
| 756 |
|
$query_args[parent][nodename] = $this->_query[parent][nodename]; |
| 757 |
|
} else { |
| 758 |
|
$query_args[guid] = $this->_query[ident]; |
| 759 |
|
$query_args[nodename] = $this->_query[nodename]; |
| 760 |
|
} |
| 761 |
|
break; |
| 762 |
case 'list': |
case 'list': |
| 763 |
if (!$this->_query[classname]) { |
if (!$this->_query[nodename]) { |
| 764 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
| 765 |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
user_error($msg_prefix . $msg); |
| 766 |
} |
} |
| 767 |
//array_push($query_args, $this->_query[classname]); |
//array_push($query_args, $this->_query[nodename]); |
| 768 |
$query_args[classname] = $this->_query[classname]; |
$query_args[nodename] = $this->_query[nodename]; |
| 769 |
|
if($this->_query[list_meta]) { $query_args[list_meta] = $this->_query[list_meta]; } |
| 770 |
break; |
break; |
| 771 |
case 'item': |
case 'tree': |
| 772 |
if (!$this->_query[classname]) { |
/* |
| 773 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
if (!$this->_query[nodename]) { |
| 774 |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
| 775 |
|
user_error($msg_prefix . $msg); |
| 776 |
} |
} |
| 777 |
|
*/ |
| 778 |
$query_args[guid] = $this->_query[ident]; |
$query_args[guid] = $this->_query[ident]; |
| 779 |
$query_args[classname] = $this->_query[classname]; |
//$query_args[nodename] = $this->_query[nodename]; |
| 780 |
break; |
break; |
| 781 |
|
default: |
| 782 |
|
$msg = "\$this->_query[abstract_type] could not be dispatched as 'item', 'list' or 'tree'."; |
| 783 |
|
user_error($msg_prefix . $msg); |
| 784 |
|
break; |
| 785 |
} |
} |
| 786 |
if($this->_query[action] == 'write') { |
|
| 787 |
|
// filter??? |
| 788 |
|
//print "Filter: " . Dumper($this->_query[filter]) . "<br>"; |
| 789 |
|
if ($this->_query[filter]) { |
| 790 |
|
$query_args[filter] = $this->_query[filter]; |
| 791 |
|
} |
| 792 |
|
|
| 793 |
|
// dispatch action |
| 794 |
|
//print "Action: " . $this->_query[action] . "<br>"; |
| 795 |
|
if ($this->_query[action] == 'write') { |
| 796 |
$query_args[action] = $this->_query[action]; |
$query_args[action] = $this->_query[action]; |
| 797 |
$query_args[data] = $this->_query[data]; |
$query_args[data] = $this->_query[data]; |
| 798 |
|
} elseif ($this->_query[action] == 'delete') { |
| 799 |
|
$query_args[action] = $this->_query[action]; |
| 800 |
|
} elseif ($this->_query[action] == 'create') { |
| 801 |
|
$query_args[action] = $this->_query[action]; |
| 802 |
} |
} |
| 803 |
|
|
| 804 |
$args = array( |
$args = array( |
| 805 |
'data_type' => $this->_query[abstract_type], |
'data_type' => $this->_query[abstract_type], |
| 806 |
'query_args' => $query_args |
'query_args' => $query_args |
| 817 |
// remoteMethod |
// remoteMethod |
| 818 |
case 'method': |
case 'method': |
| 819 |
$command = $this->_query[method]; |
$command = $this->_query[method]; |
| 820 |
$args = $this->_query[args]; |
//$args = $this->_query[args]; |
| 821 |
|
// FIX |
| 822 |
|
$args = array( $this->_query[args] ); |
| 823 |
break; |
break; |
| 824 |
|
|
| 825 |
} |
} |
| 828 |
// FIXME: bad behaviour? |
// FIXME: bad behaviour? |
| 829 |
if (!is_array($args)) { $args = array( $args ); } |
if (!is_array($args)) { $args = array( $args ); } |
| 830 |
|
|
| 831 |
|
//print Dumper($args); |
| 832 |
|
|
| 833 |
/* |
/* |
| 834 |
$this->_query[rpc_command] = $command; |
$this->_query[rpc_command] = $command; |
| 835 |
$this->_query[rpc_args] = $command; |
$this->_query[rpc_args] = $command; |
| 864 |
|
|
| 865 |
|
|
| 866 |
function &fetch_result() { |
function &fetch_result() { |
| 867 |
|
|
| 868 |
|
//print Dumper($this); |
| 869 |
|
|
| 870 |
$this->datasource_handler_buildoptions(); |
$this->datasource_handler_buildoptions(); |
| 871 |
|
|
| 872 |
$call = $this->_locator->get_call(); |
$call = $this->_locator->get_call(); |
| 873 |
|
|
| 874 |
//print Dumper($call); |
//print Dumper($call); |
| 875 |
|
//return; |
| 876 |
|
|
| 877 |
// pre-flight checks |
// pre-flight checks |
| 878 |
if (!$call[method]) { |
if (!$call[method]) { |