| 4 |
* $Id$ |
* $Id$ |
| 5 |
* |
* |
| 6 |
* $Log$ |
* $Log$ |
| 7 |
|
* Revision 1.7 2003/04/07 22:32:27 jonen |
| 8 |
|
* + minor changes related to new ecom 'chooser' |
| 9 |
|
* |
| 10 |
|
* Revision 1.6 2003/04/06 01:32:57 jonen |
| 11 |
|
* + minor changes |
| 12 |
|
* |
| 13 |
|
* Revision 1.5 2003/04/05 21:18:29 joko |
| 14 |
|
* added Chooser and associated 'ecds'-parameter |
| 15 |
|
* new rule (at bottom) to dispatch datasource-keys to each ecom-component |
| 16 |
|
* |
| 17 |
|
* Revision 1.4 2003/04/04 23:59:19 jonen |
| 18 |
|
* + minor changes according to data form submits |
| 19 |
|
* |
| 20 |
* Revision 1.3 2003/04/04 01:28:13 jonen |
* Revision 1.3 2003/04/04 01:28:13 jonen |
| 21 |
* + added function to purge unwanted merged vars |
* + added function to purge unwanted merged vars |
| 22 |
* + handle form submit's now |
* + handle form submit's now |
| 81 |
|
|
| 82 |
$this->add_model( array( |
$this->add_model( array( |
| 83 |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
| 84 |
request_args => array( 'ap', 'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode', 'ecom_data_locator_key', |
request_args => array( |
| 85 |
'ecom_data_ident', 'ecom_data_meta', 'ecom_form_edit' ), |
// ApplicationPage |
| 86 |
|
'ap', |
| 87 |
|
// important/required parameters for valid ecom-components |
| 88 |
|
'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode', |
| 89 |
|
// parameters about data identifiers, locations, sources and associated meta-information |
| 90 |
|
'ecom_data_locator_key', |
| 91 |
|
'ecom_data_ident', |
| 92 |
|
'ecom_data_meta', |
| 93 |
|
'ecom_data_form_edit', 'ecom_data_form_cancel', |
| 94 |
|
'ecom_data_source_key' |
| 95 |
|
), |
| 96 |
request_arg => array( |
request_arg => array( |
| 97 |
'ap' => array( query_arg => 'ap' ), |
'ap' => array( query_arg => 'ap' ), |
| 98 |
'ecom_label' => array( query_arg => 'ecl' ), |
'ecom_label' => array( query_arg => 'ecl' ), |
| 102 |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
| 103 |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
| 104 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
| 105 |
'ecom_form_edit' => array( query_arg => 'ecfedit' ), |
'ecom_data_form_edit' => array( query_arg => 'ecdfe' ), |
| 106 |
|
'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ), |
| 107 |
|
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
| 108 |
), |
), |
| 109 |
|
|
| 110 |
/* |
/* |
| 148 |
// COID => '123', |
// COID => '123', |
| 149 |
caption => "Explorer - ExplorerDataItem", |
caption => "Explorer - ExplorerDataItem", |
| 150 |
)); |
)); |
| 151 |
|
|
| 152 |
// FIXME!!! enhance!?!? |
// FIXME!!! enhance!?!? |
| 153 |
// AIM: "dispatch a Request to a View by using rules..." |
// AIM: "dispatch a Request to a View by using rules..." |
| 154 |
// Todo: |
// Todo: |
| 157 |
// Enhance this backend and introduce a mechanism to trigger |
// Enhance this backend and introduce a mechanism to trigger |
| 158 |
// 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. |
| 159 |
$this->add_controller( array( |
$this->add_controller( array( |
| 160 |
|
|
| 161 |
// 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 |
| 162 |
module => 'Application::Request::HttpController', |
module => 'Application::Request::HttpController', |
| 163 |
|
//module_options => blah |
| 164 |
|
|
| 165 |
rules => array( |
rules => array( |
| 166 |
|
|
| 167 |
|
|
| 168 |
// get last page state |
// get last page state |
| 169 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 170 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
| 181 |
$_out = $pre_out; |
$_out = $pre_out; |
| 182 |
'), |
'), |
| 183 |
|
|
|
|
|
| 184 |
// rewrite idents |
// rewrite idents |
| 185 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 186 |
$idents = array ( ap, ); |
$idents = array ( ap, ); |
| 190 |
'), |
'), |
| 191 |
|
|
| 192 |
// check right $_GET[ap] |
// check right $_GET[ap] |
| 193 |
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;'), |
| 194 |
|
|
| 195 |
// write components variables to out |
// write components variables to out |
| 196 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 207 |
return; |
return; |
| 208 |
'), |
'), |
| 209 |
|
|
| 210 |
// create default ecoms (navigation, etc.) |
// create default ecoms (navigation, chooser [as of 2003-04-05] etc.) |
| 211 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 212 |
if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) { |
if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) { |
| 213 |
$_out[options][ecoms] = array( |
$_out[options][ecoms] = array( |
| 214 |
nav => array( |
nav => array( |
| 215 |
ecom_type => "nav", |
ecom_type => "nav", |
| 216 |
ecom_abstract_type => "list", |
ecom_abstract_type => "list", |
| 217 |
ecom_mode => "nav", |
ecom_mode => "link", |
| 218 |
|
ecom_data_locator_key => "rpc", |
| 219 |
|
), |
| 220 |
|
chooser => array( |
| 221 |
|
ecom_type => "nav", |
| 222 |
|
ecom_abstract_type => "list", |
| 223 |
|
ecom_mode => "link", |
| 224 |
ecom_data_locator_key => "rpc", |
ecom_data_locator_key => "rpc", |
| 225 |
), |
), |
| 226 |
); |
); |
| 229 |
return; |
return; |
| 230 |
'), |
'), |
| 231 |
|
|
| 232 |
|
// handle data form buttons |
| 233 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
| 234 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
| 235 |
if($_in[ecom_form_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } |
if($_in[ecom_data_form_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } |
| 236 |
|
if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
| 237 |
|
'), |
| 238 |
|
|
| 239 |
|
// propagate datasources to ecoms |
| 240 |
|
// datasource-change requested? enhance logic here! |
| 241 |
|
// by now each ecom-component gets injected the very same |
| 242 |
|
// datasource if requested - otherwise everything will fall back to defaults |
| 243 |
|
create_function('&$_in, &$_out', ' |
| 244 |
|
if ($_in[ecom_data_source_key]) { |
| 245 |
|
//print Dumper($_out[options][ecoms]); |
| 246 |
|
//print "ds: " . $_in[ecom_data_source_key] . "<br/>"; |
| 247 |
|
/* |
| 248 |
|
foreach ($_out[options][ecoms] as $name => $ecom) { |
| 249 |
|
print "name: $name<br/>"; |
| 250 |
|
//$_out[options][sources][selected] = $_in[ecom_data_source]; |
| 251 |
|
$_out[options][ecoms][$name][ecom_data_source_key] = $_in[ecom_data_source_key]; |
| 252 |
|
} |
| 253 |
|
*/ |
| 254 |
|
$_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; |
| 255 |
|
} |
| 256 |
'), |
'), |
| 257 |
|
|
| 258 |
|
|
| 259 |
/* |
/* |
| 260 |
// translate value of argument "action" (olist => list.view, oedit => item.edit) |
// translate value of argument "action" (olist => list.view, oedit => item.edit) |
| 261 |
// action dispatcher |
// action dispatcher |