/[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.23 - (show annotations)
Fri Jun 6 11:57:20 2003 UTC (21 years, 2 months ago) by joko
Branch: MAIN
Changes since 1.22: +12 -2 lines
minor update: cosmetic changes

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

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