| 4 |
* $Id$ |
* $Id$ |
| 5 |
* |
* |
| 6 |
* $Log$ |
* $Log$ |
| 7 |
|
* Revision 1.21 2003/12/14 01:51:29 jonen |
| 8 |
|
* implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes |
| 9 |
|
* |
| 10 |
|
* Revision 1.20 2003/11/22 18:46:33 udo |
| 11 |
|
* update for expand data item |
| 12 |
|
* |
| 13 |
|
* Revision 1.19 2003/07/14 09:54:58 jonen |
| 14 |
|
* fixed bug related to 'item delete' |
| 15 |
|
* |
| 16 |
|
* Revision 1.18 2003/07/02 12:18:00 jonen |
| 17 |
|
* fixed bugs |
| 18 |
|
* |
| 19 |
|
* Revision 1.17 2003/06/25 23:45:05 joko |
| 20 |
|
* trying to switch from "ap" completely to "t" |
| 21 |
|
* |
| 22 |
* Revision 1.16 2003/05/13 14:53:56 joko |
* Revision 1.16 2003/05/13 14:53:56 joko |
| 23 |
* reset mvc-params "filter" and "meta" in tree mode!? |
* reset mvc-params "filter" and "meta" in tree mode!? |
| 24 |
* |
* |
| 138 |
// parameters about data identifiers, locations, sources and associated meta-information |
// parameters about data identifiers, locations, sources and associated meta-information |
| 139 |
'ecom_data_locator_key', |
'ecom_data_locator_key', |
| 140 |
'ecom_data_ident', |
'ecom_data_ident', |
| 141 |
'ecom_data_meta', 'ecom_data_meta_x', |
'ecom_data_meta', 'ecom_data_meta_x', 'ecom_data_meta_xe', |
| 142 |
'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', 'ecom_data_action_create', |
'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', 'ecom_data_action_create', |
| 143 |
|
'ecom_data_action_expand_edit', 'ecom_data_action_select', |
| 144 |
'ecom_data_form_checkbox', 'ecom_data_form_action', |
'ecom_data_form_checkbox', 'ecom_data_form_action', |
| 145 |
'ecom_data_source_key', |
'ecom_data_source_key', |
| 146 |
'ecom_data_filter', |
'ecom_data_filter', |
| 178 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
| 179 |
// extended meta, e.g. 2nd parent identifier |
// extended meta, e.g. 2nd parent identifier |
| 180 |
'ecom_data_meta_x' => array( query_arg => 'ecdmx' ), |
'ecom_data_meta_x' => array( query_arg => 'ecdmx' ), |
| 181 |
|
'ecom_data_meta_xe' => array( query_arg => 'ecdmxe' ), |
| 182 |
// filter the data: e.g. |
// filter the data: e.g. |
| 183 |
// - an xpath-query (xpq), |
// - an xpath-query (xpq), |
| 184 |
// - an abstract/custom filter string or |
// - an abstract/custom filter string or |
| 194 |
// ... required for data lists. |
// ... required for data lists. |
| 195 |
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
| 196 |
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
| 197 |
|
// ... required for expanded data items. |
| 198 |
|
'ecom_data_action_expand_edit' => array( query_arg => 'ecdfee' ), |
| 199 |
|
// ... required for selecting existing objects as reference |
| 200 |
|
'ecom_data_action_select' => array( query_arg => 'ecdfsel' ), |
| 201 |
|
|
| 202 |
// Special argument (should become a non-data-action). |
// Special argument (should become a non-data-action). |
| 203 |
// Triggers 'selectSource' at backend api (remote api) which causes a database handle switch. |
// Triggers 'selectSource' at backend api (remote api) which causes a database handle switch. |
| 281 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 282 |
switch ($_in[ecom_abstract_type]) { |
switch ($_in[ecom_abstract_type]) { |
| 283 |
case "list": |
case "list": |
| 284 |
if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
if($pre_out[options][ecoms][$label][ecom_mode] != "select") { |
| 285 |
if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); } |
if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
| 286 |
|
if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); } |
| 287 |
|
} |
| 288 |
break; |
break; |
| 289 |
// 2003-04-16: required for xmltree-to-item transition |
// 2003-04-16: required for xmltree-to-item transition |
| 290 |
// if we dont do this the "dotted" filter expression would persist across views |
// if we dont do this the "dotted" filter expression would persist across views |
| 309 |
|
|
| 310 |
// rewrite idents |
// rewrite idents |
| 311 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 312 |
|
|
| 313 |
|
// old version: ap == explorer |
| 314 |
// map Topic to Page if exists |
// map Topic to Page if exists |
| 315 |
if($_in[topic]) { |
//if ($_in[topic]) { |
| 316 |
$_in[ap] = $_in[topic]; |
// $_in[ap] = $_in[topic]; |
| 317 |
} |
//} |
| 318 |
$idents = array ( ap, ); |
//$idents = array ( ap ); |
| 319 |
foreach($idents as $key) { |
//foreach($idents as $key) { |
| 320 |
$_out[options][idents][$key] = $_in[$key]; |
// $_out[options][idents][$key] = $_in[$key]; |
| 321 |
} |
//} |
| 322 |
|
|
| 323 |
|
// 2003-06-26: switched from ap=explorer to t=DataBrowser |
| 324 |
|
$_out[options][idents][t] = $_in[topic]; |
| 325 |
|
|
| 326 |
'), |
'), |
| 327 |
|
|
| 328 |
// check right $_GET[ap] |
// check right $_GET[ap] - depreciated |
| 329 |
create_function('&$_in, &$_out', 'return ($_in[ap] != "explorer") ? print "Wrong application value [ap]: $_in[ap], sure this is right here?<br>" : null;'), |
//create_function('&$_in, &$_out', 'return ($_in[ap] != "explorer") ? print "Wrong application value [ap]: $_in[ap], sure this is right here?<br>" : null;'), |
| 330 |
|
|
| 331 |
// write components variables to out |
// write components variables to out |
| 332 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 338 |
if($_in[ecom_label]) { |
if($_in[ecom_label]) { |
| 339 |
foreach($vars as $key) { |
foreach($vars as $key) { |
| 340 |
if($_in[$key]) { |
if($_in[$key]) { |
| 341 |
|
//print "var: " . $key . " value: " . $_in[$key] . "<br>"; |
| 342 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 343 |
$_out[options][ecoms][$label][$key] = $_in[$key]; |
$_out[options][ecoms][$label][$key] = $_in[$key]; |
| 344 |
} |
} |
| 396 |
if($ident) { array_push($tmp, $ident); } |
if($ident) { array_push($tmp, $ident); } |
| 397 |
} |
} |
| 398 |
if($cnt == 1) { |
if($cnt == 1) { |
| 399 |
//print "Single selection, ident : " . $tmp[0] . "<br>"; |
print "Single selection, ident : " . $tmp[0] . "<br>"; |
| 400 |
$_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; |
$_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; |
| 401 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 402 |
} elseif($cnt > 1) { |
} elseif($cnt > 1) { |
| 403 |
// TODO: implement multi-selection actions on rows(items) here!! |
// TODO: implement multi-selection actions on rows(items) here!! |
| 404 |
print "Multi-Selection!! Current Ident(s) $tmp" . "<br>"; |
print "Multi-Selection!! Current Ident(s) $tmp" . "<br>"; |
| 405 |
$_out[options][ecoms][$label][ecom_data_ident] = $tmp; |
$_out[options][ecoms][$label][ecom_data_ident] = $tmp; |
| 406 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 407 |
} |
} |
| 408 |
} else { |
} else { |
| 409 |
print "ident: " . Dumper($_out[options][ecoms][$label][ecom_data_ident]) . "<br>"; |
print "ident: " . Dumper($_out[options][ecoms][$label][ecom_data_ident]) . "<br>"; |
| 410 |
} |
} |
| 411 |
//$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
| 412 |
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
| 413 |
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
//print "in: " . Dumper($_in) . "<br>"; |
| 414 |
|
//print "out: " . Dumper($_out) . "<br>"; |
| 415 |
} |
} |
| 416 |
'), |
'), |
| 417 |
|
|
| 419 |
// handle data form buttons |
// handle data form buttons |
| 420 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 421 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 422 |
if($_in[ecom_data_action_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } |
if($_in[ecom_data_action_edit]) { |
| 423 |
if($_in[ecom_data_action_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
$_out[options][ecoms][$label][ecom_mode] = "edit"; |
| 424 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 425 |
|
} |
| 426 |
|
if($_in[ecom_data_action_cancel]) { |
| 427 |
|
$_out[options][ecoms][$label][ecom_mode] = "view"; |
| 428 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 429 |
|
} |
| 430 |
|
|
| 431 |
// Action.Create |
// Action.Create |
| 432 |
if($_in[ecom_data_action_create]) { |
if($_in[ecom_data_action_create]) { |
| 433 |
print Dumper($_out[options][ecoms][$label]); |
//print Dumper($_out[options][ecoms][$label]); |
| 434 |
$_out[options][ecoms][$label][ecom_mode] = "create"; |
$_out[options][ecoms][$label][ecom_mode] = "create"; |
| 435 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 436 |
|
} |
| 437 |
|
if($_in[ecom_data_action_expand_edit]) { |
| 438 |
|
//print Dumper($_out[options][ecoms][$label]); |
| 439 |
|
$_out[options][ecoms][$label][ecom_mode] = "expandedit"; |
| 440 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 441 |
} |
} |
| 442 |
|
|
| 443 |
// Action.Delete [new of 2003-04-09] |
// Action.Delete [new of 2003-04-09] |
| 449 |
// could/should we do this for "edit" and/or "view" actions as well? |
// could/should we do this for "edit" and/or "view" actions as well? |
| 450 |
// look at ecom/FlexibleDataItem! |
// look at ecom/FlexibleDataItem! |
| 451 |
|
|
| 452 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 453 |
|
} |
| 454 |
|
// Action.Select |
| 455 |
|
if($_in[ecom_data_action_select]) { |
| 456 |
|
if(is_array($_in[ecom_data_form_checkbox])) { |
| 457 |
|
$cnt = sizeof($_in[ecom_data_form_checkbox]); |
| 458 |
|
$tmp = array(); |
| 459 |
|
foreach($_in[ecom_data_form_checkbox] as $ident) { |
| 460 |
|
if($ident) { array_push($tmp, $ident); } |
| 461 |
|
} |
| 462 |
|
if($cnt == 1) { |
| 463 |
|
print "Single selection, ident : " . $tmp[0] . "<br>"; |
| 464 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; |
| 465 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 466 |
|
} elseif($cnt > 1) { |
| 467 |
|
// TODO: implement multi-selection actions on rows(items) here!! |
| 468 |
|
print "Cannot do Multi-Selections with Action SELECT!!" . "<br>"; |
| 469 |
|
} |
| 470 |
|
|
| 471 |
|
$requestTracker = mkObject("Application::Request::Tracker"); |
| 472 |
|
$page_state = $requestTracker->getPointer(); |
| 473 |
|
$pre_out = $page_state[options]; |
| 474 |
|
//print "pre_out: " . Dumper($pre_out); |
| 475 |
|
|
| 476 |
|
$_out[options][ecoms][$label][ecom_mode] = "select"; |
| 477 |
|
$_out[options][ecoms][$label][ecom_data_meta_xe] = $pre_out[options][ecoms][$label][ecom_data_meta]; |
| 478 |
|
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
| 479 |
|
} |
| 480 |
} |
} |
|
|
|
| 481 |
'), |
'), |
| 482 |
|
|
| 483 |
// propagate datasources to ecoms |
// propagate datasources to ecoms |