/[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.16 by joko, Thu Apr 10 06:00:58 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.16  2003/04/10 06:00:58  joko
8    ##    ALPHA: Item.Delete
9    ##
10    ##    Revision 1.15  2003/04/09 02:08:20  joko
11    ##    CHANGE: renamed key 'classname' through 'nodename'
12    ##
13    ##    Revision 1.14  2003/04/09 00:31:27  jonen
14    ##    + added arguments for data list ecom
15    ##
16    ##    Revision 1.13  2003/04/09 00:03:11  jonen
17    ##    disabled form rendering for inheritanced items at 'list'
18    ##
19    ##    Revision 1.12  2003/04/08 17:52:12  joko
20    ##    CHANGE: renamed property 'datasource' to 'transport'
21    ##    NEW: Module 'RemoteAction'
22    ##
23  ##    Revision 1.11  2003/04/07 22:31:51  jonen  ##    Revision 1.11  2003/04/07 22:31:51  jonen
24  ##    + 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'
25  ##    - removed recent added ecom type chooser  ##    - removed recent added ecom type chooser
# Line 150  class WebExplorer_AbstractExplorer { Line 166  class WebExplorer_AbstractExplorer {
166        
167    
168    function init_default_gui_modules() {    function init_default_gui_modules() {
169        
170        // format of parameters: label, ecom_type, abstract_type, module_name
171        
172      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );
173      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );
174      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );
175      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );
176      // 2003-04-05 - Chooser      // 2003-04-05 - Chooser
177      $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");          $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");
178        // 2003-04-07 - RemoteAction
179        $this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction");
180        // 2003-04-09 - Item.Delete
181        $this->register_gui_module("phase_startup", "data", "item", "WebExplorer::Module::DataItem");
182        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::RemoteAction");
183        //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::DataItem");
184    }    }
185    
186    function register_source_module($label, $args) {    function register_source_module($label, $args) {
# Line 185  class WebExplorer_AbstractExplorer { Line 210  class WebExplorer_AbstractExplorer {
210    
211        
212    function _load_ecom($label) {    function _load_ecom($label) {
213        
214      // fetch values from state      // fetch values from state
215      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
216      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");
217    
218        // NEW [2003-04-10]: ecom-RESET-condition
219        if (!is_array($val) && $val == 'RESET') {
220          debug::info("Resetting component: $label");
221          return;
222        }
223    
224      // find right ecom gui module      // find right ecom gui module
225      $ecom_type = $val['ecom_type'];      $ecom_type = $val['ecom_type'];
226      $abstract_type = $val['ecom_abstract_type'];      $abstract_type = $val['ecom_abstract_type'];
# Line 204  class WebExplorer_AbstractExplorer { Line 236  class WebExplorer_AbstractExplorer {
236      //print Dumper($args);      //print Dumper($args);
237            
238      // get ecom GUI module      // get ecom GUI module
239      $ecom = php::mkComponent($gui_module, $args);      if (!$ecom = php::mkComponent($gui_module, $args)) {
240          return;
241        }
242      //print Dumper($ecom);      //print Dumper($ecom);
243                    
244      // load phphtmllib GUI object      // load phphtmllib GUI object
# Line 277  class WebExplorer_AbstractExplorer { Line 311  class WebExplorer_AbstractExplorer {
311        // switch abstract type        // switch abstract type
312        if($val['ecom_abstract_type'] == "list") {        if($val['ecom_abstract_type'] == "list") {
313          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
314            //$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']);
315            $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']);
316          } else {          } else {
317            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] !");
318          }          }
# Line 290  class WebExplorer_AbstractExplorer { Line 324  class WebExplorer_AbstractExplorer {
324                                            'decode' => 1,                                            'decode' => 1,
325                                            'decode_args' => array(                                            'decode_args' => array(
326                                                'seperator' => "_",                                                'seperator' => "_",
327                                                'form' => 1,                                                //'form' => 1,
328                                                  ),
329                                              'actionbar' => array(
330                                                  'name' => "ecdfa",
331                                                  'list' => array(
332                                                      "View" => 'view',
333                                                      "Edit" => 'edit',
334                                                      "Delete" => 'delete',
335                                                      "Add new" => 'add',
336                                                      ),
337                                                ),                                                ),
338                                            ),                                            ),
339                        );                        );
340        // switch abstract type        // switch abstract type
341        } elseif ($val['ecom_abstract_type'] == "item") {        } elseif ($val['ecom_abstract_type'] == "item") {
342          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
343            //$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']);
344            $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']);
345          } else {          } else {
346            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] !");
347          }          }
348            
349            // defaults
350          if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }          if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
351            //$val['ecom_mode'] = "view";
352            
353            // debugging
354          print "Mode: $val[ecom_mode]<br>";          print "Mode: $val[ecom_mode]<br>";
355            
356            // prepare some arguments...
357          $args = array(          $args = array(
358                        'caption' => $val['ecom_data_meta'],                        'caption' => $val['ecom_data_meta'],
359                        'mode' => $val['ecom_mode'],                        'mode' => $val['ecom_mode'],
# Line 315  class WebExplorer_AbstractExplorer { Line 365  class WebExplorer_AbstractExplorer {
365                                                ),                                                ),
366                                            ),                                            ),
367                        );                        );
368           if($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }           if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }
369            
370             // FIXME: (see WebExplorer::Module::AbstractGUIModule)
371             //if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; }
372             if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'NonValidatingFormProcessor'; }
373            
374        }        }
375            
376      // switch component type      // switch component type
# Line 326  class WebExplorer_AbstractExplorer { Line 381  class WebExplorer_AbstractExplorer {
381          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
382            // switch component label            // switch component label
383            if($label == "nav") {            if($label == "nav") {
384              $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
385              $args['caption'] = "Objekt Typen";              $args['caption'] = "Objekt Typen";
386            }            }
387            // NEW [2003-04-05]: DataSource.Chooser            // NEW [2003-04-05]: DataSource.Chooser
388            elseif ($label == "chooser") {            elseif ($label == "chooser") {
389              $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'sources.all' );              $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' );
390              $args['caption'] = "Datenquellen";              $args['caption'] = "Datenquellen";
391            }            }
392            $args['options']['data_locator_meta'] = $data_locator_meta;            $args['options']['data_locator_meta'] = $data_locator_meta;
# Line 342  class WebExplorer_AbstractExplorer { Line 397  class WebExplorer_AbstractExplorer {
397          $args = array();          $args = array();
398        }        }
399    
400        // NEW [2003-04-08]: RemoteAction (e.g.: result of a selection inside a Chooser)
401        // switch component type
402        } elseif ($val['ecom_type'] == "call") {
403    
404          // responses of RemoteActions are not predictable!
405          if ($val['ecom_abstract_type'] == "auto") {
406            
407            // Dispatching by $label is not done here. RemoteAction-ecoms can appear anywhere!
408    
409            // Just define the RemoteQuery using a declaration to use DataSource::Generic most transparently.
410            // Really - just a remote call is issued, no data-/schema-structures or similar are expected.
411            
412            // The RemoteMethod 'method' is called directly with arguments in 'args'!
413            // As response (important for widget assignement!) you may expect an arbitrary payload.
414            $args['options']['data_locator_meta'] = array(
415              transport => 'rpc',
416              metatype => 'method',
417              method => $val['ecom_call_method'],
418              args => $val['ecom_call_args']
419            );
420            
421          } else {
422            // FIXME: implement automatic re-dispatching to available ecoms here!
423            user_error("WebExplorer::AbstractExplorer: results of RemoteActions can only be handled automatically. Who knows what comes back?");
424          }      
425    
426      }      }
427      return $args;      return $args;

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

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