4 |
* $Id$ |
* $Id$ |
5 |
* |
* |
6 |
* $Log$ |
* $Log$ |
7 |
|
* Revision 1.9 2003/04/09 00:05:50 jonen |
8 |
|
* added request values and functions needed for extended form handling |
9 |
|
* |
10 |
|
* Revision 1.8 2003/04/08 17:53:08 joko |
11 |
|
* NEW: Module 'RemoteAction' in 'phase_startup' |
12 |
|
* |
13 |
|
* Revision 1.7 2003/04/07 22:32:27 jonen |
14 |
|
* + minor changes related to new ecom 'chooser' |
15 |
|
* |
16 |
|
* Revision 1.6 2003/04/06 01:32:57 jonen |
17 |
|
* + minor changes |
18 |
|
* |
19 |
|
* Revision 1.5 2003/04/05 21:18:29 joko |
20 |
|
* added Chooser and associated 'ecds'-parameter |
21 |
|
* new rule (at bottom) to dispatch datasource-keys to each ecom-component |
22 |
|
* |
23 |
* Revision 1.4 2003/04/04 23:59:19 jonen |
* Revision 1.4 2003/04/04 23:59:19 jonen |
24 |
* + minor changes according to data form submits |
* + minor changes according to data form submits |
25 |
* |
* |
87 |
|
|
88 |
$this->add_model( array( |
$this->add_model( array( |
89 |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
90 |
request_args => array( 'ap', 'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode', 'ecom_data_locator_key', |
request_args => array( |
91 |
'ecom_data_ident', 'ecom_data_meta', 'ecom_data_form_edit', 'ecom_data_form_cancel' ), |
// ApplicationPage |
92 |
|
'ap', |
93 |
|
// important/required parameters for valid ecom-components |
94 |
|
'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode', |
95 |
|
// parameters about data identifiers, locations, sources and associated meta-information |
96 |
|
'ecom_data_locator_key', |
97 |
|
'ecom_data_ident', |
98 |
|
'ecom_data_meta', |
99 |
|
'ecom_data_form_edit', 'ecom_data_form_cancel', |
100 |
|
'ecom_data_form_checkbox', 'ecom_data_form_action', |
101 |
|
'ecom_data_source_key' |
102 |
|
), |
103 |
request_arg => array( |
request_arg => array( |
104 |
'ap' => array( query_arg => 'ap' ), |
'ap' => array( query_arg => 'ap' ), |
105 |
'ecom_label' => array( query_arg => 'ecl' ), |
'ecom_label' => array( query_arg => 'ecl' ), |
111 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
112 |
'ecom_data_form_edit' => array( query_arg => 'ecdfe' ), |
'ecom_data_form_edit' => array( query_arg => 'ecdfe' ), |
113 |
'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ), |
'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ), |
114 |
|
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
115 |
|
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
116 |
|
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
117 |
), |
), |
118 |
|
|
119 |
/* |
/* |
157 |
// COID => '123', |
// COID => '123', |
158 |
caption => "Explorer - ExplorerDataItem", |
caption => "Explorer - ExplorerDataItem", |
159 |
)); |
)); |
160 |
|
|
161 |
// FIXME!!! enhance!?!? |
// FIXME!!! enhance!?!? |
162 |
// AIM: "dispatch a Request to a View by using rules..." |
// AIM: "dispatch a Request to a View by using rules..." |
163 |
// Todo: |
// Todo: |
166 |
// Enhance this backend and introduce a mechanism to trigger |
// Enhance this backend and introduce a mechanism to trigger |
167 |
// 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. |
168 |
$this->add_controller( array( |
$this->add_controller( array( |
169 |
|
|
170 |
// 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 |
171 |
module => 'Application::Request::HttpController', |
module => 'Application::Request::HttpController', |
172 |
|
//module_options => blah |
173 |
|
|
174 |
rules => array( |
rules => array( |
175 |
|
|
176 |
|
|
177 |
// get last page state |
// get last page state |
178 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
179 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
190 |
$_out = $pre_out; |
$_out = $pre_out; |
191 |
'), |
'), |
192 |
|
|
|
|
|
193 |
// rewrite idents |
// rewrite idents |
194 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
195 |
$idents = array ( ap, ); |
$idents = array ( ap, ); |
199 |
'), |
'), |
200 |
|
|
201 |
// check right $_GET[ap] |
// check right $_GET[ap] |
202 |
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;'), |
203 |
|
|
204 |
// write components variables to out |
// write components variables to out |
205 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
216 |
return; |
return; |
217 |
'), |
'), |
218 |
|
|
219 |
// create default ecoms (navigation, etc.) |
// create default ecoms (navigation, chooser [as of 2003-04-05] etc.) |
220 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
221 |
if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) { |
if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) { |
222 |
$_out[options][ecoms] = array( |
$_out[options][ecoms] = array( |
223 |
nav => array( |
nav => array( |
224 |
ecom_type => "nav", |
ecom_type => "nav", |
225 |
ecom_abstract_type => "list", |
ecom_abstract_type => "list", |
226 |
ecom_mode => "nav", |
ecom_mode => "link", |
227 |
|
ecom_data_locator_key => "rpc", |
228 |
|
), |
229 |
|
chooser => array( |
230 |
|
ecom_type => "nav", |
231 |
|
ecom_abstract_type => "list", |
232 |
|
ecom_mode => "link", |
233 |
ecom_data_locator_key => "rpc", |
ecom_data_locator_key => "rpc", |
234 |
), |
), |
235 |
); |
); |
238 |
return; |
return; |
239 |
'), |
'), |
240 |
|
|
241 |
|
|
242 |
|
// handle data form action(button) |
243 |
|
create_function('&$_in, &$_out', ' |
244 |
|
$label = $_in[ecom_label]; |
245 |
|
if($_in[ecom_data_form_action] && is_array($_in[ecom_data_form_checkbox])) { |
246 |
|
$cnt = sizeof($_in[ecom_data_form_checkbox]); |
247 |
|
if($cnt == 1) { |
248 |
|
foreach($_in[ecom_data_form_checkbox] as $ident) { |
249 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $ident; |
250 |
|
} |
251 |
|
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
252 |
|
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
253 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
254 |
|
} else { |
255 |
|
// TODO: implement multi-selection actions on rows(items) here!! |
256 |
|
} |
257 |
|
} |
258 |
|
'), |
259 |
|
|
260 |
|
|
261 |
// handle data form buttons |
// handle data form buttons |
262 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
263 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
265 |
if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
266 |
'), |
'), |
267 |
|
|
268 |
|
// propagate datasources to ecoms |
269 |
|
// datasource-change requested? enhance logic here! |
270 |
|
// by now each ecom-component gets injected the very same |
271 |
|
// datasource if requested - otherwise everything will fall back to defaults |
272 |
|
create_function('&$_in, &$_out', ' |
273 |
|
if ($_in[ecom_data_source_key]) { |
274 |
|
|
275 |
|
//print "YAI<br/>"; |
276 |
|
|
277 |
|
//print Dumper($_out[options][ecoms]); |
278 |
|
//print "ds: " . $_in[ecom_data_source_key] . "<br/>"; |
279 |
|
/* |
280 |
|
foreach ($_out[options][ecoms] as $name => $ecom) { |
281 |
|
print "name: $name<br/>"; |
282 |
|
//$_out[options][sources][selected] = $_in[ecom_data_source]; |
283 |
|
$_out[options][ecoms][$name][ecom_data_source_key] = $_in[ecom_data_source_key]; |
284 |
|
} |
285 |
|
*/ |
286 |
|
$_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; |
287 |
|
|
288 |
|
|
289 |
|
// 2003-04-07 - enhanced |
290 |
|
// now activates a special ecom-component - a "RemoteAction" - replacing |
291 |
|
// the "content"-ecom instead of displaying an empty page / overriding any |
292 |
|
// view reached by "normal dispatching" |
293 |
|
|
294 |
|
$_out[options][ecoms][phase_startup] = array( |
295 |
|
ecom_type => "call", |
296 |
|
ecom_abstract_type => "auto", |
297 |
|
ecom_mode => "link", |
298 |
|
ecom_data_locator_key => "rpc", |
299 |
|
// new attributes/properties/arguments that control further / trigger different DataFlow: |
300 |
|
ecom_call_method => "selectSource", |
301 |
|
ecom_call_args => $_in[ecom_data_source_key] |
302 |
|
); |
303 |
|
|
304 |
|
} |
305 |
|
'), |
306 |
|
|
307 |
|
|
308 |
/* |
/* |
309 |
// translate value of argument "action" (olist => list.view, oedit => item.edit) |
// translate value of argument "action" (olist => list.view, oedit => item.edit) |
310 |
// action dispatcher |
// action dispatcher |