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