4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.25 2003/11/22 18:47:49 udo |
8 |
|
## update for expand data item |
9 |
|
## |
10 |
|
## Revision 1.24 2003/07/02 11:39:16 jonen |
11 |
|
## fixed bugs |
12 |
|
## |
13 |
|
## Revision 1.23 2003/06/06 11:57:20 joko |
14 |
|
## minor update: cosmetic changes |
15 |
|
## |
16 |
|
## Revision 1.22 2003/05/13 14:50:27 joko |
17 |
|
## HACKed compatibility for config-type data sources |
18 |
|
## + function get_data_filter |
19 |
|
## |
20 |
|
## Revision 1.21 2003/05/10 18:23:21 jonen |
21 |
|
## + added stuff relating to 'create/add new' links/buttons |
22 |
|
## |
23 |
## Revision 1.20 2003/04/19 16:24:49 jonen |
## Revision 1.20 2003/04/19 16:24:49 jonen |
24 |
## + added two more GUI modules to default registry initiation, |
## + added two more GUI modules to default registry initiation, |
25 |
## relating to new navigation module 'NavigationTree' |
## relating to new navigation module 'NavigationTree' |
167 |
$this->set_e_state(); |
$this->set_e_state(); |
168 |
|
|
169 |
//debug |
//debug |
170 |
//print "State: " . Dumper($this->_state) ."<br>"; |
// print "State: " . Dumper($this->_state) ."<br>"; |
171 |
|
//print "_data_locators: " . Dumper($this->_data_locators) ."<br>"; |
172 |
$div = html_div(); |
$div = html_div(); |
173 |
$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)); |
174 |
$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;'); |
208 |
|
|
209 |
function get_page_state() { |
function get_page_state() { |
210 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
|
//print Dumper($this->_state); |
|
211 |
$this->_state = $requestTracker->getPointer(); |
$this->_state = $requestTracker->getPointer(); |
212 |
} |
} |
213 |
|
|
217 |
// 2. (was) get page state from request tracker |
// 2. (was) get page state from request tracker |
218 |
if ($state) { |
if ($state) { |
219 |
$this->_e_state = $state; |
$this->_e_state = $state; |
220 |
|
|
221 |
} else { |
} else { |
222 |
$this->get_page_state(); |
$this->get_page_state(); |
223 |
$this->_e_state = $this->_state[options][options]; |
$this->_e_state = $this->_state[options][options]; |
224 |
|
|
225 |
} |
} |
226 |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
227 |
} |
} |
228 |
|
|
229 |
function set_page_state() { |
function set_page_state() { |
278 |
|
|
279 |
// that's better ... |
// that's better ... |
280 |
$this->_load_ecom($label, $args); |
$this->_load_ecom($label, $args); |
281 |
|
|
282 |
|
//print "getEcom_args: " .Dumper($args). "<br>"; |
283 |
|
|
284 |
return $this->_ecom[$label]; |
return $this->_ecom[$label]; |
285 |
|
|
286 |
} |
} |
359 |
if($ecom_state['ecom_abstract_type'] == "list") { |
if($ecom_state['ecom_abstract_type'] == "list") { |
360 |
$hidden_items = array( |
$hidden_items = array( |
361 |
'ecl' => $label, |
'ecl' => $label, |
362 |
'ecat' => "item", |
'ecat' => "list", |
363 |
'ecmod' => "view", |
'ecmod' => "view", |
364 |
|
'ecdid' => $ecom_state['ecom_data_ident'], |
365 |
); |
); |
366 |
} |
} |
367 |
elseif($ecom_state['ecom_abstract_type'] == "item") { |
elseif($ecom_state['ecom_abstract_type'] == "item") { |
378 |
// are more label specified!! |
// are more label specified!! |
379 |
// OLD: |
// OLD: |
380 |
//if($ecom_state['ecom_abstract_type'] == "list") { |
//if($ecom_state['ecom_abstract_type'] == "list") { |
381 |
|
|
382 |
|
// decide whether to link to items or to a list |
383 |
|
$abstract_type = 'list'; |
384 |
|
// FIXME: HACK |
385 |
|
if ($this->_e_state[main][ecom_data_source_key] == 'config') { |
386 |
|
$abstract_type = 'item'; |
387 |
|
} |
388 |
|
|
389 |
// NEW: |
// NEW: |
390 |
if($label == "nav") { |
if ($label == "nav") { |
391 |
$hidden_items = array( |
$hidden_items = array( |
392 |
'ecl' => "content", |
'ecl' => "content", |
393 |
'ecat' => "list", |
'ecat' => $abstract_type, |
394 |
'ecmod' => "view", |
'ecmod' => "view", |
395 |
'ect' => "data", |
'ect' => "data", |
396 |
'ecdlk' => "rpc", |
'ecdlk' => "rpc", |
397 |
); |
); |
398 |
|
|
399 |
} |
} |
400 |
elseif($label == "chooser") { |
elseif ($label == "chooser") { |
401 |
$hidden_items = array( |
$hidden_items = array( |
402 |
'ecl' => "phase_startup", |
'ecl' => "phase_startup", |
403 |
'ecdlk' => "rpc", |
'ecdlk' => "rpc", |
406 |
} |
} |
407 |
} |
} |
408 |
// add page idents |
// add page idents |
409 |
|
|
410 |
|
//print "-e-state-idents: " .Dumper($this->_e_state[idents]). "<br>"; |
411 |
|
|
412 |
foreach($this->_e_state[idents] as $label => $value) { |
foreach($this->_e_state[idents] as $label => $value) { |
413 |
$hidden_items[$label] = $value; |
$hidden_items[$label] = $value; |
414 |
} |
} |
419 |
|
|
420 |
function _prepare_component_args($label, $args = array()) { |
function _prepare_component_args($label, $args = array()) { |
421 |
$val = $this->_e_state['ecoms'][$label]; |
$val = $this->_e_state['ecoms'][$label]; |
422 |
|
//print "val: " .Dumper($val). "<br>"; |
423 |
// pre-flight checks |
// pre-flight checks |
424 |
if (!$val['ecom_data_locator_key']) { |
if (!$val['ecom_data_locator_key']) { |
425 |
user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'."); |
user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'."); |
437 |
|
|
438 |
// trace |
// trace |
439 |
//print "YAI1<br/>"; |
//print "YAI1<br/>"; |
440 |
//print Dumper($val); |
|
441 |
|
|
442 |
$this->set_data_locator($val['ecom_data_locator_key']); |
$this->set_data_locator($val['ecom_data_locator_key']); |
443 |
|
|
455 |
if($val['ecom_type'] == "data") { |
if($val['ecom_type'] == "data") { |
456 |
// switch abstract type |
// switch abstract type |
457 |
if($val['ecom_abstract_type'] == "list") { |
if($val['ecom_abstract_type'] == "list") { |
458 |
|
// debugging |
459 |
|
//print "Mode: $val[ecom_mode], type: list<br>"; |
460 |
|
//print "val: " .Dumper($val). "<br>"; |
461 |
|
|
462 |
if($val['ecom_data_locator_key'] == "rpc") { |
if($val['ecom_data_locator_key'] == "rpc") { |
463 |
//$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']); |
464 |
$data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'list', nodename => $val['ecom_data_ident'], list_meta => $val['ecom_data_meta']); |
|
465 |
|
$data_locator_meta = array( |
466 |
|
transport => 'rpc', |
467 |
|
metatype => 'data', |
468 |
|
abstract_type => 'list', |
469 |
|
nodename => $val['ecom_data_ident'], |
470 |
|
list_meta => $val['ecom_data_meta'] |
471 |
|
); |
472 |
} else { |
} else { |
473 |
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] !"); |
474 |
} |
} |
485 |
'actionbar' => array( |
'actionbar' => array( |
486 |
'name' => "ecdfa", |
'name' => "ecdfa", |
487 |
'list' => array( |
'list' => array( |
488 |
"View" => 'view', |
"View" => 'view', |
489 |
"Edit" => 'edit', |
"Edit" => 'edit', |
490 |
|
|
491 |
"Delete" => 'delete', |
"Delete" => 'delete', |
492 |
"Add new" => 'add', |
"Expand" => 'expand', |
493 |
|
"Expandedit" => 'expandedit', |
494 |
|
|
495 |
), |
), |
496 |
|
'selected' => 'view', |
497 |
|
'create' => array( |
498 |
|
'name' => "ecdfcr", |
499 |
|
'value' => "Add new" |
500 |
|
), |
501 |
|
), |
502 |
|
'parent' => array( |
503 |
|
'class' => $val['ecom_data_ident'], |
504 |
), |
), |
505 |
), |
), |
506 |
); |
); |
511 |
//$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']); |
512 |
|
|
513 |
// NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes |
// NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes |
514 |
// this propagates the full identifier to reach through all parent nodes |
$filter = $this->get_data_filter($val); |
515 |
$filter = array( |
|
|
dotted => $val['ecom_data_filter'], |
|
|
ident => $val['ecom_data_ident'], |
|
|
//xpq => '*/*[@name="cli"]', |
|
|
//xpq => '*/*', |
|
|
); |
|
|
// lift filter from dotted format to xpq format |
|
|
$lift = mkObject('Data::Lift', $filter, array( metatype => 'filter' ) ); |
|
|
$filter = $lift->to('XPath'); |
|
|
|
|
516 |
$data_locator_meta = array( |
$data_locator_meta = array( |
517 |
transport => 'rpc', metatype => 'data', abstract_type => 'item', |
transport => 'rpc', metatype => 'data', abstract_type => 'item', |
518 |
ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], filter => $filter, |
ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], filter => $filter, |
528 |
// debugging |
// debugging |
529 |
print "Mode: $val[ecom_mode]<br>"; |
print "Mode: $val[ecom_mode]<br>"; |
530 |
|
|
531 |
|
//print Dumper($val); |
532 |
|
// NEW [2003-04-22]: append some more meta information to the caption |
533 |
|
//$caption_addendum = ' {' . $val['ecom_data_meta'] . '}'; |
534 |
|
$caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}'; |
535 |
|
|
536 |
// prepare some arguments... |
// prepare some arguments... |
537 |
$args = array( |
$args = array( |
538 |
'caption' => $val['ecom_data_meta'], |
'caption' => $val['ecom_data_ident'] . $caption_addendum, |
539 |
'mode' => $val['ecom_mode'], |
'mode' => $val['ecom_mode'], |
540 |
'options' => array( |
'options' => array( |
541 |
'data_locator_meta' => $data_locator_meta, |
'data_locator_meta' => $data_locator_meta, |
542 |
'decode' => 1, |
'decode' => 1, |
543 |
'decode_args' => array( |
'decode_args' => array( |
544 |
'seperator' => "_", |
'seperator' => "_", |
545 |
|
), |
546 |
|
'parent' => array( |
547 |
|
'guid' => $val['ecom_data_ident'], |
548 |
|
'class' => $val['ecom_data_meta'], |
549 |
|
), |
550 |
), |
), |
|
), |
|
551 |
); |
); |
552 |
if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; } |
if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; } |
553 |
|
|
554 |
// FIXME: (see WebExplorer::Module::AbstractGUIModule) |
// FIXME: (see WebExplorer::Module::AbstractGUIModule) |
555 |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
556 |
if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'NonValidatingFormProcessor'; } |
if ($val['ecom_mode'] == "delete") { |
557 |
|
$args['adapter'] = 'NonValidatingFormProcessor'; |
558 |
|
} |
559 |
|
|
560 |
|
if ($val['ecom_mode'] == "create") { |
561 |
|
$args['adapter'] = 'FormProcessor'; |
562 |
|
$args['options']['caption'] = $val['ecom_data_ident']; |
563 |
|
$args['options']['data_locator_meta']['action'] = 'create'; |
564 |
|
print "debug 'create': " . Dumper($val); |
565 |
|
} |
566 |
|
|
567 |
|
if($val['ecom_data_meta_x']) { |
568 |
|
unset($args['options']['data_locator_meta']['nodename']); |
569 |
|
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
570 |
|
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
571 |
|
} |
572 |
|
|
573 |
// switch abstract type |
// switch abstract type |
574 |
} elseif ($val['ecom_abstract_type'] == "tree") { |
} elseif ($val['ecom_abstract_type'] == "tree") { |
575 |
//print "TREE!<br/>"; |
|
576 |
|
// NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes |
577 |
|
$filter = $this->get_data_filter($val); |
578 |
|
|
579 |
// FIXME: shouldn't this (dispatching by transport-key) be done very *outside* of this scope? |
// FIXME: shouldn't this (dispatching by transport-key) be done very *outside* of this scope? |
580 |
// or: do it outside per default, let a possibility to modify it inside the lower levels of the dispatcher (here) |
// or: do it outside per default, let a possibility to modify it inside the lower levels of the dispatcher (here) |
581 |
if ($val['ecom_data_locator_key'] == "rpc") { |
if ($val['ecom_data_locator_key'] == "rpc") { |
582 |
//$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']); |
583 |
$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'data', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']); |
$args[options][data_locator_meta] = array( |
584 |
|
transport => 'rpc', metatype => 'data', abstract_type => 'tree', |
585 |
|
ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], |
586 |
|
// NEW [2003-04-22]: Full tree node filtering established. |
587 |
|
filter => $filter |
588 |
|
); |
589 |
} |
} |
590 |
|
|
591 |
|
// NEW [2003-09-26]: transparent content - argument pass-through mode |
592 |
|
} elseif ($val['ecom_abstract_type'] == "transparent") { |
593 |
|
|
594 |
|
// You are responsible for all arguments passed through. |
595 |
|
// Where are these arguments from? |
596 |
|
// They are propagated transparently to this place from a new optional |
597 |
|
// parameter ($args) introduced for the methods 'get_com', 'load_com' |
598 |
|
// and '_prepare_component_args' (this one). |
599 |
|
// This means full control over ecoms from outside. |
600 |
|
|
601 |
|
// TODO: maybe add some additional pre-flight checks here!? |
602 |
|
|
603 |
|
// croak |
604 |
} else { |
} else { |
605 |
user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'."); |
user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'."); |
606 |
|
|
652 |
|
|
653 |
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
654 |
} elseif ($val['ecom_abstract_type'] == "transparent") { |
} elseif ($val['ecom_abstract_type'] == "transparent") { |
|
|
|
655 |
// You are responsible for all arguments passed through. |
// You are responsible for all arguments passed through. |
656 |
// Where are these arguments from? |
// Where are these arguments from? |
657 |
// They are propagated transparently to this place from a new optional |
// They are propagated transparently to this place from a new optional |
660 |
// This means full control over ecoms from outside. |
// This means full control over ecoms from outside. |
661 |
|
|
662 |
// TODO: maybe add some additional pre-flight checks here!? |
// TODO: maybe add some additional pre-flight checks here!? |
|
|
|
663 |
// croak |
// croak |
664 |
} else { |
} else { |
665 |
user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'."); |
user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'."); |
695 |
|
|
696 |
// NEW[2003-04-18]: add hidden items to args |
// NEW[2003-04-18]: add hidden items to args |
697 |
$args['hidden_elements'] = $this->_get_hidden_items($label); |
$args['hidden_elements'] = $this->_get_hidden_items($label); |
698 |
|
//print "args_hidden: " .Dumper($args['hidden_elements']). "<br>"; |
699 |
return $args; |
return $args; |
700 |
} |
} |
701 |
|
|
714 |
user_error("AbstractExplorer::render - please implement me...."); |
user_error("AbstractExplorer::render - please implement me...."); |
715 |
} |
} |
716 |
|
|
717 |
|
|
718 |
|
function get_data_filter($state = array()) { |
719 |
|
|
720 |
|
// NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes |
721 |
|
// V1: this was inside ecom_abstract_type == item && ecom_data_locator_key == rpc, but ... |
722 |
|
// V2: ... it should be considered / work independent of these both criterias |
723 |
|
// since it is required for showing xml nodes in items (editing) *and* trees again (browsing). |
724 |
|
|
725 |
|
if ($filter_expression = $state[ecom_data_filter]) { |
726 |
|
|
727 |
|
// new of 2003-05-13: Apply "Node navigation" in tree mode only. |
728 |
|
// Lock context when switching to item mode. |
729 |
|
//print Dumper($state); |
730 |
|
if ($state[ecom_abstract_type] == "tree") { |
731 |
|
if ($parent_xpq = $state[ecom_data_meta]) { |
732 |
|
$filter_expression = $parent_xpq . $filter_expression; |
733 |
|
} |
734 |
|
} |
735 |
|
|
736 |
|
// This propagates a XPath filter expression which fully identifies |
737 |
|
// a single node in a document. It reaches through all parent nodes. |
738 |
|
$filter = array( |
739 |
|
//dotted => $val['ecom_data_filter'], |
740 |
|
//ident => $val['ecom_data_ident'], |
741 |
|
//xpq => '*/*[@name="cli"]', |
742 |
|
//xpq => '*/*', |
743 |
|
// NEW [2003-04-21]: An xpq is already ready now inside |
744 |
|
// 'ecdf' since it already has been built by the revamped tree lift. |
745 |
|
xpq => '*' . $filter_expression |
746 |
|
); |
747 |
|
|
748 |
|
} else { |
749 |
|
$filter = ''; |
750 |
|
|
751 |
|
} |
752 |
|
|
753 |
|
// lift filter from dotted format to xpq format |
754 |
|
// NEW [2003-04-21]: not required any more (see above) |
755 |
|
//$lift = mkObject('Data::Lift', $filter, array( metatype => 'filter' ) ); |
756 |
|
//$filter = $lift->to('XPath'); |
757 |
|
|
758 |
|
return $filter; |
759 |
|
|
760 |
|
} |
761 |
|
|
762 |
} |
} |
763 |
|
|
764 |
|
|
|
?> |
|
765 |
|
?> |