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

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

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