/[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.7 by joko, Sat Mar 29 07:49:55 2003 UTC revision 1.10 by joko, Sat Apr 5 20:32:04 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.10  2003/04/05 20:32:04  joko
8    ##    added Chooser
9    ##
10    ##    Revision 1.9  2003/04/04 02:22:37  joko
11    ##    minor fix: querySchema now issues argument
12    ##
13    ##    Revision 1.8  2003/04/04 01:16:03  jonen
14    ##    +  integrated different mode's for 'DataItem'
15    ##
16  ##    Revision 1.7  2003/03/29 07:49:55  joko  ##    Revision 1.7  2003/03/29 07:49:55  joko
17  ##    show boxes in DEBUG-mode only!  ##    show boxes in DEBUG-mode only!
18  ##  ##
# Line 141  class WebExplorer_AbstractExplorer { Line 150  class WebExplorer_AbstractExplorer {
150      $this->register_gui_module("list", "nav", array( 'name' => "WebExplorer::Module::NavigationList", 'type' => "list") );      $this->register_gui_module("list", "nav", array( 'name' => "WebExplorer::Module::NavigationList", 'type' => "list") );
151      $this->register_gui_module("list", "data", array( 'name' => "WebExplorer::Module::DataList", 'type' => "list") );      $this->register_gui_module("list", "data", array( 'name' => "WebExplorer::Module::DataList", 'type' => "list") );
152      $this->register_gui_module("item", "data", array( 'name' => "WebExplorer::Module::DataItem", 'type' => "item") );      $this->register_gui_module("item", "data", array( 'name' => "WebExplorer::Module::DataItem", 'type' => "item") );
153        // 2003-04-05 - Chooser
154        $this->register_gui_module("list", "chooser", array( 'name' => "WebExplorer::Module::Chooser", 'type' => "list") );
155    }    }
156    
157    function register_source_module($label, $args) {    function register_source_module($label, $args) {
# Line 158  class WebExplorer_AbstractExplorer { Line 169  class WebExplorer_AbstractExplorer {
169    }    }
170        
171    function _load_ecoms() {    function _load_ecoms() {
172        //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");
173      foreach($this->_e_state[ecoms] as $label => $val) {      foreach($this->_e_state[ecoms] as $label => $val) {
174        $this->_load_ecom($label);        $this->_load_ecom($label);
175      }      }
176    }    }
177        
178    function _load_ecom($label) {    function _load_ecom($label) {
179        
180      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
181        debug::info("_load_ecom: " . Dumper($val) . "<br/>");
182      // find right gui module      // find right gui module
183      $com_type = $val['ecom_type'];      $com_type = $val['ecom_type'];
184      $abstract_type = $val['ecom_abstract_type'];      $abstract_type = $val['ecom_abstract_type'];
185      $gui_module = $this->_module['gui'][$com_type][$abstract_type]['name'];      $gui_module = $this->_module['gui'][$com_type][$abstract_type]['name'];
186      if(!$gui_module) {      if(!$gui_module) {
187        user_error("AbstractExplorer::_load_component - No GUI module found for abstract type $val[ecom_abstract_type] ecom type $val[ecom_type] !");        user_error("AbstractExplorer::_load_component - No GUI module found. [label='$label', abstract type='$val[ecom_abstract_type]', ecom type='$val[ecom_type]']");
188        return;        return;
189      }      }
190      // get arguments needed for gui module      // get arguments needed for gui module
# Line 186  class WebExplorer_AbstractExplorer { Line 200  class WebExplorer_AbstractExplorer {
200    
201      // add hidden vars, needed for explorer control      // add hidden vars, needed for explorer control
202      $hidden_items = $this->_get_hidden_items($label);      $hidden_items = $this->_get_hidden_items($label);
203      if(is_array($hidden_items) ) { $ecom->add_hidden_items($hidden_items); }      if(is_array($hidden_items) ) {
204      //print "Hidden: " . Dumper($gui_ecom->_hidden_items);        $ecom->add_hidden_items($hidden_items);
205          //print "Hidden: " . Dumper($hidden_items);
206        }
207    
208      $this->_ecom[$label] = &$gui_ecom;      $this->_ecom[$label] = &$gui_ecom;
209    }    }
# Line 198  class WebExplorer_AbstractExplorer { Line 214  class WebExplorer_AbstractExplorer {
214        if($ecom_state['ecom_abstract_type'] == "list") {        if($ecom_state['ecom_abstract_type'] == "list") {
215          $hidden_items = array(          $hidden_items = array(
216                                    'ecl' => $label,                                    'ecl' => $label,
217                                      'ecat' => "item",
218                                      'ecmod' => "view",
219                                    );                                    );
220        }        }
221        // set default hidden item for whole explorer        elseif($ecom_state['ecom_abstract_type'] == "item") {
222            $hidden_items = array(
223                                      'ecl' => $label,
224                                      'ecat' => "item",
225                                      'ecmod' => "view",
226                                      );
227    /*
228            if($ecom_state['ecom_mode'] == "view") {
229              $hidden_items['ecmod'] = "edit";
230            }
231            elseif($ecom_state['ecom_mode'] == "edit") {
232              $hidden_items['ecmod'] = "edit";
233            }
234    */      
235          }
236        $hidden_items['ap'] = "explorer";        $hidden_items['ap'] = "explorer";
237      }      }
238      return $hidden_items;      return $hidden_items;
# Line 209  class WebExplorer_AbstractExplorer { Line 241  class WebExplorer_AbstractExplorer {
241    function _prepare_component_args($label) {        function _prepare_component_args($label) {    
242      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
243      $this->set_data_locator($val['ecom_data_locator_key']);      $this->set_data_locator($val['ecom_data_locator_key']);
244    
245        // detect and execute 'selectSource' action
246        // FIXME: this is a HACK!!! move to a module 'BackendAction' or s.th.l.th.
247        //print Dumper($this->_e_state['sources']);
248        if ($source = $this->_e_state['main']['ecom_data_source_key']) {
249          //print "selectSource: $source<br/>";
250          //global $app;
251          //print Dumper($backend);
252          //$app->backend->do();
253        }
254        
255      // switch component type      // switch component type
256      if($val['ecom_type'] == "data") {      if($val['ecom_type'] == "data") {
257        // switch abstract type        // switch abstract type
# Line 233  class WebExplorer_AbstractExplorer { Line 276  class WebExplorer_AbstractExplorer {
276                        );                        );
277        // switch abstract type        // switch abstract type
278        } elseif ($val['ecom_abstract_type'] == "item") {        } elseif ($val['ecom_abstract_type'] == "item") {
279          $args = array();          if($val['ecom_data_locator_key'] == "rpc") {
280              //$data_locator_meta = array( datasource => 'rpc', metatype => 'data', vartype => 'objects', classname => $val['ecom_data_ident']);
281              $data_locator_meta = array( datasource => 'rpc', metatype => 'data', abstract_type => 'item', ident => $val['ecom_data_ident'], classname => $val['ecom_data_meta']);
282            } else {
283              user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
284            }
285            if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
286            print "Mode: $val[ecom_mode]<br>";
287            $args = array(
288                          'caption' => "Item",
289                          'mode' => $val['ecom_mode'],
290                          'options' => array(
291                                              'data_locator_meta' => $data_locator_meta,
292                                              'decode' => 1,
293                                              'decode_args' => array(
294                                                  'seperator' => "_",
295                                                  ),
296                                              ),
297                          );
298             if($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }
299        }        }
300        
301      // switch component type      // switch component type
302      } elseif ($val['ecom_type'] == "nav") {      } elseif ($val['ecom_type'] == "nav") {
303        // switch abstract type        // switch abstract type
304        if($val['ecom_abstract_type'] == "list") {        if($val['ecom_abstract_type'] == "list") {
305          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
306            $data_locator_meta = array( datasource => 'rpc', metatype => 'schema' );            $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
307          } else {          } else {
308            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] !");
309          }          }
310          $args = array(          $args = array(
311                        'caption' => "Objekt Typen",                        'caption' => "Objekt Typen",
# Line 253  class WebExplorer_AbstractExplorer { Line 316  class WebExplorer_AbstractExplorer {
316        } elseif ($val['ecom_abstract_type'] == "tree") {        } elseif ($val['ecom_abstract_type'] == "tree") {
317          $args = array();          $args = array();
318        }        }
319    
320        // switch component type
321        // NEW [2003-04-05]: DataSource.Chooser
322        } elseif ($val['ecom_type'] == "chooser") {
323    
324          // switch abstract type
325          if($val['ecom_abstract_type'] == "list") {
326            if ($val['ecom_data_locator_key'] == "rpc") {
327              $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'sources.all' );
328            } else {
329              user_error("AbstractExplorer::_prepare_component_args - Cannot build schema query for data_locator_key $val[ecom_data_locator_key] !");
330            }
331            $args = array(
332              'caption' => "Datenquellen",
333              'options' => array(
334              'data_locator_meta' => $data_locator_meta,
335              ),
336            );
337          } elseif ($val['ecom_abstract_type'] == "tree") {
338            $args = array();
339          }
340    
341      }      }
342      return $args;      return $args;
343    }    }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.10

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