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