/[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.15 by joko, Wed Apr 9 02:08:20 2003 UTC revision 1.23 by joko, Fri Jun 6 11:57:20 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.23  2003/06/06 11:57:20  joko
8    ##    minor update: cosmetic changes
9    ##
10    ##    Revision 1.22  2003/05/13 14:50:27  joko
11    ##    HACKed compatibility for config-type data sources
12    ##    + function get_data_filter
13    ##
14    ##    Revision 1.21  2003/05/10 18:23:21  jonen
15    ##    + added stuff relating to 'create/add new' links/buttons
16    ##
17    ##    Revision 1.20  2003/04/19 16:24:49  jonen
18    ##    + added two more GUI modules to default registry initiation,
19    ##       relating to new navigation module 'NavigationTree'
20    ##    + added prepartion of needed args for abstract navigation tree
21    ##       and concret UserManagment 'UMnav' tree
22    ##
23    ##    Revision 1.19  2003/04/18 16:21:37  joko
24    ##    fixed commit comment - the last one caused a syntax error!!!
25    ##
26    ##    Revision 1.18  2003/04/18 15:27:06  joko
27    ##    NEW: XML Trees in data area
28    ##      new ecom module: DataTree
29    ##      introduced new query argument: 'filter' (purpose: xml/tree filtering)
30    ##        $filter = array(
31    ##          dotted => $val['ecom_data_filter'],
32    ##          ident => $val['ecom_data_ident'],
33    ##        );
34    ##        A Data::Lift module translates this filter-query into a XPath-query ...
35    ##        $filter = array(
36    ##          xpq => '*\/*[@name="cli"]',
37    ##        );
38    ##        ... which finally is propagated to the backend.
39    ##    NEW: AbstractExplorer - standalone version
40    ##      enhanced set_e_state: now can overwrite internal state to arguments from outside
41    ##      enhanced get_com: also capable of propagating additional args through _load_ecom to _prepare_component_args
42    ##      enhanced _prepare_component_args: now able to dispatch to a "transparent navigation ecom" (e.g. YAA::JobGroups)
43    ##    MISC:
44    ##      added some pre-flight checks throughout the module, especially at the core dispatcher inside _prepare_component_args
45    ##      error checking: added some more croaks via 'user_error'
46    ##      cosmetic updates
47    ##
48    ##    Revision 1.17  2003/04/18 13:46:15  jonen
49    ##    + add hidden elements(items) now to the constructor arguments of each ecom
50    ##
51    ##    Revision 1.16  2003/04/10 06:00:58  joko
52    ##    ALPHA: Item.Delete
53    ##
54  ##    Revision 1.15  2003/04/09 02:08:20  joko  ##    Revision 1.15  2003/04/09 02:08:20  joko
55  ##    CHANGE: renamed key 'classname' through 'nodename'  ##    CHANGE: renamed key 'classname' through 'nodename'
56  ##  ##
# Line 130  class WebExplorer_AbstractExplorer { Line 177  class WebExplorer_AbstractExplorer {
177        
178    function set_data_locator($label, $new_args=array() ) {    function set_data_locator($label, $new_args=array() ) {
179      global $app;      global $app;
180      //print Dumper($app) . "<br>";      
181      if($label == "rpc") {      // pre-flight checks
182        if (!$label) {
183          user_error("AbstractExplorer::set_data_locator - label was empty.");
184          return;
185        }
186        
187        if ($label == "rpc") {
188        $rpcinfo = $app->getConfig("rpcinfo");        $rpcinfo = $app->getConfig("rpcinfo");
189        define('RPC_HOSTNAME', $rpcinfo[Host]);        define('RPC_HOSTNAME', $rpcinfo[Host]);
190        define('RPC_PORT', $rpcinfo[Port]);        define('RPC_PORT', $rpcinfo[Port]);
# Line 139  class WebExplorer_AbstractExplorer { Line 192  class WebExplorer_AbstractExplorer {
192        define('RPC_TRACE', $rpcinfo[TRACE]);        define('RPC_TRACE', $rpcinfo[TRACE]);
193        define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]);        define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]);
194      } else {      } else {
195        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'!");
196      }      }
197    }    }
198        
# Line 148  class WebExplorer_AbstractExplorer { Line 201  class WebExplorer_AbstractExplorer {
201    
202    function get_page_state() {    function get_page_state() {
203      $requestTracker = mkObject("Application::Request::Tracker");      $requestTracker = mkObject("Application::Request::Tracker");
204        //print Dumper($this->_state);
205      $this->_state = $requestTracker->getPointer();      $this->_state = $requestTracker->getPointer();
206    }    }
207        
208    function set_e_state() {    function set_e_state($state = null) {
209      $this->get_page_state();      // NEW [2003-04-18]: now has two modes
210      $this->_e_state = $this->_state[options][options];      // 1. inject page state from argument passed to us
211        // 2. (was) get page state from request tracker
212        if ($state) {
213          $this->_e_state = $state;
214        } else {
215          $this->get_page_state();
216          $this->_e_state = $this->_state[options][options];
217        }
218        //  print "Setting Explorer state:" . Dumper($this->_e_state);
219    }    }
     
220    
221    function set_page_state() {    function set_page_state() {
222      user_error("AbstractExplorer::set_page_state - please implement me....");          user_error("AbstractExplorer::set_page_state - please implement me....");    
223    }    }
     
224    
225    function init_default_gui_modules() {    function init_default_gui_modules() {
226            
227      // format of parameters: label, ecom_type, abstract_type, module_name      // format of parameters: label, ecom_type, abstract_type, module_name
228            
229        // 2003-03-02 - First ecom modules/components
230      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );
231      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );
232      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );
233      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );
234      // 2003-04-05 - Chooser      
235      $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");          // 2003-04-05 - Chooser (a Nav.List)
236        $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");
237        
238      // 2003-04-07 - RemoteAction      // 2003-04-07 - RemoteAction
239      $this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction");          $this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction");
240        
241        // 2003-04-09 - Data.Item: DeleteAction
242        $this->register_gui_module("phase_startup", "data", "item", "WebExplorer::Module::DataItem");
243        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::RemoteAction");
244        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::DataItem");
245        
246        // 2003-04-12 - Data.Tree
247        $this->register_gui_module("content", "data", "tree", "WebExplorer::Module::DataTree" );
248        
249        // 2003-04-18 - Nav.Tree
250        $this->register_gui_module("nav", "nav", "tree", "WebExplorer::Module::NavigationTree" );
251    
252        // 2003-04-18 - UserManagment Nav.Tree (we need only a different 'label' as Nav.Tree yet..)
253        $this->register_gui_module("UMnav", "nav", "tree", "WebExplorer::Module::NavigationTree" );
254    
255    }    }
256    
257    function register_source_module($label, $args) {    function register_source_module($label, $args) {
# Line 185  class WebExplorer_AbstractExplorer { Line 263  class WebExplorer_AbstractExplorer {
263    }    }
264    
265    
266    function &get_ecom($label) {    function &get_ecom($label, $args = array()) {
267        
268        // the very first - strongly hardcoded - Hello World ecom
269      //return "Hello World";      //return "Hello World";
270      $this->_load_ecom($label);      
271        // that's better ...
272        $this->_load_ecom($label, $args);
273      return $this->_ecom[$label];      return $this->_ecom[$label];
274        
275    }    }
276    
   
277        
278    function _load_ecoms() {    function _load_ecoms() {
279      //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");      //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");
# Line 202  class WebExplorer_AbstractExplorer { Line 284  class WebExplorer_AbstractExplorer {
284    
285    
286        
287    function _load_ecom($label) {    function _load_ecom($label, $args = array()) {
288        
289      // fetch values from state      // fetch values from state
290      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
291      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");
292    
293        // NEW [2003-04-10]: ecom-RESET-condition
294        if (!is_array($val) && $val == 'RESET') {
295          debug::info("Resetting component: $label");
296          return;
297        }
298    
299      // find right ecom gui module      // find right ecom gui module
300      $ecom_type = $val['ecom_type'];      $ecom_type = $val['ecom_type'];
301      $abstract_type = $val['ecom_abstract_type'];      $abstract_type = $val['ecom_abstract_type'];
302      $gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type];      $gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type];
303      //print Dumper($gui_module);      //print Dumper($gui_module);
304      if(!$gui_module) {      if(!$gui_module) {
305        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]'].");
306        return;        return;
307      }      }
308    
309      // get arguments needed for ecom gui module      // get arguments needed for ecom gui module
310      $args = $this->_prepare_component_args($label);      $args = $this->_prepare_component_args($label, $args);
311      //print Dumper($args);      
312        // trace
313        //print "raw-args: " . Dumper($args) . "<br/>";
314            
315      // get ecom GUI module      // get ecom GUI module
316      if (!$ecom = php::mkComponent($gui_module, $args)) {      if (!$ecom = php::mkComponent($gui_module, $args)) {
317          user_error("AbstractExplorer::_load_component - Error while instantiating ecom gui component. [label='$label', abstract type='$val[ecom_abstract_type]', ecom type='$val[ecom_type]']");
318        return;        return;
319      }      }
320      //print Dumper($ecom);      //print Dumper($ecom);
321                
322      // load phphtmllib GUI object      // NEW[2003-04-18] done via args(prepare args!) passed at constructor
323      $gui_ecom = &$ecom->get();      //  (needed for non-real objects instanced at some child of AbstractGUIModule, eg. NavigationList)
324    /*
325      // add hidden vars, needed for explorer control      // add hidden vars, needed for explorer control
326      $hidden_items = $this->_get_hidden_items($label);      $hidden_items = $this->_get_hidden_items($label);
327      if(is_array($hidden_items) ) {      if(is_array($hidden_items) ) {
328        $ecom->add_hidden_items($hidden_items);        $ecom->add_hidden_items($hidden_items);
329        //print "Hidden: " . Dumper($hidden_items);        print "Hidden: " . Dumper($hidden_items);
330      }      }
331    */
332    
333        // load phphtmllib GUI object
334        $gui_ecom = &$ecom->get();
335    
336      // attempt:      // attempt:
337      //$gui_ecom->make_transparent();      //$gui_ecom->make_transparent();
# Line 254  class WebExplorer_AbstractExplorer { Line 350  class WebExplorer_AbstractExplorer {
350                                    'ecl' => $label,                                    'ecl' => $label,
351                                    'ecat' => "item",                                    'ecat' => "item",
352                                    'ecmod' => "view",                                    'ecmod' => "view",
353                                      'ecdm' => $ecom_state['ecom_data_ident'],
354                                    );                                    );
355        }        }
356        elseif($ecom_state['ecom_abstract_type'] == "item") {        elseif($ecom_state['ecom_abstract_type'] == "item") {
# Line 262  class WebExplorer_AbstractExplorer { Line 359  class WebExplorer_AbstractExplorer {
359                                    'ecat' => "item",                                    'ecat' => "item",
360                                    'ecmod' => "view",                                    'ecmod' => "view",
361                                    );                                    );
 /*  
         if($ecom_state['ecom_mode'] == "view") {  
           $hidden_items['ecmod'] = "edit";  
         }  
         elseif($ecom_state['ecom_mode'] == "edit") {  
           $hidden_items['ecmod'] = "edit";  
         }  
 */        
362        }        }
       $hidden_items['ap'] = "explorer";  
363      }      }
364        elseif($ecom_state['ecom_type'] == "nav") {
365          // Switching abstract make no real sense here,
366          // because hidden_items(link_vars) for Naviagtion-Ecoms
367          // are more label specified!!
368          // OLD:
369          //if($ecom_state['ecom_abstract_type'] == "list") {
370          
371          // decide whether to link to items or to a list
372          $abstract_type = 'list';
373          // FIXME: HACK
374          if ($this->_e_state[main][ecom_data_source_key] == 'config') {
375            $abstract_type = 'item';
376          }
377          
378          // NEW:
379          if ($label == "nav") {
380            $hidden_items = array(
381                                      'ecl' => "content",
382                                      'ecat' => $abstract_type,
383                                      'ecmod' => "view",
384                                      'ect' => "data",
385                                      'ecdlk' => "rpc",
386                                     );
387    
388          }
389          elseif ($label == "chooser") {
390            $hidden_items = array(
391                                      'ecl' => "phase_startup",
392                                      'ecdlk' => "rpc",
393                                     );
394    
395          }
396        }
397          // add page idents
398          foreach($this->_e_state[idents] as $label => $value) {
399            $hidden_items[$label] = $value;
400          }
401      return $hidden_items;      return $hidden_items;
402    }    }
403    
404    
405    
406    function _prepare_component_args($label) {        function _prepare_component_args($label, $args = array()) {    
407      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
408    
409        // pre-flight checks
410        if (!$val['ecom_data_locator_key']) {
411          user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'.");
412          return;
413        }
414    
415        if (!$val['ecom_type']) {
416          user_error("WebExplorer::AbstractExplorer: Key 'ecom_type' was empty, should be one of 'data|nav|call'.");
417        }
418    
419        if (!$val['ecom_abstract_type']) {
420          user_error("_prepare_component_args: Key 'ecom_abstract_type' was empty, should be one of 'item|list|tree|auto'.");
421          return;
422        }
423    
424        // trace
425        //print "YAI1<br/>";
426        //print Dumper($val);
427        
428      $this->set_data_locator($val['ecom_data_locator_key']);      $this->set_data_locator($val['ecom_data_locator_key']);
429    
430      // detect and execute 'selectSource' action      // detect and execute 'selectSource' action
# Line 298  class WebExplorer_AbstractExplorer { Line 443  class WebExplorer_AbstractExplorer {
443        if($val['ecom_abstract_type'] == "list") {        if($val['ecom_abstract_type'] == "list") {
444          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
445            //$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']);
446            $data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'list', nodename => $val['ecom_data_ident']);            $data_locator_meta = array(
447                transport => 'rpc',
448                metatype => 'data',
449                abstract_type => 'list',
450                nodename => $val['ecom_data_ident'],
451                list_meta => $val['ecom_data_meta']
452              );
453          } else {          } else {
454            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] !");
455          }          }
# Line 318  class WebExplorer_AbstractExplorer { Line 469  class WebExplorer_AbstractExplorer {
469                                                    "View" => 'view',                                                    "View" => 'view',
470                                                    "Edit" => 'edit',                                                    "Edit" => 'edit',
471                                                    "Delete" => 'delete',                                                    "Delete" => 'delete',
                                                   "Add new" => 'add',  
472                                                    ),                                                    ),
473                                                  'selected' => 'view',
474                                                  'create' => array(
475                                                       'name' => "ecdfcr",
476                                                       'value' => "Add new"
477                                                       ),
478                                                  ),
479                                              'parent' => array(
480                                                  'class' => $val['ecom_data_ident'],
481                                                ),                                                ),
482                                            ),                                            ),
483                        );                        );
484          
485        // switch abstract type        // switch abstract type
486        } elseif ($val['ecom_abstract_type'] == "item") {        } elseif ($val['ecom_abstract_type'] == "item") {
487          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
488            //$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']);
489            $data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'item', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);            
490              // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
491              $filter = $this->get_data_filter($val);
492              
493              $data_locator_meta = array(
494                transport => 'rpc', metatype => 'data', abstract_type => 'item',
495                ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], filter => $filter,
496              );
497          } else {          } else {
498            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] !");
499          }          }
500          if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }          
501            // defaults
502            if (!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
503            //$val['ecom_mode'] = "view";
504            
505            // debugging
506          print "Mode: $val[ecom_mode]<br>";          print "Mode: $val[ecom_mode]<br>";
507            
508            //print Dumper($val);
509            // NEW [2003-04-22]: append some more meta information to the caption
510            //$caption_addendum = ' {' . $val['ecom_data_meta'] . '}';
511            $caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}';
512            
513            // prepare some arguments...
514          $args = array(          $args = array(
515                        'caption' => $val['ecom_data_meta'],                        'caption' => $val['ecom_data_ident'] . $caption_addendum,
516                        'mode' => $val['ecom_mode'],                        'mode' => $val['ecom_mode'],
517                        'options' => array(                        'options' => array(
518                                            'data_locator_meta' => $data_locator_meta,                                              'data_locator_meta' => $data_locator_meta,
519                                            'decode' => 1,                                              'decode' => 1,
520                                            'decode_args' => array(                                              'decode_args' => array(
521                                                'seperator' => "_",                                                'seperator' => "_",
522                                                ),                                                ),
523                                            ),                                              'parent' => array(
524                                                    'guid' => $val['ecom_data_ident'],
525                                                    'class' => $val['ecom_data_meta'],
526                                                    ),
527                                                ),
528                        );                        );
529           if($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }           if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }
530            
531             // FIXME: (see WebExplorer::Module::AbstractGUIModule)
532             //if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; }
533             if ($val['ecom_mode'] == "delete") {
534               $args['adapter'] = 'NonValidatingFormProcessor';
535             }
536    
537             if ($val['ecom_mode'] == "create") {
538               $args['adapter'] = 'FormProcessor';
539               $args['options']['caption'] = $val['ecom_data_ident'];
540               $args['options']['data_locator_meta']['action'] = 'create';
541               print "debug 'create': " . Dumper($val);
542               if($val['ecom_data_meta_x']) {
543                 unset($args['options']['data_locator_meta']['nodename']);
544                 $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta'];
545                 $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];
546               }
547             }
548            
549          // switch abstract type
550          } elseif ($val['ecom_abstract_type'] == "tree") {
551    
552            // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
553            $filter = $this->get_data_filter($val);
554            
555            // FIXME: shouldn't this (dispatching by transport-key) be done very *outside* of this scope?
556            // or: do it outside per default, let a possibility to modify it inside the lower levels of the dispatcher (here)
557            if ($val['ecom_data_locator_key'] == "rpc") {
558              //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
559              $args[options][data_locator_meta] = array(
560                transport => 'rpc', metatype => 'data', abstract_type => 'tree',
561                ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'],
562                // NEW [2003-04-22]: Full tree node filtering established.
563                filter => $filter
564              );
565            }
566    
567          } else {
568            user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
569            
570        }        }
571            
572      // switch component type      // switch component type
573      } elseif ($val['ecom_type'] == "nav") {      } elseif ($val['ecom_type'] == "nav") {
574          
575        // switch abstract type        // switch abstract type
576        if($val['ecom_abstract_type'] == "list") {        // list
577          if ($val['ecom_abstract_type'] == "list") {
578         $args = array();         $args = array();
579          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
580              
581            // switch component label            // switch component label
582            if($label == "nav") {            // TODO: should we really dispatch by label inside here?
583              
584              if ($label == "nav") {
585              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
586              $args['caption'] = "Objekt Typen";              $args['caption'] = "Objekt Typen";
587            }            }
# Line 363  class WebExplorer_AbstractExplorer { Line 590  class WebExplorer_AbstractExplorer {
590              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' );              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' );
591              $args['caption'] = "Datenquellen";              $args['caption'] = "Datenquellen";
592            }            }
593              // NEW [2003-04-18]: croak if label empty
594              else {
595                user_error("_prepare_component_args: Dispatching for nav.list.rpc failed. \$label was empty.");
596              }
597            $args['options']['data_locator_meta'] = $data_locator_meta;            $args['options']['data_locator_meta'] = $data_locator_meta;
598              
599          } else {          } else {
600            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] !");
601          }          }
602          
603          // NEW [2003-04-18]: Abstract navigation tree
604        } elseif ($val['ecom_abstract_type'] == "tree") {        } elseif ($val['ecom_abstract_type'] == "tree") {
605          $args = array();          $args = array();
606            if($label == "nav") {
607              //$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
608              $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
609              $args['caption'] = $val['ecom_data_source_key'];
610            } elseif($label == "UMnav") {
611              //$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
612              $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'method', method => 'UserManagmentSchema' );
613              $args['caption'] = "Benutzerverwaltung";
614            }
615    
616          // NEW [2003-04-18]: transparent nav - argument pass-through mode
617          } elseif ($val['ecom_abstract_type'] == "transparent") {
618            
619            // You are responsible for all arguments passed through.
620            // Where are these arguments from?
621            // They are propagated transparently to this place from a new optional
622            // parameter ($args) introduced for the methods 'get_com', 'load_com'
623            // and '_prepare_component_args' (this one).
624            // This means full control over ecoms from outside.
625            
626            // TODO: maybe add some additional pre-flight checks here!?
627          
628          // croak
629          } else {
630            user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
631        }        }
632    
633      // 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 396  class WebExplorer_AbstractExplorer { Line 655  class WebExplorer_AbstractExplorer {
655          // FIXME: implement automatic re-dispatching to available ecoms here!          // FIXME: implement automatic re-dispatching to available ecoms here!
656          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?");
657        }              }      
658        
659      }      }
660    
661        // NEW[2003-04-18]: add hidden items to args
662        $args['hidden_elements'] = $this->_get_hidden_items($label);
663    
664      return $args;      return $args;
665    }    }
666    
# Line 416  class WebExplorer_AbstractExplorer { Line 679  class WebExplorer_AbstractExplorer {
679      user_error("AbstractExplorer::render - please implement me....");      user_error("AbstractExplorer::render - please implement me....");
680    }    }
681    
682    
683      function get_data_filter($state = array()) {
684    
685        // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
686        // V1: this was inside ecom_abstract_type == item && ecom_data_locator_key == rpc, but ...
687        // V2: ... it should be considered / work independent of these both criterias
688        //       since it is required for showing xml nodes in items (editing) *and* trees again (browsing).
689        
690        if ($filter_expression = $state[ecom_data_filter]) {
691    
692          // new of 2003-05-13: Apply "Node navigation" in tree mode only.
693          // Lock context when switching to item mode.
694          //print Dumper($state);
695          if ($state[ecom_abstract_type] == "tree") {
696            if ($parent_xpq = $state[ecom_data_meta]) {
697              $filter_expression = $parent_xpq . $filter_expression;
698            }
699          }
700    
701          // This propagates a XPath filter expression which fully identifies
702          // a single node in a document. It reaches through all parent nodes.
703          $filter = array(
704            //dotted => $val['ecom_data_filter'],
705            //ident => $val['ecom_data_ident'],
706            //xpq => '*/*[@name="cli"]',
707            //xpq => '*/*',
708            // NEW [2003-04-21]: An xpq is already ready now inside
709            // 'ecdf' since it already has been built by the revamped tree lift.
710            xpq => '*' . $filter_expression
711          );
712    
713        } else {
714          $filter = '';
715        
716        }
717        
718        // lift filter from dotted format to xpq format
719        // NEW [2003-04-21]: not required any more (see above)
720        //$lift = mkObject('Data::Lift', $filter, array( metatype => 'filter' ) );
721        //$filter = $lift->to('XPath');
722        
723        return $filter;
724    
725      }
726    
727  }  }
728    
729    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.23

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