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

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.19

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