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 |
## Revision 1.23 2003/06/06 11:57:20 joko |
20 |
## minor update: cosmetic changes |
## minor update: cosmetic changes |
21 |
## |
## |
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;'); |
214 |
|
|
215 |
function get_page_state() { |
function get_page_state() { |
216 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
|
//print Dumper($this->_state); |
|
217 |
$this->_state = $requestTracker->getPointer(); |
$this->_state = $requestTracker->getPointer(); |
218 |
} |
} |
219 |
|
|
223 |
// 2. (was) get page state from request tracker |
// 2. (was) get page state from request tracker |
224 |
if ($state) { |
if ($state) { |
225 |
$this->_e_state = $state; |
$this->_e_state = $state; |
226 |
|
|
227 |
} else { |
} else { |
228 |
$this->get_page_state(); |
$this->get_page_state(); |
229 |
$this->_e_state = $this->_state[options][options]; |
$this->_e_state = $this->_state[options][options]; |
230 |
|
|
231 |
} |
} |
232 |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
233 |
} |
} |
234 |
|
|
235 |
function set_page_state() { |
function set_page_state() { |
284 |
|
|
285 |
// that's better ... |
// that's better ... |
286 |
$this->_load_ecom($label, $args); |
$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 |
} |
} |
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 |
'ecdm' => $ecom_state['ecom_data_ident'], |
'ecdid' => $ecom_state['ecom_data_ident'], |
371 |
); |
); |
372 |
} |
} |
373 |
elseif($ecom_state['ecom_abstract_type'] == "item") { |
elseif($ecom_state['ecom_abstract_type'] == "item") { |
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 |
} |
} |
425 |
|
|
426 |
function _prepare_component_args($label, $args = array()) { |
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 |
// pre-flight checks |
430 |
if (!$val['ecom_data_locator_key']) { |
if (!$val['ecom_data_locator_key']) { |
431 |
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'."); |
443 |
|
|
444 |
// trace |
// trace |
445 |
//print "YAI1<br/>"; |
//print "YAI1<br/>"; |
446 |
//print Dumper($val); |
|
447 |
|
|
448 |
$this->set_data_locator($val['ecom_data_locator_key']); |
$this->set_data_locator($val['ecom_data_locator_key']); |
449 |
|
|
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( |
|
471 |
transport => 'rpc', |
$data_locator_meta = array( |
472 |
metatype => 'data', |
transport => 'rpc', |
473 |
abstract_type => 'list', |
metatype => 'data', |
474 |
nodename => $val['ecom_data_ident'], |
abstract_type => 'list', |
475 |
list_meta => $val['ecom_data_meta'] |
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, |
|
'name' => "ecdfa", |
|
|
'list' => array( |
|
|
"View" => 'view', |
|
|
"Edit" => 'edit', |
|
|
"Delete" => 'delete', |
|
|
), |
|
|
'selected' => 'view', |
|
|
'create' => array( |
|
|
'name' => "ecdfcr", |
|
|
'value' => "Add new" |
|
|
), |
|
|
), |
|
522 |
'parent' => array( |
'parent' => array( |
523 |
'class' => $val['ecom_data_ident'], |
'class' => $val['ecom_data_ident'], |
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") { |
557 |
// NEW [2003-04-22]: append some more meta information to the caption |
// NEW [2003-04-22]: append some more meta information to the caption |
558 |
//$caption_addendum = ' {' . $val['ecom_data_meta'] . '}'; |
//$caption_addendum = ' {' . $val['ecom_data_meta'] . '}'; |
559 |
$caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}'; |
$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_ident'] . $caption_addendum, |
'caption' => $val['ecom_data_ident'] . $caption_addendum, |
580 |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
581 |
if ($val['ecom_mode'] == "delete") { |
if ($val['ecom_mode'] == "delete") { |
582 |
$args['adapter'] = 'NonValidatingFormProcessor'; |
$args['adapter'] = 'NonValidatingFormProcessor'; |
583 |
|
$args['options']['data_locator_meta']['action'] = 'delete'; |
584 |
} |
} |
585 |
|
|
586 |
if ($val['ecom_mode'] == "create") { |
if ($val['ecom_mode'] == "create") { |
587 |
$args['adapter'] = 'FormProcessor'; |
$args['adapter'] = 'FormProcessor'; |
588 |
$args['options']['caption'] = $val['ecom_data_ident']; |
$args['options']['caption'] = $val['ecom_data_ident']; |
589 |
$args['options']['data_locator_meta']['action'] = 'create'; |
$args['options']['data_locator_meta']['action'] = 'create'; |
590 |
print "debug 'create': " . Dumper($val); |
//print "debug 'create': " . Dumper($val); |
591 |
if($val['ecom_data_meta_x']) { |
if($val['ecom_data_meta_x']) { |
592 |
unset($args['options']['data_locator_meta']['nodename']); |
unset($args['options']['data_locator_meta']['nodename']); |
593 |
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
594 |
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
$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 |
// switch abstract type |
611 |
} elseif ($val['ecom_abstract_type'] == "tree") { |
} elseif ($val['ecom_abstract_type'] == "tree") { |
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 { |
} else { |
642 |
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]'."); |
643 |
|
|
689 |
|
|
690 |
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
691 |
} elseif ($val['ecom_abstract_type'] == "transparent") { |
} elseif ($val['ecom_abstract_type'] == "transparent") { |
|
|
|
692 |
// You are responsible for all arguments passed through. |
// You are responsible for all arguments passed through. |
693 |
// Where are these arguments from? |
// Where are these arguments from? |
694 |
// They are propagated transparently to this place from a new optional |
// They are propagated transparently to this place from a new optional |
697 |
// This means full control over ecoms from outside. |
// This means full control over ecoms from outside. |
698 |
|
|
699 |
// TODO: maybe add some additional pre-flight checks here!? |
// TODO: maybe add some additional pre-flight checks here!? |
|
|
|
700 |
// croak |
// croak |
701 |
} else { |
} else { |
702 |
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]'."); |
732 |
|
|
733 |
// NEW[2003-04-18]: 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 |
|
|
799 |
} |
} |
800 |
|
|
801 |
|
|
|
?> |
|
802 |
|
?> |