/[cvs]/nfo/php/libs/org.netfrag.glib/DataSource/Generic.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/DataSource/Generic.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by joko, Fri Apr 11 00:55:49 2003 UTC revision 1.19 by joko, Fri Apr 18 15:40:51 2003 UTC
# Line 9  Line 9 
9   */   */
10    
11  /**  /**
12   * <b>Cvs-Log:</b>   * Cvs-Log:
13   *   *
  * <pre>  
14   * $Id$   * $Id$
15   *   *
16   * $Log$   * $Log$
17     * Revision 1.19  2003/04/18 15:40:51  joko
18     * NEW: tree data handling
19     *   introduced new adapter: DataSource::Adapter::Free
20     *   enhanced datasource_handler_buildoptions: now handles a) case 'tree'  b) _query[filter]
21     *
22   * Revision 1.18  2003/04/11 00:55:49  joko   * Revision 1.18  2003/04/11 00:55:49  joko
23   * updated 'datasource_handler_buildoptions': action dispatcher now aware of 'delete'   * updated 'datasource_handler_buildoptions': action dispatcher now aware of 'delete'
24   *   *
# Line 97  Line 101 
101   *   *
102   * Revision 1.1  2003/03/01 03:10:40  joko   * Revision 1.1  2003/03/01 03:10:40  joko
103   * + initial commit   * + initial commit
  * </pre>  
104   *   *
105   */   */
106    
# Line 493  class DataSource_Generic extends DesignP Line 496  class DataSource_Generic extends DesignP
496          // ... resolves this._modules.adapter._id to this._modules.adapter._module          // ... resolves this._modules.adapter._id to this._modules.adapter._module
497                    
498          switch ($locator->_adapter_type) {          switch ($locator->_adapter_type) {
499    
500            case 'phpHtmlLib':            case 'phpHtmlLib':
501              //$adapter_arguments = $args[title];              //$adapter_arguments = $args[title];
   
502              $this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource');              $this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource');
503                            
504              // in order to let the Adapter communicate with the Proxy,              // in order to let the Adapter communicate with the Proxy,
505              // instantiate a wrapper method in a third namespace via              // instantiate a wrapper method in a third namespace via
506              // Exporter::export_symbol(from, to)              // Exporter::export_symbol(from, to)
507              $this->set_adapter_options($this);              $this->set_adapter_options($this);
508                break;
509    
510              // NEW [2003-04-17]: Freedom for the adapter!
511              // phpHtmlLib didn't have a tree widget, but PEAR does.
512              // So: Free us from the phpHtmlLib-adapter in this case.
513              case 'free':
514                $this->set_adapter_module('DataSource::Adapter::Free');
515                $this->set_adapter_options($this);
516              break;              break;
517    
518            default:            default:
519              user_error("DataSource::Generic: no Adapter could be selected!");              user_error("DataSource::Generic: no Adapter could be selected: \$locator->_adapter_type='$locator->_adapter_type'");
520              break;              break;
521          }          }
522    
# Line 718  class DataSource_Generic extends DesignP Line 728  class DataSource_Generic extends DesignP
728              }              }
729   */   */
730              $query_args = array();              $query_args = array();
731                
732                 $msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: ";
733               switch ($this->_query[abstract_type]) {               switch ($this->_query[abstract_type]) {
734                  case 'item':
735                    if (!$this->_query[nodename]) {
736                      $msg = "_query[vartype] == 'objects' requires _query[nodename]";
737                      user_error($msg_prefix . $msg);
738                    }
739                    $query_args[guid] = $this->_query[ident];
740                    $query_args[nodename] = $this->_query[nodename];
741                    break;
742                case 'list':                case 'list':
743                  if (!$this->_query[nodename]) {                  if (!$this->_query[nodename]) {
744                    $msg = "_query[vartype] == 'objects' requires _query[nodename]";                    $msg = "_query[vartype] == 'objects' requires _query[nodename]";
745                    user_error("DataSource::Generic: query_data() - failed: " . $msg);                    user_error($msg_prefix . $msg);
746                  }                  }
747                  //array_push($query_args, $this->_query[nodename]);                  //array_push($query_args, $this->_query[nodename]);
748                  $query_args[nodename] = $this->_query[nodename];                  $query_args[nodename] = $this->_query[nodename];
749                  break;                  break;
750                case 'item':                case 'tree':
751                    /*
752                  if (!$this->_query[nodename]) {                  if (!$this->_query[nodename]) {
753                    $msg = "_query[vartype] == 'objects' requires _query[nodename]";                    $msg = "_query[vartype] == 'objects' requires _query[nodename]";
754                    user_error("DataSource::Generic: query_data() - failed: " . $msg);                    user_error($msg_prefix . $msg);
755                  }                  }
756                    */
757                  $query_args[guid] = $this->_query[ident];                  $query_args[guid] = $this->_query[ident];
758                  $query_args[nodename] = $this->_query[nodename];                  //$query_args[nodename] = $this->_query[nodename];
759                  break;                                break;
760                  default:
761                    $msg = "\$this->_query[abstract_type] could not be dispatched as 'item', 'list' or 'tree'.";
762                    user_error($msg_prefix . $msg);
763                    break;
764                }
765                
766                // filter???
767                if ($this->_query[filter]) {
768                  $query_args[filter] = $this->_query[filter];
769              }              }
770                            
771              // dispatch action              // dispatch action
# Line 744  class DataSource_Generic extends DesignP Line 775  class DataSource_Generic extends DesignP
775              } elseif ($this->_query[action] == 'delete') {              } elseif ($this->_query[action] == 'delete') {
776               $query_args[action] = $this->_query[action];               $query_args[action] = $this->_query[action];
777              }              }
778                
779              $args = array(              $args = array(
780                            'data_type' => $this->_query[abstract_type],                            'data_type' => $this->_query[abstract_type],
781                            'query_args' => $query_args                            'query_args' => $query_args
# Line 803  class DataSource_Generic extends DesignP Line 835  class DataSource_Generic extends DesignP
835    
836    
837          function &fetch_result() {          function &fetch_result() {
838    
839          //print Dumper($this);
840                
841        $this->datasource_handler_buildoptions();        $this->datasource_handler_buildoptions();
842    
843        $call = $this->_locator->get_call();        $call = $this->_locator->get_call();
844    
845        //print Dumper($call);        //print Dumper($call);
846          //return;
847    
848        // pre-flight checks        // pre-flight checks
849          if (!$call[method]) {          if (!$call[method]) {

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed