/[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.11 by jonen, Mon Apr 7 22:31:51 2003 UTC revision 1.17 by jonen, Fri Apr 18 13:46:15 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.17  2003/04/18 13:46:15  jonen
8    ##    + add hidden elements(items) now to the constructor arguments of each ecom
9    ##
10    ##    Revision 1.16  2003/04/10 06:00:58  joko
11    ##    ALPHA: Item.Delete
12    ##
13    ##    Revision 1.15  2003/04/09 02:08:20  joko
14    ##    CHANGE: renamed key 'classname' through 'nodename'
15    ##
16    ##    Revision 1.14  2003/04/09 00:31:27  jonen
17    ##    + added arguments for data list ecom
18    ##
19    ##    Revision 1.13  2003/04/09 00:03:11  jonen
20    ##    disabled form rendering for inheritanced items at 'list'
21    ##
22    ##    Revision 1.12  2003/04/08 17:52:12  joko
23    ##    CHANGE: renamed property 'datasource' to 'transport'
24    ##    NEW: Module 'RemoteAction'
25    ##
26  ##    Revision 1.11  2003/04/07 22:31:51  jonen  ##    Revision 1.11  2003/04/07 22:31:51  jonen
27  ##    + added switch of ecom label (e.g. nav, chooser) at ecom type switch 'nav'  ##    + added switch of ecom label (e.g. nav, chooser) at ecom type switch 'nav'
28  ##    - removed recent added ecom type chooser  ##    - removed recent added ecom type chooser
# Line 141  class WebExplorer_AbstractExplorer { Line 160  class WebExplorer_AbstractExplorer {
160    function set_e_state() {    function set_e_state() {
161      $this->get_page_state();      $this->get_page_state();
162      $this->_e_state = $this->_state[options][options];      $this->_e_state = $this->_state[options][options];
163        //  print "Setting Explorer state:" . Dumper($this->_e_state);
164    }    }
165        
166    
# Line 150  class WebExplorer_AbstractExplorer { Line 170  class WebExplorer_AbstractExplorer {
170        
171    
172    function init_default_gui_modules() {    function init_default_gui_modules() {
173        
174        // format of parameters: label, ecom_type, abstract_type, module_name
175        
176      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );
177      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );
178      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );
179      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );
180      // 2003-04-05 - Chooser      // 2003-04-05 - Chooser
181      $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");          $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");
182        // 2003-04-07 - RemoteAction
183        $this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction");
184        // 2003-04-09 - Item.Delete
185        $this->register_gui_module("phase_startup", "data", "item", "WebExplorer::Module::DataItem");
186        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::RemoteAction");
187        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::DataItem");
188    }    }
189    
190    function register_source_module($label, $args) {    function register_source_module($label, $args) {
# Line 185  class WebExplorer_AbstractExplorer { Line 214  class WebExplorer_AbstractExplorer {
214    
215        
216    function _load_ecom($label) {    function _load_ecom($label) {
217        
218      // fetch values from state      // fetch values from state
219      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
220      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");
221    
222        // NEW [2003-04-10]: ecom-RESET-condition
223        if (!is_array($val) && $val == 'RESET') {
224          debug::info("Resetting component: $label");
225          return;
226        }
227    
228      // find right ecom gui module      // find right ecom gui module
229      $ecom_type = $val['ecom_type'];      $ecom_type = $val['ecom_type'];
230      $abstract_type = $val['ecom_abstract_type'];      $abstract_type = $val['ecom_abstract_type'];
# Line 204  class WebExplorer_AbstractExplorer { Line 240  class WebExplorer_AbstractExplorer {
240      //print Dumper($args);      //print Dumper($args);
241            
242      // get ecom GUI module      // get ecom GUI module
243      $ecom = php::mkComponent($gui_module, $args);      if (!$ecom = php::mkComponent($gui_module, $args)) {
244          return;
245        }
246      //print Dumper($ecom);      //print Dumper($ecom);
247                
248      // load phphtmllib GUI object      // NOW[2003-18-04] done at via args(prepare args!) to pass at constructor
249      $gui_ecom = &$ecom->get();      //  (needed for non-real objects instanced at some child of AbstractGUIModule, eg. NavigationList)
250    /*
251      // add hidden vars, needed for explorer control      // add hidden vars, needed for explorer control
252      $hidden_items = $this->_get_hidden_items($label);      $hidden_items = $this->_get_hidden_items($label);
253      if(is_array($hidden_items) ) {      if(is_array($hidden_items) ) {
254        $ecom->add_hidden_items($hidden_items);        $ecom->add_hidden_items($hidden_items);
255        //print "Hidden: " . Dumper($hidden_items);        print "Hidden: " . Dumper($hidden_items);
256      }      }
257    */
258    
259        // load phphtmllib GUI object
260        $gui_ecom = &$ecom->get();
261    
262      // attempt:      // attempt:
263      //$gui_ecom->make_transparent();      //$gui_ecom->make_transparent();
# Line 242  class WebExplorer_AbstractExplorer { Line 284  class WebExplorer_AbstractExplorer {
284                                    'ecat' => "item",                                    'ecat' => "item",
285                                    'ecmod' => "view",                                    'ecmod' => "view",
286                                    );                                    );
 /*  
         if($ecom_state['ecom_mode'] == "view") {  
           $hidden_items['ecmod'] = "edit";  
         }  
         elseif($ecom_state['ecom_mode'] == "edit") {  
           $hidden_items['ecmod'] = "edit";  
         }  
 */        
287        }        }
       $hidden_items['ap'] = "explorer";  
288      }      }
289        elseif($ecom_state['ecom_type'] == "nav") {
290          // Switching abstract make no real sense here,
291          // because hidden_items(link_vars) for Naviagtion-Ecoms
292          // are more label specified!!
293          // OLD:
294          //if($ecom_state['ecom_abstract_type'] == "list") {
295          // NEW:
296          if($label == "nav") {
297            $hidden_items = array(
298                                      'ecl' => "content",
299                                      'ecat' => "list",
300                                      'ecmod' => "view",
301                                      'ect' => "data",
302                                      'ecdlk' => "rpc",
303                                     );
304    
305          }
306          elseif($label == "chooser") {
307            $hidden_items = array(
308                                      'ecl' => "phase_startup",
309                                      'ecdlk' => "rpc",
310                                     );
311    
312          }
313        }
314          // add page idents
315          foreach($this->_e_state[idents] as $label => $value) {
316            $hidden_items[$label] = $value;
317          }
318      return $hidden_items;      return $hidden_items;
319    }    }
320    
# Line 277  class WebExplorer_AbstractExplorer { Line 339  class WebExplorer_AbstractExplorer {
339        // switch abstract type        // switch abstract type
340        if($val['ecom_abstract_type'] == "list") {        if($val['ecom_abstract_type'] == "list") {
341          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
342            //$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']);
343            $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']);
344          } else {          } else {
345            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] !");
346          }          }
# Line 290  class WebExplorer_AbstractExplorer { Line 352  class WebExplorer_AbstractExplorer {
352                                            'decode' => 1,                                            'decode' => 1,
353                                            'decode_args' => array(                                            'decode_args' => array(
354                                                'seperator' => "_",                                                'seperator' => "_",
355                                                'form' => 1,                                                //'form' => 1,
356                                                  ),
357                                              'actionbar' => array(
358                                                  'name' => "ecdfa",
359                                                  'list' => array(
360                                                      "View" => 'view',
361                                                      "Edit" => 'edit',
362                                                      "Delete" => 'delete',
363                                                      "Add new" => 'add',
364                                                      ),
365                                                ),                                                ),
366                                            ),                                            ),
367                        );                        );
368        // switch abstract type        // switch abstract type
369        } elseif ($val['ecom_abstract_type'] == "item") {        } elseif ($val['ecom_abstract_type'] == "item") {
370          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
371            //$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']);
372            $data_locator_meta = array( datasource => 'rpc', metatype => 'data', abstract_type => 'item', ident => $val['ecom_data_ident'], classname => $val['ecom_data_meta']);            $data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'item', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
373          } else {          } else {
374            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] !");
375          }          }
376            
377            // defaults
378          if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }          if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
379            //$val['ecom_mode'] = "view";
380            
381            // debugging
382          print "Mode: $val[ecom_mode]<br>";          print "Mode: $val[ecom_mode]<br>";
383            
384            // prepare some arguments...
385          $args = array(          $args = array(
386                        'caption' => $val['ecom_data_meta'],                        'caption' => $val['ecom_data_meta'],
387                        'mode' => $val['ecom_mode'],                        'mode' => $val['ecom_mode'],
# Line 315  class WebExplorer_AbstractExplorer { Line 393  class WebExplorer_AbstractExplorer {
393                                                ),                                                ),
394                                            ),                                            ),
395                        );                        );
396           if($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }           if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }
397            
398             // FIXME: (see WebExplorer::Module::AbstractGUIModule)
399             //if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; }
400             if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'NonValidatingFormProcessor'; }
401            
402        }        }
403            
404      // switch component type      // switch component type
# Line 326  class WebExplorer_AbstractExplorer { Line 409  class WebExplorer_AbstractExplorer {
409          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
410            // switch component label            // switch component label
411            if($label == "nav") {            if($label == "nav") {
412              $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
413              $args['caption'] = "Objekt Typen";              $args['caption'] = "Objekt Typen";
414            }            }
415            // NEW [2003-04-05]: DataSource.Chooser            // NEW [2003-04-05]: DataSource.Chooser
416            elseif ($label == "chooser") {            elseif ($label == "chooser") {
417              $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'sources.all' );              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' );
418              $args['caption'] = "Datenquellen";              $args['caption'] = "Datenquellen";
419            }            }
420            $args['options']['data_locator_meta'] = $data_locator_meta;            $args['options']['data_locator_meta'] = $data_locator_meta;
# Line 342  class WebExplorer_AbstractExplorer { Line 425  class WebExplorer_AbstractExplorer {
425          $args = array();          $args = array();
426        }        }
427    
428        // NEW [2003-04-08]: RemoteAction (e.g.: result of a selection inside a Chooser)
429        // switch component type
430        } elseif ($val['ecom_type'] == "call") {
431    
432          // responses of RemoteActions are not predictable!
433          if ($val['ecom_abstract_type'] == "auto") {
434            
435            // Dispatching by $label is not done here. RemoteAction-ecoms can appear anywhere!
436    
437            // Just define the RemoteQuery using a declaration to use DataSource::Generic most transparently.
438            // Really - just a remote call is issued, no data-/schema-structures or similar are expected.
439            
440            // The RemoteMethod 'method' is called directly with arguments in 'args'!
441            // As response (important for widget assignement!) you may expect an arbitrary payload.
442            $args['options']['data_locator_meta'] = array(
443              transport => 'rpc',
444              metatype => 'method',
445              method => $val['ecom_call_method'],
446              args => $val['ecom_call_args']
447            );
448            
449          } else {
450            // FIXME: implement automatic re-dispatching to available ecoms here!
451            user_error("WebExplorer::AbstractExplorer: results of RemoteActions can only be handled automatically. Who knows what comes back?");
452          }      
453    
454      }      }
455    
456        // add hidden items to args
457        $args['hidden_elements'] = $this->_get_hidden_items($label);
458    
459      return $args;      return $args;
460    }    }
461    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.17

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