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 |
* 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 |
* + added 'topic' to requested vars which will currently be merged with the 'ap' var |
21 |
* |
* |
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_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', |
'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', 'ecom_data_action_create', |
125 |
'ecom_data_form_checkbox', 'ecom_data_form_action', |
'ecom_data_form_checkbox', 'ecom_data_form_action', |
126 |
'ecom_data_source_key' |
'ecom_data_source_key', |
127 |
|
'ecom_data_filter', |
128 |
), |
), |
129 |
request_arg => array( |
request_arg => array( |
130 |
'topic' => array( query_arg => 't' ), |
|
131 |
'ap' => array( query_arg => 'ap' ), |
// a key identifying the current topic |
132 |
'ecom_label' => array( query_arg => 'ecl' ), |
'topic' => array( query_arg => 't' ), |
133 |
'ecom_type' => array( query_arg => 'ect' ), |
|
134 |
'ecom_abstract_type' => array( query_arg => 'ecat' ), |
// a key identifying the current page |
135 |
'ecom_mode' => array( query_arg => 'ecmod' ), |
'ap' => array( query_arg => 'ap' ), |
136 |
'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), |
|
137 |
'ecom_data_ident' => array( query_arg => 'ecdid' ), |
// ecom, ecom, ecom |
138 |
'ecom_data_meta' => array( query_arg => 'ecdm' ), |
|
139 |
'ecom_data_action_edit' => array( query_arg => 'ecdfe' ), |
// component specific arguments (important for the main dispatcher, etc.) |
140 |
'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ), |
// a label identifying a component |
141 |
'ecom_data_action_delete' => array( query_arg => 'ecdfd' ), |
'ecom_label' => array( query_arg => 'ecl' ), |
142 |
'ecom_data_form_action' => array( query_arg => 'ecdfa' ), |
// data or schema |
143 |
'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), |
'ecom_type' => array( query_arg => 'ect' ), |
144 |
'ecom_data_source_key' => array( query_arg => 'ecds' ), |
// 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 |
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; |
274 |
// HACK!!! |
// HACK!!! |
275 |
// FIXME: review and implement in a more clean way? |
// FIXME: review and implement in a more clean way? |
276 |
//print "RESET!<br/>"; |
//print "RESET!<br/>"; |
|
|
|
277 |
$_out[options][ecoms][phase_startup] = "RESET"; |
$_out[options][ecoms][phase_startup] = "RESET"; |
278 |
'), |
'), |
279 |
|
|
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( |
$vars = array( |
298 |
ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta |
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 |
// ecom_call_method, ecom_call_args |
302 |
if($_in[ecom_label]) { |
if($_in[ecom_label]) { |
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) |
// handle data form action(button) |
351 |
create_function('&$_in, &$_out', ' |
create_function('&$_in, &$_out', ' |
352 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
353 |
if($_in[ecom_data_form_action] && is_array($_in[ecom_data_form_checkbox])) { |
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]); |
$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) { |
if($cnt == 1) { |
362 |
foreach($_in[ecom_data_form_checkbox] as $ident) { |
//print "Single selection, ident : " . $tmp[0] . "<br>"; |
363 |
$_out[options][ecoms][$label][ecom_data_ident] = $ident; |
$_out[options][ecoms][$label][ecom_data_ident] = $tmp[0]; |
364 |
} |
} elseif($cnt > 1) { |
|
$_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; |
|
|
$_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; |
|
|
$_out[options][ecoms][$label][ecom_abstract_type] = "item"; |
|
|
} else { |
|
365 |
// TODO: implement multi-selection actions on rows(items) here!! |
// 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 |
|
|
381 |
$label = $_in[ecom_label]; |
$label = $_in[ecom_label]; |
382 |
if($_in[ecom_data_action_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_action_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] |
// Action.Delete [new of 2003-04-09] |
392 |
if ($_in[ecom_data_action_delete]) { |
if ($_in[ecom_data_action_delete]) { |