9 |
*/ |
*/ |
10 |
|
|
11 |
/** |
/** |
12 |
* <b>Cvs-Log:</b> |
* Cvs-Log: |
13 |
* |
* |
|
* <pre> |
|
14 |
* $Id$ |
* $Id$ |
15 |
* |
* |
16 |
* $Log$ |
* $Log$ |
17 |
|
* Revision 1.21 2003/05/10 18:14:50 jonen |
18 |
|
* + implements 'create' of item (query mapping part) |
19 |
|
* |
20 |
|
* Revision 1.20 2003/04/19 16:07:15 jonen |
21 |
|
* + added '_query[list_meta]' at 'queryData' needed for meta query args |
22 |
|
* (e.g. at UserManagment) |
23 |
|
* |
24 |
|
* Revision 1.19 2003/04/18 15:40:51 joko |
25 |
|
* NEW: tree data handling |
26 |
|
* introduced new adapter: DataSource::Adapter::Free |
27 |
|
* enhanced datasource_handler_buildoptions: now handles a) case 'tree' b) _query[filter] |
28 |
|
* |
29 |
|
* Revision 1.18 2003/04/11 00:55:49 joko |
30 |
|
* updated 'datasource_handler_buildoptions': action dispatcher now aware of 'delete' |
31 |
|
* |
32 |
* Revision 1.17 2003/04/09 02:07:33 joko |
* Revision 1.17 2003/04/09 02:07:33 joko |
33 |
* CHANGE: renamed key 'classname' through 'nodename' |
* CHANGE: renamed key 'classname' through 'nodename' |
34 |
* |
* |
108 |
* |
* |
109 |
* Revision 1.1 2003/03/01 03:10:40 joko |
* Revision 1.1 2003/03/01 03:10:40 joko |
110 |
* + initial commit |
* + initial commit |
|
* </pre> |
|
111 |
* |
* |
112 |
*/ |
*/ |
113 |
|
|
503 |
// ... resolves this._modules.adapter._id to this._modules.adapter._module |
// ... resolves this._modules.adapter._id to this._modules.adapter._module |
504 |
|
|
505 |
switch ($locator->_adapter_type) { |
switch ($locator->_adapter_type) { |
506 |
|
|
507 |
case 'phpHtmlLib': |
case 'phpHtmlLib': |
508 |
//$adapter_arguments = $args[title]; |
//$adapter_arguments = $args[title]; |
|
|
|
509 |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); |
510 |
|
|
511 |
// in order to let the Adapter communicate with the Proxy, |
// in order to let the Adapter communicate with the Proxy, |
512 |
// instantiate a wrapper method in a third namespace via |
// instantiate a wrapper method in a third namespace via |
513 |
// Exporter::export_symbol(from, to) |
// Exporter::export_symbol(from, to) |
514 |
$this->set_adapter_options($this); |
$this->set_adapter_options($this); |
515 |
|
break; |
516 |
|
|
517 |
|
// NEW [2003-04-17]: Freedom for the adapter! |
518 |
|
// phpHtmlLib didn't have a tree widget, but PEAR does. |
519 |
|
// So: Free us from the phpHtmlLib-adapter in this case. |
520 |
|
case 'free': |
521 |
|
$this->set_adapter_module('DataSource::Adapter::Free'); |
522 |
|
$this->set_adapter_options($this); |
523 |
break; |
break; |
524 |
|
|
525 |
default: |
default: |
526 |
user_error("DataSource::Generic: no Adapter could be selected!"); |
user_error("DataSource::Generic: no Adapter could be selected: \$locator->_adapter_type='$locator->_adapter_type'"); |
527 |
break; |
break; |
528 |
} |
} |
529 |
|
|
735 |
} |
} |
736 |
*/ |
*/ |
737 |
$query_args = array(); |
$query_args = array(); |
738 |
|
|
739 |
|
$msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: "; |
740 |
switch ($this->_query[abstract_type]) { |
switch ($this->_query[abstract_type]) { |
741 |
|
case 'item': |
742 |
|
if (!$this->_query[nodename] && $this->_query[action] != 'create') { |
743 |
|
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
744 |
|
user_error($msg_prefix . $msg); |
745 |
|
} elseif($this->_query[action] == 'create' && $this->_query[parent]) { |
746 |
|
if($this->_query[nodename]) { $query_args[node_class] = $this->_query[nodename]; } |
747 |
|
if($this->_query['hash_key']) { $query_args['hash_key'] = $this->_query['hash_key']; } |
748 |
|
$query_args[nodename] = $this->_query[ident]; |
749 |
|
$query_args[parent][guid] = $this->_query[parent][guid]; |
750 |
|
$query_args[parent][nodename] = $this->_query[parent][nodename]; |
751 |
|
} else { |
752 |
|
$query_args[guid] = $this->_query[ident]; |
753 |
|
$query_args[nodename] = $this->_query[nodename]; |
754 |
|
} |
755 |
|
break; |
756 |
case 'list': |
case 'list': |
757 |
if (!$this->_query[nodename]) { |
if (!$this->_query[nodename]) { |
758 |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
759 |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
user_error($msg_prefix . $msg); |
760 |
} |
} |
761 |
//array_push($query_args, $this->_query[nodename]); |
//array_push($query_args, $this->_query[nodename]); |
762 |
$query_args[nodename] = $this->_query[nodename]; |
$query_args[nodename] = $this->_query[nodename]; |
763 |
|
if($this->_query[list_meta]) { $query_args[list_meta] = $this->_query[list_meta]; } |
764 |
break; |
break; |
765 |
case 'item': |
case 'tree': |
766 |
|
/* |
767 |
if (!$this->_query[nodename]) { |
if (!$this->_query[nodename]) { |
768 |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
769 |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
user_error($msg_prefix . $msg); |
770 |
} |
} |
771 |
|
*/ |
772 |
$query_args[guid] = $this->_query[ident]; |
$query_args[guid] = $this->_query[ident]; |
773 |
$query_args[nodename] = $this->_query[nodename]; |
//$query_args[nodename] = $this->_query[nodename]; |
774 |
break; |
break; |
775 |
|
default: |
776 |
|
$msg = "\$this->_query[abstract_type] could not be dispatched as 'item', 'list' or 'tree'."; |
777 |
|
user_error($msg_prefix . $msg); |
778 |
|
break; |
779 |
|
} |
780 |
|
|
781 |
|
// filter??? |
782 |
|
print "Filter: " . Dumper($this->_query[filter]) . "<br>"; |
783 |
|
if ($this->_query[filter]) { |
784 |
|
$query_args[filter] = $this->_query[filter]; |
785 |
} |
} |
786 |
if($this->_query[action] == 'write') { |
|
787 |
|
// dispatch action |
788 |
|
print "Action: " . $this->_query[action] . "<br>"; |
789 |
|
if ($this->_query[action] == 'write') { |
790 |
$query_args[action] = $this->_query[action]; |
$query_args[action] = $this->_query[action]; |
791 |
$query_args[data] = $this->_query[data]; |
$query_args[data] = $this->_query[data]; |
792 |
|
} elseif ($this->_query[action] == 'delete') { |
793 |
|
$query_args[action] = $this->_query[action]; |
794 |
|
} elseif ($this->_query[action] == 'create') { |
795 |
|
$query_args[action] = $this->_query[action]; |
796 |
} |
} |
797 |
|
|
798 |
$args = array( |
$args = array( |
799 |
'data_type' => $this->_query[abstract_type], |
'data_type' => $this->_query[abstract_type], |
800 |
'query_args' => $query_args |
'query_args' => $query_args |
854 |
|
|
855 |
|
|
856 |
function &fetch_result() { |
function &fetch_result() { |
857 |
|
|
858 |
|
//print Dumper($this); |
859 |
|
|
860 |
$this->datasource_handler_buildoptions(); |
$this->datasource_handler_buildoptions(); |
861 |
|
|
862 |
$call = $this->_locator->get_call(); |
$call = $this->_locator->get_call(); |
863 |
|
|
864 |
//print Dumper($call); |
//print Dumper($call); |
865 |
|
//return; |
866 |
|
|
867 |
// pre-flight checks |
// pre-flight checks |
868 |
if (!$call[method]) { |
if (!$call[method]) { |