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