/[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.20 by jonen, Sat Apr 19 16:07:15 2003 UTC revision 1.28 by jonen, Thu Oct 7 14:11:28 2004 UTC
# Line 14  Line 14 
14   * $Id$   * $Id$
15   *   *
16   * $Log$   * $Log$
17     * Revision 1.28  2004/10/07 14:11:28  jonen
18     * + added HACK related to DataList-filters which are mapped to backend now (page-control!)
19     *
20     * Revision 1.27  2004/06/15 12:50:48  joko
21     * disabled caching in "datasource_handler_call"
22     *
23     * Revision 1.26  2003/12/14 01:53:42  jonen
24     * implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes
25     *
26     * Revision 1.25  2003/11/17 18:01:03  jonen
27     * bugfix: php cannot use perl-syntax!! ;-)
28     *
29     * Revision 1.23  2003/07/14 10:02:32  jonen
30     * removed debug dumper
31     *
32     * Revision 1.22  2003/06/06 04:25:45  joko
33     * fix: query args get encapsulated once more
34     *
35     * Revision 1.21  2003/05/10 18:14:50  jonen
36     * + implements 'create' of item (query mapping part)
37     *
38   * Revision 1.20  2003/04/19 16:07:15  jonen   * Revision 1.20  2003/04/19 16:07:15  jonen
39   * + added '_query[list_meta]' at 'queryData' needed for meta query args   * + added '_query[list_meta]' at 'queryData' needed for meta query args
40   *    (e.g. at UserManagment)   *    (e.g. at UserManagment)
# Line 423  class DataSource_Generic extends DesignP Line 444  class DataSource_Generic extends DesignP
444                  */                  */
445                                    
446        //$this->set_locator( $locator );        //$this->set_locator( $locator );
447          //print "query: " . Dumper($query) . "<br>";
448        $this->set_query( $query );        $this->set_query( $query );
449    
450    
# Line 683  class DataSource_Generic extends DesignP Line 705  class DataSource_Generic extends DesignP
705                
706                
707        //$this->set_component_name( $proxy_name );        //$this->set_component_name( $proxy_name );
708        $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 ) ) );
709        //print Dumper($this);        //print Dumper($this);
710        //exit;        //exit;
711                
# Line 736  class DataSource_Generic extends DesignP Line 758  class DataSource_Generic extends DesignP
758               $msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: ";               $msg_prefix = "DataSource::Generic::datasource_handler_buildoptions failed: ";
759               switch ($this->_query[abstract_type]) {               switch ($this->_query[abstract_type]) {
760                case 'item':                case 'item':
761                  if (!$this->_query[nodename]) {                  if (!$this->_query[nodename] && $this->_query[action] != 'create') {
762                    $msg = "_query[vartype] == 'objects' requires _query[nodename]";                    $msg = "_query[vartype] == 'objects' requires _query[nodename]";
763                    user_error($msg_prefix . $msg);                    user_error($msg_prefix . $msg);
764                    } elseif($this->_query[action] == 'create' && $this->_query[parent]) {
765                      if($this->_query[nodename]) { $query_args[node_class] = $this->_query[nodename]; }
766                      if($this->_query['hash_key']) { $query_args['hash_key'] = $this->_query['hash_key']; }
767                      $query_args[nodename] = $this->_query[ident];
768                      $query_args[parent][guid] = $this->_query[parent][guid];
769                      $query_args[parent][nodename] = $this->_query[parent][nodename];
770                    } elseif($this->_query[parent]) {
771                      $query_args[guid] = $this->_query[ident];
772                      $query_args[nodename] = $this->_query[nodename];
773                      $query_args[parent][guid] = $this->_query[parent][guid];
774                      $query_args[parent][nodename] = $this->_query[parent][nodename];
775                    } else {
776                      $query_args[guid] = $this->_query[ident];
777                      $query_args[nodename] = $this->_query[nodename];
778                      // 2003-11-17 NEW: use expand flag for real obj expand at backend
779                      if ($this->_query[expand]) {$query_args[expand] = 1; }
780                  }                  }
781                  $query_args[guid] = $this->_query[ident];                  //print "generic_source->debug: args " . Dumper($query_args) . "<br>";
                 $query_args[nodename] = $this->_query[nodename];  
782                  break;                  break;
783                case 'list':                case 'list':
784                  if (!$this->_query[nodename]) {                  if (!$this->_query[nodename]) {
785                    $msg = "_query[vartype] == 'objects' requires _query[nodename]";                    $msg = "_query[vartype] == 'objects' requires _query[nodename]";
786                    user_error($msg_prefix . $msg);                    user_error($msg_prefix . $msg);
787                    } elseif($this->_query[parent]) {
788                      //if($this->_query[nodename]) { $query_args[node_class] = $this->_query[nodename]; }
789                      //if($this->_query['hash_key']) { $query_args['hash_key'] = $this->_query['hash_key']; }
790                      //$query_args[nodename] = $this->_query[ident];
791                      $query_args[parent][guid] = $this->_query[parent][guid];
792                      $query_args[parent][nodename] = $this->_query[parent][nodename];
793                  }                  }
794                  //array_push($query_args, $this->_query[nodename]);                  //array_push($query_args, $this->_query[nodename]);
795                  $query_args[nodename] = $this->_query[nodename];                  $query_args[nodename] = $this->_query[nodename];
# Line 769  class DataSource_Generic extends DesignP Line 812  class DataSource_Generic extends DesignP
812              }              }
813                            
814              // filter???              // filter???
815                //print "Filter: " . Dumper($this->_query[filter]) . "<br>";
816              if ($this->_query[filter]) {              if ($this->_query[filter]) {
817                $query_args[filter] = $this->_query[filter];                $query_args[filter] = $this->_query[filter];
818              }              }
819                            
820              // dispatch action              // dispatch action
821                //print "Action: " . $this->_query[action] . "<br>";
822              if ($this->_query[action] == 'write') {              if ($this->_query[action] == 'write') {
823               $query_args[action] = $this->_query[action];               $query_args[action] = $this->_query[action];
824               $query_args[data] = $this->_query[data];               $query_args[data] = $this->_query[data];
825              } elseif ($this->_query[action] == 'delete') {              } elseif ($this->_query[action] == 'delete') {
826               $query_args[action] = $this->_query[action];               $query_args[action] = $this->_query[action];
827                } elseif ($this->_query[action] == 'create') {
828                   $query_args[action] = $this->_query[action];
829                } elseif ($this->_query[action] == 'select') {
830                   $query_args[action] = $this->_query[action];
831              }              }
832                            
833              $args = array(              $args = array(
# Line 797  class DataSource_Generic extends DesignP Line 846  class DataSource_Generic extends DesignP
846            // remoteMethod            // remoteMethod
847            case 'method':            case 'method':
848              $command = $this->_query[method];              $command = $this->_query[method];
849              $args = $this->_query[args];              //$args = $this->_query[args];
850                // FIX
851                $args = array( $this->_query[args] );
852              break;              break;
853    
854          }          }
# Line 806  class DataSource_Generic extends DesignP Line 857  class DataSource_Generic extends DesignP
857          // FIXME: bad behaviour?          // FIXME: bad behaviour?
858          if (!is_array($args)) { $args = array( $args ); }          if (!is_array($args)) { $args = array( $args ); }
859                    
860            //print Dumper($args);
861            
862          /*          /*
863          $this->_query[rpc_command] = $command;          $this->_query[rpc_command] = $command;
864          $this->_query[rpc_args] = $command;          $this->_query[rpc_args] = $command;
# Line 866  class DataSource_Generic extends DesignP Line 919  class DataSource_Generic extends DesignP
919                    
920          // TODO: ... = $this->poll_handler_result  and  $this->get_handler_result          // TODO: ... = $this->poll_handler_result  and  $this->get_handler_result
921          $proxy = $this->get_proxy();          $proxy = $this->get_proxy();
922          $this->_result = $proxy->getResult();            //HACK 2004-10-07: page-filter done by backend now,
923              //                 before offset values filled with empty arrays
924            //$this->_result = $proxy->getResult();
925            $result = $proxy->getResult();
926            if($result['total_rows']) {
927              // debug
928              //print "result: " . Dumper($result);
929              $this->_result_count = $result['total_rows'];
930              if($result[offset]) {
931                $result_new = array();
932                for($i=0;$i<$result[offset];$i++) {
933                  array_push($result_new, array());
934                }
935                foreach($result['payload'] as $key => $value) {
936                  array_push($result_new, $value);
937                }
938                $this->_result = $result_new;
939              } else {
940                $this->_result = $result['payload'];
941              }
942            } else {
943              $this->_result = $result;
944              $this->_result_count = sizeof($this->_result);
945            }
946            //print "result: " . Dumper($this->_result);
947          //print "result: " . Dumper($this->_result); exit;          //print "result: " . Dumper($this->_result); exit;
948    
         $this->_result_count = sizeof($this->_result);  
949    
950        // trace        // trace
951          //if (constants::get('VERBOSE') && $this->_debug[notice]) {          //if (constants::get('VERBOSE') && $this->_debug[notice]) {

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.28

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