4 |
* $Id$ |
* $Id$ |
5 |
* |
* |
6 |
* $Log$ |
* $Log$ |
7 |
|
* Revision 1.16 2003/05/13 14:53:56 joko |
8 |
|
* reset mvc-params "filter" and "meta" in tree mode!? |
9 |
|
* |
10 |
|
* Revision 1.15 2003/05/10 18:19:55 jonen |
11 |
|
* + added stuff relating to 'create/add new' links/buttons |
12 |
|
* |
13 |
|
* Revision 1.14 2003/04/19 16:20:47 jonen |
14 |
|
* + added handle of ecom 'UMnav' according to page 'Benutzverwaltung' |
15 |
|
* |
16 |
|
* Revision 1.13 2003/04/18 15:30:24 joko |
17 |
|
* NEW: parameter 'ecom_data_filter' - used for 'items' |
18 |
|
* (introduced to filter xml-payload at backend side via xpath queries) |
19 |
|
* documented global state parameters |
20 |
|
* some comments |
21 |
|
* |
22 |
|
* Revision 1.12 2003/04/18 13:40:54 jonen |
23 |
|
* + added 'topic' to requested vars which will currently be merged with the 'ap' var |
24 |
|
* |
25 |
|
* Revision 1.11 2003/04/11 00:51:10 joko |
26 |
|
* minor update: just testing stuff... |
27 |
|
* |
28 |
|
* Revision 1.10 2003/04/10 06:03:26 joko |
29 |
|
* ++ renamed keys: 'ecom_data_form_edit', 'ecom_data_form_cancel' through 'ecom_data_action_edit', 'ecom_data_action_cancel' |
30 |
|
* + new key: 'ecom_data_action_delete' |
31 |
|
* + Action.Delete: not really, since it's inside component in fact (self-contained ecom) |
32 |
|
* |
33 |
|
* Revision 1.9 2003/04/09 00:05:50 jonen |
34 |
|
* added request values and functions needed for extended form handling |
35 |
|
* |
36 |
|
* Revision 1.8 2003/04/08 17:53:08 joko |
37 |
|
* NEW: Module 'RemoteAction' in 'phase_startup' |
38 |
|
* |
39 |
* Revision 1.7 2003/04/07 22:32:27 jonen |
* Revision 1.7 2003/04/07 22:32:27 jonen |
40 |
* + minor changes related to new ecom 'chooser' |
* + minor changes related to new ecom 'chooser' |
41 |
* |
* |
114 |
$this->add_model( array( |
$this->add_model( array( |
115 |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
116 |
request_args => array( |
request_args => array( |
117 |
|
// ApplicationTopic |
118 |
|
'topic', |
119 |
// ApplicationPage |
// ApplicationPage |
120 |
'ap', |
'ap', |
121 |
// important/required parameters for valid ecom-components |
// important/required parameters for valid ecom-components |
123 |
// parameters about data identifiers, locations, sources and associated meta-information |
// parameters about data identifiers, locations, sources and associated meta-information |
124 |
'ecom_data_locator_key', |
'ecom_data_locator_key', |
125 |
'ecom_data_ident', |
'ecom_data_ident', |
126 |
'ecom_data_meta', |
'ecom_data_meta', 'ecom_data_meta_x', |
127 |
'ecom_data_form_edit', 'ecom_data_form_cancel', |
'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', 'ecom_data_action_create', |
128 |
'ecom_data_source_key' |
'ecom_data_form_checkbox', 'ecom_data_form_action', |
129 |
|
'ecom_data_source_key', |
130 |
|
'ecom_data_filter', |
131 |
), |
), |
132 |
request_arg => array( |
request_arg => array( |
133 |
'ap' => array( query_arg => 'ap' ), |
|
134 |
'ecom_label' => array( query_arg => 'ecl' ), |
// a key identifying the current topic |
135 |
'ecom_type' => array( query_arg => 'ect' ), |
'topic' => array( query_arg => 't' ), |
136 |
'ecom_abstract_type' => array( query_arg => 'ecat' ), |
|
137 |
'ecom_mode' => array( query_arg => 'ecmod' ), |
// a key identifying the current page |
138 |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
'ap' => array( query_arg => 'ap' ), |
139 |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
|
140 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
// ecom, ecom, ecom |
141 |
'ecom_data_form_edit' => array( query_arg => 'ecdfe' ), |
|
142 |
'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ), |
// component specific arguments (important for the main dispatcher, etc.) |
143 |
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
// a label identifying a component |
144 |
|
'ecom_label' => array( query_arg => 'ecl' ), |
145 |
|
// data or schema |
146 |
|
'ecom_type' => array( query_arg => 'ect' ), |
147 |
|
// item, list or tree |
148 |
|
'ecom_abstract_type' => array( query_arg => 'ecat' ), |
149 |
|
|
150 |
|
|
151 |
|
// data, data, data |
152 |
|
|
153 |
|
// e.g. view, edit |
154 |
|
'ecom_mode' => array( query_arg => 'ecmod' ), |
155 |
|
// This should be renamed to 'ecom_data_transport_key'. |
156 |
|
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
157 |
|
|
158 |
|
// This should be enough to identify data Xyz. |
159 |
|
// e.g. an OID, a GUID, a filename or similar stuff |
160 |
|
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
161 |
|
// e.g. a classname or a filename |
162 |
|
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
163 |
|
// extended meta, e.g. 2nd parent identifier |
164 |
|
'ecom_data_meta_x' => array( query_arg => 'ecdmx' ), |
165 |
|
// filter the data: e.g. |
166 |
|
// - an xpath-query (xpq), |
167 |
|
// - an abstract/custom filter string or |
168 |
|
// - a parent node identifier (maybe revamp as 'ecdpnid')? |
169 |
|
'ecom_data_filter' => array( query_arg => 'ecdf' ), |
170 |
|
|
171 |
|
// Some actions ... |
172 |
|
// ... required for data items. |
173 |
|
'ecom_data_action_edit' => array( query_arg => 'ecdfe' ), |
174 |
|
'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ), |
175 |
|
'ecom_data_action_delete' => array( query_arg => 'ecdfd' ), |
176 |
|
'ecom_data_action_create' => array( query_arg => 'ecdfcr' ), |
177 |
|
// ... required for data lists. |
178 |
|
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
179 |
|
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
180 |
|
|
181 |
|
// Special argument (should become a non-data-action). |
182 |
|
// Triggers 'selectSource' at backend api (remote api) which causes a database handle switch. |
183 |
|
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
184 |
|
|
185 |
), |
), |
186 |
|
|
187 |
/* |
/* |
188 |
// block model (what is used for each block) |
// block model (what is used for each block) |
189 |
|
// is this deprecated??? |
190 |
block => array( |
block => array( |
191 |
'ident' => array( query_arg => 'ident' ), |
'ident' => array( query_arg => 'ident' ), |
192 |
'meta' => array( query_arg => 'meta' ), |
'meta' => array( query_arg => 'meta' ), |
199 |
|
|
200 |
)); |
)); |
201 |
|
|
202 |
|
|
203 |
|
// TODO: activate MVC-Views!!! |
204 |
|
// - Here: Picture a ecom-component as a MVC-View. |
205 |
|
// - Assign a GUID to each ecom-component! |
206 |
|
// - Build WebExplorer-Introspection-Module to show stuff like this... (->WebExplorer::Designer) |
207 |
|
|
208 |
|
|
209 |
//$this->setup_views( &$this->_registry ); |
//$this->setup_views( &$this->_registry ); |
210 |
|
|
211 |
// associate behaviour with "View"-components |
// associate behaviour with "View"-components |
249 |
|
|
250 |
rules => array( |
rules => array( |
251 |
|
|
|
|
|
252 |
// get last page state |
// get last page state |
253 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
254 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
255 |
$page_state = $requestTracker->getPointer(); |
$page_state = $requestTracker->getPointer(); |
256 |
$pre_out = $page_state[options]; |
$pre_out = $page_state[options]; |
257 |
//print Dumper($pre_out); |
//print "pre_out: " . Dumper($pre_out); |
258 |
|
|
259 |
// clean-up unwanted variables |
// clean-up unwanted variables |
260 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
261 |
switch ($_in[ecom_abstract_type]) { |
switch ($_in[ecom_abstract_type]) { |
262 |
case "list": |
case "list": |
263 |
if($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
264 |
|
if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); } |
265 |
|
break; |
266 |
|
// 2003-04-16: required for xmltree-to-item transition |
267 |
|
// if we dont do this the "dotted" filter expression would persist across views |
268 |
|
case "item": |
269 |
|
if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); } |
270 |
|
break; |
271 |
|
case "tree": |
272 |
|
if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); } |
273 |
|
if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
274 |
break; |
break; |
275 |
} |
} |
276 |
$_out = $pre_out; |
$_out = $pre_out; |
277 |
'), |
'), |
278 |
|
|
279 |
|
// reset machine |
280 |
|
create_function('&$_in, &$_out', ' |
281 |
|
// HACK!!! |
282 |
|
// FIXME: review and implement in a more clean way? |
283 |
|
//print "RESET!<br/>"; |
284 |
|
$_out[options][ecoms][phase_startup] = "RESET"; |
285 |
|
'), |
286 |
|
|
287 |
// rewrite idents |
// rewrite idents |
288 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
289 |
|
// map Topic to Page if exists |
290 |
|
if($_in[topic]) { |
291 |
|
$_in[ap] = $_in[topic]; |
292 |
|
} |
293 |
$idents = array ( ap, ); |
$idents = array ( ap, ); |
294 |
foreach($idents as $key) { |
foreach($idents as $key) { |
295 |
$_out[options][idents][$key] = $_in[$key]; |
$_out[options][idents][$key] = $_in[$key]; |
297 |
'), |
'), |
298 |
|
|
299 |
// check right $_GET[ap] |
// check right $_GET[ap] |
300 |
create_function('&$_in, &$_out', 'return ($_in[ap] != "explorer") ? print "Wrong application value: $_in[ap], sure this is right here?<br>" : null;'), |
create_function('&$_in, &$_out', 'return ($_in[ap] != "explorer") ? print "Wrong application value [ap]: $_in[ap], sure this is right here?<br>" : null;'), |
301 |
|
|
302 |
// write components variables to out |
// write components variables to out |
303 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
304 |
$vars = array( ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta ); |
$vars = array( |
305 |
|
ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, |
306 |
|
ecom_data_ident, ecom_data_meta, ecom_data_filter, ecom_data_meta_x |
307 |
|
); |
308 |
|
// ecom_call_method, ecom_call_args |
309 |
if($_in[ecom_label]) { |
if($_in[ecom_label]) { |
310 |
foreach($vars as $key) { |
foreach($vars as $key) { |
311 |
if($_in[$key]) { |
if($_in[$key]) { |
340 |
return; |
return; |
341 |
'), |
'), |
342 |
|
|
343 |
|
// handle data form action(button) |
344 |
|
create_function('&$_in, &$_out', ' |
345 |
|
if($_in[ap] == "Benutzerverwaltung" || $_in[topic] == "Benutzerverwaltung") { |
346 |
|
if(!$_out[options][ecoms][UMnav]) { |
347 |
|
$_out[options][ecoms][UMnav] = array( |
348 |
|
ecom_type => "nav", |
349 |
|
ecom_abstract_type => "tree", |
350 |
|
ecom_mode => "link", |
351 |
|
ecom_data_locator_key => "rpc", |
352 |
|
); |
353 |
|
} |
354 |
|
} |
355 |
|
'), |
356 |
|
|
357 |
|
// handle data form action(button) |
358 |
|
create_function('&$_in, &$_out', ' |
359 |
|
$label = $_in[ecom_label]; |
360 |
|
if($_in[ecom_data_form_action]) { |
361 |
|
//print "from action button pressed!<br>"; |
362 |
|
if(is_array($_in[ecom_data_form_checkbox])) { |
363 |
|
$cnt = sizeof($_in[ecom_data_form_checkbox]); |
364 |
|
$tmp = array(); |
365 |
|
foreach($_in[ecom_data_form_checkbox] as $ident) { |
366 |
|
if($ident) { array_push($tmp, $ident); } |
367 |
|
} |
368 |
|
if($cnt == 1) { |
369 |
|
//print "Single selection, ident : " . $tmp[0] . "<br>"; |
370 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; |
371 |
|
} elseif($cnt > 1) { |
372 |
|
// TODO: implement multi-selection actions on rows(items) here!! |
373 |
|
print "Multi-Selection!! Current Ident(s) $tmp" . "<br>"; |
374 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $tmp; |
375 |
|
} |
376 |
|
} else { |
377 |
|
print "ident: " . Dumper($_out[options][ecoms][$label][ecom_data_ident]) . "<br>"; |
378 |
|
} |
379 |
|
//$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
380 |
|
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
381 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
382 |
|
} |
383 |
|
'), |
384 |
|
|
385 |
|
|
386 |
// handle data form buttons |
// handle data form buttons |
387 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
388 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
389 |
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"; } |
390 |
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"; } |
391 |
|
|
392 |
|
// Action.Create |
393 |
|
if($_in[ecom_data_action_create]) { |
394 |
|
print Dumper($_out[options][ecoms][$label]); |
395 |
|
$_out[options][ecoms][$label][ecom_mode] = "create"; |
396 |
|
} |
397 |
|
|
398 |
|
// Action.Delete [new of 2003-04-09] |
399 |
|
if ($_in[ecom_data_action_delete]) { |
400 |
|
|
401 |
|
//$_out[options][ecoms][content][ecom_mode] = "view"; |
402 |
|
|
403 |
|
// the code here vanished to the component itself! |
404 |
|
// could/should we do this for "edit" and/or "view" actions as well? |
405 |
|
// look at ecom/FlexibleDataItem! |
406 |
|
|
407 |
|
} |
408 |
|
|
409 |
'), |
'), |
410 |
|
|
411 |
// propagate datasources to ecoms |
// propagate datasources to ecoms |
414 |
// datasource if requested - otherwise everything will fall back to defaults |
// datasource if requested - otherwise everything will fall back to defaults |
415 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
416 |
if ($_in[ecom_data_source_key]) { |
if ($_in[ecom_data_source_key]) { |
417 |
|
|
418 |
|
print "YAI: ecom_data_source_key<br/>"; |
419 |
|
|
420 |
//print Dumper($_out[options][ecoms]); |
//print Dumper($_out[options][ecoms]); |
421 |
//print "ds: " . $_in[ecom_data_source_key] . "<br/>"; |
//print "ds: " . $_in[ecom_data_source_key] . "<br/>"; |
422 |
/* |
/* |
427 |
} |
} |
428 |
*/ |
*/ |
429 |
$_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; |
$_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; |
430 |
|
|
431 |
|
|
432 |
|
// 2003-04-07 - enhanced |
433 |
|
// now activates a special ecom-component - a "RemoteAction" - replacing |
434 |
|
// the "content"-ecom instead of displaying an empty page / overriding any |
435 |
|
// view reached by "normal dispatching" |
436 |
|
|
437 |
|
$_out[options][ecoms][phase_startup] = array( |
438 |
|
ecom_type => "call", |
439 |
|
ecom_abstract_type => "auto", |
440 |
|
ecom_mode => "link", |
441 |
|
ecom_data_locator_key => "rpc", |
442 |
|
// new attributes/properties/arguments that control further / trigger different DataFlow: |
443 |
|
// FIXME: add these to declaration at top! |
444 |
|
ecom_call_method => "selectSource", |
445 |
|
ecom_call_args => $_in[ecom_data_source_key] |
446 |
|
); |
447 |
|
|
448 |
} |
} |
449 |
'), |
'), |
450 |
|
|