/[cvs]/nfo/php/libs/org.netfrag.app/WebExplorer/AbstractExplorer.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.app/WebExplorer/AbstractExplorer.php

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

revision 1.22 by joko, Tue May 13 14:50:27 2003 UTC revision 1.27 by jonen, Thu Mar 11 21:01:35 2004 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.27  2004/03/11 21:01:35  jonen
8    ##    minor change
9    ##
10    ##    Revision 1.26  2003/12/14 01:50:30  jonen
11    ##    implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes
12    ##
13    ##    Revision 1.25  2003/11/22 18:47:49  udo
14    ##    update for expand data item
15    ##
16    ##    Revision 1.24  2003/07/02 11:39:16  jonen
17    ##    fixed bugs
18    ##
19    ##    Revision 1.23  2003/06/06 11:57:20  joko
20    ##    minor update: cosmetic changes
21    ##
22  ##    Revision 1.22  2003/05/13 14:50:27  joko  ##    Revision 1.22  2003/05/13 14:50:27  joko
23  ##    HACKed compatibility for config-type data sources  ##    HACKed compatibility for config-type data sources
24  ##    + function get_data_filter  ##    + function get_data_filter
# Line 158  class WebExplorer_AbstractExplorer { Line 173  class WebExplorer_AbstractExplorer {
173      $this->set_e_state();      $this->set_e_state();
174    
175      //debug      //debug
176      //print "State: " . Dumper($this->_state) ."<br>";  //    print "State: " . Dumper($this->_state) ."<br>";
177        //print "_data_locators: " . Dumper($this->_data_locators) ."<br>";
178      $div = html_div();      $div = html_div();
179      $div->add( html_b(get_class($this)), html_hr(), "Explorer_State: " . Dumper($this->_e_state));      $div->add( html_b(get_class($this)), html_hr(), "Explorer_State: " . Dumper($this->_e_state));
180      $div->set_style('background: #adadad; border: 2px black groove; width:640px; padding:10px; margin:40px;');      $div->set_style('background: #adadad; border: 2px black groove; width:640px; padding:10px; margin:40px;');
# Line 198  class WebExplorer_AbstractExplorer { Line 214  class WebExplorer_AbstractExplorer {
214    
215    function get_page_state() {    function get_page_state() {
216      $requestTracker = mkObject("Application::Request::Tracker");      $requestTracker = mkObject("Application::Request::Tracker");
     //print Dumper($this->_state);  
217      $this->_state = $requestTracker->getPointer();      $this->_state = $requestTracker->getPointer();
218    }    }
219        
# Line 208  class WebExplorer_AbstractExplorer { Line 223  class WebExplorer_AbstractExplorer {
223      // 2. (was) get page state from request tracker      // 2. (was) get page state from request tracker
224      if ($state) {      if ($state) {
225        $this->_e_state = $state;        $this->_e_state = $state;
226    
227      } else {      } else {
228        $this->get_page_state();        $this->get_page_state();
229        $this->_e_state = $this->_state[options][options];        $this->_e_state = $this->_state[options][options];
230    
231      }      }
232      //  print "Setting Explorer state:" . Dumper($this->_e_state);       // print "Setting Explorer state:" . Dumper($this->_e_state);
233    }    }
234    
235    function set_page_state() {    function set_page_state() {
# Line 267  class WebExplorer_AbstractExplorer { Line 284  class WebExplorer_AbstractExplorer {
284            
285      // that's better ...      // that's better ...
286      $this->_load_ecom($label, $args);      $this->_load_ecom($label, $args);
287            
288            //print "getEcom_args: " .Dumper($args). "<br>";
289            
290      return $this->_ecom[$label];      return $this->_ecom[$label];
291            
292    }    }
# Line 345  class WebExplorer_AbstractExplorer { Line 365  class WebExplorer_AbstractExplorer {
365        if($ecom_state['ecom_abstract_type'] == "list") {        if($ecom_state['ecom_abstract_type'] == "list") {
366          $hidden_items = array(          $hidden_items = array(
367                                    'ecl' => $label,                                    'ecl' => $label,
368                                    'ecat' => "item",                                    'ecat' => "list",
369                                    'ecmod' => "view",                                    'ecmod' => "view",
370                                    'ecdm' => $ecom_state['ecom_data_ident'],                                    'ecdid' => $ecom_state['ecom_data_ident'],
371                                    );                                    );
372        }        }
373        elseif($ecom_state['ecom_abstract_type'] == "item") {        elseif($ecom_state['ecom_abstract_type'] == "item") {
# Line 392  class WebExplorer_AbstractExplorer { Line 412  class WebExplorer_AbstractExplorer {
412        }        }
413      }      }
414        // add page idents        // add page idents
415              
416              //print "-e-state-idents: " .Dumper($this->_e_state[idents]). "<br>";
417              
418        foreach($this->_e_state[idents] as $label => $value) {        foreach($this->_e_state[idents] as $label => $value) {
419          $hidden_items[$label] = $value;          $hidden_items[$label] = $value;
420        }        }
# Line 402  class WebExplorer_AbstractExplorer { Line 425  class WebExplorer_AbstractExplorer {
425    
426    function _prepare_component_args($label, $args = array()) {        function _prepare_component_args($label, $args = array()) {    
427      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
428    //print "val: " .Dumper($val). "<br>";
429      // pre-flight checks      // pre-flight checks
430      if (!$val['ecom_data_locator_key']) {      if (!$val['ecom_data_locator_key']) {
431        user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'.");        user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'.");
# Line 420  class WebExplorer_AbstractExplorer { Line 443  class WebExplorer_AbstractExplorer {
443    
444      // trace      // trace
445      //print "YAI1<br/>";      //print "YAI1<br/>";
446      //print Dumper($val);      
447            
448      $this->set_data_locator($val['ecom_data_locator_key']);      $this->set_data_locator($val['ecom_data_locator_key']);
449    
# Line 438  class WebExplorer_AbstractExplorer { Line 461  class WebExplorer_AbstractExplorer {
461      if($val['ecom_type'] == "data") {      if($val['ecom_type'] == "data") {
462        // switch abstract type        // switch abstract type
463        if($val['ecom_abstract_type'] == "list") {        if($val['ecom_abstract_type'] == "list") {
464                    // debugging
465            //print "Mode: $val[ecom_mode], type: list<br>";
466            //print "val: " .Dumper($val). "<br>";
467            
468          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
469            //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);            //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
470            $data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'list', nodename => $val['ecom_data_ident'], list_meta => $val['ecom_data_meta']);  
471                $data_locator_meta = array(
472                  transport => 'rpc',
473                  metatype => 'data',
474                  abstract_type => 'list',
475                  nodename => $val['ecom_data_ident'],
476                  list_meta => $val['ecom_data_meta']
477                );
478          } else {          } else {
479            user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");            user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
480          }          }
481            
482            if($val['ecom_mode'] == 'select') {        
483              $actionbar = array(
484                     'buttons' => array(
485                                   array(
486                                     'name' => "ecdfsel",
487                                     'value' => "Select"
488                                   ),
489                                 ),
490                         );
491            } else {        
492              $actionbar = array(
493                     'name' => "ecdfa",
494                     'list' => array(
495                                                                                                   "View" => 'view',
496                                                                                                   "Edit" => 'edit',
497                                 "Delete" => 'delete',
498                                 "Expand" => 'expand',
499                                 "Expandedit" => 'expandedit',                                                
500                               ),
501                     'selected' => 'view',
502                     'buttons' => array(
503                                   array(
504                                     'name' => "ecdfcr",
505                                     'value' => "Add new"
506                                   ),
507                                 ),
508                         );
509            }
510            
511          $args = array(          $args = array(
512                        'caption' => $val['ecom_data_ident'],                        'caption' => $val['ecom_data_ident'],
513                        'orderby' => "Guid",                        'orderby' => "Guid",
# Line 454  class WebExplorer_AbstractExplorer { Line 518  class WebExplorer_AbstractExplorer {
518                                                'seperator' => "_",                                                'seperator' => "_",
519                                                //'form' => 1,                                                //'form' => 1,
520                                                ),                                                ),
521                                            'actionbar' => array(                                            'actionbar' => $actionbar,
                                               'name' => "ecdfa",  
                                               'list' => array(  
                                                   "View" => 'view',  
                                                   "Edit" => 'edit',  
                                                   "Delete" => 'delete',  
                                                   ),  
                                               'selected' => 'view',  
                                               'create' => array(  
                                                    'name' => "ecdfcr",  
                                                    'value' => "Add new"  
                                                    ),  
                                               ),  
522                                            'parent' => array(                                            'parent' => array(
523                                                'class' => $val['ecom_data_ident'],                                                'class' => $val['ecom_data_ident'],
524                                                ),                                                ),
525                                            ),                                            ),
526                        );                        );
527               if($val['ecom_data_meta_x']) {
528                 //unset($args['options']['data_locator_meta']['nodename']);
529                 $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta'];
530                 $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];
531               }
532                
533        // switch abstract type        // switch abstract type
534        } elseif ($val['ecom_abstract_type'] == "item") {        } elseif ($val['ecom_abstract_type'] == "item") {
# Line 500  class WebExplorer_AbstractExplorer { Line 557  class WebExplorer_AbstractExplorer {
557          // NEW [2003-04-22]: append some more meta information to the caption          // NEW [2003-04-22]: append some more meta information to the caption
558          //$caption_addendum = ' {' . $val['ecom_data_meta'] . '}';          //$caption_addendum = ' {' . $val['ecom_data_meta'] . '}';
559          $caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}';          $caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}';
560                            
561          // prepare some arguments...          // prepare some arguments...
562          $args = array(          $args = array(
563                        'caption' => $val['ecom_data_ident'] . $caption_addendum,                        'caption' => $val['ecom_data_ident'] . $caption_addendum,
# Line 523  class WebExplorer_AbstractExplorer { Line 580  class WebExplorer_AbstractExplorer {
580           //if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; }           //if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; }
581           if ($val['ecom_mode'] == "delete") {           if ($val['ecom_mode'] == "delete") {
582             $args['adapter'] = 'NonValidatingFormProcessor';             $args['adapter'] = 'NonValidatingFormProcessor';
583               $args['options']['data_locator_meta']['action'] = 'delete';
584           }           }
585    
586           if ($val['ecom_mode'] == "create") {           if ($val['ecom_mode'] == "create") {
587             $args['adapter'] = 'FormProcessor';             $args['adapter'] = 'FormProcessor';
588             $args['options']['caption'] = $val['ecom_data_ident'];             $args['options']['caption'] = $val['ecom_data_ident'];
589             $args['options']['data_locator_meta']['action'] = 'create';             $args['options']['data_locator_meta']['action'] = 'create';
590             print "debug 'create': " . Dumper($val);             //print "debug 'create': " . Dumper($val);
591             if($val['ecom_data_meta_x']) {             if($val['ecom_data_meta_x']) {
592               unset($args['options']['data_locator_meta']['nodename']);               unset($args['options']['data_locator_meta']['nodename']);
593               $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta'];               $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta'];
594               $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];               $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];
595             }             }
596           }           }
597             if ($val['ecom_mode'] == "select") {
598               $args['adapter'] = 'FormProcessor';
599               $args['caption'] = $val['ecom_data_meta_xe'] . " {". $val['ecom_data_meta_x'] . ":}";
600               $args['options']['data_locator_meta']['action'] = 'select';
601               //print "debug 'select': " . Dumper($val);
602               if($val['ecom_data_meta_x']) {
603                 $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta_xe'];
604                 $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];
605               }
606             }
607    
608             //print "debug 'args' : " . Dumper($args);
609                    
610        // switch abstract type        // switch abstract type
611        } elseif ($val['ecom_abstract_type'] == "tree") {        } elseif ($val['ecom_abstract_type'] == "tree") {
# Line 555  class WebExplorer_AbstractExplorer { Line 625  class WebExplorer_AbstractExplorer {
625            );            );
626          }          }
627    
628          // NEW [2003-09-26]: transparent content - argument pass-through mode
629          } elseif ($val['ecom_abstract_type'] == "transparent") {
630            
631            // You are responsible for all arguments passed through.
632            // Where are these arguments from?
633            // They are propagated transparently to this place from a new optional
634            // parameter ($args) introduced for the methods 'get_com', 'load_com'
635            // and '_prepare_component_args' (this one).
636            // This means full control over ecoms from outside.
637            
638            // TODO: maybe add some additional pre-flight checks here!?
639          
640          // croak
641        } else {        } else {
642          user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");          user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
643                    
# Line 606  class WebExplorer_AbstractExplorer { Line 689  class WebExplorer_AbstractExplorer {
689    
690        // NEW [2003-04-18]: transparent nav - argument pass-through mode        // NEW [2003-04-18]: transparent nav - argument pass-through mode
691        } elseif ($val['ecom_abstract_type'] == "transparent") {        } elseif ($val['ecom_abstract_type'] == "transparent") {
           
692          // You are responsible for all arguments passed through.          // You are responsible for all arguments passed through.
693          // Where are these arguments from?          // Where are these arguments from?
694          // They are propagated transparently to this place from a new optional          // They are propagated transparently to this place from a new optional
# Line 615  class WebExplorer_AbstractExplorer { Line 697  class WebExplorer_AbstractExplorer {
697          // This means full control over ecoms from outside.          // This means full control over ecoms from outside.
698                    
699          // TODO: maybe add some additional pre-flight checks here!?          // TODO: maybe add some additional pre-flight checks here!?
         
700        // croak        // croak
701        } else {        } else {
702          user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");          user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
# Line 651  class WebExplorer_AbstractExplorer { Line 732  class WebExplorer_AbstractExplorer {
732    
733      // NEW[2003-04-18]: add hidden items to args      // NEW[2003-04-18]: add hidden items to args
734      $args['hidden_elements'] = $this->_get_hidden_items($label);      $args['hidden_elements'] = $this->_get_hidden_items($label);
735            //print "args_hidden: " .Dumper($args['hidden_elements']). "<br>";
736      return $args;      return $args;
737    }    }
738    
# Line 718  class WebExplorer_AbstractExplorer { Line 799  class WebExplorer_AbstractExplorer {
799  }  }
800    
801    
 ?>  
802    ?>

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.27

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