4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.28 2004/08/31 14:15:49 jonen |
8 |
|
## + added function to clear 'ecom' state |
9 |
|
## (specially needed to refresh the 'content' block) |
10 |
|
## |
11 |
|
## Revision 1.27 2004/03/11 21:01:35 jonen |
12 |
|
## minor change |
13 |
|
## |
14 |
|
## Revision 1.26 2003/12/14 01:50:30 jonen |
15 |
|
## implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes |
16 |
|
## |
17 |
|
## Revision 1.25 2003/11/22 18:47:49 udo |
18 |
|
## update for expand data item |
19 |
|
## |
20 |
## Revision 1.24 2003/07/02 11:39:16 jonen |
## Revision 1.24 2003/07/02 11:39:16 jonen |
21 |
## fixed bugs |
## fixed bugs |
22 |
## |
## |
177 |
$this->set_e_state(); |
$this->set_e_state(); |
178 |
|
|
179 |
//debug |
//debug |
180 |
//print "State: " . Dumper($this->_state) ."<br>"; |
// print "State: " . Dumper($this->_state) ."<br>"; |
181 |
|
//print "_data_locators: " . Dumper($this->_data_locators) ."<br>"; |
182 |
$div = html_div(); |
$div = html_div(); |
183 |
$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)); |
184 |
$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;'); |
218 |
|
|
219 |
function get_page_state() { |
function get_page_state() { |
220 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
|
//print Dumper($this->_state); |
|
221 |
$this->_state = $requestTracker->getPointer(); |
$this->_state = $requestTracker->getPointer(); |
222 |
|
//print "state: " . Dumper($this->_state) . "<br>"; |
223 |
|
} |
224 |
|
|
225 |
|
function clear_comp_state($comp = NULL) { |
226 |
|
if($comp) { |
227 |
|
$this->_e_state[ecoms][$comp] = array(); |
228 |
|
} |
229 |
} |
} |
230 |
|
|
231 |
function set_e_state($state = null) { |
function set_e_state($state = null) { |
234 |
// 2. (was) get page state from request tracker |
// 2. (was) get page state from request tracker |
235 |
if ($state) { |
if ($state) { |
236 |
$this->_e_state = $state; |
$this->_e_state = $state; |
237 |
|
|
238 |
} else { |
} else { |
239 |
$this->get_page_state(); |
$this->get_page_state(); |
240 |
$this->_e_state = $this->_state[options][options]; |
$this->_e_state = $this->_state[options][options]; |
241 |
|
|
242 |
} |
} |
243 |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
244 |
} |
} |
245 |
|
|
246 |
function set_page_state() { |
function set_page_state() { |
295 |
|
|
296 |
// that's better ... |
// that's better ... |
297 |
$this->_load_ecom($label, $args); |
$this->_load_ecom($label, $args); |
298 |
|
|
299 |
|
//print "getEcom_args: " .Dumper($args). "<br>"; |
300 |
|
|
301 |
return $this->_ecom[$label]; |
return $this->_ecom[$label]; |
302 |
|
|
303 |
} |
} |
423 |
} |
} |
424 |
} |
} |
425 |
// add page idents |
// add page idents |
426 |
|
|
427 |
|
//print "-e-state-idents: " .Dumper($this->_e_state[idents]). "<br>"; |
428 |
|
|
429 |
foreach($this->_e_state[idents] as $label => $value) { |
foreach($this->_e_state[idents] as $label => $value) { |
430 |
$hidden_items[$label] = $value; |
$hidden_items[$label] = $value; |
431 |
} |
} |
436 |
|
|
437 |
function _prepare_component_args($label, $args = array()) { |
function _prepare_component_args($label, $args = array()) { |
438 |
$val = $this->_e_state['ecoms'][$label]; |
$val = $this->_e_state['ecoms'][$label]; |
439 |
|
//print "val: " .Dumper($val). "<br>"; |
440 |
// pre-flight checks |
// pre-flight checks |
441 |
if (!$val['ecom_data_locator_key']) { |
if (!$val['ecom_data_locator_key']) { |
442 |
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'."); |
454 |
|
|
455 |
// trace |
// trace |
456 |
//print "YAI1<br/>"; |
//print "YAI1<br/>"; |
457 |
//print Dumper($val); |
|
458 |
|
|
459 |
$this->set_data_locator($val['ecom_data_locator_key']); |
$this->set_data_locator($val['ecom_data_locator_key']); |
460 |
|
|
472 |
if($val['ecom_type'] == "data") { |
if($val['ecom_type'] == "data") { |
473 |
// switch abstract type |
// switch abstract type |
474 |
if($val['ecom_abstract_type'] == "list") { |
if($val['ecom_abstract_type'] == "list") { |
475 |
|
// debugging |
476 |
|
//print "Mode: $val[ecom_mode], type: list<br>"; |
477 |
|
//print "val: " .Dumper($val). "<br>"; |
478 |
|
|
479 |
if($val['ecom_data_locator_key'] == "rpc") { |
if($val['ecom_data_locator_key'] == "rpc") { |
480 |
//$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']); |
481 |
$data_locator_meta = array( |
|
482 |
transport => 'rpc', |
$data_locator_meta = array( |
483 |
metatype => 'data', |
transport => 'rpc', |
484 |
abstract_type => 'list', |
metatype => 'data', |
485 |
nodename => $val['ecom_data_ident'], |
abstract_type => 'list', |
486 |
list_meta => $val['ecom_data_meta'] |
nodename => $val['ecom_data_ident'], |
487 |
); |
list_meta => $val['ecom_data_meta'] |
488 |
|
); |
489 |
} else { |
} else { |
490 |
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] !"); |
491 |
} |
} |
492 |
|
|
493 |
|
if($val['ecom_mode'] == 'select') { |
494 |
|
$actionbar = array( |
495 |
|
'buttons' => array( |
496 |
|
array( |
497 |
|
'name' => "ecdfsel", |
498 |
|
'value' => "Select" |
499 |
|
), |
500 |
|
), |
501 |
|
); |
502 |
|
} else { |
503 |
|
$actionbar = array( |
504 |
|
'name' => "ecdfa", |
505 |
|
'list' => array( |
506 |
|
"View" => 'view', |
507 |
|
"Edit" => 'edit', |
508 |
|
"Delete" => 'delete', |
509 |
|
"Expand" => 'expand', |
510 |
|
"Expandedit" => 'expandedit', |
511 |
|
), |
512 |
|
'selected' => 'view', |
513 |
|
'buttons' => array( |
514 |
|
array( |
515 |
|
'name' => "ecdfcr", |
516 |
|
'value' => "Add new" |
517 |
|
), |
518 |
|
), |
519 |
|
); |
520 |
|
} |
521 |
|
|
522 |
$args = array( |
$args = array( |
523 |
'caption' => $val['ecom_data_ident'], |
'caption' => $val['ecom_data_ident'], |
524 |
'orderby' => "Guid", |
'orderby' => "Guid", |
529 |
'seperator' => "_", |
'seperator' => "_", |
530 |
//'form' => 1, |
//'form' => 1, |
531 |
), |
), |
532 |
'actionbar' => array( |
'actionbar' => $actionbar, |
|
'name' => "ecdfa", |
|
|
'list' => array( |
|
|
"View" => 'view', |
|
|
"Edit" => 'edit', |
|
|
"Delete" => 'delete', |
|
|
), |
|
|
'selected' => 'view', |
|
|
'create' => array( |
|
|
'name' => "ecdfcr", |
|
|
'value' => "Add new" |
|
|
), |
|
|
), |
|
533 |
'parent' => array( |
'parent' => array( |
534 |
'class' => $val['ecom_data_ident'], |
'class' => $val['ecom_data_ident'], |
535 |
), |
), |
536 |
), |
), |
537 |
); |
); |
538 |
|
if($val['ecom_data_meta_x']) { |
539 |
|
//unset($args['options']['data_locator_meta']['nodename']); |
540 |
|
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
541 |
|
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
542 |
|
} |
543 |
|
|
544 |
// switch abstract type |
// switch abstract type |
545 |
} elseif ($val['ecom_abstract_type'] == "item") { |
} elseif ($val['ecom_abstract_type'] == "item") { |
568 |
// NEW [2003-04-22]: append some more meta information to the caption |
// NEW [2003-04-22]: append some more meta information to the caption |
569 |
//$caption_addendum = ' {' . $val['ecom_data_meta'] . '}'; |
//$caption_addendum = ' {' . $val['ecom_data_meta'] . '}'; |
570 |
$caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}'; |
$caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}'; |
571 |
|
|
572 |
// prepare some arguments... |
// prepare some arguments... |
573 |
$args = array( |
$args = array( |
574 |
'caption' => $val['ecom_data_ident'] . $caption_addendum, |
'caption' => $val['ecom_data_ident'] . $caption_addendum, |
591 |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
592 |
if ($val['ecom_mode'] == "delete") { |
if ($val['ecom_mode'] == "delete") { |
593 |
$args['adapter'] = 'NonValidatingFormProcessor'; |
$args['adapter'] = 'NonValidatingFormProcessor'; |
594 |
|
$args['options']['data_locator_meta']['action'] = 'delete'; |
595 |
} |
} |
596 |
|
|
597 |
if ($val['ecom_mode'] == "create") { |
if ($val['ecom_mode'] == "create") { |
598 |
$args['adapter'] = 'FormProcessor'; |
$args['adapter'] = 'FormProcessor'; |
599 |
$args['options']['caption'] = $val['ecom_data_ident']; |
$args['options']['caption'] = $val['ecom_data_ident']; |
600 |
$args['options']['data_locator_meta']['action'] = 'create'; |
$args['options']['data_locator_meta']['action'] = 'create'; |
601 |
print "debug 'create': " . Dumper($val); |
//print "debug 'create': " . Dumper($val); |
|
} |
|
|
|
|
602 |
if($val['ecom_data_meta_x']) { |
if($val['ecom_data_meta_x']) { |
603 |
unset($args['options']['data_locator_meta']['nodename']); |
unset($args['options']['data_locator_meta']['nodename']); |
604 |
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
605 |
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
606 |
} |
} |
607 |
|
} |
608 |
|
if ($val['ecom_mode'] == "select") { |
609 |
|
$args['adapter'] = 'FormProcessor'; |
610 |
|
$args['caption'] = $val['ecom_data_meta_xe'] . " {". $val['ecom_data_meta_x'] . ":}"; |
611 |
|
$args['options']['data_locator_meta']['action'] = 'select'; |
612 |
|
//print "debug 'select': " . Dumper($val); |
613 |
|
if($val['ecom_data_meta_x']) { |
614 |
|
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta_xe']; |
615 |
|
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
616 |
|
} |
617 |
|
} |
618 |
|
|
619 |
|
//print "debug 'args' : " . Dumper($args); |
620 |
|
|
621 |
// switch abstract type |
// switch abstract type |
622 |
} elseif ($val['ecom_abstract_type'] == "tree") { |
} elseif ($val['ecom_abstract_type'] == "tree") { |
636 |
); |
); |
637 |
} |
} |
638 |
|
|
639 |
|
// NEW [2003-09-26]: transparent content - argument pass-through mode |
640 |
|
} elseif ($val['ecom_abstract_type'] == "transparent") { |
641 |
|
|
642 |
|
// You are responsible for all arguments passed through. |
643 |
|
// Where are these arguments from? |
644 |
|
// They are propagated transparently to this place from a new optional |
645 |
|
// parameter ($args) introduced for the methods 'get_com', 'load_com' |
646 |
|
// and '_prepare_component_args' (this one). |
647 |
|
// This means full control over ecoms from outside. |
648 |
|
|
649 |
|
// TODO: maybe add some additional pre-flight checks here!? |
650 |
|
|
651 |
|
// croak |
652 |
} else { |
} else { |
653 |
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]'."); |
654 |
|
|
700 |
|
|
701 |
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
702 |
} elseif ($val['ecom_abstract_type'] == "transparent") { |
} elseif ($val['ecom_abstract_type'] == "transparent") { |
|
|
|
703 |
// You are responsible for all arguments passed through. |
// You are responsible for all arguments passed through. |
704 |
// Where are these arguments from? |
// Where are these arguments from? |
705 |
// They are propagated transparently to this place from a new optional |
// They are propagated transparently to this place from a new optional |
708 |
// This means full control over ecoms from outside. |
// This means full control over ecoms from outside. |
709 |
|
|
710 |
// TODO: maybe add some additional pre-flight checks here!? |
// TODO: maybe add some additional pre-flight checks here!? |
|
|
|
711 |
// croak |
// croak |
712 |
} else { |
} else { |
713 |
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]'."); |
743 |
|
|
744 |
// NEW[2003-04-18]: add hidden items to args |
// NEW[2003-04-18]: add hidden items to args |
745 |
$args['hidden_elements'] = $this->_get_hidden_items($label); |
$args['hidden_elements'] = $this->_get_hidden_items($label); |
746 |
|
//print "args_hidden: " .Dumper($args['hidden_elements']). "<br>"; |
747 |
return $args; |
return $args; |
748 |
} |
} |
749 |
|
|
810 |
} |
} |
811 |
|
|
812 |
|
|
|
?> |
|
813 |
|
?> |