| 4 |
* $Id$ |
* $Id$ |
| 5 |
* |
* |
| 6 |
* $Log$ |
* $Log$ |
| 7 |
|
* Revision 1.18 2003/07/02 12:18:00 jonen |
| 8 |
|
* fixed bugs |
| 9 |
|
* |
| 10 |
|
* Revision 1.17 2003/06/25 23:45:05 joko |
| 11 |
|
* trying to switch from "ap" completely to "t" |
| 12 |
|
* |
| 13 |
|
* Revision 1.16 2003/05/13 14:53:56 joko |
| 14 |
|
* reset mvc-params "filter" and "meta" in tree mode!? |
| 15 |
|
* |
| 16 |
|
* Revision 1.15 2003/05/10 18:19:55 jonen |
| 17 |
|
* + added stuff relating to 'create/add new' links/buttons |
| 18 |
|
* |
| 19 |
|
* Revision 1.14 2003/04/19 16:20:47 jonen |
| 20 |
|
* + added handle of ecom 'UMnav' according to page 'Benutzverwaltung' |
| 21 |
|
* |
| 22 |
* Revision 1.13 2003/04/18 15:30:24 joko |
* Revision 1.13 2003/04/18 15:30:24 joko |
| 23 |
* NEW: parameter 'ecom_data_filter' - used for 'items' |
* NEW: parameter 'ecom_data_filter' - used for 'items' |
| 24 |
* (introduced to filter xml-payload at backend side via xpath queries) |
* (introduced to filter xml-payload at backend side via xpath queries) |
| 129 |
// parameters about data identifiers, locations, sources and associated meta-information |
// parameters about data identifiers, locations, sources and associated meta-information |
| 130 |
'ecom_data_locator_key', |
'ecom_data_locator_key', |
| 131 |
'ecom_data_ident', |
'ecom_data_ident', |
| 132 |
'ecom_data_meta', |
'ecom_data_meta', 'ecom_data_meta_x', |
| 133 |
'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', |
'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', 'ecom_data_action_create', |
| 134 |
'ecom_data_form_checkbox', 'ecom_data_form_action', |
'ecom_data_form_checkbox', 'ecom_data_form_action', |
| 135 |
'ecom_data_source_key', |
'ecom_data_source_key', |
| 136 |
'ecom_data_filter', |
'ecom_data_filter', |
| 166 |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
| 167 |
// e.g. a classname or a filename |
// e.g. a classname or a filename |
| 168 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
| 169 |
|
// extended meta, e.g. 2nd parent identifier |
| 170 |
|
'ecom_data_meta_x' => array( query_arg => 'ecdmx' ), |
| 171 |
// filter the data: e.g. |
// filter the data: e.g. |
| 172 |
// - an xpath-query (xpq), |
// - an xpath-query (xpq), |
| 173 |
// - an abstract/custom filter string or |
// - an abstract/custom filter string or |
| 179 |
'ecom_data_action_edit' => array( query_arg => 'ecdfe' ), |
'ecom_data_action_edit' => array( query_arg => 'ecdfe' ), |
| 180 |
'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ), |
'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ), |
| 181 |
'ecom_data_action_delete' => array( query_arg => 'ecdfd' ), |
'ecom_data_action_delete' => array( query_arg => 'ecdfd' ), |
| 182 |
|
'ecom_data_action_create' => array( query_arg => 'ecdfcr' ), |
| 183 |
// ... required for data lists. |
// ... required for data lists. |
| 184 |
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
| 185 |
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
| 260 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
| 261 |
$page_state = $requestTracker->getPointer(); |
$page_state = $requestTracker->getPointer(); |
| 262 |
$pre_out = $page_state[options]; |
$pre_out = $page_state[options]; |
| 263 |
//print Dumper($pre_out); |
//print "pre_out: " . Dumper($pre_out); |
| 264 |
|
|
| 265 |
// clean-up unwanted variables |
// clean-up unwanted variables |
| 266 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 267 |
switch ($_in[ecom_abstract_type]) { |
switch ($_in[ecom_abstract_type]) { |
| 268 |
case "list": |
case "list": |
| 269 |
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_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
| 270 |
|
if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); } |
| 271 |
break; |
break; |
| 272 |
// 2003-04-16: required for xmltree-to-item transition |
// 2003-04-16: required for xmltree-to-item transition |
| 273 |
// 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 |
| 274 |
case "item": |
case "item": |
| 275 |
if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); } |
if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); } |
| 276 |
break; |
break; |
| 277 |
|
case "tree": |
| 278 |
|
if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); } |
| 279 |
|
if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
| 280 |
|
break; |
| 281 |
} |
} |
| 282 |
$_out = $pre_out; |
$_out = $pre_out; |
| 283 |
'), |
'), |
| 292 |
|
|
| 293 |
// rewrite idents |
// rewrite idents |
| 294 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 295 |
|
|
| 296 |
|
// old version: ap == explorer |
| 297 |
// map Topic to Page if exists |
// map Topic to Page if exists |
| 298 |
if($_in[topic]) { |
//if ($_in[topic]) { |
| 299 |
$_in[ap] = $_in[topic]; |
// $_in[ap] = $_in[topic]; |
| 300 |
} |
//} |
| 301 |
$idents = array ( ap, ); |
//$idents = array ( ap ); |
| 302 |
foreach($idents as $key) { |
//foreach($idents as $key) { |
| 303 |
$_out[options][idents][$key] = $_in[$key]; |
// $_out[options][idents][$key] = $_in[$key]; |
| 304 |
} |
//} |
| 305 |
|
|
| 306 |
|
// 2003-06-26: switched from ap=explorer to t=DataBrowser |
| 307 |
|
$_out[options][idents][t] = $_in[topic]; |
| 308 |
|
|
| 309 |
'), |
'), |
| 310 |
|
|
| 311 |
// check right $_GET[ap] |
// check right $_GET[ap] - depreciated |
| 312 |
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;'), |
| 313 |
|
|
| 314 |
// write components variables to out |
// write components variables to out |
| 315 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 316 |
$vars = array( |
$vars = array( |
| 317 |
ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, |
ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, |
| 318 |
ecom_data_ident, ecom_data_meta, ecom_data_filter |
ecom_data_ident, ecom_data_meta, ecom_data_filter, ecom_data_meta_x |
| 319 |
); |
); |
| 320 |
// ecom_call_method, ecom_call_args |
// ecom_call_method, ecom_call_args |
| 321 |
if($_in[ecom_label]) { |
if($_in[ecom_label]) { |
| 322 |
foreach($vars as $key) { |
foreach($vars as $key) { |
| 323 |
if($_in[$key]) { |
if($_in[$key]) { |
| 324 |
|
//print "var: " . $key . " value: " . $_in[$key] . "<br>"; |
| 325 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 326 |
$_out[options][ecoms][$label][$key] = $_in[$key]; |
$_out[options][ecoms][$label][$key] = $_in[$key]; |
| 327 |
} |
} |
| 353 |
return; |
return; |
| 354 |
'), |
'), |
| 355 |
|
|
| 356 |
|
// handle data form action(button) |
| 357 |
|
create_function('&$_in, &$_out', ' |
| 358 |
|
if($_in[ap] == "Benutzerverwaltung" || $_in[topic] == "Benutzerverwaltung") { |
| 359 |
|
if(!$_out[options][ecoms][UMnav]) { |
| 360 |
|
$_out[options][ecoms][UMnav] = array( |
| 361 |
|
ecom_type => "nav", |
| 362 |
|
ecom_abstract_type => "tree", |
| 363 |
|
ecom_mode => "link", |
| 364 |
|
ecom_data_locator_key => "rpc", |
| 365 |
|
); |
| 366 |
|
} |
| 367 |
|
} |
| 368 |
|
'), |
| 369 |
|
|
| 370 |
// handle data form action(button) |
// handle data form action(button) |
| 371 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 372 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 373 |
if($_in[ecom_data_form_action] && is_array($_in[ecom_data_form_checkbox])) { |
if($_in[ecom_data_form_action]) { |
| 374 |
|
//print "from action button pressed!<br>"; |
| 375 |
|
if(is_array($_in[ecom_data_form_checkbox])) { |
| 376 |
$cnt = sizeof($_in[ecom_data_form_checkbox]); |
$cnt = sizeof($_in[ecom_data_form_checkbox]); |
| 377 |
|
$tmp = array(); |
| 378 |
|
foreach($_in[ecom_data_form_checkbox] as $ident) { |
| 379 |
|
if($ident) { array_push($tmp, $ident); } |
| 380 |
|
} |
| 381 |
if($cnt == 1) { |
if($cnt == 1) { |
| 382 |
foreach($_in[ecom_data_form_checkbox] as $ident) { |
print "Single selection, ident : " . $tmp[0] . "<br>"; |
| 383 |
$_out[options][ecoms][$label][ecom_data_ident] = $ident; |
$_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; |
|
} |
|
|
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
|
|
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
|
| 384 |
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 385 |
} else { |
} elseif($cnt > 1) { |
| 386 |
// TODO: implement multi-selection actions on rows(items) here!! |
// TODO: implement multi-selection actions on rows(items) here!! |
| 387 |
|
print "Multi-Selection!! Current Ident(s) $tmp" . "<br>"; |
| 388 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $tmp; |
| 389 |
} |
} |
| 390 |
|
} else { |
| 391 |
|
print "ident: " . Dumper($_out[options][ecoms][$label][ecom_data_ident]) . "<br>"; |
| 392 |
|
} |
| 393 |
|
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
| 394 |
|
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
| 395 |
|
//print "in: " . Dumper($_in) . "<br>"; |
| 396 |
|
//print "out: " . Dumper($_out) . "<br>"; |
| 397 |
} |
} |
| 398 |
'), |
'), |
| 399 |
|
|
| 401 |
// handle data form buttons |
// handle data form buttons |
| 402 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 403 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 404 |
if($_in[ecom_data_action_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } |
if($_in[ecom_data_action_edit]) { |
| 405 |
if($_in[ecom_data_action_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
$_out[options][ecoms][$label][ecom_mode] = "edit"; |
| 406 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 407 |
|
} |
| 408 |
|
if($_in[ecom_data_action_cancel]) { |
| 409 |
|
$_out[options][ecoms][$label][ecom_mode] = "view"; |
| 410 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 411 |
|
} |
| 412 |
|
|
| 413 |
|
// Action.Create |
| 414 |
|
if($_in[ecom_data_action_create]) { |
| 415 |
|
//print Dumper($_out[options][ecoms][$label]); |
| 416 |
|
$_out[options][ecoms][$label][ecom_mode] = "create"; |
| 417 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 418 |
|
} |
| 419 |
|
|
| 420 |
// Action.Delete [new of 2003-04-09] |
// Action.Delete [new of 2003-04-09] |
| 421 |
if ($_in[ecom_data_action_delete]) { |
if ($_in[ecom_data_action_delete]) { |
| 426 |
// 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? |
| 427 |
// look at ecom/FlexibleDataItem! |
// look at ecom/FlexibleDataItem! |
| 428 |
|
|
| 429 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 430 |
} |
} |
|
|
|
| 431 |
'), |
'), |
| 432 |
|
|
| 433 |
// propagate datasources to ecoms |
// propagate datasources to ecoms |