| 4 |
* $Id$ |
* $Id$ |
| 5 |
* |
* |
| 6 |
* $Log$ |
* $Log$ |
| 7 |
|
* Revision 1.8 2003/04/08 17:53:08 joko |
| 8 |
|
* NEW: Module 'RemoteAction' in 'phase_startup' |
| 9 |
|
* |
| 10 |
|
* Revision 1.7 2003/04/07 22:32:27 jonen |
| 11 |
|
* + minor changes related to new ecom 'chooser' |
| 12 |
|
* |
| 13 |
|
* Revision 1.6 2003/04/06 01:32:57 jonen |
| 14 |
|
* + minor changes |
| 15 |
|
* |
| 16 |
|
* Revision 1.5 2003/04/05 21:18:29 joko |
| 17 |
|
* added Chooser and associated 'ecds'-parameter |
| 18 |
|
* new rule (at bottom) to dispatch datasource-keys to each ecom-component |
| 19 |
|
* |
| 20 |
|
* Revision 1.4 2003/04/04 23:59:19 jonen |
| 21 |
|
* + minor changes according to data form submits |
| 22 |
|
* |
| 23 |
|
* Revision 1.3 2003/04/04 01:28:13 jonen |
| 24 |
|
* + added function to purge unwanted merged vars |
| 25 |
|
* + handle form submit's now |
| 26 |
|
* |
| 27 |
* Revision 1.2 2003/03/20 07:54:52 jonen |
* Revision 1.2 2003/03/20 07:54:52 jonen |
| 28 |
* + added docu |
* + added docu |
| 29 |
* |
* |
| 84 |
|
|
| 85 |
$this->add_model( array( |
$this->add_model( array( |
| 86 |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
| 87 |
request_args => array( 'ap', 'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_action', 'ecom_data_locator_key', |
request_args => array( |
| 88 |
'ecom_data_ident', 'ecom_data_meta' ), |
// ApplicationPage |
| 89 |
|
'ap', |
| 90 |
|
// important/required parameters for valid ecom-components |
| 91 |
|
'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode', |
| 92 |
|
// parameters about data identifiers, locations, sources and associated meta-information |
| 93 |
|
'ecom_data_locator_key', |
| 94 |
|
'ecom_data_ident', |
| 95 |
|
'ecom_data_meta', |
| 96 |
|
'ecom_data_form_edit', 'ecom_data_form_cancel', |
| 97 |
|
'ecom_data_source_key' |
| 98 |
|
), |
| 99 |
request_arg => array( |
request_arg => array( |
| 100 |
'ap' => array( query_arg => 'ap' ), |
'ap' => array( query_arg => 'ap' ), |
| 101 |
'ecom_label' => array( query_arg => 'ecl' ), |
'ecom_label' => array( query_arg => 'ecl' ), |
| 102 |
'ecom_type' => array( query_arg => 'ect' ), |
'ecom_type' => array( query_arg => 'ect' ), |
| 103 |
'ecom_abstract_type' => array( query_arg => 'ecat' ), |
'ecom_abstract_type' => array( query_arg => 'ecat' ), |
| 104 |
'ecom_action' => array( query_arg => 'ecac' ), |
'ecom_mode' => array( query_arg => 'ecmod' ), |
| 105 |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
| 106 |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
| 107 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
| 108 |
|
'ecom_data_form_edit' => array( query_arg => 'ecdfe' ), |
| 109 |
|
'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ), |
| 110 |
|
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
| 111 |
), |
), |
| 112 |
|
|
| 113 |
/* |
/* |
| 151 |
// COID => '123', |
// COID => '123', |
| 152 |
caption => "Explorer - ExplorerDataItem", |
caption => "Explorer - ExplorerDataItem", |
| 153 |
)); |
)); |
| 154 |
|
|
| 155 |
// FIXME!!! enhance!?!? |
// FIXME!!! enhance!?!? |
| 156 |
// AIM: "dispatch a Request to a View by using rules..." |
// AIM: "dispatch a Request to a View by using rules..." |
| 157 |
// Todo: |
// Todo: |
| 160 |
// Enhance this backend and introduce a mechanism to trigger |
// Enhance this backend and introduce a mechanism to trigger |
| 161 |
// 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. |
| 162 |
$this->add_controller( array( |
$this->add_controller( array( |
| 163 |
|
|
| 164 |
// 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 |
| 165 |
module => 'Application::Request::HttpController', |
module => 'Application::Request::HttpController', |
| 166 |
|
//module_options => blah |
| 167 |
|
|
| 168 |
rules => array( |
rules => array( |
| 169 |
|
|
| 170 |
|
|
| 171 |
// get last page state |
// get last page state |
| 172 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 173 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
| 174 |
$page_state = $requestTracker->getPointer(); |
$page_state = $requestTracker->getPointer(); |
| 175 |
$_out = $page_state[options]; |
$pre_out = $page_state[options]; |
| 176 |
|
//print Dumper($pre_out); |
| 177 |
|
// clean-up unwanted variables |
| 178 |
|
$label = $_in[ecom_label]; |
| 179 |
|
switch ($_in[ecom_abstract_type]) { |
| 180 |
|
case "list": |
| 181 |
|
if($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
| 182 |
|
break; |
| 183 |
|
} |
| 184 |
|
$_out = $pre_out; |
| 185 |
'), |
'), |
| 186 |
|
|
| 187 |
// rewrite idents |
// rewrite idents |
| 193 |
'), |
'), |
| 194 |
|
|
| 195 |
// check right $_GET[ap] |
// check right $_GET[ap] |
| 196 |
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;'), |
| 197 |
|
|
| 198 |
// write components variables to out |
// write components variables to out |
| 199 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 200 |
$vars = array( ecom_type, ecom_abstract_type, ecom_action, ecom_data_locator_key, ecom_data_ident, ecom_data_meta ); |
$vars = array( ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta ); |
| 201 |
if($_in[ecom_label]) { |
if($_in[ecom_label]) { |
| 202 |
foreach($vars as $key) { |
foreach($vars as $key) { |
| 203 |
if($_in[$key]) { |
if($_in[$key]) { |
| 210 |
return; |
return; |
| 211 |
'), |
'), |
| 212 |
|
|
| 213 |
// create default ecoms (navigation, etc.) |
// create default ecoms (navigation, chooser [as of 2003-04-05] etc.) |
| 214 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 215 |
if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) { |
if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) { |
| 216 |
$_out[options][ecoms] = array( |
$_out[options][ecoms] = array( |
| 217 |
nav => array( |
nav => array( |
| 218 |
ecom_type => "nav", |
ecom_type => "nav", |
| 219 |
ecom_abstract_type => "list", |
ecom_abstract_type => "list", |
| 220 |
ecom_action => "nav", |
ecom_mode => "link", |
| 221 |
|
ecom_data_locator_key => "rpc", |
| 222 |
|
), |
| 223 |
|
chooser => array( |
| 224 |
|
ecom_type => "nav", |
| 225 |
|
ecom_abstract_type => "list", |
| 226 |
|
ecom_mode => "link", |
| 227 |
ecom_data_locator_key => "rpc", |
ecom_data_locator_key => "rpc", |
| 228 |
), |
), |
| 229 |
); |
); |
| 232 |
return; |
return; |
| 233 |
'), |
'), |
| 234 |
|
|
| 235 |
|
// handle data form buttons |
| 236 |
|
create_function('&$_in, &$_out', ' |
| 237 |
|
$label = $_in[ecom_label]; |
| 238 |
|
if($_in[ecom_data_form_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } |
| 239 |
|
if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
| 240 |
|
'), |
| 241 |
|
|
| 242 |
|
// propagate datasources to ecoms |
| 243 |
|
// datasource-change requested? enhance logic here! |
| 244 |
|
// by now each ecom-component gets injected the very same |
| 245 |
|
// datasource if requested - otherwise everything will fall back to defaults |
| 246 |
|
create_function('&$_in, &$_out', ' |
| 247 |
|
if ($_in[ecom_data_source_key]) { |
| 248 |
|
|
| 249 |
|
//print "YAI<br/>"; |
| 250 |
|
|
| 251 |
|
//print Dumper($_out[options][ecoms]); |
| 252 |
|
//print "ds: " . $_in[ecom_data_source_key] . "<br/>"; |
| 253 |
|
/* |
| 254 |
|
foreach ($_out[options][ecoms] as $name => $ecom) { |
| 255 |
|
print "name: $name<br/>"; |
| 256 |
|
//$_out[options][sources][selected] = $_in[ecom_data_source]; |
| 257 |
|
$_out[options][ecoms][$name][ecom_data_source_key] = $_in[ecom_data_source_key]; |
| 258 |
|
} |
| 259 |
|
*/ |
| 260 |
|
$_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; |
| 261 |
|
|
| 262 |
|
|
| 263 |
|
// 2003-04-07 - enhanced |
| 264 |
|
// now activates a special ecom-component - a "RemoteAction" - replacing |
| 265 |
|
// the "content"-ecom instead of displaying an empty page / overriding any |
| 266 |
|
// view reached by "normal dispatching" |
| 267 |
|
|
| 268 |
|
$_out[options][ecoms][phase_startup] = array( |
| 269 |
|
ecom_type => "call", |
| 270 |
|
ecom_abstract_type => "auto", |
| 271 |
|
ecom_mode => "link", |
| 272 |
|
ecom_data_locator_key => "rpc", |
| 273 |
|
// new attributes/properties/arguments that control further / trigger different DataFlow: |
| 274 |
|
ecom_call_method => "selectSource", |
| 275 |
|
ecom_call_args => $_in[ecom_data_source_key] |
| 276 |
|
); |
| 277 |
|
|
| 278 |
|
} |
| 279 |
|
'), |
| 280 |
|
|
| 281 |
|
|
| 282 |
/* |
/* |
| 283 |
// translate value of argument "action" (olist => list.view, oedit => item.edit) |
// translate value of argument "action" (olist => list.view, oedit => item.edit) |
| 284 |
// action dispatcher |
// action dispatcher |