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