4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.27 2004/03/11 21:01:35 jonen |
8 |
|
## minor change |
9 |
|
## |
10 |
|
## Revision 1.26 2003/12/14 01:50:30 jonen |
11 |
|
## implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes |
12 |
|
## |
13 |
|
## Revision 1.25 2003/11/22 18:47:49 udo |
14 |
|
## update for expand data item |
15 |
|
## |
16 |
|
## Revision 1.24 2003/07/02 11:39:16 jonen |
17 |
|
## fixed bugs |
18 |
|
## |
19 |
|
## Revision 1.23 2003/06/06 11:57:20 joko |
20 |
|
## minor update: cosmetic changes |
21 |
|
## |
22 |
|
## Revision 1.22 2003/05/13 14:50:27 joko |
23 |
|
## HACKed compatibility for config-type data sources |
24 |
|
## + function get_data_filter |
25 |
|
## |
26 |
|
## Revision 1.21 2003/05/10 18:23:21 jonen |
27 |
|
## + added stuff relating to 'create/add new' links/buttons |
28 |
|
## |
29 |
|
## Revision 1.20 2003/04/19 16:24:49 jonen |
30 |
|
## + added two more GUI modules to default registry initiation, |
31 |
|
## relating to new navigation module 'NavigationTree' |
32 |
|
## + added prepartion of needed args for abstract navigation tree |
33 |
|
## and concret UserManagment 'UMnav' tree |
34 |
|
## |
35 |
|
## Revision 1.19 2003/04/18 16:21:37 joko |
36 |
|
## fixed commit comment - the last one caused a syntax error!!! |
37 |
|
## |
38 |
|
## Revision 1.18 2003/04/18 15:27:06 joko |
39 |
|
## NEW: XML Trees in data area |
40 |
|
## new ecom module: DataTree |
41 |
|
## introduced new query argument: 'filter' (purpose: xml/tree filtering) |
42 |
|
## $filter = array( |
43 |
|
## dotted => $val['ecom_data_filter'], |
44 |
|
## ident => $val['ecom_data_ident'], |
45 |
|
## ); |
46 |
|
## A Data::Lift module translates this filter-query into a XPath-query ... |
47 |
|
## $filter = array( |
48 |
|
## xpq => '*\/*[@name="cli"]', |
49 |
|
## ); |
50 |
|
## ... which finally is propagated to the backend. |
51 |
|
## NEW: AbstractExplorer - standalone version |
52 |
|
## enhanced set_e_state: now can overwrite internal state to arguments from outside |
53 |
|
## enhanced get_com: also capable of propagating additional args through _load_ecom to _prepare_component_args |
54 |
|
## enhanced _prepare_component_args: now able to dispatch to a "transparent navigation ecom" (e.g. YAA::JobGroups) |
55 |
|
## MISC: |
56 |
|
## added some pre-flight checks throughout the module, especially at the core dispatcher inside _prepare_component_args |
57 |
|
## error checking: added some more croaks via 'user_error' |
58 |
|
## cosmetic updates |
59 |
|
## |
60 |
## Revision 1.17 2003/04/18 13:46:15 jonen |
## Revision 1.17 2003/04/18 13:46:15 jonen |
61 |
## + add hidden elements(items) now to the constructor arguments of each ecom |
## + add hidden elements(items) now to the constructor arguments of each ecom |
62 |
## |
## |
173 |
$this->set_e_state(); |
$this->set_e_state(); |
174 |
|
|
175 |
//debug |
//debug |
176 |
//print "State: " . Dumper($this->_state) ."<br>"; |
// print "State: " . Dumper($this->_state) ."<br>"; |
177 |
|
//print "_data_locators: " . Dumper($this->_data_locators) ."<br>"; |
178 |
$div = html_div(); |
$div = html_div(); |
179 |
$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)); |
180 |
$div->set_style('background: #adadad; border: 2px black groove; width:640px; padding:10px; margin:40px;'); |
$div->set_style('background: #adadad; border: 2px black groove; width:640px; padding:10px; margin:40px;'); |
190 |
|
|
191 |
function set_data_locator($label, $new_args=array() ) { |
function set_data_locator($label, $new_args=array() ) { |
192 |
global $app; |
global $app; |
193 |
//print Dumper($app) . "<br>"; |
|
194 |
if($label == "rpc") { |
// pre-flight checks |
195 |
|
if (!$label) { |
196 |
|
user_error("AbstractExplorer::set_data_locator - label was empty."); |
197 |
|
return; |
198 |
|
} |
199 |
|
|
200 |
|
if ($label == "rpc") { |
201 |
$rpcinfo = $app->getConfig("rpcinfo"); |
$rpcinfo = $app->getConfig("rpcinfo"); |
202 |
define('RPC_HOSTNAME', $rpcinfo[Host]); |
define('RPC_HOSTNAME', $rpcinfo[Host]); |
203 |
define('RPC_PORT', $rpcinfo[Port]); |
define('RPC_PORT', $rpcinfo[Port]); |
205 |
define('RPC_TRACE', $rpcinfo[TRACE]); |
define('RPC_TRACE', $rpcinfo[TRACE]); |
206 |
define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]); |
define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]); |
207 |
} else { |
} else { |
208 |
user_error("AbstractExplorer::set_data_locator - data_locator_key label $label not found!"); |
user_error("AbstractExplorer::set_data_locator - Could not dispatch data_locator_key label '$label'!"); |
209 |
} |
} |
210 |
} |
} |
211 |
|
|
217 |
$this->_state = $requestTracker->getPointer(); |
$this->_state = $requestTracker->getPointer(); |
218 |
} |
} |
219 |
|
|
220 |
function set_e_state() { |
function set_e_state($state = null) { |
221 |
$this->get_page_state(); |
// NEW [2003-04-18]: now has two modes |
222 |
$this->_e_state = $this->_state[options][options]; |
// 1. inject page state from argument passed to us |
223 |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
// 2. (was) get page state from request tracker |
224 |
|
if ($state) { |
225 |
|
$this->_e_state = $state; |
226 |
|
|
227 |
|
} else { |
228 |
|
$this->get_page_state(); |
229 |
|
$this->_e_state = $this->_state[options][options]; |
230 |
|
|
231 |
|
} |
232 |
|
// print "Setting Explorer state:" . Dumper($this->_e_state); |
233 |
} |
} |
|
|
|
234 |
|
|
235 |
function set_page_state() { |
function set_page_state() { |
236 |
user_error("AbstractExplorer::set_page_state - please implement me...."); |
user_error("AbstractExplorer::set_page_state - please implement me...."); |
237 |
} |
} |
|
|
|
238 |
|
|
239 |
function init_default_gui_modules() { |
function init_default_gui_modules() { |
240 |
|
|
241 |
// format of parameters: label, ecom_type, abstract_type, module_name |
// format of parameters: label, ecom_type, abstract_type, module_name |
242 |
|
|
243 |
|
// 2003-03-02 - First ecom modules/components |
244 |
//$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") ); |
//$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") ); |
245 |
$this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" ); |
$this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" ); |
246 |
$this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" ); |
$this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" ); |
247 |
$this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" ); |
$this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" ); |
248 |
// 2003-04-05 - Chooser |
|
249 |
|
// 2003-04-05 - Chooser (a Nav.List) |
250 |
$this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser"); |
$this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser"); |
251 |
|
|
252 |
// 2003-04-07 - RemoteAction |
// 2003-04-07 - RemoteAction |
253 |
$this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction"); |
$this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction"); |
254 |
// 2003-04-09 - Item.Delete |
|
255 |
|
// 2003-04-09 - Data.Item: DeleteAction |
256 |
$this->register_gui_module("phase_startup", "data", "item", "WebExplorer::Module::DataItem"); |
$this->register_gui_module("phase_startup", "data", "item", "WebExplorer::Module::DataItem"); |
257 |
//$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::RemoteAction"); |
//$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::RemoteAction"); |
258 |
//$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::DataItem"); |
//$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::DataItem"); |
259 |
|
|
260 |
|
// 2003-04-12 - Data.Tree |
261 |
|
$this->register_gui_module("content", "data", "tree", "WebExplorer::Module::DataTree" ); |
262 |
|
|
263 |
|
// 2003-04-18 - Nav.Tree |
264 |
|
$this->register_gui_module("nav", "nav", "tree", "WebExplorer::Module::NavigationTree" ); |
265 |
|
|
266 |
|
// 2003-04-18 - UserManagment Nav.Tree (we need only a different 'label' as Nav.Tree yet..) |
267 |
|
$this->register_gui_module("UMnav", "nav", "tree", "WebExplorer::Module::NavigationTree" ); |
268 |
|
|
269 |
} |
} |
270 |
|
|
271 |
function register_source_module($label, $args) { |
function register_source_module($label, $args) { |
277 |
} |
} |
278 |
|
|
279 |
|
|
280 |
function &get_ecom($label) { |
function &get_ecom($label, $args = array()) { |
281 |
|
|
282 |
|
// the very first - strongly hardcoded - Hello World ecom |
283 |
//return "Hello World"; |
//return "Hello World"; |
284 |
$this->_load_ecom($label); |
|
285 |
|
// that's better ... |
286 |
|
$this->_load_ecom($label, $args); |
287 |
|
|
288 |
|
//print "getEcom_args: " .Dumper($args). "<br>"; |
289 |
|
|
290 |
return $this->_ecom[$label]; |
return $this->_ecom[$label]; |
291 |
|
|
292 |
} |
} |
293 |
|
|
|
|
|
294 |
|
|
295 |
function _load_ecoms() { |
function _load_ecoms() { |
296 |
//trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>"); |
//trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>"); |
301 |
|
|
302 |
|
|
303 |
|
|
304 |
function _load_ecom($label) { |
function _load_ecom($label, $args = array()) { |
305 |
|
|
306 |
// fetch values from state |
// fetch values from state |
307 |
$val = $this->_e_state['ecoms'][$label]; |
$val = $this->_e_state['ecoms'][$label]; |
319 |
$gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type]; |
$gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type]; |
320 |
//print Dumper($gui_module); |
//print Dumper($gui_module); |
321 |
if(!$gui_module) { |
if(!$gui_module) { |
322 |
user_error("AbstractExplorer::_load_component - No GUI module found. [label='$label', abstract type='$val[ecom_abstract_type]', ecom type='$val[ecom_type]']"); |
user_error("_load_ecom: No GUI module found for [label='$label', ecom type='$val[ecom_type]', abstract type='$val[ecom_abstract_type]']."); |
323 |
return; |
return; |
324 |
} |
} |
325 |
|
|
326 |
// get arguments needed for ecom gui module |
// get arguments needed for ecom gui module |
327 |
$args = $this->_prepare_component_args($label); |
$args = $this->_prepare_component_args($label, $args); |
328 |
//print Dumper($args); |
|
329 |
|
// trace |
330 |
|
//print "raw-args: " . Dumper($args) . "<br/>"; |
331 |
|
|
332 |
// get ecom GUI module |
// get ecom GUI module |
333 |
if (!$ecom = php::mkComponent($gui_module, $args)) { |
if (!$ecom = php::mkComponent($gui_module, $args)) { |
334 |
|
user_error("AbstractExplorer::_load_component - Error while instantiating ecom gui component. [label='$label', abstract type='$val[ecom_abstract_type]', ecom type='$val[ecom_type]']"); |
335 |
return; |
return; |
336 |
} |
} |
337 |
//print Dumper($ecom); |
//print Dumper($ecom); |
338 |
|
|
339 |
// NOW[2003-18-04] done at via args(prepare args!) to pass at constructor |
// NEW[2003-04-18] done via args(prepare args!) passed at constructor |
340 |
// (needed for non-real objects instanced at some child of AbstractGUIModule, eg. NavigationList) |
// (needed for non-real objects instanced at some child of AbstractGUIModule, eg. NavigationList) |
341 |
/* |
/* |
342 |
// add hidden vars, needed for explorer control |
// add hidden vars, needed for explorer control |
365 |
if($ecom_state['ecom_abstract_type'] == "list") { |
if($ecom_state['ecom_abstract_type'] == "list") { |
366 |
$hidden_items = array( |
$hidden_items = array( |
367 |
'ecl' => $label, |
'ecl' => $label, |
368 |
'ecat' => "item", |
'ecat' => "list", |
369 |
'ecmod' => "view", |
'ecmod' => "view", |
370 |
|
'ecdid' => $ecom_state['ecom_data_ident'], |
371 |
); |
); |
372 |
} |
} |
373 |
elseif($ecom_state['ecom_abstract_type'] == "item") { |
elseif($ecom_state['ecom_abstract_type'] == "item") { |
384 |
// are more label specified!! |
// are more label specified!! |
385 |
// OLD: |
// OLD: |
386 |
//if($ecom_state['ecom_abstract_type'] == "list") { |
//if($ecom_state['ecom_abstract_type'] == "list") { |
387 |
|
|
388 |
|
// decide whether to link to items or to a list |
389 |
|
$abstract_type = 'list'; |
390 |
|
// FIXME: HACK |
391 |
|
if ($this->_e_state[main][ecom_data_source_key] == 'config') { |
392 |
|
$abstract_type = 'item'; |
393 |
|
} |
394 |
|
|
395 |
// NEW: |
// NEW: |
396 |
if($label == "nav") { |
if ($label == "nav") { |
397 |
$hidden_items = array( |
$hidden_items = array( |
398 |
'ecl' => "content", |
'ecl' => "content", |
399 |
'ecat' => "list", |
'ecat' => $abstract_type, |
400 |
'ecmod' => "view", |
'ecmod' => "view", |
401 |
'ect' => "data", |
'ect' => "data", |
402 |
'ecdlk' => "rpc", |
'ecdlk' => "rpc", |
403 |
); |
); |
404 |
|
|
405 |
} |
} |
406 |
elseif($label == "chooser") { |
elseif ($label == "chooser") { |
407 |
$hidden_items = array( |
$hidden_items = array( |
408 |
'ecl' => "phase_startup", |
'ecl' => "phase_startup", |
409 |
'ecdlk' => "rpc", |
'ecdlk' => "rpc", |
412 |
} |
} |
413 |
} |
} |
414 |
// add page idents |
// add page idents |
415 |
|
|
416 |
|
//print "-e-state-idents: " .Dumper($this->_e_state[idents]). "<br>"; |
417 |
|
|
418 |
foreach($this->_e_state[idents] as $label => $value) { |
foreach($this->_e_state[idents] as $label => $value) { |
419 |
$hidden_items[$label] = $value; |
$hidden_items[$label] = $value; |
420 |
} |
} |
423 |
|
|
424 |
|
|
425 |
|
|
426 |
function _prepare_component_args($label) { |
function _prepare_component_args($label, $args = array()) { |
427 |
$val = $this->_e_state['ecoms'][$label]; |
$val = $this->_e_state['ecoms'][$label]; |
428 |
|
//print "val: " .Dumper($val). "<br>"; |
429 |
|
// pre-flight checks |
430 |
|
if (!$val['ecom_data_locator_key']) { |
431 |
|
user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'."); |
432 |
|
return; |
433 |
|
} |
434 |
|
|
435 |
|
if (!$val['ecom_type']) { |
436 |
|
user_error("WebExplorer::AbstractExplorer: Key 'ecom_type' was empty, should be one of 'data|nav|call'."); |
437 |
|
} |
438 |
|
|
439 |
|
if (!$val['ecom_abstract_type']) { |
440 |
|
user_error("_prepare_component_args: Key 'ecom_abstract_type' was empty, should be one of 'item|list|tree|auto'."); |
441 |
|
return; |
442 |
|
} |
443 |
|
|
444 |
|
// trace |
445 |
|
//print "YAI1<br/>"; |
446 |
|
|
447 |
|
|
448 |
$this->set_data_locator($val['ecom_data_locator_key']); |
$this->set_data_locator($val['ecom_data_locator_key']); |
449 |
|
|
450 |
// detect and execute 'selectSource' action |
// detect and execute 'selectSource' action |
461 |
if($val['ecom_type'] == "data") { |
if($val['ecom_type'] == "data") { |
462 |
// switch abstract type |
// switch abstract type |
463 |
if($val['ecom_abstract_type'] == "list") { |
if($val['ecom_abstract_type'] == "list") { |
464 |
|
// debugging |
465 |
|
//print "Mode: $val[ecom_mode], type: list<br>"; |
466 |
|
//print "val: " .Dumper($val). "<br>"; |
467 |
|
|
468 |
if($val['ecom_data_locator_key'] == "rpc") { |
if($val['ecom_data_locator_key'] == "rpc") { |
469 |
//$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']); |
//$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']); |
470 |
$data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'list', nodename => $val['ecom_data_ident']); |
|
471 |
|
$data_locator_meta = array( |
472 |
|
transport => 'rpc', |
473 |
|
metatype => 'data', |
474 |
|
abstract_type => 'list', |
475 |
|
nodename => $val['ecom_data_ident'], |
476 |
|
list_meta => $val['ecom_data_meta'] |
477 |
|
); |
478 |
} else { |
} else { |
479 |
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] !"); |
480 |
} |
} |
481 |
|
|
482 |
|
if($val['ecom_mode'] == 'select') { |
483 |
|
$actionbar = array( |
484 |
|
'buttons' => array( |
485 |
|
array( |
486 |
|
'name' => "ecdfsel", |
487 |
|
'value' => "Select" |
488 |
|
), |
489 |
|
), |
490 |
|
); |
491 |
|
} else { |
492 |
|
$actionbar = array( |
493 |
|
'name' => "ecdfa", |
494 |
|
'list' => array( |
495 |
|
"View" => 'view', |
496 |
|
"Edit" => 'edit', |
497 |
|
"Delete" => 'delete', |
498 |
|
"Expand" => 'expand', |
499 |
|
"Expandedit" => 'expandedit', |
500 |
|
), |
501 |
|
'selected' => 'view', |
502 |
|
'buttons' => array( |
503 |
|
array( |
504 |
|
'name' => "ecdfcr", |
505 |
|
'value' => "Add new" |
506 |
|
), |
507 |
|
), |
508 |
|
); |
509 |
|
} |
510 |
|
|
511 |
$args = array( |
$args = array( |
512 |
'caption' => $val['ecom_data_ident'], |
'caption' => $val['ecom_data_ident'], |
513 |
'orderby' => "Guid", |
'orderby' => "Guid", |
518 |
'seperator' => "_", |
'seperator' => "_", |
519 |
//'form' => 1, |
//'form' => 1, |
520 |
), |
), |
521 |
'actionbar' => array( |
'actionbar' => $actionbar, |
522 |
'name' => "ecdfa", |
'parent' => array( |
523 |
'list' => array( |
'class' => $val['ecom_data_ident'], |
|
"View" => 'view', |
|
|
"Edit" => 'edit', |
|
|
"Delete" => 'delete', |
|
|
"Add new" => 'add', |
|
|
), |
|
524 |
), |
), |
525 |
), |
), |
526 |
); |
); |
527 |
|
if($val['ecom_data_meta_x']) { |
528 |
|
//unset($args['options']['data_locator_meta']['nodename']); |
529 |
|
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
530 |
|
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
531 |
|
} |
532 |
|
|
533 |
// switch abstract type |
// switch abstract type |
534 |
} elseif ($val['ecom_abstract_type'] == "item") { |
} elseif ($val['ecom_abstract_type'] == "item") { |
535 |
if($val['ecom_data_locator_key'] == "rpc") { |
if($val['ecom_data_locator_key'] == "rpc") { |
536 |
//$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']); |
//$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']); |
537 |
$data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'item', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']); |
|
538 |
|
// NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes |
539 |
|
$filter = $this->get_data_filter($val); |
540 |
|
|
541 |
|
$data_locator_meta = array( |
542 |
|
transport => 'rpc', metatype => 'data', abstract_type => 'item', |
543 |
|
ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], filter => $filter, |
544 |
|
); |
545 |
} else { |
} else { |
546 |
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] !"); |
547 |
} |
} |
548 |
|
|
549 |
// defaults |
// defaults |
550 |
if(!$val['ecom_mode']) { $val['ecom_mode'] = "view"; } |
if (!$val['ecom_mode']) { $val['ecom_mode'] = "view"; } |
551 |
//$val['ecom_mode'] = "view"; |
//$val['ecom_mode'] = "view"; |
552 |
|
|
553 |
// debugging |
// debugging |
554 |
print "Mode: $val[ecom_mode]<br>"; |
print "Mode: $val[ecom_mode]<br>"; |
555 |
|
|
556 |
|
//print Dumper($val); |
557 |
|
// NEW [2003-04-22]: append some more meta information to the caption |
558 |
|
//$caption_addendum = ' {' . $val['ecom_data_meta'] . '}'; |
559 |
|
$caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}'; |
560 |
|
|
561 |
// prepare some arguments... |
// prepare some arguments... |
562 |
$args = array( |
$args = array( |
563 |
'caption' => $val['ecom_data_meta'], |
'caption' => $val['ecom_data_ident'] . $caption_addendum, |
564 |
'mode' => $val['ecom_mode'], |
'mode' => $val['ecom_mode'], |
565 |
'options' => array( |
'options' => array( |
566 |
'data_locator_meta' => $data_locator_meta, |
'data_locator_meta' => $data_locator_meta, |
567 |
'decode' => 1, |
'decode' => 1, |
568 |
'decode_args' => array( |
'decode_args' => array( |
569 |
'seperator' => "_", |
'seperator' => "_", |
570 |
), |
), |
571 |
), |
'parent' => array( |
572 |
|
'guid' => $val['ecom_data_ident'], |
573 |
|
'class' => $val['ecom_data_meta'], |
574 |
|
), |
575 |
|
), |
576 |
); |
); |
577 |
if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; } |
if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; } |
578 |
|
|
579 |
// FIXME: (see WebExplorer::Module::AbstractGUIModule) |
// FIXME: (see WebExplorer::Module::AbstractGUIModule) |
580 |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
581 |
if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'NonValidatingFormProcessor'; } |
if ($val['ecom_mode'] == "delete") { |
582 |
|
$args['adapter'] = 'NonValidatingFormProcessor'; |
583 |
|
$args['options']['data_locator_meta']['action'] = 'delete'; |
584 |
|
} |
585 |
|
|
586 |
|
if ($val['ecom_mode'] == "create") { |
587 |
|
$args['adapter'] = 'FormProcessor'; |
588 |
|
$args['options']['caption'] = $val['ecom_data_ident']; |
589 |
|
$args['options']['data_locator_meta']['action'] = 'create'; |
590 |
|
//print "debug 'create': " . Dumper($val); |
591 |
|
if($val['ecom_data_meta_x']) { |
592 |
|
unset($args['options']['data_locator_meta']['nodename']); |
593 |
|
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
594 |
|
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
595 |
|
} |
596 |
|
} |
597 |
|
if ($val['ecom_mode'] == "select") { |
598 |
|
$args['adapter'] = 'FormProcessor'; |
599 |
|
$args['caption'] = $val['ecom_data_meta_xe'] . " {". $val['ecom_data_meta_x'] . ":}"; |
600 |
|
$args['options']['data_locator_meta']['action'] = 'select'; |
601 |
|
//print "debug 'select': " . Dumper($val); |
602 |
|
if($val['ecom_data_meta_x']) { |
603 |
|
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta_xe']; |
604 |
|
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
605 |
|
} |
606 |
|
} |
607 |
|
|
608 |
|
//print "debug 'args' : " . Dumper($args); |
609 |
|
|
610 |
|
// switch abstract type |
611 |
|
} elseif ($val['ecom_abstract_type'] == "tree") { |
612 |
|
|
613 |
|
// NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes |
614 |
|
$filter = $this->get_data_filter($val); |
615 |
|
|
616 |
|
// FIXME: shouldn't this (dispatching by transport-key) be done very *outside* of this scope? |
617 |
|
// or: do it outside per default, let a possibility to modify it inside the lower levels of the dispatcher (here) |
618 |
|
if ($val['ecom_data_locator_key'] == "rpc") { |
619 |
|
//$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']); |
620 |
|
$args[options][data_locator_meta] = array( |
621 |
|
transport => 'rpc', metatype => 'data', abstract_type => 'tree', |
622 |
|
ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], |
623 |
|
// NEW [2003-04-22]: Full tree node filtering established. |
624 |
|
filter => $filter |
625 |
|
); |
626 |
|
} |
627 |
|
|
628 |
|
// NEW [2003-09-26]: transparent content - argument pass-through mode |
629 |
|
} elseif ($val['ecom_abstract_type'] == "transparent") { |
630 |
|
|
631 |
|
// You are responsible for all arguments passed through. |
632 |
|
// Where are these arguments from? |
633 |
|
// They are propagated transparently to this place from a new optional |
634 |
|
// parameter ($args) introduced for the methods 'get_com', 'load_com' |
635 |
|
// and '_prepare_component_args' (this one). |
636 |
|
// This means full control over ecoms from outside. |
637 |
|
|
638 |
|
// TODO: maybe add some additional pre-flight checks here!? |
639 |
|
|
640 |
|
// croak |
641 |
|
} else { |
642 |
|
user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'."); |
643 |
|
|
644 |
} |
} |
645 |
|
|
646 |
// switch component type |
// switch component type |
647 |
} elseif ($val['ecom_type'] == "nav") { |
} elseif ($val['ecom_type'] == "nav") { |
648 |
|
|
649 |
// switch abstract type |
// switch abstract type |
650 |
if($val['ecom_abstract_type'] == "list") { |
// list |
651 |
|
if ($val['ecom_abstract_type'] == "list") { |
652 |
$args = array(); |
$args = array(); |
653 |
if($val['ecom_data_locator_key'] == "rpc") { |
if($val['ecom_data_locator_key'] == "rpc") { |
654 |
|
|
655 |
// switch component label |
// switch component label |
656 |
if($label == "nav") { |
// TODO: should we really dispatch by label inside here? |
657 |
|
|
658 |
|
if ($label == "nav") { |
659 |
$data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' ); |
$data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' ); |
660 |
$args['caption'] = "Objekt Typen"; |
$args['caption'] = "Objekt Typen"; |
661 |
} |
} |
664 |
$data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' ); |
$data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' ); |
665 |
$args['caption'] = "Datenquellen"; |
$args['caption'] = "Datenquellen"; |
666 |
} |
} |
667 |
|
// NEW [2003-04-18]: croak if label empty |
668 |
|
else { |
669 |
|
user_error("_prepare_component_args: Dispatching for nav.list.rpc failed. \$label was empty."); |
670 |
|
} |
671 |
$args['options']['data_locator_meta'] = $data_locator_meta; |
$args['options']['data_locator_meta'] = $data_locator_meta; |
672 |
|
|
673 |
} else { |
} else { |
674 |
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] !"); |
675 |
} |
} |
676 |
|
|
677 |
|
// NEW [2003-04-18]: Abstract navigation tree |
678 |
} elseif ($val['ecom_abstract_type'] == "tree") { |
} elseif ($val['ecom_abstract_type'] == "tree") { |
679 |
$args = array(); |
$args = array(); |
680 |
|
if($label == "nav") { |
681 |
|
//$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']); |
682 |
|
$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' ); |
683 |
|
$args['caption'] = $val['ecom_data_source_key']; |
684 |
|
} elseif($label == "UMnav") { |
685 |
|
//$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']); |
686 |
|
$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'method', method => 'UserManagmentSchema' ); |
687 |
|
$args['caption'] = "Benutzerverwaltung"; |
688 |
|
} |
689 |
|
|
690 |
|
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
691 |
|
} elseif ($val['ecom_abstract_type'] == "transparent") { |
692 |
|
// You are responsible for all arguments passed through. |
693 |
|
// Where are these arguments from? |
694 |
|
// They are propagated transparently to this place from a new optional |
695 |
|
// parameter ($args) introduced for the methods 'get_com', 'load_com' |
696 |
|
// and '_prepare_component_args' (this one). |
697 |
|
// This means full control over ecoms from outside. |
698 |
|
|
699 |
|
// TODO: maybe add some additional pre-flight checks here!? |
700 |
|
// croak |
701 |
|
} else { |
702 |
|
user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'."); |
703 |
} |
} |
704 |
|
|
705 |
// NEW [2003-04-08]: RemoteAction (e.g.: result of a selection inside a Chooser) |
// NEW [2003-04-08]: RemoteAction (e.g.: result of a selection inside a Chooser) |
727 |
// FIXME: implement automatic re-dispatching to available ecoms here! |
// FIXME: implement automatic re-dispatching to available ecoms here! |
728 |
user_error("WebExplorer::AbstractExplorer: results of RemoteActions can only be handled automatically. Who knows what comes back?"); |
user_error("WebExplorer::AbstractExplorer: results of RemoteActions can only be handled automatically. Who knows what comes back?"); |
729 |
} |
} |
730 |
|
|
731 |
} |
} |
732 |
|
|
733 |
// add hidden items to args |
// NEW[2003-04-18]: add hidden items to args |
734 |
$args['hidden_elements'] = $this->_get_hidden_items($label); |
$args['hidden_elements'] = $this->_get_hidden_items($label); |
735 |
|
//print "args_hidden: " .Dumper($args['hidden_elements']). "<br>"; |
736 |
return $args; |
return $args; |
737 |
} |
} |
738 |
|
|
751 |
user_error("AbstractExplorer::render - please implement me...."); |
user_error("AbstractExplorer::render - please implement me...."); |
752 |
} |
} |
753 |
|
|
754 |
|
|
755 |
|
function get_data_filter($state = array()) { |
756 |
|
|
757 |
|
// NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes |
758 |
|
// V1: this was inside ecom_abstract_type == item && ecom_data_locator_key == rpc, but ... |
759 |
|
// V2: ... it should be considered / work independent of these both criterias |
760 |
|
// since it is required for showing xml nodes in items (editing) *and* trees again (browsing). |
761 |
|
|
762 |
|
if ($filter_expression = $state[ecom_data_filter]) { |
763 |
|
|
764 |
|
// new of 2003-05-13: Apply "Node navigation" in tree mode only. |
765 |
|
// Lock context when switching to item mode. |
766 |
|
//print Dumper($state); |
767 |
|
if ($state[ecom_abstract_type] == "tree") { |
768 |
|
if ($parent_xpq = $state[ecom_data_meta]) { |
769 |
|
$filter_expression = $parent_xpq . $filter_expression; |
770 |
|
} |
771 |
|
} |
772 |
|
|
773 |
|
// This propagates a XPath filter expression which fully identifies |
774 |
|
// a single node in a document. It reaches through all parent nodes. |
775 |
|
$filter = array( |
776 |
|
//dotted => $val['ecom_data_filter'], |
777 |
|
//ident => $val['ecom_data_ident'], |
778 |
|
//xpq => '*/*[@name="cli"]', |
779 |
|
//xpq => '*/*', |
780 |
|
// NEW [2003-04-21]: An xpq is already ready now inside |
781 |
|
// 'ecdf' since it already has been built by the revamped tree lift. |
782 |
|
xpq => '*' . $filter_expression |
783 |
|
); |
784 |
|
|
785 |
|
} else { |
786 |
|
$filter = ''; |
787 |
|
|
788 |
|
} |
789 |
|
|
790 |
|
// lift filter from dotted format to xpq format |
791 |
|
// NEW [2003-04-21]: not required any more (see above) |
792 |
|
//$lift = mkObject('Data::Lift', $filter, array( metatype => 'filter' ) ); |
793 |
|
//$filter = $lift->to('XPath'); |
794 |
|
|
795 |
|
return $filter; |
796 |
|
|
797 |
|
} |
798 |
|
|
799 |
} |
} |
800 |
|
|
801 |
|
|
|
?> |
|
802 |
|
?> |