| 4 |
* $Id$ |
* $Id$ |
| 5 |
* |
* |
| 6 |
* $Log$ |
* $Log$ |
| 7 |
|
* Revision 1.12 2003/04/18 13:40:54 jonen |
| 8 |
|
* + added 'topic' to requested vars which will currently be merged with the 'ap' var |
| 9 |
|
* |
| 10 |
|
* Revision 1.11 2003/04/11 00:51:10 joko |
| 11 |
|
* minor update: just testing stuff... |
| 12 |
|
* |
| 13 |
|
* Revision 1.10 2003/04/10 06:03:26 joko |
| 14 |
|
* ++ renamed keys: 'ecom_data_form_edit', 'ecom_data_form_cancel' through 'ecom_data_action_edit', 'ecom_data_action_cancel' |
| 15 |
|
* + new key: 'ecom_data_action_delete' |
| 16 |
|
* + Action.Delete: not really, since it's inside component in fact (self-contained ecom) |
| 17 |
|
* |
| 18 |
|
* Revision 1.9 2003/04/09 00:05:50 jonen |
| 19 |
|
* added request values and functions needed for extended form handling |
| 20 |
|
* |
| 21 |
|
* Revision 1.8 2003/04/08 17:53:08 joko |
| 22 |
|
* NEW: Module 'RemoteAction' in 'phase_startup' |
| 23 |
|
* |
| 24 |
|
* Revision 1.7 2003/04/07 22:32:27 jonen |
| 25 |
|
* + minor changes related to new ecom 'chooser' |
| 26 |
|
* |
| 27 |
|
* Revision 1.6 2003/04/06 01:32:57 jonen |
| 28 |
|
* + minor changes |
| 29 |
|
* |
| 30 |
|
* Revision 1.5 2003/04/05 21:18:29 joko |
| 31 |
|
* added Chooser and associated 'ecds'-parameter |
| 32 |
|
* new rule (at bottom) to dispatch datasource-keys to each ecom-component |
| 33 |
|
* |
| 34 |
* Revision 1.4 2003/04/04 23:59:19 jonen |
* Revision 1.4 2003/04/04 23:59:19 jonen |
| 35 |
* + minor changes according to data form submits |
* + minor changes according to data form submits |
| 36 |
* |
* |
| 98 |
|
|
| 99 |
$this->add_model( array( |
$this->add_model( array( |
| 100 |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
| 101 |
request_args => array( 'ap', 'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode', 'ecom_data_locator_key', |
request_args => array( |
| 102 |
'ecom_data_ident', 'ecom_data_meta', 'ecom_data_form_edit', 'ecom_data_form_cancel' ), |
// ApplicationTopic |
| 103 |
|
'topic', |
| 104 |
|
// ApplicationPage |
| 105 |
|
'ap', |
| 106 |
|
// important/required parameters for valid ecom-components |
| 107 |
|
'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode', |
| 108 |
|
// parameters about data identifiers, locations, sources and associated meta-information |
| 109 |
|
'ecom_data_locator_key', |
| 110 |
|
'ecom_data_ident', |
| 111 |
|
'ecom_data_meta', |
| 112 |
|
'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', |
| 113 |
|
'ecom_data_form_checkbox', 'ecom_data_form_action', |
| 114 |
|
'ecom_data_source_key' |
| 115 |
|
), |
| 116 |
request_arg => array( |
request_arg => array( |
| 117 |
|
'topic' => array( query_arg => 't' ), |
| 118 |
'ap' => array( query_arg => 'ap' ), |
'ap' => array( query_arg => 'ap' ), |
| 119 |
'ecom_label' => array( query_arg => 'ecl' ), |
'ecom_label' => array( query_arg => 'ecl' ), |
| 120 |
'ecom_type' => array( query_arg => 'ect' ), |
'ecom_type' => array( query_arg => 'ect' ), |
| 123 |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
| 124 |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
| 125 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
| 126 |
'ecom_data_form_edit' => array( query_arg => 'ecdfe' ), |
'ecom_data_action_edit' => array( query_arg => 'ecdfe' ), |
| 127 |
'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ), |
'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ), |
| 128 |
|
'ecom_data_action_delete' => array( query_arg => 'ecdfd' ), |
| 129 |
|
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
| 130 |
|
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
| 131 |
|
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
| 132 |
), |
), |
| 133 |
|
|
| 134 |
/* |
/* |
| 172 |
// COID => '123', |
// COID => '123', |
| 173 |
caption => "Explorer - ExplorerDataItem", |
caption => "Explorer - ExplorerDataItem", |
| 174 |
)); |
)); |
| 175 |
|
|
| 176 |
// FIXME!!! enhance!?!? |
// FIXME!!! enhance!?!? |
| 177 |
// AIM: "dispatch a Request to a View by using rules..." |
// AIM: "dispatch a Request to a View by using rules..." |
| 178 |
// Todo: |
// Todo: |
| 181 |
// Enhance this backend and introduce a mechanism to trigger |
// Enhance this backend and introduce a mechanism to trigger |
| 182 |
// a true callback to process a rule (or: "as a rule") on top of that. |
// a true callback to process a rule (or: "as a rule") on top of that. |
| 183 |
$this->add_controller( array( |
$this->add_controller( array( |
| 184 |
|
|
| 185 |
// for "module", no component registry is required, just does 'mkObject' under the hood |
// for "module", no component registry is required, just does 'mkObject' under the hood |
| 186 |
module => 'Application::Request::HttpController', |
module => 'Application::Request::HttpController', |
| 187 |
|
//module_options => blah |
| 188 |
|
|
| 189 |
rules => array( |
rules => array( |
| 190 |
|
|
| 191 |
// get last page state |
// get last page state |
| 204 |
$_out = $pre_out; |
$_out = $pre_out; |
| 205 |
'), |
'), |
| 206 |
|
|
| 207 |
|
// reset machine |
| 208 |
|
create_function('&$_in, &$_out', ' |
| 209 |
|
// HACK!!! |
| 210 |
|
// FIXME: review and implement in a more clean way? |
| 211 |
|
//print "RESET!<br/>"; |
| 212 |
|
|
| 213 |
|
$_out[options][ecoms][phase_startup] = "RESET"; |
| 214 |
|
'), |
| 215 |
|
|
| 216 |
// rewrite idents |
// rewrite idents |
| 217 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 218 |
|
// map Topic to Page if exists |
| 219 |
|
if($_in[topic]) { |
| 220 |
|
$_in[ap] = $_in[topic]; |
| 221 |
|
} |
| 222 |
$idents = array ( ap, ); |
$idents = array ( ap, ); |
| 223 |
foreach($idents as $key) { |
foreach($idents as $key) { |
| 224 |
$_out[options][idents][$key] = $_in[$key]; |
$_out[options][idents][$key] = $_in[$key]; |
| 226 |
'), |
'), |
| 227 |
|
|
| 228 |
// check right $_GET[ap] |
// check right $_GET[ap] |
| 229 |
create_function('&$_in, &$_out', 'return ($_in[ap] != "explorer") ? print "Wrong application value $_in[ap], sure this is right here?" : null;'), |
create_function('&$_in, &$_out', 'return ($_in[ap] != "explorer") ? print "Wrong application value: $_in[ap], sure this is right here?<br>" : null;'), |
| 230 |
|
|
| 231 |
// write components variables to out |
// write components variables to out |
| 232 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 233 |
$vars = array( ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta ); |
$vars = array( |
| 234 |
|
ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta |
| 235 |
|
); |
| 236 |
|
// ecom_call_method, ecom_call_args |
| 237 |
if($_in[ecom_label]) { |
if($_in[ecom_label]) { |
| 238 |
foreach($vars as $key) { |
foreach($vars as $key) { |
| 239 |
if($_in[$key]) { |
if($_in[$key]) { |
| 246 |
return; |
return; |
| 247 |
'), |
'), |
| 248 |
|
|
| 249 |
// create default ecoms (navigation, etc.) |
// create default ecoms (navigation, chooser [as of 2003-04-05] etc.) |
| 250 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 251 |
if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) { |
if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) { |
| 252 |
$_out[options][ecoms] = array( |
$_out[options][ecoms] = array( |
| 253 |
nav => array( |
nav => array( |
| 254 |
ecom_type => "nav", |
ecom_type => "nav", |
| 255 |
ecom_abstract_type => "list", |
ecom_abstract_type => "list", |
| 256 |
ecom_mode => "nav", |
ecom_mode => "link", |
| 257 |
|
ecom_data_locator_key => "rpc", |
| 258 |
|
), |
| 259 |
|
chooser => array( |
| 260 |
|
ecom_type => "nav", |
| 261 |
|
ecom_abstract_type => "list", |
| 262 |
|
ecom_mode => "link", |
| 263 |
ecom_data_locator_key => "rpc", |
ecom_data_locator_key => "rpc", |
| 264 |
), |
), |
| 265 |
); |
); |
| 268 |
return; |
return; |
| 269 |
'), |
'), |
| 270 |
|
|
| 271 |
|
|
| 272 |
|
// handle data form action(button) |
| 273 |
|
create_function('&$_in, &$_out', ' |
| 274 |
|
$label = $_in[ecom_label]; |
| 275 |
|
if($_in[ecom_data_form_action] && is_array($_in[ecom_data_form_checkbox])) { |
| 276 |
|
$cnt = sizeof($_in[ecom_data_form_checkbox]); |
| 277 |
|
if($cnt == 1) { |
| 278 |
|
foreach($_in[ecom_data_form_checkbox] as $ident) { |
| 279 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $ident; |
| 280 |
|
} |
| 281 |
|
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
| 282 |
|
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
| 283 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
| 284 |
|
} else { |
| 285 |
|
// TODO: implement multi-selection actions on rows(items) here!! |
| 286 |
|
} |
| 287 |
|
} |
| 288 |
|
'), |
| 289 |
|
|
| 290 |
|
|
| 291 |
// handle data form buttons |
// handle data form buttons |
| 292 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 293 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 294 |
if($_in[ecom_data_form_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } |
if($_in[ecom_data_action_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } |
| 295 |
if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
if($_in[ecom_data_action_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
| 296 |
|
|
| 297 |
|
// Action.Delete [new of 2003-04-09] |
| 298 |
|
if ($_in[ecom_data_action_delete]) { |
| 299 |
|
|
| 300 |
|
//$_out[options][ecoms][content][ecom_mode] = "view"; |
| 301 |
|
|
| 302 |
|
// the code here vanished to the component itself! |
| 303 |
|
// could/should we do this for "edit" and/or "view" actions as well? |
| 304 |
|
// look at ecom/FlexibleDataItem! |
| 305 |
|
|
| 306 |
|
} |
| 307 |
|
|
| 308 |
|
'), |
| 309 |
|
|
| 310 |
|
// propagate datasources to ecoms |
| 311 |
|
// datasource-change requested? enhance logic here! |
| 312 |
|
// by now each ecom-component gets injected the very same |
| 313 |
|
// datasource if requested - otherwise everything will fall back to defaults |
| 314 |
|
create_function('&$_in, &$_out', ' |
| 315 |
|
if ($_in[ecom_data_source_key]) { |
| 316 |
|
|
| 317 |
|
print "YAI: ecom_data_source_key<br/>"; |
| 318 |
|
|
| 319 |
|
//print Dumper($_out[options][ecoms]); |
| 320 |
|
//print "ds: " . $_in[ecom_data_source_key] . "<br/>"; |
| 321 |
|
/* |
| 322 |
|
foreach ($_out[options][ecoms] as $name => $ecom) { |
| 323 |
|
print "name: $name<br/>"; |
| 324 |
|
//$_out[options][sources][selected] = $_in[ecom_data_source]; |
| 325 |
|
$_out[options][ecoms][$name][ecom_data_source_key] = $_in[ecom_data_source_key]; |
| 326 |
|
} |
| 327 |
|
*/ |
| 328 |
|
$_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; |
| 329 |
|
|
| 330 |
|
|
| 331 |
|
// 2003-04-07 - enhanced |
| 332 |
|
// now activates a special ecom-component - a "RemoteAction" - replacing |
| 333 |
|
// the "content"-ecom instead of displaying an empty page / overriding any |
| 334 |
|
// view reached by "normal dispatching" |
| 335 |
|
|
| 336 |
|
$_out[options][ecoms][phase_startup] = array( |
| 337 |
|
ecom_type => "call", |
| 338 |
|
ecom_abstract_type => "auto", |
| 339 |
|
ecom_mode => "link", |
| 340 |
|
ecom_data_locator_key => "rpc", |
| 341 |
|
// new attributes/properties/arguments that control further / trigger different DataFlow: |
| 342 |
|
// FIXME: add these to declaration at top! |
| 343 |
|
ecom_call_method => "selectSource", |
| 344 |
|
ecom_call_args => $_in[ecom_data_source_key] |
| 345 |
|
); |
| 346 |
|
|
| 347 |
|
} |
| 348 |
'), |
'), |
| 349 |
|
|
| 350 |
|
|
| 351 |
/* |
/* |
| 352 |
// translate value of argument "action" (olist => list.view, oedit => item.edit) |
// translate value of argument "action" (olist => list.view, oedit => item.edit) |