/[cvs]/nfo/php/libs/org.netfrag.app/WebExplorer/AbstractExplorer.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.app/WebExplorer/AbstractExplorer.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.22 - (show annotations)
Tue May 13 14:50:27 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.21: +77 -18 lines
HACKed compatibility for config-type data sources
+ function get_data_filter

1 <?
2 /*
3 ## -----------------------------------------------------------------------------
4 ## $Id: AbstractExplorer.php,v 1.21 2003/05/10 18:23:21 jonen Exp $
5 ## -----------------------------------------------------------------------------
6 ## $Log: AbstractExplorer.php,v $
7 ## Revision 1.21 2003/05/10 18:23:21 jonen
8 ## + added stuff relating to 'create/add new' links/buttons
9 ##
10 ## Revision 1.20 2003/04/19 16:24:49 jonen
11 ## + added two more GUI modules to default registry initiation,
12 ## relating to new navigation module 'NavigationTree'
13 ## + added prepartion of needed args for abstract navigation tree
14 ## and concret UserManagment 'UMnav' tree
15 ##
16 ## Revision 1.19 2003/04/18 16:21:37 joko
17 ## fixed commit comment - the last one caused a syntax error!!!
18 ##
19 ## Revision 1.18 2003/04/18 15:27:06 joko
20 ## NEW: XML Trees in data area
21 ## new ecom module: DataTree
22 ## introduced new query argument: 'filter' (purpose: xml/tree filtering)
23 ## $filter = array(
24 ## dotted => $val['ecom_data_filter'],
25 ## ident => $val['ecom_data_ident'],
26 ## );
27 ## A Data::Lift module translates this filter-query into a XPath-query ...
28 ## $filter = array(
29 ## xpq => '*\/*[@name="cli"]',
30 ## );
31 ## ... which finally is propagated to the backend.
32 ## NEW: AbstractExplorer - standalone version
33 ## enhanced set_e_state: now can overwrite internal state to arguments from outside
34 ## enhanced get_com: also capable of propagating additional args through _load_ecom to _prepare_component_args
35 ## enhanced _prepare_component_args: now able to dispatch to a "transparent navigation ecom" (e.g. YAA::JobGroups)
36 ## MISC:
37 ## added some pre-flight checks throughout the module, especially at the core dispatcher inside _prepare_component_args
38 ## error checking: added some more croaks via 'user_error'
39 ## cosmetic updates
40 ##
41 ## Revision 1.17 2003/04/18 13:46:15 jonen
42 ## + add hidden elements(items) now to the constructor arguments of each ecom
43 ##
44 ## Revision 1.16 2003/04/10 06:00:58 joko
45 ## ALPHA: Item.Delete
46 ##
47 ## Revision 1.15 2003/04/09 02:08:20 joko
48 ## CHANGE: renamed key 'classname' through 'nodename'
49 ##
50 ## Revision 1.14 2003/04/09 00:31:27 jonen
51 ## + added arguments for data list ecom
52 ##
53 ## Revision 1.13 2003/04/09 00:03:11 jonen
54 ## disabled form rendering for inheritanced items at 'list'
55 ##
56 ## Revision 1.12 2003/04/08 17:52:12 joko
57 ## CHANGE: renamed property 'datasource' to 'transport'
58 ## NEW: Module 'RemoteAction'
59 ##
60 ## Revision 1.11 2003/04/07 22:31:51 jonen
61 ## + added switch of ecom label (e.g. nav, chooser) at ecom type switch 'nav'
62 ## - removed recent added ecom type chooser
63 ##
64 ## Revision 1.10 2003/04/05 20:32:04 joko
65 ## added Chooser
66 ##
67 ## Revision 1.9 2003/04/04 02:22:37 joko
68 ## minor fix: querySchema now issues argument
69 ##
70 ## Revision 1.8 2003/04/04 01:16:03 jonen
71 ## + integrated different mode's for 'DataItem'
72 ##
73 ## Revision 1.7 2003/03/29 07:49:55 joko
74 ## show boxes in DEBUG-mode only!
75 ##
76 ## Revision 1.6 2003/03/28 06:42:37 joko
77 ## fix: propagating rpc-debugging-options to constants here
78 ##
79 ## Revision 1.5 2003/03/27 01:24:29 jonen
80 ## + enabled navigation ecom (only list yet)
81 ##
82 ## Revision 1.4 2003/03/20 08:02:11 jonen
83 ## + purged code
84 ##
85 ## Revision 1.3 2003/03/20 07:54:52 jonen
86 ## + added docu
87 ##
88 ## Revision 1.2 2003/03/20 07:44:31 jonen
89 ## + removed dumper
90 ##
91 ## Revision 1.1 2003/03/20 03:48:46 jonen
92 ## + initial commit
93 ##
94 ## Revision 1.1 2003/03/08 02:36:17 cvsmax
95 ## + moved from *.inc
96 ## + mungled namespace with WebExplorer
97 ##
98 ## Revision 1.3 2003/03/03 22:25:21 joko
99 ## fixed minor typos
100 ## namespace mungling
101 ##
102 ## Revision 1.2 2003/03/02 00:48:49 cvsmax
103 ## + set up gui module registry
104 ## - purged old/sample code
105 ##
106 ## Revision 1.1 2003/03/01 22:57:32 cvsmax
107 ## + inital commit
108 ##
109 ##
110 ## -----------------------------------------------------------------------------
111 */
112
113 /**
114 * WebExplorer::AbstractExplorer - this can be simple compared to a container,
115 * which modular GUI classes can be register, manipulated and rendered...
116 *
117 * @author Sebastian Utz <seut@tunemedia.de>
118 * @package org.netfrag.app
119 * @name WebExplorer::AbstractExplorer
120 */
121
122
123 class WebExplorer_AbstractExplorer {
124
125 /**
126 * container holds meta information of data locators
127 */
128 var $_data_locators = array();
129
130 /**
131 * container for registered modules
132 */
133 var $_module = array();
134
135 /**
136 * container holds references to each ecom
137 */
138 var $_ecom = array();
139
140 /**
141 * holds the whole page state
142 */
143 var $_state = array();
144
145 /**
146 * holds state variables only needed for explorer
147 */
148 var $_e_state = array();
149
150
151 function WebExplorer_AbstractExplorer($data_locators=array()) {
152 $this->_data_locators = $data_locators;
153 $this->init_default_gui_modules();
154 $this->set_e_state();
155
156 //debug
157 //print "State: " . Dumper($this->_state) ."<br>";
158 $div = html_div();
159 $div->add( html_b(get_class($this)), html_hr(), "Explorer_State: " . Dumper($this->_e_state));
160 $div->set_style('background: #adadad; border: 2px black groove; width:640px; padding:10px; margin:40px;');
161 if (constants::get('DEBUG')) {
162 print $div->render();
163 }
164 }
165
166
167 function add_data_locator($label, $args) {
168 $this->_data_locators[$label] = $args;
169 }
170
171 function set_data_locator($label, $new_args=array() ) {
172 global $app;
173
174 // pre-flight checks
175 if (!$label) {
176 user_error("AbstractExplorer::set_data_locator - label was empty.");
177 return;
178 }
179
180 if ($label == "rpc") {
181 $rpcinfo = $app->getConfig("rpcinfo");
182 define('RPC_HOSTNAME', $rpcinfo[Host]);
183 define('RPC_PORT', $rpcinfo[Port]);
184 define('RPC_DEBUG', $rpcinfo[DEBUG]);
185 define('RPC_TRACE', $rpcinfo[TRACE]);
186 define('RPC_DISCONNECT_ON_ERROR', $rpcinfo[DISCONNECT_ON_ERROR]);
187 } else {
188 user_error("AbstractExplorer::set_data_locator - Could not dispatch data_locator_key label '$label'!");
189 }
190 }
191
192 function get_data_locator($label) {
193 }
194
195 function get_page_state() {
196 $requestTracker = mkObject("Application::Request::Tracker");
197 //print Dumper($this->_state);
198 $this->_state = $requestTracker->getPointer();
199 }
200
201 function set_e_state($state = null) {
202 // NEW [2003-04-18]: now has two modes
203 // 1. inject page state from argument passed to us
204 // 2. (was) get page state from request tracker
205 if ($state) {
206 $this->_e_state = $state;
207 } else {
208 $this->get_page_state();
209 $this->_e_state = $this->_state[options][options];
210 }
211 // print "Setting Explorer state:" . Dumper($this->_e_state);
212 }
213
214 function set_page_state() {
215 user_error("AbstractExplorer::set_page_state - please implement me....");
216 }
217
218 function init_default_gui_modules() {
219
220 // format of parameters: label, ecom_type, abstract_type, module_name
221
222 // 2003-03-02 - First ecom modules/components
223 //$this->register_gui_module("n_tree", "nav", array( 'name' => "NavigationTree", 'type' => "tree") );
224 $this->register_gui_module("nav", "nav", "list", "WebExplorer::Module::NavigationList" );
225 $this->register_gui_module("content", "data", "list", "WebExplorer::Module::DataList" );
226 $this->register_gui_module("content", "data", "item", "WebExplorer::Module::DataItem" );
227
228 // 2003-04-05 - Chooser (a Nav.List)
229 $this->register_gui_module("chooser", "nav", "list", "WebExplorer::Module::Chooser");
230
231 // 2003-04-07 - RemoteAction
232 $this->register_gui_module("phase_startup", "call", "auto", "WebExplorer::Module::RemoteAction");
233
234 // 2003-04-09 - Data.Item: DeleteAction
235 $this->register_gui_module("phase_startup", "data", "item", "WebExplorer::Module::DataItem");
236 //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::RemoteAction");
237 //$this->register_gui_module("phase_startup", "data", "auto", "WebExplorer::Module::DataItem");
238
239 // 2003-04-12 - Data.Tree
240 $this->register_gui_module("content", "data", "tree", "WebExplorer::Module::DataTree" );
241
242 // 2003-04-18 - Nav.Tree
243 $this->register_gui_module("nav", "nav", "tree", "WebExplorer::Module::NavigationTree" );
244
245 // 2003-04-18 - UserManagment Nav.Tree (we need only a different 'label' as Nav.Tree yet..)
246 $this->register_gui_module("UMnav", "nav", "tree", "WebExplorer::Module::NavigationTree" );
247
248 }
249
250 function register_source_module($label, $args) {
251 $this->_module['source'][$label] = $args;
252 }
253
254 function register_gui_module($label, $ecom_type, $abstract_type, $module_name) {
255 $this->_module['gui'][$label][$ecom_type][$abstract_type] = $module_name;
256 }
257
258
259 function &get_ecom($label, $args = array()) {
260
261 // the very first - strongly hardcoded - Hello World ecom
262 //return "Hello World";
263
264 // that's better ...
265 $this->_load_ecom($label, $args);
266 return $this->_ecom[$label];
267
268 }
269
270
271 function _load_ecoms() {
272 //trace("_load_ecoms: " . Dumper($this->_e_state[ecoms]) . "<br/>");
273 foreach($this->_e_state[ecoms] as $label => $val) {
274 $this->_load_ecom($label);
275 }
276 }
277
278
279
280 function _load_ecom($label, $args = array()) {
281
282 // fetch values from state
283 $val = $this->_e_state['ecoms'][$label];
284 debug::info("_load_ecom($label): " . Dumper($val) . "<br/>");
285
286 // NEW [2003-04-10]: ecom-RESET-condition
287 if (!is_array($val) && $val == 'RESET') {
288 debug::info("Resetting component: $label");
289 return;
290 }
291
292 // find right ecom gui module
293 $ecom_type = $val['ecom_type'];
294 $abstract_type = $val['ecom_abstract_type'];
295 $gui_module = $this->_module['gui'][$label][$ecom_type][$abstract_type];
296 //print Dumper($gui_module);
297 if(!$gui_module) {
298 user_error("_load_ecom: No GUI module found for [label='$label', ecom type='$val[ecom_type]', abstract type='$val[ecom_abstract_type]'].");
299 return;
300 }
301
302 // get arguments needed for ecom gui module
303 $args = $this->_prepare_component_args($label, $args);
304
305 // trace
306 //print "raw-args: " . Dumper($args) . "<br/>";
307
308 // get ecom GUI module
309 if (!$ecom = php::mkComponent($gui_module, $args)) {
310 user_error("AbstractExplorer::_load_component - Error while instantiating ecom gui component. [label='$label', abstract type='$val[ecom_abstract_type]', ecom type='$val[ecom_type]']");
311 return;
312 }
313 //print Dumper($ecom);
314
315 // NEW[2003-04-18] done via args(prepare args!) passed at constructor
316 // (needed for non-real objects instanced at some child of AbstractGUIModule, eg. NavigationList)
317 /*
318 // add hidden vars, needed for explorer control
319 $hidden_items = $this->_get_hidden_items($label);
320 if(is_array($hidden_items) ) {
321 $ecom->add_hidden_items($hidden_items);
322 print "Hidden: " . Dumper($hidden_items);
323 }
324 */
325
326 // load phphtmllib GUI object
327 $gui_ecom = &$ecom->get();
328
329 // attempt:
330 //$gui_ecom->make_transparent();
331
332 // store phphtmllib GUI object
333 $this->_ecom[$label] = &$gui_ecom;
334 }
335
336
337
338 function _get_hidden_items($label) {
339 $ecom_state = $this->_e_state['ecoms'][$label];
340 if($ecom_state['ecom_type'] == "data") {
341 if($ecom_state['ecom_abstract_type'] == "list") {
342 $hidden_items = array(
343 'ecl' => $label,
344 'ecat' => "item",
345 'ecmod' => "view",
346 'ecdm' => $ecom_state['ecom_data_ident'],
347 );
348 }
349 elseif($ecom_state['ecom_abstract_type'] == "item") {
350 $hidden_items = array(
351 'ecl' => $label,
352 'ecat' => "item",
353 'ecmod' => "view",
354 );
355 }
356 }
357 elseif($ecom_state['ecom_type'] == "nav") {
358 // Switching abstract make no real sense here,
359 // because hidden_items(link_vars) for Naviagtion-Ecoms
360 // are more label specified!!
361 // OLD:
362 //if($ecom_state['ecom_abstract_type'] == "list") {
363
364 // decide whether to link to items or to a list
365 $abstract_type = 'list';
366 // FIXME: HACK
367 if ($this->_e_state[main][ecom_data_source_key] == 'config') {
368 $abstract_type = 'item';
369 }
370
371 // NEW:
372 if ($label == "nav") {
373 $hidden_items = array(
374 'ecl' => "content",
375 'ecat' => $abstract_type,
376 'ecmod' => "view",
377 'ect' => "data",
378 'ecdlk' => "rpc",
379 );
380
381 }
382 elseif ($label == "chooser") {
383 $hidden_items = array(
384 'ecl' => "phase_startup",
385 'ecdlk' => "rpc",
386 );
387
388 }
389 }
390 // add page idents
391 foreach($this->_e_state[idents] as $label => $value) {
392 $hidden_items[$label] = $value;
393 }
394 return $hidden_items;
395 }
396
397
398
399 function _prepare_component_args($label, $args = array()) {
400 $val = $this->_e_state['ecoms'][$label];
401
402 // pre-flight checks
403 if (!$val['ecom_data_locator_key']) {
404 user_error("_prepare_component_args: Key 'ecom_data_locator_key' was empty, should be one of 'rpc'.");
405 return;
406 }
407
408 if (!$val['ecom_type']) {
409 user_error("WebExplorer::AbstractExplorer: Key 'ecom_type' was empty, should be one of 'data|nav|call'.");
410 }
411
412 if (!$val['ecom_abstract_type']) {
413 user_error("_prepare_component_args: Key 'ecom_abstract_type' was empty, should be one of 'item|list|tree|auto'.");
414 return;
415 }
416
417 // trace
418 //print "YAI1<br/>";
419 //print Dumper($val);
420
421 $this->set_data_locator($val['ecom_data_locator_key']);
422
423 // detect and execute 'selectSource' action
424 // FIXME: this is a HACK!!! move to a module 'BackendAction' or s.th.l.th.
425 //print Dumper($this->_e_state['sources']);
426 if ($source = $this->_e_state['main']['ecom_data_source_key']) {
427 //print "selectSource: $source<br/>";
428 //global $app;
429 //print Dumper($backend);
430 //$app->backend->do();
431 }
432
433 // switch component type
434 if($val['ecom_type'] == "data") {
435 // switch abstract type
436 if($val['ecom_abstract_type'] == "list") {
437 if($val['ecom_data_locator_key'] == "rpc") {
438 //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
439 $data_locator_meta = array( transport => 'rpc', metatype => 'data', abstract_type => 'list', nodename => $val['ecom_data_ident'], list_meta => $val['ecom_data_meta']);
440 } else {
441 user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
442 }
443 $args = array(
444 'caption' => $val['ecom_data_ident'],
445 'orderby' => "Guid",
446 'options' => array(
447 'data_locator_meta' => $data_locator_meta,
448 'decode' => 1,
449 'decode_args' => array(
450 'seperator' => "_",
451 //'form' => 1,
452 ),
453 'actionbar' => array(
454 'name' => "ecdfa",
455 'list' => array(
456 "View" => 'view',
457 "Edit" => 'edit',
458 "Delete" => 'delete',
459 ),
460 'selected' => 'view',
461 'create' => array(
462 'name' => "ecdfcr",
463 'value' => "Add new"
464 ),
465 ),
466 'parent' => array(
467 'class' => $val['ecom_data_ident'],
468 ),
469 ),
470 );
471
472 // switch abstract type
473 } elseif ($val['ecom_abstract_type'] == "item") {
474 if($val['ecom_data_locator_key'] == "rpc") {
475 //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
476
477 // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
478 $filter = $this->get_data_filter($val);
479
480 $data_locator_meta = array(
481 transport => 'rpc', metatype => 'data', abstract_type => 'item',
482 ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'], filter => $filter,
483 );
484 } else {
485 user_error("AbstractExplorer::_prepare_component_args - Cannot build query for data_locator_key $val[ecom_data_locator_key] !");
486 }
487
488 // defaults
489 if (!$val['ecom_mode']) { $val['ecom_mode'] = "view"; }
490 //$val['ecom_mode'] = "view";
491
492 // debugging
493 print "Mode: $val[ecom_mode]<br>";
494
495 //print Dumper($val);
496 // NEW [2003-04-22]: append some more meta information to the caption
497 //$caption_addendum = ' {' . $val['ecom_data_meta'] . '}';
498 $caption_addendum = ' {' . $val['ecom_data_meta'] . ':' . $val['ecom_data_filter'] . '}';
499
500 // prepare some arguments...
501 $args = array(
502 'caption' => $val['ecom_data_ident'] . $caption_addendum,
503 'mode' => $val['ecom_mode'],
504 'options' => array(
505 'data_locator_meta' => $data_locator_meta,
506 'decode' => 1,
507 'decode_args' => array(
508 'seperator' => "_",
509 ),
510 'parent' => array(
511 'guid' => $val['ecom_data_ident'],
512 'class' => $val['ecom_data_meta'],
513 ),
514 ),
515 );
516 if ($val['ecom_mode'] == "edit") { $args['adapter'] = 'FormProcessor'; }
517
518 // FIXME: (see WebExplorer::Module::AbstractGUIModule)
519 //if ($val['ecom_mode'] == "delete") { $args['adapter'] = 'GenericNegotiation'; }
520 if ($val['ecom_mode'] == "delete") {
521 $args['adapter'] = 'NonValidatingFormProcessor';
522 }
523
524 if ($val['ecom_mode'] == "create") {
525 $args['adapter'] = 'FormProcessor';
526 $args['options']['caption'] = $val['ecom_data_ident'];
527 $args['options']['data_locator_meta']['action'] = 'create';
528 print "debug 'create': " . Dumper($val);
529 if($val['ecom_data_meta_x']) {
530 unset($args['options']['data_locator_meta']['nodename']);
531 $args['options']['data_locator_meta']['parent'][guid] = $val['ecom_data_meta'];
532 $args['options']['data_locator_meta']['parent'][nodename] = $val['ecom_data_meta_x'];
533 }
534 }
535
536 // switch abstract type
537 } elseif ($val['ecom_abstract_type'] == "tree") {
538
539 // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
540 $filter = $this->get_data_filter($val);
541
542 // FIXME: shouldn't this (dispatching by transport-key) be done very *outside* of this scope?
543 // or: do it outside per default, let a possibility to modify it inside the lower levels of the dispatcher (here)
544 if ($val['ecom_data_locator_key'] == "rpc") {
545 //$data_locator_meta = array( transport => 'rpc', metatype => 'data', vartype => 'objects', nodename => $val['ecom_data_ident']);
546 $args[options][data_locator_meta] = array(
547 transport => 'rpc', metatype => 'data', abstract_type => 'tree',
548 ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta'],
549 // NEW [2003-04-22]: Full tree node filtering established.
550 filter => $filter
551 );
552 }
553
554 } else {
555 user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
556
557 }
558
559 // switch component type
560 } elseif ($val['ecom_type'] == "nav") {
561
562 // switch abstract type
563 // list
564 if ($val['ecom_abstract_type'] == "list") {
565 $args = array();
566 if($val['ecom_data_locator_key'] == "rpc") {
567
568 // switch component label
569 // TODO: should we really dispatch by label inside here?
570
571 if ($label == "nav") {
572 $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
573 $args['caption'] = "Objekt Typen";
574 }
575 // NEW [2003-04-05]: DataSource.Chooser
576 elseif ($label == "chooser") {
577 $data_locator_meta = array( transport => 'rpc', metatype => 'schema', filter => 'sources.all' );
578 $args['caption'] = "Datenquellen";
579 }
580 // NEW [2003-04-18]: croak if label empty
581 else {
582 user_error("_prepare_component_args: Dispatching for nav.list.rpc failed. \$label was empty.");
583 }
584 $args['options']['data_locator_meta'] = $data_locator_meta;
585
586 } else {
587 user_error("AbstractExplorer::_prepare_component_args - Cannot build schema query for data_locator_key $val[ecom_data_locator_key] !");
588 }
589
590 // NEW [2003-04-18]: Abstract navigation tree
591 } elseif ($val['ecom_abstract_type'] == "tree") {
592 $args = array();
593 if($label == "nav") {
594 //$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
595 $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', filter => 'nodes.root:concrete' );
596 $args['caption'] = $val['ecom_data_source_key'];
597 } elseif($label == "UMnav") {
598 //$args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'schema', abstract_type => 'tree', ident => $val['ecom_data_ident'], nodename => $val['ecom_data_meta']);
599 $args[options][data_locator_meta] = array( transport => 'rpc', metatype => 'method', method => 'UserManagmentSchema' );
600 $args['caption'] = "Benutzerverwaltung";
601 }
602
603 // NEW [2003-04-18]: transparent nav - argument pass-through mode
604 } elseif ($val['ecom_abstract_type'] == "transparent") {
605
606 // You are responsible for all arguments passed through.
607 // Where are these arguments from?
608 // They are propagated transparently to this place from a new optional
609 // parameter ($args) introduced for the methods 'get_com', 'load_com'
610 // and '_prepare_component_args' (this one).
611 // This means full control over ecoms from outside.
612
613 // TODO: maybe add some additional pre-flight checks here!?
614
615 // croak
616 } else {
617 user_error("_prepare_component_args: Could not dispatch ecom_abstract_type='$val[ecom_abstract_type]'.");
618 }
619
620 // NEW [2003-04-08]: RemoteAction (e.g.: result of a selection inside a Chooser)
621 // switch component type
622 } elseif ($val['ecom_type'] == "call") {
623
624 // responses of RemoteActions are not predictable!
625 if ($val['ecom_abstract_type'] == "auto") {
626
627 // Dispatching by $label is not done here. RemoteAction-ecoms can appear anywhere!
628
629 // Just define the RemoteQuery using a declaration to use DataSource::Generic most transparently.
630 // Really - just a remote call is issued, no data-/schema-structures or similar are expected.
631
632 // The RemoteMethod 'method' is called directly with arguments in 'args'!
633 // As response (important for widget assignement!) you may expect an arbitrary payload.
634 $args['options']['data_locator_meta'] = array(
635 transport => 'rpc',
636 metatype => 'method',
637 method => $val['ecom_call_method'],
638 args => $val['ecom_call_args']
639 );
640
641 } else {
642 // FIXME: implement automatic re-dispatching to available ecoms here!
643 user_error("WebExplorer::AbstractExplorer: results of RemoteActions can only be handled automatically. Who knows what comes back?");
644 }
645
646 }
647
648 // NEW[2003-04-18]: add hidden items to args
649 $args['hidden_elements'] = $this->_get_hidden_items($label);
650
651 return $args;
652 }
653
654
655
656 function get_msg($label) {
657 if($label == "welcome") {
658 $msg = "Welcome to the Explorer.";
659 }
660 return $msg;
661 }
662
663
664
665 function render() {
666 user_error("AbstractExplorer::render - please implement me....");
667 }
668
669
670 function get_data_filter($state = array()) {
671
672 // NEW: 'filter' - 2003-04-14 - required for filtering xml-nodes
673 // V1: this was inside ecom_abstract_type == item && ecom_data_locator_key == rpc, but ...
674 // V2: ... it should be considered / work independent of these both criterias
675 // since it is required for showing xml nodes in items (editing) *and* trees again (browsing).
676
677 if ($filter_expression = $state[ecom_data_filter]) {
678
679 // new of 2003-05-13: Apply "Node navigation" in tree mode only.
680 // Lock context when switching to item mode.
681 //print Dumper($state);
682 if ($state[ecom_abstract_type] == "tree") {
683 if ($parent_xpq = $state[ecom_data_meta]) {
684 $filter_expression = $parent_xpq . $filter_expression;
685 }
686 }
687
688 // This propagates a XPath filter expression which fully identifies
689 // a single node in a document. It reaches through all parent nodes.
690 $filter = array(
691 //dotted => $val['ecom_data_filter'],
692 //ident => $val['ecom_data_ident'],
693 //xpq => '*/*[@name="cli"]',
694 //xpq => '*/*',
695 // NEW [2003-04-21]: An xpq is already ready now inside
696 // 'ecdf' since it already has been built by the revamped tree lift.
697 xpq => '*' . $filter_expression
698 );
699
700 } else {
701 $filter = '';
702
703 }
704
705 // lift filter from dotted format to xpq format
706 // NEW [2003-04-21]: not required any more (see above)
707 //$lift = mkObject('Data::Lift', $filter, array( metatype => 'filter' ) );
708 //$filter = $lift->to('XPath');
709
710 return $filter;
711
712 }
713
714 }
715
716
717 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed