--- nfo/php/libs/org.netfrag.glib/DataSource/Generic.php 2003/04/11 00:55:49 1.18 +++ nfo/php/libs/org.netfrag.glib/DataSource/Generic.php 2003/04/18 15:40:51 1.19 @@ -9,12 +9,16 @@ */ /** - * Cvs-Log: + * Cvs-Log: * - *
- * $Id: Generic.php,v 1.18 2003/04/11 00:55:49 joko Exp $ + * $Id: Generic.php,v 1.19 2003/04/18 15:40:51 joko Exp $ * * $Log: Generic.php,v $ + * Revision 1.19 2003/04/18 15:40:51 joko + * NEW: tree data handling + * introduced new adapter: DataSource::Adapter::Free + * enhanced datasource_handler_buildoptions: now handles a) case 'tree' b) _query[filter] + * * Revision 1.18 2003/04/11 00:55:49 joko * updated 'datasource_handler_buildoptions': action dispatcher now aware of 'delete' * @@ -97,7 +101,6 @@ * * Revision 1.1 2003/03/01 03:10:40 joko * + initial commit - ** */ @@ -493,20 +496,27 @@ // ... resolves this._modules.adapter._id to this._modules.adapter._module switch ($locator->_adapter_type) { + case 'phpHtmlLib': //$adapter_arguments = $args[title]; - $this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); // in order to let the Adapter communicate with the Proxy, // instantiate a wrapper method in a third namespace via // Exporter::export_symbol(from, to) $this->set_adapter_options($this); + break; - + // NEW [2003-04-17]: Freedom for the adapter! + // phpHtmlLib didn't have a tree widget, but PEAR does. + // So: Free us from the phpHtmlLib-adapter in this case. + case 'free': + $this->set_adapter_module('DataSource::Adapter::Free'); + $this->set_adapter_options($this); break; + default: - user_error("DataSource::Generic: no Adapter could be selected!"); + user_error("DataSource::Generic: no Adapter could be selected: \$locator->_adapter_type='$locator->_adapter_type'"); break; } @@ -718,23 +728,44 @@ } */ $query_args = array(); + + $msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: "; switch ($this->_query[abstract_type]) { + case 'item': + if (!$this->_query[nodename]) { + $msg = "_query[vartype] == 'objects' requires _query[nodename]"; + user_error($msg_prefix . $msg); + } + $query_args[guid] = $this->_query[ident]; + $query_args[nodename] = $this->_query[nodename]; + break; case 'list': if (!$this->_query[nodename]) { $msg = "_query[vartype] == 'objects' requires _query[nodename]"; - user_error("DataSource::Generic: query_data() - failed: " . $msg); + user_error($msg_prefix . $msg); } //array_push($query_args, $this->_query[nodename]); $query_args[nodename] = $this->_query[nodename]; break; - case 'item': + case 'tree': + /* if (!$this->_query[nodename]) { $msg = "_query[vartype] == 'objects' requires _query[nodename]"; - user_error("DataSource::Generic: query_data() - failed: " . $msg); + user_error($msg_prefix . $msg); } + */ $query_args[guid] = $this->_query[ident]; - $query_args[nodename] = $this->_query[nodename]; - break; + //$query_args[nodename] = $this->_query[nodename]; + break; + default: + $msg = "\$this->_query[abstract_type] could not be dispatched as 'item', 'list' or 'tree'."; + user_error($msg_prefix . $msg); + break; + } + + // filter??? + if ($this->_query[filter]) { + $query_args[filter] = $this->_query[filter]; } // dispatch action @@ -744,6 +775,7 @@ } elseif ($this->_query[action] == 'delete') { $query_args[action] = $this->_query[action]; } + $args = array( 'data_type' => $this->_query[abstract_type], 'query_args' => $query_args @@ -803,11 +835,15 @@ function &fetch_result() { + + //print Dumper($this); $this->datasource_handler_buildoptions(); $call = $this->_locator->get_call(); + //print Dumper($call); + //return; // pre-flight checks if (!$call[method]) {