14 |
* $Id$ |
* $Id$ |
15 |
* |
* |
16 |
* $Log$ |
* $Log$ |
17 |
|
* Revision 1.27 2004/06/15 12:50:48 joko |
18 |
|
* disabled caching in "datasource_handler_call" |
19 |
|
* |
20 |
|
* Revision 1.26 2003/12/14 01:53:42 jonen |
21 |
|
* implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes |
22 |
|
* |
23 |
|
* Revision 1.25 2003/11/17 18:01:03 jonen |
24 |
|
* bugfix: php cannot use perl-syntax!! ;-) |
25 |
|
* |
26 |
|
* Revision 1.23 2003/07/14 10:02:32 jonen |
27 |
|
* removed debug dumper |
28 |
|
* |
29 |
|
* Revision 1.22 2003/06/06 04:25:45 joko |
30 |
|
* fix: query args get encapsulated once more |
31 |
|
* |
32 |
|
* Revision 1.21 2003/05/10 18:14:50 jonen |
33 |
|
* + implements 'create' of item (query mapping part) |
34 |
|
* |
35 |
|
* Revision 1.20 2003/04/19 16:07:15 jonen |
36 |
|
* + added '_query[list_meta]' at 'queryData' needed for meta query args |
37 |
|
* (e.g. at UserManagment) |
38 |
|
* |
39 |
* Revision 1.19 2003/04/18 15:40:51 joko |
* Revision 1.19 2003/04/18 15:40:51 joko |
40 |
* NEW: tree data handling |
* NEW: tree data handling |
41 |
* introduced new adapter: DataSource::Adapter::Free |
* introduced new adapter: DataSource::Adapter::Free |
701 |
|
|
702 |
|
|
703 |
//$this->set_component_name( $proxy_name ); |
//$this->set_component_name( $proxy_name ); |
704 |
$this->set_component_options( $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) ); |
$this->set_component_options( $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 0 ) ) ); |
705 |
//print Dumper($this); |
//print Dumper($this); |
706 |
//exit; |
//exit; |
707 |
|
|
754 |
$msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: "; |
$msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: "; |
755 |
switch ($this->_query[abstract_type]) { |
switch ($this->_query[abstract_type]) { |
756 |
case 'item': |
case 'item': |
757 |
if (!$this->_query[nodename]) { |
if (!$this->_query[nodename] && $this->_query[action] != 'create') { |
758 |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
759 |
user_error($msg_prefix . $msg); |
user_error($msg_prefix . $msg); |
760 |
|
} elseif($this->_query[action] == 'create' && $this->_query[parent]) { |
761 |
|
if($this->_query[nodename]) { $query_args[node_class] = $this->_query[nodename]; } |
762 |
|
if($this->_query['hash_key']) { $query_args['hash_key'] = $this->_query['hash_key']; } |
763 |
|
$query_args[nodename] = $this->_query[ident]; |
764 |
|
$query_args[parent][guid] = $this->_query[parent][guid]; |
765 |
|
$query_args[parent][nodename] = $this->_query[parent][nodename]; |
766 |
|
} elseif($this->_query[parent]) { |
767 |
|
$query_args[guid] = $this->_query[ident]; |
768 |
|
$query_args[nodename] = $this->_query[nodename]; |
769 |
|
$query_args[parent][guid] = $this->_query[parent][guid]; |
770 |
|
$query_args[parent][nodename] = $this->_query[parent][nodename]; |
771 |
|
} else { |
772 |
|
$query_args[guid] = $this->_query[ident]; |
773 |
|
$query_args[nodename] = $this->_query[nodename]; |
774 |
|
// 2003-11-17 NEW: use expand flag for real obj expand at backend |
775 |
|
if ($this->_query[expand]) {$query_args[expand] = 1; } |
776 |
} |
} |
777 |
$query_args[guid] = $this->_query[ident]; |
//print "generic_source->debug: args " . Dumper($query_args) . "<br>"; |
|
$query_args[nodename] = $this->_query[nodename]; |
|
778 |
break; |
break; |
779 |
case 'list': |
case 'list': |
780 |
if (!$this->_query[nodename]) { |
if (!$this->_query[nodename]) { |
781 |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
782 |
user_error($msg_prefix . $msg); |
user_error($msg_prefix . $msg); |
783 |
|
} elseif($this->_query[parent]) { |
784 |
|
//if($this->_query[nodename]) { $query_args[node_class] = $this->_query[nodename]; } |
785 |
|
//if($this->_query['hash_key']) { $query_args['hash_key'] = $this->_query['hash_key']; } |
786 |
|
//$query_args[nodename] = $this->_query[ident]; |
787 |
|
$query_args[parent][guid] = $this->_query[parent][guid]; |
788 |
|
$query_args[parent][nodename] = $this->_query[parent][nodename]; |
789 |
} |
} |
790 |
//array_push($query_args, $this->_query[nodename]); |
//array_push($query_args, $this->_query[nodename]); |
791 |
$query_args[nodename] = $this->_query[nodename]; |
$query_args[nodename] = $this->_query[nodename]; |
792 |
|
if($this->_query[list_meta]) { $query_args[list_meta] = $this->_query[list_meta]; } |
793 |
break; |
break; |
794 |
case 'tree': |
case 'tree': |
795 |
/* |
/* |
808 |
} |
} |
809 |
|
|
810 |
// filter??? |
// filter??? |
811 |
|
//print "Filter: " . Dumper($this->_query[filter]) . "<br>"; |
812 |
if ($this->_query[filter]) { |
if ($this->_query[filter]) { |
813 |
$query_args[filter] = $this->_query[filter]; |
$query_args[filter] = $this->_query[filter]; |
814 |
} |
} |
815 |
|
|
816 |
// dispatch action |
// dispatch action |
817 |
|
//print "Action: " . $this->_query[action] . "<br>"; |
818 |
if ($this->_query[action] == 'write') { |
if ($this->_query[action] == 'write') { |
819 |
$query_args[action] = $this->_query[action]; |
$query_args[action] = $this->_query[action]; |
820 |
$query_args[data] = $this->_query[data]; |
$query_args[data] = $this->_query[data]; |
821 |
} elseif ($this->_query[action] == 'delete') { |
} elseif ($this->_query[action] == 'delete') { |
822 |
$query_args[action] = $this->_query[action]; |
$query_args[action] = $this->_query[action]; |
823 |
|
} elseif ($this->_query[action] == 'create') { |
824 |
|
$query_args[action] = $this->_query[action]; |
825 |
|
} elseif ($this->_query[action] == 'select') { |
826 |
|
$query_args[action] = $this->_query[action]; |
827 |
} |
} |
828 |
|
|
829 |
$args = array( |
$args = array( |
842 |
// remoteMethod |
// remoteMethod |
843 |
case 'method': |
case 'method': |
844 |
$command = $this->_query[method]; |
$command = $this->_query[method]; |
845 |
$args = $this->_query[args]; |
//$args = $this->_query[args]; |
846 |
|
// FIX |
847 |
|
$args = array( $this->_query[args] ); |
848 |
break; |
break; |
849 |
|
|
850 |
} |
} |
853 |
// FIXME: bad behaviour? |
// FIXME: bad behaviour? |
854 |
if (!is_array($args)) { $args = array( $args ); } |
if (!is_array($args)) { $args = array( $args ); } |
855 |
|
|
856 |
|
//print Dumper($args); |
857 |
|
|
858 |
/* |
/* |
859 |
$this->_query[rpc_command] = $command; |
$this->_query[rpc_command] = $command; |
860 |
$this->_query[rpc_args] = $command; |
$this->_query[rpc_args] = $command; |