/[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.14 by jonen, Wed Apr 9 00:31:27 2003 UTC revision 1.26 by jonen, Sun Dec 14 01:50:30 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.26  2003/12/14 01:50:30  jonen
8    ##    implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes
9    ##
10    ##    Revision 1.25  2003/11/22 18:47:49  udo
11    ##    update for expand data item
12    ##
13    ##    Revision 1.24  2003/07/02 11:39:16  jonen
14    ##    fixed bugs
15    ##
16    ##    Revision 1.23  2003/06/06 11:57:20  joko
17    ##    minor update: cosmetic changes
18    ##
19    ##    Revision 1.22  2003/05/13 14:50:27  joko
20    ##    HACKed compatibility for config-type data sources
21    ##    + function get_data_filter
22    ##
23    ##    Revision 1.21  2003/05/10 18:23:21  jonen
24    ##    + added stuff relating to 'create/add new' links/buttons
25    ##
26    ##    Revision 1.20  2003/04/19 16:24:49  jonen
27    ##    + added two more GUI modules to default registry initiation,
28    ##       relating to new navigation module 'NavigationTree'
29    ##    + added prepartion of needed args for abstract navigation tree
30    ##       and concret UserManagment 'UMnav' tree
31    ##
32    ##    Revision 1.19  2003/04/18 16:21:37  joko
33    ##    fixed commit comment - the last one caused a syntax error!!!
34    ##
35    ##    Revision 1.18  2003/04/18 15:27:06  joko
36    ##    NEW: XML Trees in data area
37    ##      new ecom module: DataTree
38    ##      introduced new query argument: 'filter' (purpose: xml/tree filtering)
39    ##        $filter = array(
40    ##          dotted => $val['ecom_data_filter'],
41    ##          ident => $val['ecom_data_ident'],
42    ##        );
43    ##        A Data::Lift module translates this filter-query into a XPath-query ...
44    ##        $filter = array(
45    ##          xpq => '*\/*[@name="cli"]',
46    ##        );
47    ##        ... which finally is propagated to the backend.
48    ##    NEW: AbstractExplorer - standalone version
49    ##      enhanced set_e_state: now can overwrite internal state to arguments from outside
50    ##      enhanced get_com: also capable of propagating additional args through _load_ecom to _prepare_component_args
51    ##      enhanced _prepare_component_args: now able to dispatch to a "transparent navigation ecom" (e.g. YAA::JobGroups)
52    ##    MISC:
53    ##      added some pre-flight checks throughout the module, especially at the core dispatcher inside _prepare_component_args
54    ##      error checking: added some more croaks via 'user_error'
55    ##      cosmetic updates
56    ##
57    ##    Revision 1.17  2003/04/18 13:46:15  jonen
58    ##    + add hidden elements(items) now to the constructor arguments of each ecom
59    ##
60    ##    Revision 1.16  2003/04/10 06:00:58  joko
61    ##    ALPHA: Item.Delete
62    ##
63    ##    Revision 1.15  2003/04/09 02:08:20  joko
64    ##    CHANGE: renamed key 'classname' through 'nodename'
65    ##
66  ##    Revision 1.14  2003/04/09 00:31:27  jonen  ##    Revision 1.14  2003/04/09 00:31:27  jonen
67  ##    + added arguments for data list ecom  ##    + added arguments for data list ecom
68  ##  ##
# Line 111  class WebExplorer_AbstractExplorer { Line 170  class WebExplorer_AbstractExplorer {
170      $this->set_e_state();      $this->set_e_state();
171    
172      //debug      //debug
173      //print "State: " . Dumper($this->_state) ."<br>";  //    print "State: " . Dumper($this->_state) ."<br>";
174        //print "_data_locators: " . Dumper($this->_data_locators) ."<br>";
175      $div = html_div();      $div = html_div();
176      $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));
177      $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 127  class WebExplorer_AbstractExplorer { Line 187  class WebExplorer_AbstractExplorer {
187        
188    function set_data_locator($label, $new_args=array() ) {    function set_data_locator($label, $new_args=array() ) {
189      global $app;      global $app;
190      //print Dumper($app) . "<br>";      
191      if($label == "rpc") {      // pre-flight checks
192        if (!$label) {
193          user_error("AbstractExplorer::set_data_locator - label was empty.");
194          return;
195        }
196        
197        if ($label == "rpc") {
198        $rpcinfo = $app->getConfig("rpcinfo");        $rpcinfo = $app->getConfig("rpcinfo");
199        define('RPC_HOSTNAME', $rpcinfo[Host]);        define('RPC_HOSTNAME', $rpcinfo[Host]);
200        define('RPC_PORT', $rpcinfo[Port]);        define('RPC_PORT', $rpcinfo[Port]);
# Line 136  class WebExplorer_AbstractExplorer { Line 202  class WebExplorer_AbstractExplorer {
202        define('RPC_TRACE', $rpcinfo[TRACE]);        define('RPC_TRACE', $rpcinfo[TRACE]);
203        define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]);        define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]);
204      } else {      } else {
205        user_error("AbstractExplorer::set_data_locator - data_locator_key label $label not found!");        user_error("AbstractExplorer::set_data_locator - Could not dispatch data_locator_key label '$label'!");
206      }      }
207    }    }
208        
# Line 148  class WebExplorer_AbstractExplorer { Line 214  class WebExplorer_AbstractExplorer {
214      $this->_state = $requestTracker->getPointer();      $this->_state = $requestTracker->getPointer();
215    }    }
216        
217    function set_e_state() {    function set_e_state($state = null) {
218      $this->get_page_state();      // NEW [2003-04-18]: now has two modes
219      $this->_e_state = $this->_state[options][options];      // 1. inject page state from argument passed to us
220        // 2. (was) get page state from request tracker
221        if ($state) {
222          $this->_e_state = $state;
223    
224        } else {
225          $this->get_page_state();
226          $this->_e_state = $this->_state[options][options];
227    
228        }
229         // print "Setting Explorer state:" . Dumper($this->_e_state);
230    }    }
     
231    
232    function set_page_state() {    function set_page_state() {
233      user_error("AbstractExplorer::set_page_state - please implement me....");          user_error("AbstractExplorer::set_page_state - please implement me....");    
234    }    }
     
235    
236    function init_default_gui_modules() {    function init_default_gui_modules() {
237            
238      // format of parameters: label, ecom_type, abstract_type, module_name      // format of parameters: label, ecom_type, abstract_type, module_name
239            
240        // 2003-03-02 - First ecom modules/components
241      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );
242      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );
243      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );
244      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );
245      // 2003-04-05 - Chooser      
246      $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");          // 2003-04-05 - Chooser (a Nav.List)
247        $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");
248        
249      // 2003-04-07 - RemoteAction      // 2003-04-07 - RemoteAction
250      $this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction");          $this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction");
251        
252        // 2003-04-09 - Data.Item: DeleteAction
253        $this->register_gui_module("phase_startup", "data", "item", "WebExplorer::Module::DataItem");
254        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::RemoteAction");
255        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::DataItem");
256        
257        // 2003-04-12 - Data.Tree
258        $this->register_gui_module("content", "data", "tree", "WebExplorer::Module::DataTree" );
259        
260        // 2003-04-18 - Nav.Tree
261        $this->register_gui_module("nav", "nav", "tree", "WebExplorer::Module::NavigationTree" );
262    
263        // 2003-04-18 - UserManagment Nav.Tree (we need only a different 'label' as Nav.Tree yet..)
264        $this->register_gui_module("UMnav", "nav", "tree", "WebExplorer::Module::NavigationTree" );
265    
266    }    }
267    
268    function register_source_module($label, $args) {    function register_source_module($label, $args) {
# Line 182  class WebExplorer_AbstractExplorer { Line 274  class WebExplorer_AbstractExplorer {
274    }    }
275    
276    
277    function &get_ecom($label) {    function &get_ecom($label, $args = array()) {
278        
279        // the very first - strongly hardcoded - Hello World ecom
280      //return "Hello World";      //return "Hello World";
281      $this->_load_ecom($label);      
282        // that's better ...
283        $this->_load_ecom($label, $args);
284            
285            //print "getEcom_args: " .Dumper($args). "<br>";
286            
287      return $this->_ecom[$label];      return $this->_ecom[$label];
288        
289    }    }
290    
   
291        
292    function _load_ecoms() {    function _load_ecoms() {
293      //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");      //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");
# Line 199  class WebExplorer_AbstractExplorer { Line 298  class WebExplorer_AbstractExplorer {
298    
299    
300        
301    function _load_ecom($label) {    function _load_ecom($label, $args = array()) {
302        
303      // fetch values from state      // fetch values from state
304      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
305      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");
306    
307        // NEW [2003-04-10]: ecom-RESET-condition
308        if (!is_array($val) && $val == 'RESET') {
309          debug::info("Resetting component: $label");
310          return;
311        }
312    
313      // find right ecom gui module      // find right ecom gui module
314      $ecom_type = $val['ecom_type'];      $ecom_type = $val['ecom_type'];
315      $abstract_type = $val['ecom_abstract_type'];      $abstract_type = $val['ecom_abstract_type'];
316      $gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type];      $gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type];
317      //print Dumper($gui_module);      //print Dumper($gui_module);
318      if(!$gui_module) {      if(!$gui_module) {
319        user_error("AbstractExplorer::_load_component - No GUI module found. [label='$label', abstract type='$val[ecom_abstract_type]', ecom type='$val[ecom_type]']");        user_error("_load_ecom: No GUI module found for [label='$label', ecom type='$val[ecom_type]', abstract type='$val[ecom_abstract_type]'].");
320        return;        return;
321      }      }
322    
323      // get arguments needed for ecom gui module      // get arguments needed for ecom gui module
324      $args = $this->_prepare_component_args($label);      $args = $this->_prepare_component_args($label, $args);
325      //print Dumper($args);      
326        // trace
327        //print "raw-args: " . Dumper($args) . "<br/>";
328            
329      // get ecom GUI module      // get ecom GUI module
330      if (!$ecom = php::mkComponent($gui_module, $args)) {      if (!$ecom = php::mkComponent($gui_module, $args)) {
331          user_error("AbstractExplorer::_load_component - Error while instantiating ecom gui component. [label='$label', abstract type='$val[ecom_abstract_type]', ecom type='$val[ecom_type]']");
332        return;        return;
333      }      }
334      //print Dumper($ecom);      //print Dumper($ecom);
335                
336      // load phphtmllib GUI object      // NEW[2003-04-18] done via args(prepare args!) passed at constructor
337      $gui_ecom = &$ecom->get();      //  (needed for non-real objects instanced at some child of AbstractGUIModule, eg. NavigationList)
338    /*
339      // add hidden vars, needed for explorer control      // add hidden vars, needed for explorer control
340      $hidden_items = $this->_get_hidden_items($label);      $hidden_items = $this->_get_hidden_items($label);
341      if(is_array($hidden_items) ) {      if(is_array($hidden_items) ) {
342        $ecom->add_hidden_items($hidden_items);        $ecom->add_hidden_items($hidden_items);
343        //print "Hidden: " . Dumper($hidden_items);        print "Hidden: " . Dumper($hidden_items);
344      }      }
345    */
346    
347        // load phphtmllib GUI object
348        $gui_ecom = &$ecom->get();
349    
350      // attempt:      // attempt:
351      //$gui_ecom->make_transparent();      //$gui_ecom->make_transparent();
# Line 249  class WebExplorer_AbstractExplorer { Line 362  class WebExplorer_AbstractExplorer {
362        if($ecom_state['ecom_abstract_type'] == "list") {        if($ecom_state['ecom_abstract_type'] == "list") {
363          $hidden_items = array(          $hidden_items = array(
364                                    'ecl' => $label,                                    'ecl' => $label,
365                                    'ecat' => "item",                                    'ecat' => "list",
366                                    'ecmod' => "view",                                    'ecmod' => "view",
367                                      'ecdid' => $ecom_state['ecom_data_ident'],
368                                    );                                    );
369        }        }
370        elseif($ecom_state['ecom_abstract_type'] == "item") {        elseif($ecom_state['ecom_abstract_type'] == "item") {
# Line 259  class WebExplorer_AbstractExplorer { Line 373  class WebExplorer_AbstractExplorer {
373                                    'ecat' => "item",                                    'ecat' => "item",
374                                    'ecmod' => "view",                                    'ecmod' => "view",
375                                    );                                    );
 /*  
         if($ecom_state['ecom_mode'] == "view") {  
           $hidden_items['ecmod'] = "edit";  
         }  
         elseif($ecom_state['ecom_mode'] == "edit") {  
           $hidden_items['ecmod'] = "edit";  
         }  
 */        
376        }        }
       $hidden_items['ap'] = "explorer";  
377      }      }
378        elseif($ecom_state['ecom_type'] == "nav") {
379          // Switching abstract make no real sense here,
380          // because hidden_items(link_vars) for Naviagtion-Ecoms
381          // are more label specified!!
382          // OLD:
383          //if($ecom_state['ecom_abstract_type'] == "list") {
384          
385          // decide whether to link to items or to a list
386          $abstract_type = 'list';
387          // FIXME: HACK
388          if ($this->_e_state[main][ecom_data_source_key] == 'config') {
389            $abstract_type = 'item';
390          }
391          
392          // NEW:
393          if ($label == "nav") {
394            $hidden_items = array(
395                                      'ecl' => "content",
396                                      'ecat' => $abstract_type,
397                                      'ecmod' => "view",
398                                      'ect' => "data",
399                                      'ecdlk' => "rpc",
400                                     );
401    
402          }
403          elseif ($label == "chooser") {
404            $hidden_items = array(
405                                      'ecl' => "phase_startup",
406                                      'ecdlk' => "rpc",
407                                     );
408    
409          }
410        }
411          // add page idents
412              
413              //print "-e-state-idents: " .Dumper($this->_e_state[idents]). "<br>";
414              
415          foreach($this->_e_state[idents] as $label => $value) {
416            $hidden_items[$label] = $value;
417          }
418      return $hidden_items;      return $hidden_items;
419    }    }
420    
421    
422    
423    function _prepare_component_args($label) {        function _prepare_component_args($label, $args = array()) {    
424      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
425    //print "val: " .Dumper($val). "<br>";
426        // pre-flight checks
427        if (!$val['ecom_data_locator_key']) {
428          user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'.");
429          return;
430        }
431    
432        if (!$val['ecom_type']) {
433          user_error("WebExplorer::AbstractExplorer: Key 'ecom_type' was empty, should be one of 'data|nav|call'.");
434        }
435    
436        if (!$val['ecom_abstract_type']) {
437          user_error("_prepare_component_args: Key 'ecom_abstract_type' was empty, should be one of 'item|list|tree|auto'.");
438          return;
439        }
440    
441        // trace
442        //print "YAI1<br/>";
443        
444        
445      $this->set_data_locator($val['ecom_data_locator_key']);      $this->set_data_locator($val['ecom_data_locator_key']);
446    
447      // detect and execute 'selectSource' action      // detect and execute 'selectSource' action
# Line 293  class WebExplorer_AbstractExplorer { Line 458  class WebExplorer_AbstractExplorer {
458      if($val['ecom_type'] == "data") {      if($val['ecom_type'] == "data") {
459        // switch abstract type        // switch abstract type
460        if($val['ecom_abstract_type'] == "list") {        if($val['ecom_abstract_type'] == "list") {
461                    // debugging
462            //print "Mode: $val[ecom_mode], type: list<br>";
463            //print "val: " .Dumper($val). "<br>";
464            
465          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
466            //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', classname => $val['ecom_data_ident']);            //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
467            $data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'list', classname => $val['ecom_data_ident']);  
468                $data_locator_meta = array(
469                  transport => 'rpc',
470                  metatype => 'data',
471                  abstract_type => 'list',
472                  nodename => $val['ecom_data_ident'],
473                  list_meta => $val['ecom_data_meta']
474                );
475          } else {          } else {
476            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] !");
477          }          }
478            
479            if($val['ecom_mode'] == 'select') {        
480              $actionbar = array(
481                     'buttons' => array(
482                                   array(
483                                     'name' => "ecdfsel",
484                                     'value' => "Select"
485                                   ),
486                                 ),
487                         );
488            } else {        
489              $actionbar = array(
490                     'name' => "ecdfa",
491                     'list' => array(
492                                                                                                   "View" => 'view',
493                                                                                                   "Edit" => 'edit',
494                                 "Delete" => 'delete',
495                                 "Expand" => 'expand',
496                                 "Expandedit" => 'expandedit',                                                
497                               ),
498                     'selected' => 'view',
499                     'buttons' => array(
500                                   array(
501                                     'name' => "ecdfcr",
502                                     'value' => "Add new"
503                                   ),
504                                 ),
505                         );
506            }
507            
508          $args = array(          $args = array(
509                        'caption' => $val['ecom_data_ident'],                        'caption' => $val['ecom_data_ident'],
510                        'orderby' => "Guid",                        'orderby' => "Guid",
# Line 309  class WebExplorer_AbstractExplorer { Line 515  class WebExplorer_AbstractExplorer {
515                                                'seperator' => "_",                                                'seperator' => "_",
516                                                //'form' => 1,                                                //'form' => 1,
517                                                ),                                                ),
518                                            'actionbar' => array(                                            'actionbar' => $actionbar,
519                                                'name' => "ecdfa",                                            'parent' => array(
520                                                'list' => array(                                                'class' => $val['ecom_data_ident'],
                                                   "View" => 'view',  
                                                   "Edit" => 'edit',  
                                                   "Delete" => 'delete',  
                                                   "Add new" => 'add',  
                                                   ),  
521                                                ),                                                ),
522                                            ),                                            ),
523                        );                        );
524               if($val['ecom_data_meta_x']) {
525                 //unset($args['options']['data_locator_meta']['nodename']);
526                 $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta'];
527                 $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];
528               }
529          
530        // switch abstract type        // switch abstract type
531        } elseif ($val['ecom_abstract_type'] == "item") {        } elseif ($val['ecom_abstract_type'] == "item") {
532          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
533            //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', classname => $val['ecom_data_ident']);            //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
534            $data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'item', ident => $val['ecom_data_ident'], classname => $val['ecom_data_meta']);            
535              // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
536              $filter = $this->get_data_filter($val);
537              
538              $data_locator_meta = array(
539                transport => 'rpc', metatype => 'data', abstract_type => 'item',
540                ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], filter => $filter,
541              );
542          } else {          } else {
543            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] !");
544          }          }
545          if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }          
546            // defaults
547            if (!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
548            //$val['ecom_mode'] = "view";
549            
550            // debugging
551          print "Mode: $val[ecom_mode]<br>";          print "Mode: $val[ecom_mode]<br>";
552            
553            //print Dumper($val);
554            // NEW [2003-04-22]: append some more meta information to the caption
555            //$caption_addendum = ' {' . $val['ecom_data_meta'] . '}';
556            $caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}';
557                    
558            // prepare some arguments...
559          $args = array(          $args = array(
560                        'caption' => $val['ecom_data_meta'],                        'caption' => $val['ecom_data_ident'] . $caption_addendum,
561                        'mode' => $val['ecom_mode'],                        'mode' => $val['ecom_mode'],
562                        'options' => array(                        'options' => array(
563                                            'data_locator_meta' => $data_locator_meta,                                              'data_locator_meta' => $data_locator_meta,
564                                            'decode' => 1,                                              'decode' => 1,
565                                            'decode_args' => array(                                              'decode_args' => array(
566                                                'seperator' => "_",                                                'seperator' => "_",
567                                                ),                                                ),
568                                            ),                                              'parent' => array(
569                                                    'guid' => $val['ecom_data_ident'],
570                                                    'class' => $val['ecom_data_meta'],
571                                                    ),
572                                                ),
573                        );                        );
574           if($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }           if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }
575            
576             // FIXME: (see WebExplorer::Module::AbstractGUIModule)
577             //if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; }
578             if ($val['ecom_mode'] == "delete") {
579               $args['adapter'] = 'NonValidatingFormProcessor';
580             }
581    
582             if ($val['ecom_mode'] == "create") {
583               $args['adapter'] = 'FormProcessor';
584               $args['options']['caption'] = $val['ecom_data_ident'];
585               $args['options']['data_locator_meta']['action'] = 'create';
586               //print "debug 'create': " . Dumper($val);
587               if($val['ecom_data_meta_x']) {
588                 unset($args['options']['data_locator_meta']['nodename']);
589                 $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta'];
590                 $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];
591               }
592             }
593             if ($val['ecom_mode'] == "select") {
594               $args['adapter'] = 'FormProcessor';
595               $args['caption'] = $val['ecom_data_meta_xe'] . " {". $val['ecom_data_meta_x'] . ":}";
596               $args['options']['data_locator_meta']['action'] = 'select';
597               //print "debug 'select': " . Dumper($val);
598               if($val['ecom_data_meta_x']) {
599                 $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta_xe'];
600                 $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];
601               }
602             }
603    
604             //print "debug 'args' : " . Dumper($args);
605            
606          // switch abstract type
607          } elseif ($val['ecom_abstract_type'] == "tree") {
608    
609            // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
610            $filter = $this->get_data_filter($val);
611            
612            // FIXME: shouldn't this (dispatching by transport-key) be done very *outside* of this scope?
613            // or: do it outside per default, let a possibility to modify it inside the lower levels of the dispatcher (here)
614            if ($val['ecom_data_locator_key'] == "rpc") {
615              //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
616              $args[options][data_locator_meta] = array(
617                transport => 'rpc', metatype => 'data', abstract_type => 'tree',
618                ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'],
619                // NEW [2003-04-22]: Full tree node filtering established.
620                filter => $filter
621              );
622            }
623    
624          // NEW [2003-09-26]: transparent content - argument pass-through mode
625          } elseif ($val['ecom_abstract_type'] == "transparent") {
626            
627            // You are responsible for all arguments passed through.
628            // Where are these arguments from?
629            // They are propagated transparently to this place from a new optional
630            // parameter ($args) introduced for the methods 'get_com', 'load_com'
631            // and '_prepare_component_args' (this one).
632            // This means full control over ecoms from outside.
633            
634            // TODO: maybe add some additional pre-flight checks here!?
635          
636          // croak
637          } else {
638            user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
639            
640        }        }
641            
642      // switch component type      // switch component type
643      } elseif ($val['ecom_type'] == "nav") {      } elseif ($val['ecom_type'] == "nav") {
644          
645        // switch abstract type        // switch abstract type
646        if($val['ecom_abstract_type'] == "list") {        // list
647          if ($val['ecom_abstract_type'] == "list") {
648         $args = array();         $args = array();
649          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
650              
651            // switch component label            // switch component label
652            if($label == "nav") {            // TODO: should we really dispatch by label inside here?
653              
654              if ($label == "nav") {
655              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
656              $args['caption'] = "Objekt Typen";              $args['caption'] = "Objekt Typen";
657            }            }
# Line 360  class WebExplorer_AbstractExplorer { Line 660  class WebExplorer_AbstractExplorer {
660              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' );              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' );
661              $args['caption'] = "Datenquellen";              $args['caption'] = "Datenquellen";
662            }            }
663              // NEW [2003-04-18]: croak if label empty
664              else {
665                user_error("_prepare_component_args: Dispatching for nav.list.rpc failed. \$label was empty.");
666              }
667            $args['options']['data_locator_meta'] = $data_locator_meta;            $args['options']['data_locator_meta'] = $data_locator_meta;
668              
669          } else {          } else {
670            user_error("AbstractExplorer::_prepare_component_args - Cannot build schema query for data_locator_key $val[ecom_data_locator_key] !");            user_error("AbstractExplorer::_prepare_component_args - Cannot build schema query for data_locator_key $val[ecom_data_locator_key] !");
671          }          }
672          
673          // NEW [2003-04-18]: Abstract navigation tree
674        } elseif ($val['ecom_abstract_type'] == "tree") {        } elseif ($val['ecom_abstract_type'] == "tree") {
675          $args = array();          $args = array();
676            if($label == "nav") {
677              //$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
678              $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
679              $args['caption'] = $val['ecom_data_source_key'];
680            } elseif($label == "UMnav") {
681              //$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
682              $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'method', method => 'UserManagmentSchema' );
683              $args['caption'] = "Benutzerverwaltung";
684            }
685    
686          // NEW [2003-04-18]: transparent nav - argument pass-through mode
687          } elseif ($val['ecom_abstract_type'] == "transparent") {
688            // You are responsible for all arguments passed through.
689            // Where are these arguments from?
690            // They are propagated transparently to this place from a new optional
691            // parameter ($args) introduced for the methods 'get_com', 'load_com'
692            // and '_prepare_component_args' (this one).
693            // This means full control over ecoms from outside.
694            
695            // TODO: maybe add some additional pre-flight checks here!?
696          // croak
697          } else {
698            user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
699        }        }
700    
701      // NEW [2003-04-08]: RemoteAction (e.g.: result of a selection inside a Chooser)      // NEW [2003-04-08]: RemoteAction (e.g.: result of a selection inside a Chooser)
# Line 393  class WebExplorer_AbstractExplorer { Line 723  class WebExplorer_AbstractExplorer {
723          // FIXME: implement automatic re-dispatching to available ecoms here!          // FIXME: implement automatic re-dispatching to available ecoms here!
724          user_error("WebExplorer::AbstractExplorer: results of RemoteActions can only be handled automatically. Who knows what comes back?");          user_error("WebExplorer::AbstractExplorer: results of RemoteActions can only be handled automatically. Who knows what comes back?");
725        }              }      
726        
727      }      }
728    
729        // NEW[2003-04-18]: add hidden items to args
730        $args['hidden_elements'] = $this->_get_hidden_items($label);
731            //print "args_hidden: " .Dumper($args['hidden_elements']). "<br>";
732      return $args;      return $args;
733    }    }
734    
# Line 413  class WebExplorer_AbstractExplorer { Line 747  class WebExplorer_AbstractExplorer {
747      user_error("AbstractExplorer::render - please implement me....");      user_error("AbstractExplorer::render - please implement me....");
748    }    }
749    
750    
751      function get_data_filter($state = array()) {
752    
753        // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
754        // V1: this was inside ecom_abstract_type == item && ecom_data_locator_key == rpc, but ...
755        // V2: ... it should be considered / work independent of these both criterias
756        //       since it is required for showing xml nodes in items (editing) *and* trees again (browsing).
757        
758        if ($filter_expression = $state[ecom_data_filter]) {
759    
760          // new of 2003-05-13: Apply "Node navigation" in tree mode only.
761          // Lock context when switching to item mode.
762          //print Dumper($state);
763          if ($state[ecom_abstract_type] == "tree") {
764            if ($parent_xpq = $state[ecom_data_meta]) {
765              $filter_expression = $parent_xpq . $filter_expression;
766            }
767          }
768    
769          // This propagates a XPath filter expression which fully identifies
770          // a single node in a document. It reaches through all parent nodes.
771          $filter = array(
772            //dotted => $val['ecom_data_filter'],
773            //ident => $val['ecom_data_ident'],
774            //xpq => '*/*[@name="cli"]',
775            //xpq => '*/*',
776            // NEW [2003-04-21]: An xpq is already ready now inside
777            // 'ecdf' since it already has been built by the revamped tree lift.
778            xpq => '*' . $filter_expression
779          );
780    
781        } else {
782          $filter = '';
783        
784        }
785        
786        // lift filter from dotted format to xpq format
787        // NEW [2003-04-21]: not required any more (see above)
788        //$lift = mkObject('Data::Lift', $filter, array( metatype => 'filter' ) );
789        //$filter = $lift->to('XPath');
790        
791        return $filter;
792    
793      }
794    
795  }  }
796    
797    
 ?>  
798    ?>

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.26

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