/[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.25 - (show annotations)
Sat Nov 22 18:47:49 2003 UTC (20 years, 9 months ago) by udo
Branch: MAIN
Changes since 1.24: +51 -20 lines
update for expand data item

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

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