4 |
* $Id$ |
* $Id$ |
5 |
* |
* |
6 |
* $Log$ |
* $Log$ |
7 |
|
* Revision 1.21 2003/12/14 01:51:29 jonen |
8 |
|
* implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes |
9 |
|
* |
10 |
|
* Revision 1.20 2003/11/22 18:46:33 udo |
11 |
|
* update for expand data item |
12 |
|
* |
13 |
|
* Revision 1.19 2003/07/14 09:54:58 jonen |
14 |
|
* fixed bug related to 'item delete' |
15 |
|
* |
16 |
|
* Revision 1.18 2003/07/02 12:18:00 jonen |
17 |
|
* fixed bugs |
18 |
|
* |
19 |
|
* Revision 1.17 2003/06/25 23:45:05 joko |
20 |
|
* trying to switch from "ap" completely to "t" |
21 |
|
* |
22 |
|
* Revision 1.16 2003/05/13 14:53:56 joko |
23 |
|
* reset mvc-params "filter" and "meta" in tree mode!? |
24 |
|
* |
25 |
|
* Revision 1.15 2003/05/10 18:19:55 jonen |
26 |
|
* + added stuff relating to 'create/add new' links/buttons |
27 |
|
* |
28 |
|
* Revision 1.14 2003/04/19 16:20:47 jonen |
29 |
|
* + added handle of ecom 'UMnav' according to page 'Benutzverwaltung' |
30 |
|
* |
31 |
|
* Revision 1.13 2003/04/18 15:30:24 joko |
32 |
|
* NEW: parameter 'ecom_data_filter' - used for 'items' |
33 |
|
* (introduced to filter xml-payload at backend side via xpath queries) |
34 |
|
* documented global state parameters |
35 |
|
* some comments |
36 |
|
* |
37 |
|
* Revision 1.12 2003/04/18 13:40:54 jonen |
38 |
|
* + added 'topic' to requested vars which will currently be merged with the 'ap' var |
39 |
|
* |
40 |
|
* Revision 1.11 2003/04/11 00:51:10 joko |
41 |
|
* minor update: just testing stuff... |
42 |
|
* |
43 |
|
* Revision 1.10 2003/04/10 06:03:26 joko |
44 |
|
* ++ renamed keys: 'ecom_data_form_edit', 'ecom_data_form_cancel' through 'ecom_data_action_edit', 'ecom_data_action_cancel' |
45 |
|
* + new key: 'ecom_data_action_delete' |
46 |
|
* + Action.Delete: not really, since it's inside component in fact (self-contained ecom) |
47 |
|
* |
48 |
|
* Revision 1.9 2003/04/09 00:05:50 jonen |
49 |
|
* added request values and functions needed for extended form handling |
50 |
|
* |
51 |
|
* Revision 1.8 2003/04/08 17:53:08 joko |
52 |
|
* NEW: Module 'RemoteAction' in 'phase_startup' |
53 |
|
* |
54 |
* Revision 1.7 2003/04/07 22:32:27 jonen |
* Revision 1.7 2003/04/07 22:32:27 jonen |
55 |
* + minor changes related to new ecom 'chooser' |
* + minor changes related to new ecom 'chooser' |
56 |
* |
* |
129 |
$this->add_model( array( |
$this->add_model( array( |
130 |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
//args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), |
131 |
request_args => array( |
request_args => array( |
132 |
|
// ApplicationTopic |
133 |
|
'topic', |
134 |
// ApplicationPage |
// ApplicationPage |
135 |
'ap', |
'ap', |
136 |
// important/required parameters for valid ecom-components |
// important/required parameters for valid ecom-components |
138 |
// parameters about data identifiers, locations, sources and associated meta-information |
// parameters about data identifiers, locations, sources and associated meta-information |
139 |
'ecom_data_locator_key', |
'ecom_data_locator_key', |
140 |
'ecom_data_ident', |
'ecom_data_ident', |
141 |
'ecom_data_meta', |
'ecom_data_meta', 'ecom_data_meta_x', 'ecom_data_meta_xe', |
142 |
'ecom_data_form_edit', 'ecom_data_form_cancel', |
'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', 'ecom_data_action_create', |
143 |
'ecom_data_source_key' |
'ecom_data_action_expand_edit', 'ecom_data_action_select', |
144 |
|
'ecom_data_form_checkbox', 'ecom_data_form_action', |
145 |
|
'ecom_data_source_key', |
146 |
|
'ecom_data_filter', |
147 |
), |
), |
148 |
request_arg => array( |
request_arg => array( |
149 |
'ap' => array( query_arg => 'ap' ), |
|
150 |
'ecom_label' => array( query_arg => 'ecl' ), |
// a key identifying the current topic |
151 |
'ecom_type' => array( query_arg => 'ect' ), |
'topic' => array( query_arg => 't' ), |
152 |
'ecom_abstract_type' => array( query_arg => 'ecat' ), |
|
153 |
'ecom_mode' => array( query_arg => 'ecmod' ), |
// a key identifying the current page |
154 |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
'ap' => array( query_arg => 'ap' ), |
155 |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
|
156 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
// ecom, ecom, ecom |
157 |
'ecom_data_form_edit' => array( query_arg => 'ecdfe' ), |
|
158 |
'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ), |
// component specific arguments (important for the main dispatcher, etc.) |
159 |
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
// a label identifying a component |
160 |
|
'ecom_label' => array( query_arg => 'ecl' ), |
161 |
|
// data or schema |
162 |
|
'ecom_type' => array( query_arg => 'ect' ), |
163 |
|
// item, list or tree |
164 |
|
'ecom_abstract_type' => array( query_arg => 'ecat' ), |
165 |
|
|
166 |
|
|
167 |
|
// data, data, data |
168 |
|
|
169 |
|
// e.g. view, edit |
170 |
|
'ecom_mode' => array( query_arg => 'ecmod' ), |
171 |
|
// This should be renamed to 'ecom_data_transport_key'. |
172 |
|
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
173 |
|
|
174 |
|
// This should be enough to identify data Xyz. |
175 |
|
// e.g. an OID, a GUID, a filename or similar stuff |
176 |
|
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
177 |
|
// e.g. a classname or a filename |
178 |
|
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
179 |
|
// extended meta, e.g. 2nd parent identifier |
180 |
|
'ecom_data_meta_x' => array( query_arg => 'ecdmx' ), |
181 |
|
'ecom_data_meta_xe' => array( query_arg => 'ecdmxe' ), |
182 |
|
// filter the data: e.g. |
183 |
|
// - an xpath-query (xpq), |
184 |
|
// - an abstract/custom filter string or |
185 |
|
// - a parent node identifier (maybe revamp as 'ecdpnid')? |
186 |
|
'ecom_data_filter' => array( query_arg => 'ecdf' ), |
187 |
|
|
188 |
|
// Some actions ... |
189 |
|
// ... required for data items. |
190 |
|
'ecom_data_action_edit' => array( query_arg => 'ecdfe' ), |
191 |
|
'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ), |
192 |
|
'ecom_data_action_delete' => array( query_arg => 'ecdfd' ), |
193 |
|
'ecom_data_action_create' => array( query_arg => 'ecdfcr' ), |
194 |
|
// ... required for data lists. |
195 |
|
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
196 |
|
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
197 |
|
// ... required for expanded data items. |
198 |
|
'ecom_data_action_expand_edit' => array( query_arg => 'ecdfee' ), |
199 |
|
// ... required for selecting existing objects as reference |
200 |
|
'ecom_data_action_select' => array( query_arg => 'ecdfsel' ), |
201 |
|
|
202 |
|
// Special argument (should become a non-data-action). |
203 |
|
// Triggers 'selectSource' at backend api (remote api) which causes a database handle switch. |
204 |
|
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
205 |
|
|
206 |
), |
), |
207 |
|
|
208 |
/* |
/* |
209 |
// block model (what is used for each block) |
// block model (what is used for each block) |
210 |
|
// is this deprecated??? |
211 |
block => array( |
block => array( |
212 |
'ident' => array( query_arg => 'ident' ), |
'ident' => array( query_arg => 'ident' ), |
213 |
'meta' => array( query_arg => 'meta' ), |
'meta' => array( query_arg => 'meta' ), |
220 |
|
|
221 |
)); |
)); |
222 |
|
|
223 |
|
|
224 |
|
// TODO: activate MVC-Views!!! |
225 |
|
// - Here: Picture a ecom-component as a MVC-View. |
226 |
|
// - Assign a GUID to each ecom-component! |
227 |
|
// - Build WebExplorer-Introspection-Module to show stuff like this... (->WebExplorer::Designer) |
228 |
|
|
229 |
|
|
230 |
//$this->setup_views( &$this->_registry ); |
//$this->setup_views( &$this->_registry ); |
231 |
|
|
232 |
// associate behaviour with "View"-components |
// associate behaviour with "View"-components |
270 |
|
|
271 |
rules => array( |
rules => array( |
272 |
|
|
|
|
|
273 |
// get last page state |
// get last page state |
274 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
275 |
$requestTracker = mkObject("Application::Request::Tracker"); |
$requestTracker = mkObject("Application::Request::Tracker"); |
276 |
$page_state = $requestTracker->getPointer(); |
$page_state = $requestTracker->getPointer(); |
277 |
$pre_out = $page_state[options]; |
$pre_out = $page_state[options]; |
278 |
//print Dumper($pre_out); |
//print "pre_out: " . Dumper($pre_out); |
279 |
|
|
280 |
// clean-up unwanted variables |
// clean-up unwanted variables |
281 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
282 |
switch ($_in[ecom_abstract_type]) { |
switch ($_in[ecom_abstract_type]) { |
283 |
case "list": |
case "list": |
284 |
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_mode] != "select") { |
285 |
|
if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
286 |
|
if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); } |
287 |
|
} |
288 |
|
break; |
289 |
|
// 2003-04-16: required for xmltree-to-item transition |
290 |
|
// if we dont do this the "dotted" filter expression would persist across views |
291 |
|
case "item": |
292 |
|
if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); } |
293 |
|
break; |
294 |
|
case "tree": |
295 |
|
if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); } |
296 |
|
if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); } |
297 |
break; |
break; |
298 |
} |
} |
299 |
$_out = $pre_out; |
$_out = $pre_out; |
300 |
'), |
'), |
301 |
|
|
302 |
|
// reset machine |
303 |
|
create_function('&$_in, &$_out', ' |
304 |
|
// HACK!!! |
305 |
|
// FIXME: review and implement in a more clean way? |
306 |
|
//print "RESET!<br/>"; |
307 |
|
$_out[options][ecoms][phase_startup] = "RESET"; |
308 |
|
'), |
309 |
|
|
310 |
// rewrite idents |
// rewrite idents |
311 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
312 |
$idents = array ( ap, ); |
|
313 |
foreach($idents as $key) { |
// old version: ap == explorer |
314 |
$_out[options][idents][$key] = $_in[$key]; |
// map Topic to Page if exists |
315 |
} |
//if ($_in[topic]) { |
316 |
|
// $_in[ap] = $_in[topic]; |
317 |
|
//} |
318 |
|
//$idents = array ( ap ); |
319 |
|
//foreach($idents as $key) { |
320 |
|
// $_out[options][idents][$key] = $_in[$key]; |
321 |
|
//} |
322 |
|
|
323 |
|
// 2003-06-26: switched from ap=explorer to t=DataBrowser |
324 |
|
$_out[options][idents][t] = $_in[topic]; |
325 |
|
|
326 |
'), |
'), |
327 |
|
|
328 |
// check right $_GET[ap] |
// check right $_GET[ap] - depreciated |
329 |
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;'), |
330 |
|
|
331 |
// write components variables to out |
// write components variables to out |
332 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
333 |
$vars = array( ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta ); |
$vars = array( |
334 |
|
ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, |
335 |
|
ecom_data_ident, ecom_data_meta, ecom_data_filter, ecom_data_meta_x |
336 |
|
); |
337 |
|
// ecom_call_method, ecom_call_args |
338 |
if($_in[ecom_label]) { |
if($_in[ecom_label]) { |
339 |
foreach($vars as $key) { |
foreach($vars as $key) { |
340 |
if($_in[$key]) { |
if($_in[$key]) { |
341 |
|
//print "var: " . $key . " value: " . $_in[$key] . "<br>"; |
342 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
343 |
$_out[options][ecoms][$label][$key] = $_in[$key]; |
$_out[options][ecoms][$label][$key] = $_in[$key]; |
344 |
} |
} |
370 |
return; |
return; |
371 |
'), |
'), |
372 |
|
|
373 |
|
// handle data form action(button) |
374 |
|
create_function('&$_in, &$_out', ' |
375 |
|
if($_in[ap] == "Benutzerverwaltung" || $_in[topic] == "Benutzerverwaltung") { |
376 |
|
if(!$_out[options][ecoms][UMnav]) { |
377 |
|
$_out[options][ecoms][UMnav] = array( |
378 |
|
ecom_type => "nav", |
379 |
|
ecom_abstract_type => "tree", |
380 |
|
ecom_mode => "link", |
381 |
|
ecom_data_locator_key => "rpc", |
382 |
|
); |
383 |
|
} |
384 |
|
} |
385 |
|
'), |
386 |
|
|
387 |
|
// handle data form action(button) |
388 |
|
create_function('&$_in, &$_out', ' |
389 |
|
$label = $_in[ecom_label]; |
390 |
|
if($_in[ecom_data_form_action]) { |
391 |
|
//print "from action button pressed!<br>"; |
392 |
|
if(is_array($_in[ecom_data_form_checkbox])) { |
393 |
|
$cnt = sizeof($_in[ecom_data_form_checkbox]); |
394 |
|
$tmp = array(); |
395 |
|
foreach($_in[ecom_data_form_checkbox] as $ident) { |
396 |
|
if($ident) { array_push($tmp, $ident); } |
397 |
|
} |
398 |
|
if($cnt == 1) { |
399 |
|
print "Single selection, ident : " . $tmp[0] . "<br>"; |
400 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; |
401 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
402 |
|
} elseif($cnt > 1) { |
403 |
|
// TODO: implement multi-selection actions on rows(items) here!! |
404 |
|
print "Multi-Selection!! Current Ident(s) $tmp" . "<br>"; |
405 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $tmp; |
406 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
407 |
|
} |
408 |
|
} else { |
409 |
|
print "ident: " . Dumper($_out[options][ecoms][$label][ecom_data_ident]) . "<br>"; |
410 |
|
} |
411 |
|
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
412 |
|
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
413 |
|
//print "in: " . Dumper($_in) . "<br>"; |
414 |
|
//print "out: " . Dumper($_out) . "<br>"; |
415 |
|
} |
416 |
|
'), |
417 |
|
|
418 |
|
|
419 |
// handle data form buttons |
// handle data form buttons |
420 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
421 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
422 |
if($_in[ecom_data_form_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } |
if($_in[ecom_data_action_edit]) { |
423 |
if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } |
$_out[options][ecoms][$label][ecom_mode] = "edit"; |
424 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
425 |
|
} |
426 |
|
if($_in[ecom_data_action_cancel]) { |
427 |
|
$_out[options][ecoms][$label][ecom_mode] = "view"; |
428 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
429 |
|
} |
430 |
|
|
431 |
|
// Action.Create |
432 |
|
if($_in[ecom_data_action_create]) { |
433 |
|
//print Dumper($_out[options][ecoms][$label]); |
434 |
|
$_out[options][ecoms][$label][ecom_mode] = "create"; |
435 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
436 |
|
} |
437 |
|
if($_in[ecom_data_action_expand_edit]) { |
438 |
|
//print Dumper($_out[options][ecoms][$label]); |
439 |
|
$_out[options][ecoms][$label][ecom_mode] = "expandedit"; |
440 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
441 |
|
} |
442 |
|
|
443 |
|
// Action.Delete [new of 2003-04-09] |
444 |
|
if ($_in[ecom_data_action_delete]) { |
445 |
|
|
446 |
|
//$_out[options][ecoms][content][ecom_mode] = "view"; |
447 |
|
|
448 |
|
// the code here vanished to the component itself! |
449 |
|
// could/should we do this for "edit" and/or "view" actions as well? |
450 |
|
// look at ecom/FlexibleDataItem! |
451 |
|
|
452 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
453 |
|
} |
454 |
|
// Action.Select |
455 |
|
if($_in[ecom_data_action_select]) { |
456 |
|
if(is_array($_in[ecom_data_form_checkbox])) { |
457 |
|
$cnt = sizeof($_in[ecom_data_form_checkbox]); |
458 |
|
$tmp = array(); |
459 |
|
foreach($_in[ecom_data_form_checkbox] as $ident) { |
460 |
|
if($ident) { array_push($tmp, $ident); } |
461 |
|
} |
462 |
|
if($cnt == 1) { |
463 |
|
print "Single selection, ident : " . $tmp[0] . "<br>"; |
464 |
|
$_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; |
465 |
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
466 |
|
} elseif($cnt > 1) { |
467 |
|
// TODO: implement multi-selection actions on rows(items) here!! |
468 |
|
print "Cannot do Multi-Selections with Action SELECT!!" . "<br>"; |
469 |
|
} |
470 |
|
|
471 |
|
$requestTracker = mkObject("Application::Request::Tracker"); |
472 |
|
$page_state = $requestTracker->getPointer(); |
473 |
|
$pre_out = $page_state[options]; |
474 |
|
//print "pre_out: " . Dumper($pre_out); |
475 |
|
|
476 |
|
$_out[options][ecoms][$label][ecom_mode] = "select"; |
477 |
|
$_out[options][ecoms][$label][ecom_data_meta_xe] = $pre_out[options][ecoms][$label][ecom_data_meta]; |
478 |
|
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
479 |
|
} |
480 |
|
} |
481 |
'), |
'), |
482 |
|
|
483 |
// propagate datasources to ecoms |
// propagate datasources to ecoms |
486 |
// datasource if requested - otherwise everything will fall back to defaults |
// datasource if requested - otherwise everything will fall back to defaults |
487 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
488 |
if ($_in[ecom_data_source_key]) { |
if ($_in[ecom_data_source_key]) { |
489 |
|
|
490 |
|
print "YAI: ecom_data_source_key<br/>"; |
491 |
|
|
492 |
//print Dumper($_out[options][ecoms]); |
//print Dumper($_out[options][ecoms]); |
493 |
//print "ds: " . $_in[ecom_data_source_key] . "<br/>"; |
//print "ds: " . $_in[ecom_data_source_key] . "<br/>"; |
494 |
/* |
/* |
499 |
} |
} |
500 |
*/ |
*/ |
501 |
$_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; |
$_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; |
502 |
|
|
503 |
|
|
504 |
|
// 2003-04-07 - enhanced |
505 |
|
// now activates a special ecom-component - a "RemoteAction" - replacing |
506 |
|
// the "content"-ecom instead of displaying an empty page / overriding any |
507 |
|
// view reached by "normal dispatching" |
508 |
|
|
509 |
|
$_out[options][ecoms][phase_startup] = array( |
510 |
|
ecom_type => "call", |
511 |
|
ecom_abstract_type => "auto", |
512 |
|
ecom_mode => "link", |
513 |
|
ecom_data_locator_key => "rpc", |
514 |
|
// new attributes/properties/arguments that control further / trigger different DataFlow: |
515 |
|
// FIXME: add these to declaration at top! |
516 |
|
ecom_call_method => "selectSource", |
517 |
|
ecom_call_args => $_in[ecom_data_source_key] |
518 |
|
); |
519 |
|
|
520 |
} |
} |
521 |
'), |
'), |
522 |
|
|