/[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.1 by jonen, Thu Mar 20 03:48:46 2003 UTC revision 1.8 by jonen, Fri Apr 4 01:16:03 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.8  2003/04/04 01:16:03  jonen
8    ##    +  integrated different mode's for 'DataItem'
9    ##
10    ##    Revision 1.7  2003/03/29 07:49:55  joko
11    ##    show boxes in DEBUG-mode only!
12    ##
13    ##    Revision 1.6  2003/03/28 06:42:37  joko
14    ##    fix: propagating rpc-debugging-options to constants here
15    ##
16    ##    Revision 1.5  2003/03/27 01:24:29  jonen
17    ##    + enabled navigation ecom (only list yet)
18    ##
19    ##    Revision 1.4  2003/03/20 08:02:11  jonen
20    ##    + purged code
21    ##
22    ##    Revision 1.3  2003/03/20 07:54:52  jonen
23    ##    + added docu
24    ##
25    ##    Revision 1.2  2003/03/20 07:44:31  jonen
26    ##    + removed dumper
27    ##
28  ##    Revision 1.1  2003/03/20 03:48:46  jonen  ##    Revision 1.1  2003/03/20 03:48:46  jonen
29  ##    + initial commit  ##    + initial commit
30  ##  ##
# Line 26  Line 47 
47  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
48  */  */
49    
50    /**
51     * WebExplorer::AbstractExplorer - this can be simple compared to a container,
52     *  which modular GUI classes can be register, manipulated and rendered...
53     *
54     * @author Sebastian Utz <seut@tunemedia.de>
55     * @package org.netfrag.app
56     * @name WebExplorer::AbstractExplorer
57     */
58    
59    
60  class WebExplorer_AbstractExplorer {  class WebExplorer_AbstractExplorer {
61    
# Line 54  class WebExplorer_AbstractExplorer { Line 84  class WebExplorer_AbstractExplorer {
84    */    */
85   var $_e_state = array();   var $_e_state = array();
86    
  // needed (old)?  
  var $_control = array();  
  var $_hidden_elements = array();  
   
87    
88    function WebExplorer_AbstractExplorer($data_locators=array()) {    function WebExplorer_AbstractExplorer($data_locators=array()) {
89      $this->_data_locators = $data_locators;      $this->_data_locators = $data_locators;
90      $this->init_default_gui_modules();      $this->init_default_gui_modules();
91            
92      $this->set_e_state();      $this->set_e_state();
93      print "State: " . Dumper($this->_state) ."<br>";      //print "State: " . Dumper($this->_state) ."<br>";
94      print "E_State: " . Dumper($this->_e_state) ."<br>";      $div = html_div();
95        $div->add( html_b(get_class($this)), html_hr(), "Explorer_State: " . Dumper($this->_e_state));
96        $div->set_style('background: #adadad; border: 2px black groove; width:640px; padding:10px; margin:40px;');
97        if (constants::get('DEBUG')) {
98          print $div->render();
99        }
100      //$this->init_state();      //$this->init_state();
101    }    }
102    
# Line 81  class WebExplorer_AbstractExplorer { Line 112  class WebExplorer_AbstractExplorer {
112        $rpcinfo = $app->getConfig("rpcinfo");        $rpcinfo = $app->getConfig("rpcinfo");
113        define('RPC_HOSTNAME', $rpcinfo[Host]);        define('RPC_HOSTNAME', $rpcinfo[Host]);
114        define('RPC_PORT', $rpcinfo[Port]);        define('RPC_PORT', $rpcinfo[Port]);
115          define('RPC_DEBUG', $rpcinfo[DEBUG]);
116          define('RPC_TRACE', $rpcinfo[TRACE]);
117          define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]);
118      } else {      } else {
119        user_error("AbstractExplorer::set_data_locator - data_locator_key label $label not found!");        user_error("AbstractExplorer::set_data_locator - data_locator_key label $label not found!");
120      }      }
# Line 107  class WebExplorer_AbstractExplorer { Line 141  class WebExplorer_AbstractExplorer {
141    
142    function init_default_gui_modules() {    function init_default_gui_modules() {
143      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );
144      $this->register_gui_module("list", "nav", array( 'name' => "NavigationList", 'type' => "list") );      $this->register_gui_module("list", "nav", array( 'name' => "WebExplorer::Module::NavigationList", 'type' => "list") );
145      $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") );
146      $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") );
147    }    }
# Line 155  class WebExplorer_AbstractExplorer { Line 189  class WebExplorer_AbstractExplorer {
189    
190      // add hidden vars, needed for explorer control      // add hidden vars, needed for explorer control
191      $hidden_items = $this->_get_hidden_items($label);      $hidden_items = $this->_get_hidden_items($label);
192      $ecom->add_hidden_items($hidden_items);      if(is_array($hidden_items) ) {
193      //print "Hidden: " . Dumper($gui_ecom->_hidden_items);        $ecom->add_hidden_items($hidden_items);
194          //print "Hidden: " . Dumper($hidden_items);
195        }
196    
197      $this->_ecom[$label] = &$gui_ecom;      $this->_ecom[$label] = &$gui_ecom;
198    }    }
199    
200    function _get_hidden_items($label) {    function _get_hidden_items($label) {
201      $ecom_state = $this->_e_state['ecoms'][$label];      $ecom_state = $this->_e_state['ecoms'][$label];
202      if($ecom_state['ecom_abstract_type'] == "list") {      if($ecom_state['ecom_type'] == "data") {
203        $hidden_items = array(        if($ecom_state['ecom_abstract_type'] == "list") {
204            $hidden_items = array(
205                                    'ecl' => $label,                                    'ecl' => $label,
206                                      'ecat' => "item",
207                                      'ecmod' => "view",
208                                    );                                    );
209          }
210          elseif($ecom_state['ecom_abstract_type'] == "item") {
211            $hidden_items = array(
212                                      'ecl' => $label,
213                                      'ecat' => "item",
214                                      'ecmod' => "view",
215                                      );
216    /*
217            if($ecom_state['ecom_mode'] == "view") {
218              $hidden_items['ecmod'] = "edit";
219            }
220            elseif($ecom_state['ecom_mode'] == "edit") {
221              $hidden_items['ecmod'] = "edit";
222            }
223    */      
224          }
225          $hidden_items['ap'] = "explorer";
226      }      }
     // set default hidden item for whole explorer  
     $hidden_items['ap'] = "explorer";  
227      return $hidden_items;      return $hidden_items;
228    }    }
229    
230    function _prepare_component_args($label) {        function _prepare_component_args($label) {    
231      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
232      $this->set_data_locator($val['ecom_data_locator_key']);      $this->set_data_locator($val['ecom_data_locator_key']);
233      if($val['ecom_abstract_type'] == "list") {      // switch component type
234        if($val['ecom_data_locator_key'] == "rpc") {      if($val['ecom_type'] == "data") {
235          $data_locator_meta = array( datasource => 'rpc', metatype => 'data', vartype => 'objects', classname => $val['ecom_data_ident']);        // switch abstract type
236        } else {        if($val['ecom_abstract_type'] == "list") {
237          user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");          if($val['ecom_data_locator_key'] == "rpc") {
238        }            //$data_locator_meta = array( datasource => 'rpc', metatype => 'data', vartype => 'objects', classname => $val['ecom_data_ident']);
239        $args = array(            $data_locator_meta = array( datasource => 'rpc', metatype => 'data', abstract_type => 'list', classname => $val['ecom_data_ident']);
240            } else {
241              user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
242            }
243            $args = array(
244                        'caption' => "Liste",                        'caption' => "Liste",
245                        'orderby' => "Guid",                        'orderby' => "Guid",
246                        'options' => array(                        'options' => array(
# Line 194  class WebExplorer_AbstractExplorer { Line 252  class WebExplorer_AbstractExplorer {
252                                                ),                                                ),
253                                            ),                                            ),
254                        );                        );
255      } elseif ($ecom_type == "item") {        // switch abstract type
256        $args = array();        } elseif ($val['ecom_abstract_type'] == "item") {
257      } elseif ($ecom_type == "nav") {          if($val['ecom_data_locator_key'] == "rpc") {
258        $args = array();            //$data_locator_meta = array( datasource => 'rpc', metatype => 'data', vartype => 'objects', classname => $val['ecom_data_ident']);
259              $data_locator_meta = array( datasource => 'rpc', metatype => 'data', abstract_type => 'item', ident => $val['ecom_data_ident'], classname => $val['ecom_data_meta']);
260            } else {
261              user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
262            }
263            if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
264            print "Mode: $val[ecom_mode]<br>";
265            $args = array(
266                          'caption' => "Item",
267                          'mode' => $val['ecom_mode'],
268                          'options' => array(
269                                              'data_locator_meta' => $data_locator_meta,
270                                              'decode' => 1,
271                                              'decode_args' => array(
272                                                  'seperator' => "_",
273                                                  ),
274                                              ),
275                          );
276             if($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }
277          }
278        // switch component type
279        } elseif ($val['ecom_type'] == "nav") {
280          // switch abstract type
281          if($val['ecom_abstract_type'] == "list") {
282            if($val['ecom_data_locator_key'] == "rpc") {
283              $data_locator_meta = array( datasource => 'rpc', metatype => 'schema' );
284            } else {
285              user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
286            }
287            $args = array(
288                          'caption' => "Objekt Typen",
289                          'options' => array(
290                                              'data_locator_meta' => $data_locator_meta,
291                                              ),
292                          );
293          } elseif ($val['ecom_abstract_type'] == "tree") {
294            $args = array();
295          }
296      }      }
297      return $args;      return $args;
298    }    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.8

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