/[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.10 by joko, Sat Apr 5 20:32:04 2003 UTC revision 1.11 by jonen, Mon Apr 7 22:31:51 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.11  2003/04/07 22:31:51  jonen
8    ##    + added switch of ecom label (e.g. nav, chooser) at ecom type switch 'nav'
9    ##    - removed recent added ecom type chooser
10    ##
11  ##    Revision 1.10  2003/04/05 20:32:04  joko  ##    Revision 1.10  2003/04/05 20:32:04  joko
12  ##    added Chooser  ##    added Chooser
13  ##  ##
# Line 93  class WebExplorer_AbstractExplorer { Line 97  class WebExplorer_AbstractExplorer {
97    
98    function WebExplorer_AbstractExplorer($data_locators=array()) {    function WebExplorer_AbstractExplorer($data_locators=array()) {
99      $this->_data_locators = $data_locators;      $this->_data_locators = $data_locators;
100      $this->init_default_gui_modules();      $this->init_default_gui_modules();    
       
101      $this->set_e_state();      $this->set_e_state();
102    
103        //debug
104      //print "State: " . Dumper($this->_state) ."<br>";      //print "State: " . Dumper($this->_state) ."<br>";
105      $div = html_div();      $div = html_div();
106      $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));
# Line 103  class WebExplorer_AbstractExplorer { Line 108  class WebExplorer_AbstractExplorer {
108      if (constants::get('DEBUG')) {      if (constants::get('DEBUG')) {
109        print $div->render();        print $div->render();
110      }      }
     //$this->init_state();  
111    }    }
112    
113    
# Line 147  class WebExplorer_AbstractExplorer { Line 151  class WebExplorer_AbstractExplorer {
151    
152    function init_default_gui_modules() {    function init_default_gui_modules() {
153      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );      //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );
154      $this->register_gui_module("list", "nav", array( 'name' => "WebExplorer::Module::NavigationList", 'type' => "list") );      $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );
155      $this->register_gui_module("list", "data", array( 'name' => "WebExplorer::Module::DataList", 'type' => "list") );      $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );
156      $this->register_gui_module("item", "data", array( 'name' => "WebExplorer::Module::DataItem", 'type' => "item") );      $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );
157      // 2003-04-05 - Chooser      // 2003-04-05 - Chooser
158      $this->register_gui_module("list", "chooser", array( 'name' => "WebExplorer::Module::Chooser", 'type' => "list") );      $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");    
159    }    }
160    
161    function register_source_module($label, $args) {    function register_source_module($label, $args) {
162      $this->_module['source'][$label] = $args;      $this->_module['source'][$label] = $args;
163    }    }
164        
165    function register_gui_module($abstract_type, $ecom_type, $args) {    function register_gui_module($label, $ecom_type, $abstract_type, $module_name) {
166      $this->_module['gui'][$ecom_type][$abstract_type] = $args;      $this->_module['gui'][$label][$ecom_type][$abstract_type] = $module_name;
167    }    }
168    
169    
170    function &get_ecom($label) {    function &get_ecom($label) {
171      //return "Hello World";      //return "Hello World";
172      $this->_load_ecom($label);      $this->_load_ecom($label);
173      return $this->_ecom[$label];      return $this->_ecom[$label];
174    }    }
175    
176    
177        
178    function _load_ecoms() {    function _load_ecoms() {
179      //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");      //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");
# Line 174  class WebExplorer_AbstractExplorer { Line 181  class WebExplorer_AbstractExplorer {
181        $this->_load_ecom($label);        $this->_load_ecom($label);
182      }      }
183    }    }
184    
185    
186        
187    function _load_ecom($label) {    function _load_ecom($label) {
188            // fetch values from state
189      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
190      debug::info("_load_ecom: " . Dumper($val) . "<br/>");      debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");
191      // find right gui module  
192      $com_type = $val['ecom_type'];      // find right ecom gui module
193        $ecom_type = $val['ecom_type'];
194      $abstract_type = $val['ecom_abstract_type'];      $abstract_type = $val['ecom_abstract_type'];
195      $gui_module = $this->_module['gui'][$com_type][$abstract_type]['name'];      $gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type];
196        //print Dumper($gui_module);
197      if(!$gui_module) {      if(!$gui_module) {
198        user_error("AbstractExplorer::_load_component - No GUI module found. [label='$label', 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]']");
199        return;        return;
200      }      }
201      // get arguments needed for gui module  
202        // get arguments needed for ecom gui module
203      $args = $this->_prepare_component_args($label);      $args = $this->_prepare_component_args($label);
204      //print Dumper($args);      //print Dumper($args);
205            
206      // get GUI module      // get ecom GUI module
207      $ecom = php::mkComponent($gui_module, $args);      $ecom = php::mkComponent($gui_module, $args);
208      //print Dumper($ecom);      //print Dumper($ecom);
209                    
210      // get phphtmllib GUI object      // load phphtmllib GUI object
211      $gui_ecom = &$ecom->get();      $gui_ecom = &$ecom->get();
212    
213      // add hidden vars, needed for explorer control      // add hidden vars, needed for explorer control
# Line 205  class WebExplorer_AbstractExplorer { Line 217  class WebExplorer_AbstractExplorer {
217        //print "Hidden: " . Dumper($hidden_items);        //print "Hidden: " . Dumper($hidden_items);
218      }      }
219    
220        // attempt:
221        //$gui_ecom->make_transparent();
222        
223        // store phphtmllib GUI object
224      $this->_ecom[$label] = &$gui_ecom;      $this->_ecom[$label] = &$gui_ecom;
225    }    }
226    
227    
228    
229    function _get_hidden_items($label) {    function _get_hidden_items($label) {
230      $ecom_state = $this->_e_state['ecoms'][$label];      $ecom_state = $this->_e_state['ecoms'][$label];
231      if($ecom_state['ecom_type'] == "data") {      if($ecom_state['ecom_type'] == "data") {
# Line 238  class WebExplorer_AbstractExplorer { Line 256  class WebExplorer_AbstractExplorer {
256      return $hidden_items;      return $hidden_items;
257    }    }
258    
259    
260    
261    function _prepare_component_args($label) {        function _prepare_component_args($label) {    
262      $val = $this->_e_state['ecoms'][$label];      $val = $this->_e_state['ecoms'][$label];
263      $this->set_data_locator($val['ecom_data_locator_key']);      $this->set_data_locator($val['ecom_data_locator_key']);
# Line 263  class WebExplorer_AbstractExplorer { Line 283  class WebExplorer_AbstractExplorer {
283            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] !");
284          }          }
285          $args = array(          $args = array(
286                        'caption' => "Liste",                        'caption' => $val['ecom_data_ident'],
287                        'orderby' => "Guid",                        'orderby' => "Guid",
288                        'options' => array(                        'options' => array(
289                                            'data_locator_meta' => $data_locator_meta,                                            'data_locator_meta' => $data_locator_meta,
# Line 285  class WebExplorer_AbstractExplorer { Line 305  class WebExplorer_AbstractExplorer {
305          if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }          if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
306          print "Mode: $val[ecom_mode]<br>";          print "Mode: $val[ecom_mode]<br>";
307          $args = array(          $args = array(
308                        'caption' => "Item",                        'caption' => $val['ecom_data_meta'],
309                        'mode' => $val['ecom_mode'],                        'mode' => $val['ecom_mode'],
310                        'options' => array(                        'options' => array(
311                                            'data_locator_meta' => $data_locator_meta,                                            'data_locator_meta' => $data_locator_meta,
# Line 302  class WebExplorer_AbstractExplorer { Line 322  class WebExplorer_AbstractExplorer {
322      } elseif ($val['ecom_type'] == "nav") {      } elseif ($val['ecom_type'] == "nav") {
323        // switch abstract type        // switch abstract type
324        if($val['ecom_abstract_type'] == "list") {        if($val['ecom_abstract_type'] == "list") {
325           $args = array();
326          if($val['ecom_data_locator_key'] == "rpc") {          if($val['ecom_data_locator_key'] == "rpc") {
327            $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );            // switch component label
328              if($label == "nav") {
329                $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
330                $args['caption'] = "Objekt Typen";
331              }
332              // NEW [2003-04-05]: DataSource.Chooser
333              elseif ($label == "chooser") {
334                $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'sources.all' );
335                $args['caption'] = "Datenquellen";
336              }
337              $args['options']['data_locator_meta'] = $data_locator_meta;
338          } else {          } else {
339            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] !");
340          }          }
         $args = array(  
                       'caption' => "Objekt Typen",  
                       'options' => array(  
                                           'data_locator_meta' => $data_locator_meta,  
                                           ),  
                       );  
341        } elseif ($val['ecom_abstract_type'] == "tree") {        } elseif ($val['ecom_abstract_type'] == "tree") {
342          $args = array();          $args = array();
343        }        }
344    
     // switch component type  
     // NEW [2003-04-05]: DataSource.Chooser  
     } elseif ($val['ecom_type'] == "chooser") {  
   
       // switch abstract type  
       if($val['ecom_abstract_type'] == "list") {  
         if ($val['ecom_data_locator_key'] == "rpc") {  
           $data_locator_meta = array( datasource => 'rpc', metatype => 'schema', filter => 'sources.all' );  
         } else {  
           user_error("AbstractExplorer::_prepare_component_args - Cannot build schema query for data_locator_key $val[ecom_data_locator_key] !");  
         }  
         $args = array(  
           'caption' => "Datenquellen",  
           'options' => array(  
           'data_locator_meta' => $data_locator_meta,  
           ),  
         );  
       } elseif ($val['ecom_abstract_type'] == "tree") {  
         $args = array();  
       }  
345    
346      }      }
347      return $args;      return $args;
348    }    }
349    
350    
351    
352    function get_msg($label) {    function get_msg($label) {
353      if($label == "welcome") {      if($label == "welcome") {
354        $msg = "Welcome to the Explorer.";        $msg = "Welcome to the Explorer.";
355      }      }
356      return $msg;      return $msg;
357    }    }
358    
359    
360        
361    function render() {    function render() {
362      user_error("AbstractExplorer::render - please implement me....");      user_error("AbstractExplorer::render - please implement me....");

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

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