/[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.1 by jonen, Thu Mar 20 03:48:46 2003 UTC revision 1.20 by jonen, Sat Apr 19 16:24:49 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.20  2003/04/19 16:24:49  jonen
8    ##    + added two more GUI modules to default registry initiation,
9    ##       relating to new navigation module 'NavigationTree'
10    ##    + added prepartion of needed args for abstract navigation tree
11    ##       and concret UserManagment 'UMnav' tree
12    ##
13    ##    Revision 1.19  2003/04/18 16:21:37  joko
14    ##    fixed commit comment - the last one caused a syntax error!!!
15    ##
16    ##    Revision 1.18  2003/04/18 15:27:06  joko
17    ##    NEW: XML Trees in data area
18    ##      new ecom module: DataTree
19    ##      introduced new query argument: 'filter' (purpose: xml/tree filtering)
20    ##        $filter = array(
21    ##          dotted => $val['ecom_data_filter'],
22    ##          ident => $val['ecom_data_ident'],
23    ##        );
24    ##        A Data::Lift module translates this filter-query into a XPath-query ...
25    ##        $filter = array(
26    ##          xpq => '*\/*[@name="cli"]',
27    ##        );
28    ##        ... which finally is propagated to the backend.
29    ##    NEW: AbstractExplorer - standalone version
30    ##      enhanced set_e_state: now can overwrite internal state to arguments from outside
31    ##      enhanced get_com: also capable of propagating additional args through _load_ecom to _prepare_component_args
32    ##      enhanced _prepare_component_args: now able to dispatch to a "transparent navigation ecom" (e.g. YAA::JobGroups)
33    ##    MISC:
34    ##      added some pre-flight checks throughout the module, especially at the core dispatcher inside _prepare_component_args
35    ##      error checking: added some more croaks via 'user_error'
36    ##      cosmetic updates
37    ##
38    ##    Revision 1.17  2003/04/18 13:46:15  jonen
39    ##    + add hidden elements(items) now to the constructor arguments of each ecom
40    ##
41    ##    Revision 1.16  2003/04/10 06:00:58  joko
42    ##    ALPHA: Item.Delete
43    ##
44    ##    Revision 1.15  2003/04/09 02:08:20  joko
45    ##    CHANGE: renamed key 'classname' through 'nodename'
46    ##
47    ##    Revision 1.14  2003/04/09 00:31:27  jonen
48    ##    + added arguments for data list ecom
49    ##
50    ##    Revision 1.13  2003/04/09 00:03:11  jonen
51    ##    disabled form rendering for inheritanced items at 'list'
52    ##
53    ##    Revision 1.12  2003/04/08 17:52:12  joko
54    ##    CHANGE: renamed property 'datasource' to 'transport'
55    ##    NEW: Module 'RemoteAction'
56    ##
57    ##    Revision 1.11  2003/04/07 22:31:51  jonen
58    ##    + added switch of ecom label (e.g. nav, chooser) at ecom type switch 'nav'
59    ##    - removed recent added ecom type chooser
60    ##
61    ##    Revision 1.10  2003/04/05 20:32:04  joko
62    ##    added Chooser
63    ##
64    ##    Revision 1.9  2003/04/04 02:22:37  joko
65    ##    minor fix: querySchema now issues argument
66    ##
67    ##    Revision 1.8  2003/04/04 01:16:03  jonen
68    ##    +  integrated different mode's for 'DataItem'
69    ##
70    ##    Revision 1.7  2003/03/29 07:49:55  joko
71    ##    show boxes in DEBUG-mode only!
72    ##
73    ##    Revision 1.6  2003/03/28 06:42:37  joko
74    ##    fix: propagating rpc-debugging-options to constants here
75    ##
76    ##    Revision 1.5  2003/03/27 01:24:29  jonen
77    ##    + enabled navigation ecom (only list yet)
78    ##
79    ##    Revision 1.4  2003/03/20 08:02:11  jonen
80    ##    + purged code
81    ##
82    ##    Revision 1.3  2003/03/20 07:54:52  jonen
83    ##    + added docu
84    ##
85    ##    Revision 1.2  2003/03/20 07:44:31  jonen
86    ##    + removed dumper
87    ##
88  ##    Revision 1.1  2003/03/20 03:48:46  jonen  ##    Revision 1.1  2003/03/20 03:48:46  jonen
89  ##    + initial commit  ##    + initial commit
90  ##  ##
# Line 26  Line 107 
107  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
108  */  */
109    
110    /**
111     * WebExplorer::AbstractExplorer - this can be simple compared to a container,
112     *  which modular GUI classes can be register, manipulated and rendered...
113     *
114     * @author Sebastian Utz <seut@tunemedia.de>
115     * @package org.netfrag.app
116     * @name WebExplorer::AbstractExplorer
117     */
118    
119    
120  class WebExplorer_AbstractExplorer {  class WebExplorer_AbstractExplorer {
121    
# Line 54  class WebExplorer_AbstractExplorer { Line 144  class WebExplorer_AbstractExplorer {
144    */    */
145   var $_e_state = array();   var $_e_state = array();
146    
  // needed (old)?  
  var $_control = array();  
  var $_hidden_elements = array();  
   
147    
148    function WebExplorer_AbstractExplorer($data_locators=array()) {    function WebExplorer_AbstractExplorer($data_locators=array()) {
149      $this->_data_locators = $data_locators;      $this->_data_locators = $data_locators;
150      $this->init_default_gui_modules();      $this->init_default_gui_modules();    
       
151      $this->set_e_state();      $this->set_e_state();
152      print "State: " . Dumper($this->_state) ."<br>";  
153      print "E_State: " . Dumper($this->_e_state) ."<br>";      //debug
154      //$this->init_state();      //print "State: " . Dumper($this->_state) ."<br>";
155        $div = html_div();
156        $div->add( html_b(get_class($this)), html_hr(), "Explorer_State: " . Dumper($this->_e_state));
157        $div->set_style('background: #adadad; border: 2px black groove; width:640px; padding:10px; margin:40px;');
158        if (constants::get('DEBUG')) {
159          print $div->render();
160        }
161    }    }
162    
163    
# Line 76  class WebExplorer_AbstractExplorer { Line 167  class WebExplorer_AbstractExplorer {
167        
168    function set_data_locator($label, $new_args=array() ) {    function set_data_locator($label, $new_args=array() ) {
169      global $app;      global $app;
170      //print Dumper($app) . "<br>";      
171      if($label == "rpc") {      // pre-flight checks
172        if (!$label) {
173          user_error("AbstractExplorer::set_data_locator - label was empty.");
174          return;
175        }
176        
177        if ($label == "rpc") {
178        $rpcinfo = $app->getConfig("rpcinfo");        $rpcinfo = $app->getConfig("rpcinfo");
179        define('RPC_HOSTNAME', $rpcinfo[Host]);        define('RPC_HOSTNAME', $rpcinfo[Host]);
180        define('RPC_PORT', $rpcinfo[Port]);        define('RPC_PORT', $rpcinfo[Port]);
181          define('RPC_DEBUG', $rpcinfo[DEBUG]);
182          define('RPC_TRACE', $rpcinfo[TRACE]);
183          define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]);
184      } else {      } else {
185        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'!");
186      }      }
187    }    }
188        
# Line 91  class WebExplorer_AbstractExplorer { Line 191  class WebExplorer_AbstractExplorer {
191    
192    function get_page_state() {    function get_page_state() {
193      $requestTracker = mkObject("Application::Request::Tracker");      $requestTracker = mkObject("Application::Request::Tracker");
194        //print Dumper($this->_state);
195      $this->_state = $requestTracker->getPointer();      $this->_state = $requestTracker->getPointer();
196    }    }
197        
198    function set_e_state() {    function set_e_state($state = null) {
199      $this->get_page_state();      // NEW [2003-04-18]: now has two modes
200      $this->_e_state = $this->_state[options][options];      // 1. inject page state from argument passed to us
201        // 2. (was) get page state from request tracker
202        if ($state) {
203          $this->_e_state = $state;
204        } else {
205          $this->get_page_state();
206          $this->_e_state = $this->_state[options][options];
207        }
208        //  print "Setting Explorer state:" . Dumper($this->_e_state);
209    }    }
     
210    
211    function set_page_state() {    function set_page_state() {
212      user_error("AbstractExplorer::set_page_state - please implement me....");          user_error("AbstractExplorer::set_page_state - please implement me....");    
213    }    }
     
214    
215    function init_default_gui_modules() {    function init_default_gui_modules() {
216        
217        // format of parameters: label, ecom_type, abstract_type, module_name
218        
219        // 2003-03-02 - First ecom modules/components
220      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );
221      $this->register_gui_module("list", "nav", array( 'name' => "NavigationList", 'type' => "list") );      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );
222      $this->register_gui_module("list", "data", array( 'name' => "WebExplorer::Module::DataList", 'type' => "list") );      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );
223      $this->register_gui_module("item", "data", array( 'name' => "WebExplorer::Module::DataItem", 'type' => "item") );      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );
224        
225        // 2003-04-05 - Chooser (a Nav.List)
226        $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");
227        
228        // 2003-04-07 - RemoteAction
229        $this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction");
230        
231        // 2003-04-09 - Data.Item: DeleteAction
232        $this->register_gui_module("phase_startup", "data", "item", "WebExplorer::Module::DataItem");
233        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::RemoteAction");
234        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::DataItem");
235        
236        // 2003-04-12 - Data.Tree
237        $this->register_gui_module("content", "data", "tree", "WebExplorer::Module::DataTree" );
238        
239        // 2003-04-18 - Nav.Tree
240        $this->register_gui_module("nav", "nav", "tree", "WebExplorer::Module::NavigationTree" );
241    
242        // 2003-04-18 - UserManagment Nav.Tree (we need only a different 'label' as Nav.Tree yet..)
243        $this->register_gui_module("UMnav", "nav", "tree", "WebExplorer::Module::NavigationTree" );
244    
245    }    }
246    
247    function register_source_module($label, $args) {    function register_source_module($label, $args) {
248      $this->_module['source'][$label] = $args;      $this->_module['source'][$label] = $args;
249    }    }
250        
251    function register_gui_module($abstract_type, $ecom_type, $args) {    function register_gui_module($label, $ecom_type, $abstract_type, $module_name) {
252      $this->_module['gui'][$ecom_type][$abstract_type] = $args;      $this->_module['gui'][$label][$ecom_type][$abstract_type] = $module_name;
253    }    }
254    
255    function &get_ecom($label) {  
256      function &get_ecom($label, $args = array()) {
257        
258        // the very first - strongly hardcoded - Hello World ecom
259      //return "Hello World";      //return "Hello World";
260      $this->_load_ecom($label);      
261        // that's better ...
262        $this->_load_ecom($label, $args);
263      return $this->_ecom[$label];      return $this->_ecom[$label];
264        
265    }    }
266    
267        
268    function _load_ecoms() {    function _load_ecoms() {
269        //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");
270      foreach($this->_e_state[ecoms] as $label => $val) {      foreach($this->_e_state[ecoms] as $label => $val) {
271        $this->_load_ecom($label);        $this->_load_ecom($label);
272      }      }
273    }    }
274    
275    
276        
277    function _load_ecom($label) {    function _load_ecom($label, $args = array()) {
278        
279        // fetch values from state
280      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
281      // find right gui module      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");
282      $com_type = $val['ecom_type'];  
283        // NEW [2003-04-10]: ecom-RESET-condition
284        if (!is_array($val) && $val == 'RESET') {
285          debug::info("Resetting component: $label");
286          return;
287        }
288    
289        // find right ecom gui module
290        $ecom_type = $val['ecom_type'];
291      $abstract_type = $val['ecom_abstract_type'];      $abstract_type = $val['ecom_abstract_type'];
292      $gui_module = $this->_module['gui'][$com_type][$abstract_type]['name'];      $gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type];
293        //print Dumper($gui_module);
294      if(!$gui_module) {      if(!$gui_module) {
295        user_error("AbstractExplorer::_load_component - No GUI module found for 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]'].");
296        return;        return;
297      }      }
298      // get arguments needed for gui module  
299      $args = $this->_prepare_component_args($label);      // get arguments needed for ecom gui module
300      //print Dumper($args);      $args = $this->_prepare_component_args($label, $args);
301            
302      // get GUI module      // trace
303      $ecom = php::mkComponent($gui_module, $args);      //print "raw-args: " . Dumper($args) . "<br/>";
304        
305        // get ecom GUI module
306        if (!$ecom = php::mkComponent($gui_module, $args)) {
307          user_error("AbstractExplorer::_load_component - Error while instantiating ecom gui component. [label='$label', abstract type='$val[ecom_abstract_type]', ecom type='$val[ecom_type]']");
308          return;
309        }
310      //print Dumper($ecom);      //print Dumper($ecom);
311                
312      // get phphtmllib GUI object      // NEW[2003-04-18] done via args(prepare args!) passed at constructor
313      $gui_ecom = &$ecom->get();      //  (needed for non-real objects instanced at some child of AbstractGUIModule, eg. NavigationList)
314    /*
315      // add hidden vars, needed for explorer control      // add hidden vars, needed for explorer control
316      $hidden_items = $this->_get_hidden_items($label);      $hidden_items = $this->_get_hidden_items($label);
317      $ecom->add_hidden_items($hidden_items);      if(is_array($hidden_items) ) {
318      //print "Hidden: " . Dumper($gui_ecom->_hidden_items);        $ecom->add_hidden_items($hidden_items);
319          print "Hidden: " . Dumper($hidden_items);
320        }
321    */
322    
323        // load phphtmllib GUI object
324        $gui_ecom = &$ecom->get();
325    
326        // attempt:
327        //$gui_ecom->make_transparent();
328        
329        // store phphtmllib GUI object
330      $this->_ecom[$label] = &$gui_ecom;      $this->_ecom[$label] = &$gui_ecom;
331    }    }
332    
333    
334    
335    function _get_hidden_items($label) {    function _get_hidden_items($label) {
336      $ecom_state = $this->_e_state['ecoms'][$label];      $ecom_state = $this->_e_state['ecoms'][$label];
337      if($ecom_state['ecom_abstract_type'] == "list") {      if($ecom_state['ecom_type'] == "data") {
338        $hidden_items = array(        if($ecom_state['ecom_abstract_type'] == "list") {
339            $hidden_items = array(
340                                    'ecl' => $label,                                    'ecl' => $label,
341                                      'ecat' => "item",
342                                      'ecmod' => "view",
343                                    );                                    );
344          }
345          elseif($ecom_state['ecom_abstract_type'] == "item") {
346            $hidden_items = array(
347                                      'ecl' => $label,
348                                      'ecat' => "item",
349                                      'ecmod' => "view",
350                                      );
351          }
352      }      }
353      // set default hidden item for whole explorer      elseif($ecom_state['ecom_type'] == "nav") {
354      $hidden_items['ap'] = "explorer";        // Switching abstract make no real sense here,
355          // because hidden_items(link_vars) for Naviagtion-Ecoms
356          // are more label specified!!
357          // OLD:
358          //if($ecom_state['ecom_abstract_type'] == "list") {
359          // NEW:
360          if($label == "nav") {
361            $hidden_items = array(
362                                      'ecl' => "content",
363                                      'ecat' => "list",
364                                      'ecmod' => "view",
365                                      'ect' => "data",
366                                      'ecdlk' => "rpc",
367                                     );
368    
369          }
370          elseif($label == "chooser") {
371            $hidden_items = array(
372                                      'ecl' => "phase_startup",
373                                      'ecdlk' => "rpc",
374                                     );
375    
376          }
377        }
378          // add page idents
379          foreach($this->_e_state[idents] as $label => $value) {
380            $hidden_items[$label] = $value;
381          }
382      return $hidden_items;      return $hidden_items;
383    }    }
384    
385    function _prepare_component_args($label) {      
386    
387      function _prepare_component_args($label, $args = array()) {    
388      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
389    
390        // pre-flight checks
391        if (!$val['ecom_data_locator_key']) {
392          user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'.");
393          return;
394        }
395    
396        if (!$val['ecom_type']) {
397          user_error("WebExplorer::AbstractExplorer: Key 'ecom_type' was empty, should be one of 'data|nav|call'.");
398        }
399    
400        if (!$val['ecom_abstract_type']) {
401          user_error("_prepare_component_args: Key 'ecom_abstract_type' was empty, should be one of 'item|list|tree|auto'.");
402          return;
403        }
404    
405        // trace
406        //print "YAI1<br/>";
407        //print Dumper($val);
408        
409      $this->set_data_locator($val['ecom_data_locator_key']);      $this->set_data_locator($val['ecom_data_locator_key']);
410      if($val['ecom_abstract_type'] == "list") {  
411        if($val['ecom_data_locator_key'] == "rpc") {      // detect and execute 'selectSource' action
412          $data_locator_meta = array( datasource => 'rpc', metatype => 'data', vartype => 'objects', classname => $val['ecom_data_ident']);      // FIXME: this is a HACK!!! move to a module 'BackendAction' or s.th.l.th.
413        } else {      //print Dumper($this->_e_state['sources']);
414          user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");      if ($source = $this->_e_state['main']['ecom_data_source_key']) {
415        }        //print "selectSource: $source<br/>";
416        $args = array(        //global $app;
417                        'caption' => "Liste",        //print Dumper($backend);
418          //$app->backend->do();
419        }
420        
421        // switch component type
422        if($val['ecom_type'] == "data") {
423          // switch abstract type
424          if($val['ecom_abstract_type'] == "list") {
425            if($val['ecom_data_locator_key'] == "rpc") {
426              //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
427              $data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'list', nodename => $val['ecom_data_ident'], list_meta => $val['ecom_data_meta']);
428            } else {
429              user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
430            }
431            $args = array(
432                          'caption' => $val['ecom_data_ident'],
433                        'orderby' => "Guid",                        'orderby' => "Guid",
434                        'options' => array(                        'options' => array(
435                                            'data_locator_meta' => $data_locator_meta,                                            'data_locator_meta' => $data_locator_meta,
436                                            'decode' => 1,                                            'decode' => 1,
437                                            'decode_args' => array(                                            'decode_args' => array(
438                                                'seperator' => "_",                                                'seperator' => "_",
439                                                'form' => 1,                                                //'form' => 1,
440                                                  ),
441                                              'actionbar' => array(
442                                                  'name' => "ecdfa",
443                                                  'list' => array(
444                                                      "View" => 'view',
445                                                      "Edit" => 'edit',
446                                                      "Delete" => 'delete',
447                                                      "Add new" => 'add',
448                                                      ),
449                                                ),                                                ),
450                                            ),                                            ),
451                        );                        );
452      } elseif ($ecom_type == "item") {        
453        $args = array();        // switch abstract type
454      } elseif ($ecom_type == "nav") {        } elseif ($val['ecom_abstract_type'] == "item") {
455        $args = array();          if($val['ecom_data_locator_key'] == "rpc") {
456              //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
457              
458              // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
459              // this propagates the full identifier to reach through all parent nodes
460              $filter = array(
461                dotted => $val['ecom_data_filter'],
462                ident => $val['ecom_data_ident'],
463                //xpq => '*/*[@name="cli"]',
464                //xpq => '*/*',
465              );
466              // lift filter from dotted format to xpq format
467              $lift = mkObject('Data::Lift', $filter, array( metatype => 'filter' ) );
468              $filter = $lift->to('XPath');
469    
470              $data_locator_meta = array(
471                transport => 'rpc', metatype => 'data', abstract_type => 'item',
472                ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], filter => $filter,
473              );
474            } else {
475              user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
476            }
477            
478            // defaults
479            if (!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
480            //$val['ecom_mode'] = "view";
481            
482            // debugging
483            print "Mode: $val[ecom_mode]<br>";
484            
485            // prepare some arguments...
486            $args = array(
487                          'caption' => $val['ecom_data_meta'],
488                          'mode' => $val['ecom_mode'],
489                          'options' => array(
490                                                'data_locator_meta' => $data_locator_meta,
491                                                'decode' => 1,
492                                                'decode_args' => array(
493                                                  'seperator' => "_",
494                                                ),
495                                            ),
496                          );
497             if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }
498            
499             // FIXME: (see WebExplorer::Module::AbstractGUIModule)
500             //if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; }
501             if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'NonValidatingFormProcessor'; }
502            
503          // switch abstract type
504          } elseif ($val['ecom_abstract_type'] == "tree") {
505            //print "TREE!<br/>";
506            
507            // FIXME: shouldn't this (dispatching by transport-key) be done very *outside* of this scope?
508            // or: do it outside per default, let a possibility to modify it inside the lower levels of the dispatcher (here)
509            if ($val['ecom_data_locator_key'] == "rpc") {
510              //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
511              $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'data', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
512            }
513    
514          } else {
515            user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
516            
517          }
518        
519        // switch component type
520        } elseif ($val['ecom_type'] == "nav") {
521          
522          // switch abstract type
523          // list
524          if ($val['ecom_abstract_type'] == "list") {
525           $args = array();
526            if($val['ecom_data_locator_key'] == "rpc") {
527              
528              // switch component label
529              // TODO: should we really dispatch by label inside here?
530              
531              if ($label == "nav") {
532                $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
533                $args['caption'] = "Objekt Typen";
534              }
535              // NEW [2003-04-05]: DataSource.Chooser
536              elseif ($label == "chooser") {
537                $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' );
538                $args['caption'] = "Datenquellen";
539              }
540              // NEW [2003-04-18]: croak if label empty
541              else {
542                user_error("_prepare_component_args: Dispatching for nav.list.rpc failed. \$label was empty.");
543              }
544              $args['options']['data_locator_meta'] = $data_locator_meta;
545              
546            } else {
547              user_error("AbstractExplorer::_prepare_component_args - Cannot build schema query for data_locator_key $val[ecom_data_locator_key] !");
548            }
549          
550          // NEW [2003-04-18]: Abstract navigation tree
551          } elseif ($val['ecom_abstract_type'] == "tree") {
552            $args = array();
553            if($label == "nav") {
554              //$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
555              $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
556              $args['caption'] = $val['ecom_data_source_key'];
557            } elseif($label == "UMnav") {
558              //$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
559              $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'method', method => 'UserManagmentSchema' );
560              $args['caption'] = "Benutzerverwaltung";
561            }
562    
563          // NEW [2003-04-18]: transparent nav - argument pass-through mode
564          } elseif ($val['ecom_abstract_type'] == "transparent") {
565            
566            // You are responsible for all arguments passed through.
567            // Where are these arguments from?
568            // They are propagated transparently to this place from a new optional
569            // parameter ($args) introduced for the methods 'get_com', 'load_com'
570            // and '_prepare_component_args' (this one).
571            // This means full control over ecoms from outside.
572            
573            // TODO: maybe add some additional pre-flight checks here!?
574          
575          // croak
576          } else {
577            user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
578          }
579    
580        // NEW [2003-04-08]: RemoteAction (e.g.: result of a selection inside a Chooser)
581        // switch component type
582        } elseif ($val['ecom_type'] == "call") {
583    
584          // responses of RemoteActions are not predictable!
585          if ($val['ecom_abstract_type'] == "auto") {
586            
587            // Dispatching by $label is not done here. RemoteAction-ecoms can appear anywhere!
588    
589            // Just define the RemoteQuery using a declaration to use DataSource::Generic most transparently.
590            // Really - just a remote call is issued, no data-/schema-structures or similar are expected.
591            
592            // The RemoteMethod 'method' is called directly with arguments in 'args'!
593            // As response (important for widget assignement!) you may expect an arbitrary payload.
594            $args['options']['data_locator_meta'] = array(
595              transport => 'rpc',
596              metatype => 'method',
597              method => $val['ecom_call_method'],
598              args => $val['ecom_call_args']
599            );
600            
601          } else {
602            // FIXME: implement automatic re-dispatching to available ecoms here!
603            user_error("WebExplorer::AbstractExplorer: results of RemoteActions can only be handled automatically. Who knows what comes back?");
604          }      
605        
606      }      }
607    
608        // NEW[2003-04-18]: add hidden items to args
609        $args['hidden_elements'] = $this->_get_hidden_items($label);
610    
611      return $args;      return $args;
612    }    }
613    
614    
615    
616    function get_msg($label) {    function get_msg($label) {
617      if($label == "welcome") {      if($label == "welcome") {
618        $msg = "Welcome to the Explorer.";        $msg = "Welcome to the Explorer.";
619      }      }
620      return $msg;      return $msg;
621    }    }
622    
623    
624        
625    function render() {    function render() {
626      user_error("AbstractExplorer::render - please implement me....");      user_error("AbstractExplorer::render - please implement me....");

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

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