/[cvs]/nfo/php/libs/org.netfrag.app/WebExplorer/Module/NavigationTree.php
ViewVC logotype

Annotation of /nfo/php/libs/org.netfrag.app/WebExplorer/Module/NavigationTree.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sat Apr 19 16:18:16 2003 UTC (21 years, 5 months ago) by jonen
Branch: MAIN
initial commit

1 jonen 1.1 <?
2     /*
3     ## -----------------------------------------------------------------------------
4     ## $Id: NavigationTree.inc,v 1.1 2003/03/01 22:57:23 cvsmax Exp $
5     ## -----------------------------------------------------------------------------
6     ## $Log: NavigationTree.inc,v $
7     ##
8     ##
9     ## -----------------------------------------------------------------------------
10     */
11    
12     loadModule('WebExplorer::Module::AbstractGUIModule');
13    
14     class WebExplorer_Module_NavigationTree extends WebExplorer_Module_AbstractGUIModule {
15    
16     var $source;
17     var $result;
18     var $tree;
19    
20     function set_gui_object() {
21     $this->_gui_object = $this->buildTree();
22     }
23    
24    
25     function buildTree() {
26    
27     //print "args: " . Dumper($this->_args);
28    
29     $locator_meta = $this->_args['options']['data_locator_meta'];
30     //if (!$this->_args[caption]) { $this->_args[caption] = $locator_meta[ident] . " as " . $locator_meta[abstract_type]; }
31     if (!$this->_args[caption]) { $this->_args[caption] = ""; }
32    
33    
34     // query data
35     $initial_locator = php::mkComponent( 'DataSource::Locator', array( adapter_type => 'free' ) );
36     $proxy = php::mkComponent('DataSource::Generic', $initial_locator, $this->_args['options']['data_locator_meta']);
37     //print "proxy: " . Dumper($proxy);
38    
39     if ($this->source = $proxy->get_adapter()) {
40     //print "source: " . Dumper($this->source);
41     $this->source->do_query();
42     }
43    
44     //print "result: " . Dumper($this->source->_result);
45    
46     // get navigation data structure (nested tree) from backend object
47     // remote or locally? we just don't care here....
48     //global $backend;
49    
50     // V1 - HACK!!!
51     //$this->backend = new TsBackend();
52     //$treedata = $this->backend->getNavigationTree();
53    
54     // V2 - better
55     $treedata = $this->source->get_result();
56    
57     //print Dumper($treedata);
58    
59     /*
60     $treedata = array(
61     //'name' => '', attributes => array( url => '123' ),
62     'children' => array(
63     array( name => 'Login', attributes => array( url => linkargs::topic('Login') ) ),
64     array( name => 'Verwaltung', attributes => array( url => linkargs::topic('Overview') ),
65     'children' => array(
66     array( name => 'Jobs', attributes => array( url => linkargs::topic('Jobs') ) ),
67     array( name => 'Daten:Backend', attributes => array( url => linkargs::topic('DataBrowser') ) ),
68     array( name => 'Daten:Frontend', attributes => array( url => linkargs::topic('DataBrowser') ) ),
69     array( name => 'Daten:Steuerung', attributes => array( url => linkargs::topic('DataBrowser') ) ),
70     ),
71     ),
72     ));
73     */
74    
75     $hidden_elements = $this->_args['hidden_elements'];
76     $link_vars = array(
77     't' => $this->_args[caption],
78     'name' => "ecdid",
79     'list' => $hidden_elements
80     );
81    
82    
83     // convert (speak "lift") data from nested arrays/hashes to a hashified topic tree
84     // this step is required to satisfy the following lifting
85     $lift = mkObject('Data::Lift', $treedata, array( metatype => 'topic', link_args => $link_vars ) );
86     $this->topictree = $lift->to('ExplorerTree');
87     //print "topictree: " . Dumper($this->topictree) . "<br/>";
88    
89     //return;
90    
91     // convert (speak "lift") data from nested arrays/hashes to a PEAR::Tree object
92     $lift = mkObject('Data::Lift', $this->topictree, array( metatype => 'tree' ) );
93     $this->treeobject = $lift->to('PEAR::Tree');
94     //print "treeobject: " . Dumper($this->treeobject) . "<br/>";
95    
96     // trace
97     //print Dumper($initial_locator);
98     //print Dumper($this->_args);
99    
100     //$this->nav = new VerticalCSSNavTable($this->_args['caption'], "", $width="100%");
101     //$this->tree = new VerticalCSSNavTable($this->_args['caption'], "", $width="100%");
102     $this->tree = new DHTMLTreeNav( $this->treeobject );
103    
104     //$this->tree->add(link::topic('DataBrowser'), "No data.");
105    
106    
107     /*
108     // check valid/non-empty result
109     //if ($itemCount = $this->source->get_total_rows()) {
110     if (1) {
111     $this->result = $this->source->_result;
112    
113     // trace
114     //print Dumper($source->_result);
115    
116     //if (is_array($result)) {
117     $this->propagate();
118     //}
119    
120     } else {
121    
122     // both are valid! (at least - should be...)
123     //$nav->add(pageLink('explorer'), "No data.");
124     //$this->nav->add(link::topic('DataBrowser'), "No data.");
125     print "No data.<br/>";
126    
127     }
128     */
129    
130    
131     $container = html_div();
132     $container->add( $this->tree, html_br() );
133    
134     return $container;
135    
136     }
137    
138    
139    
140     }
141    
142     ?>

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