4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.29 2005/08/11 14:11:28 jonen |
8 |
|
## + changes relating to new web-interface for TerminalOwner |
9 |
|
## |
10 |
|
## Revision 1.28 2004/08/31 14:15:49 jonen |
11 |
|
## + added function to clear 'ecom' state |
12 |
|
## (specially needed to refresh the 'content' block) |
13 |
|
## |
14 |
|
## Revision 1.27 2004/03/11 21:01:35 jonen |
15 |
|
## minor change |
16 |
|
## |
17 |
|
## Revision 1.26 2003/12/14 01:50:30 jonen |
18 |
|
## implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes |
19 |
|
## |
20 |
|
## Revision 1.25 2003/11/22 18:47:49 udo |
21 |
|
## update for expand data item |
22 |
|
## |
23 |
## Revision 1.24 2003/07/02 11:39:16 jonen |
## Revision 1.24 2003/07/02 11:39:16 jonen |
24 |
## fixed bugs |
## fixed bugs |
25 |
## |
## |
180 |
$this->set_e_state(); |
$this->set_e_state(); |
181 |
|
|
182 |
//debug |
//debug |
183 |
//print "State: " . Dumper($this->_state) ."<br>"; |
// print "State: " . Dumper($this->_state) ."<br>"; |
184 |
|
//print "_data_locators: " . Dumper($this->_data_locators) ."<br>"; |
185 |
$div = html_div(); |
$div = html_div(); |
186 |
$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)); |
187 |
$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;'); |
221 |
|
|
222 |
function get_page_state() { |
function get_page_state() { |
223 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
|
//print Dumper($this->_state); |
|
224 |
$this->_state = $requestTracker->getPointer(); |
$this->_state = $requestTracker->getPointer(); |
225 |
|
//print "state: " . Dumper($this->_state) . "<br>"; |
226 |
|
} |
227 |
|
|
228 |
|
function clear_comp_state($comp = NULL) { |
229 |
|
if($comp) { |
230 |
|
$this->_e_state[ecoms][$comp] = array(); |
231 |
|
} |
232 |
} |
} |
233 |
|
|
234 |
function set_e_state($state = null) { |
function set_e_state($state = null) { |
237 |
// 2. (was) get page state from request tracker |
// 2. (was) get page state from request tracker |
238 |
if ($state) { |
if ($state) { |
239 |
$this->_e_state = $state; |
$this->_e_state = $state; |
240 |
|
|
241 |
} else { |
} else { |
242 |
$this->get_page_state(); |
$this->get_page_state(); |
243 |
$this->_e_state = $this->_state[options][options]; |
$this->_e_state = $this->_state[options][options]; |
244 |
|
|
245 |
} |
} |
246 |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
// print "Setting Explorer state:" . Dumper($this->_e_state); |
247 |
} |
} |
248 |
|
|
249 |
function set_page_state() { |
function set_page_state() { |
298 |
|
|
299 |
// that's better ... |
// that's better ... |
300 |
$this->_load_ecom($label, $args); |
$this->_load_ecom($label, $args); |
301 |
|
|
302 |
|
//print "getEcom_args: " .Dumper($args). "<br>"; |
303 |
|
|
304 |
return $this->_ecom[$label]; |
return $this->_ecom[$label]; |
305 |
|
|
306 |
} |
} |
426 |
} |
} |
427 |
} |
} |
428 |
// add page idents |
// add page idents |
429 |
|
|
430 |
|
//print "-e-state-idents: " .Dumper($this->_e_state[idents]). "<br>"; |
431 |
|
|
432 |
foreach($this->_e_state[idents] as $label => $value) { |
foreach($this->_e_state[idents] as $label => $value) { |
433 |
$hidden_items[$label] = $value; |
$hidden_items[$label] = $value; |
434 |
} |
} |
439 |
|
|
440 |
function _prepare_component_args($label, $args = array()) { |
function _prepare_component_args($label, $args = array()) { |
441 |
$val = $this->_e_state['ecoms'][$label]; |
$val = $this->_e_state['ecoms'][$label]; |
442 |
|
//print "val: " .Dumper($val). "<br>"; |
443 |
// pre-flight checks |
// pre-flight checks |
444 |
if (!$val['ecom_data_locator_key']) { |
if (!$val['ecom_data_locator_key']) { |
445 |
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'."); |
457 |
|
|
458 |
// trace |
// trace |
459 |
//print "YAI1<br/>"; |
//print "YAI1<br/>"; |
460 |
//print Dumper($val); |
|
461 |
|
|
462 |
$this->set_data_locator($val['ecom_data_locator_key']); |
$this->set_data_locator($val['ecom_data_locator_key']); |
463 |
|
|
475 |
if($val['ecom_type'] == "data") { |
if($val['ecom_type'] == "data") { |
476 |
// switch abstract type |
// switch abstract type |
477 |
if($val['ecom_abstract_type'] == "list") { |
if($val['ecom_abstract_type'] == "list") { |
478 |
|
// debugging |
479 |
|
//print "Mode: $val[ecom_mode], type: list<br>"; |
480 |
|
//print "val: " .Dumper($val). "<br>"; |
481 |
|
|
482 |
if($val['ecom_data_locator_key'] == "rpc") { |
if($val['ecom_data_locator_key'] == "rpc") { |
483 |
//$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']); |
484 |
$data_locator_meta = array( |
|
485 |
transport => 'rpc', |
$data_locator_meta = array( |
486 |
metatype => 'data', |
transport => 'rpc', |
487 |
abstract_type => 'list', |
metatype => 'data', |
488 |
nodename => $val['ecom_data_ident'], |
abstract_type => 'list', |
489 |
list_meta => $val['ecom_data_meta'] |
nodename => $val['ecom_data_ident'], |
490 |
); |
list_meta => $val['ecom_data_meta'] |
491 |
|
); |
492 |
} else { |
} else { |
493 |
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] !"); |
494 |
} |
} |
495 |
|
|
496 |
|
if($val['ecom_mode'] == 'select') { |
497 |
|
$actionbar = array( |
498 |
|
'buttons' => array( |
499 |
|
array( |
500 |
|
'name' => "ecdfsel", |
501 |
|
'value' => "Select" |
502 |
|
), |
503 |
|
), |
504 |
|
); |
505 |
|
} else { |
506 |
|
if(is_array($_SESSION[user]) && $_SESSION[user][loggedIn]) { |
507 |
|
$actionbar = array( |
508 |
|
'name' => "ecdfa", |
509 |
|
'list' => array( |
510 |
|
"View" => 'view', |
511 |
|
"Edit" => 'edit', |
512 |
|
), |
513 |
|
'selected' => 'view', |
514 |
|
'buttons' => array( |
515 |
|
), |
516 |
|
); |
517 |
|
} else { |
518 |
|
$actionbar = array( |
519 |
|
'name' => "ecdfa", |
520 |
|
'list' => array( |
521 |
|
"View" => 'view', |
522 |
|
"Edit" => 'edit', |
523 |
|
"Delete" => 'delete', |
524 |
|
"Expand" => 'expand', |
525 |
|
"Expandedit" => 'expandedit', |
526 |
|
), |
527 |
|
'selected' => 'view', |
528 |
|
'buttons' => array( |
529 |
|
array( |
530 |
|
'name' => "ecdfcr", |
531 |
|
'value' => "Add new" |
532 |
|
), |
533 |
|
), |
534 |
|
); |
535 |
|
} |
536 |
|
} |
537 |
|
|
538 |
$args = array( |
$args = array( |
539 |
'caption' => $val['ecom_data_ident'], |
'caption' => $val['ecom_data_ident'], |
540 |
'orderby' => "Guid", |
'orderby' => "Guid", |
545 |
'seperator' => "_", |
'seperator' => "_", |
546 |
//'form' => 1, |
//'form' => 1, |
547 |
), |
), |
548 |
'actionbar' => array( |
'actionbar' => $actionbar, |
|
'name' => "ecdfa", |
|
|
'list' => array( |
|
|
"View" => 'view', |
|
|
"Edit" => 'edit', |
|
|
"Delete" => 'delete', |
|
|
), |
|
|
'selected' => 'view', |
|
|
'create' => array( |
|
|
'name' => "ecdfcr", |
|
|
'value' => "Add new" |
|
|
), |
|
|
), |
|
549 |
'parent' => array( |
'parent' => array( |
550 |
'class' => $val['ecom_data_ident'], |
'class' => $val['ecom_data_ident'], |
551 |
), |
), |
552 |
), |
), |
553 |
); |
); |
554 |
|
if($val['ecom_data_meta_x']) { |
555 |
|
//unset($args['options']['data_locator_meta']['nodename']); |
556 |
|
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
557 |
|
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
558 |
|
} |
559 |
|
if(is_array($_SESSION[user]) && $_SESSION[user][loggedIn]) { |
560 |
|
$args['options']['data_locator_meta']['owner'][guid] = $_SESSION[user][guid]; |
561 |
|
$args['options']['data_locator_meta']['owner']['class'] = $_SESSION[user]['class']; |
562 |
|
} |
563 |
|
|
564 |
// switch abstract type |
// switch abstract type |
565 |
} elseif ($val['ecom_abstract_type'] == "item") { |
} elseif ($val['ecom_abstract_type'] == "item") { |
588 |
// NEW [2003-04-22]: append some more meta information to the caption |
// NEW [2003-04-22]: append some more meta information to the caption |
589 |
//$caption_addendum = ' {' . $val['ecom_data_meta'] . '}'; |
//$caption_addendum = ' {' . $val['ecom_data_meta'] . '}'; |
590 |
$caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}'; |
$caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}'; |
591 |
|
|
592 |
// prepare some arguments... |
// prepare some arguments... |
593 |
$args = array( |
$args = array( |
594 |
'caption' => $val['ecom_data_ident'] . $caption_addendum, |
'caption' => $val['ecom_data_ident'] . $caption_addendum, |
611 |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
//if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; } |
612 |
if ($val['ecom_mode'] == "delete") { |
if ($val['ecom_mode'] == "delete") { |
613 |
$args['adapter'] = 'NonValidatingFormProcessor'; |
$args['adapter'] = 'NonValidatingFormProcessor'; |
614 |
|
$args['options']['data_locator_meta']['action'] = 'delete'; |
615 |
} |
} |
616 |
|
|
617 |
if ($val['ecom_mode'] == "create") { |
if ($val['ecom_mode'] == "create") { |
618 |
$args['adapter'] = 'FormProcessor'; |
$args['adapter'] = 'FormProcessor'; |
619 |
$args['options']['caption'] = $val['ecom_data_ident']; |
$args['options']['caption'] = $val['ecom_data_ident']; |
620 |
$args['options']['data_locator_meta']['action'] = 'create'; |
$args['options']['data_locator_meta']['action'] = 'create'; |
621 |
print "debug 'create': " . Dumper($val); |
//print "debug 'create': " . Dumper($val); |
|
} |
|
|
|
|
622 |
if($val['ecom_data_meta_x']) { |
if($val['ecom_data_meta_x']) { |
623 |
unset($args['options']['data_locator_meta']['nodename']); |
unset($args['options']['data_locator_meta']['nodename']); |
624 |
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta']; |
625 |
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
626 |
} |
} |
627 |
|
} |
628 |
|
if ($val['ecom_mode'] == "select") { |
629 |
|
$args['adapter'] = 'FormProcessor'; |
630 |
|
$args['caption'] = $val['ecom_data_meta_xe'] . " {". $val['ecom_data_meta_x'] . ":}"; |
631 |
|
$args['options']['data_locator_meta']['action'] = 'select'; |
632 |
|
//print "debug 'select': " . Dumper($val); |
633 |
|
if($val['ecom_data_meta_x']) { |
634 |
|
$args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta_xe']; |
635 |
|
$args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x']; |
636 |
|
} |
637 |
|
} |
638 |
|
|
639 |
|
//print "debug 'args' : " . Dumper($args); |
640 |
|
|
641 |
// switch abstract type |
// switch abstract type |
642 |
} elseif ($val['ecom_abstract_type'] == "tree") { |
} elseif ($val['ecom_abstract_type'] == "tree") { |
656 |
); |
); |
657 |
} |
} |
658 |
|
|
659 |
|
// NEW [2003-09-26]: transparent content - argument pass-through mode |
660 |
|
} elseif ($val['ecom_abstract_type'] == "transparent") { |
661 |
|
|
662 |
|
// You are responsible for all arguments passed through. |
663 |
|
// Where are these arguments from? |
664 |
|
// They are propagated transparently to this place from a new optional |
665 |
|
// parameter ($args) introduced for the methods 'get_com', 'load_com' |
666 |
|
// and '_prepare_component_args' (this one). |
667 |
|
// This means full control over ecoms from outside. |
668 |
|
|
669 |
|
// TODO: maybe add some additional pre-flight checks here!? |
670 |
|
|
671 |
|
// croak |
672 |
} else { |
} else { |
673 |
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]'."); |
674 |
|
|
720 |
|
|
721 |
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
// NEW [2003-04-18]: transparent nav - argument pass-through mode |
722 |
} elseif ($val['ecom_abstract_type'] == "transparent") { |
} elseif ($val['ecom_abstract_type'] == "transparent") { |
|
|
|
723 |
// You are responsible for all arguments passed through. |
// You are responsible for all arguments passed through. |
724 |
// Where are these arguments from? |
// Where are these arguments from? |
725 |
// They are propagated transparently to this place from a new optional |
// They are propagated transparently to this place from a new optional |
728 |
// This means full control over ecoms from outside. |
// This means full control over ecoms from outside. |
729 |
|
|
730 |
// TODO: maybe add some additional pre-flight checks here!? |
// TODO: maybe add some additional pre-flight checks here!? |
|
|
|
731 |
// croak |
// croak |
732 |
} else { |
} else { |
733 |
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]'."); |
761 |
|
|
762 |
} |
} |
763 |
|
|
764 |
|
if(is_array($_SESSION[user]) && $_SESSION[user][loggedIn]) { |
765 |
|
$args['options']['userclass'] = $_SESSION[user]['class']; |
766 |
|
} |
767 |
|
|
768 |
// NEW[2003-04-18]: add hidden items to args |
// NEW[2003-04-18]: add hidden items to args |
769 |
$args['hidden_elements'] = $this->_get_hidden_items($label); |
$args['hidden_elements'] = $this->_get_hidden_items($label); |
770 |
|
//print "args_hidden: " .Dumper($args['hidden_elements']). "<br>"; |
771 |
return $args; |
return $args; |
772 |
} |
} |
773 |
|
|
834 |
} |
} |
835 |
|
|
836 |
|
|
|
?> |
|
837 |
|
?> |