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

Diff of /nfo/php/libs/org.netfrag.app/WebExplorer/MVC.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by joko, Sat Apr 5 21:18:29 2003 UTC revision 1.19 by jonen, Mon Jul 14 09:54:58 2003 UTC
# Line 4  Line 4 
4   * $Id$   * $Id$
5   *   *
6   * $Log$   * $Log$
7     * Revision 1.19  2003/07/14 09:54:58  jonen
8     * fixed bug related to 'item delete'
9     *
10     * Revision 1.18  2003/07/02 12:18:00  jonen
11     * fixed bugs
12     *
13     * Revision 1.17  2003/06/25 23:45:05  joko
14     * trying to switch from "ap" completely to "t"
15     *
16     * Revision 1.16  2003/05/13 14:53:56  joko
17     * reset mvc-params "filter" and "meta" in tree mode!?
18     *
19     * Revision 1.15  2003/05/10 18:19:55  jonen
20     * + added stuff relating to 'create/add new' links/buttons
21     *
22     * Revision 1.14  2003/04/19 16:20:47  jonen
23     * + added handle of ecom 'UMnav' according to page 'Benutzverwaltung'
24     *
25     * Revision 1.13  2003/04/18 15:30:24  joko
26     * NEW: parameter 'ecom_data_filter' - used for 'items'
27     *   (introduced to filter xml-payload at backend side via xpath queries)
28     * documented global state parameters
29     * some comments
30     *
31     * Revision 1.12  2003/04/18 13:40:54  jonen
32     * + added 'topic' to requested vars which will currently be merged with the 'ap' var
33     *
34     * Revision 1.11  2003/04/11 00:51:10  joko
35     * minor update: just testing stuff...
36     *
37     * Revision 1.10  2003/04/10 06:03:26  joko
38     * ++ renamed keys: 'ecom_data_form_edit', 'ecom_data_form_cancel' through 'ecom_data_action_edit', 'ecom_data_action_cancel'
39     * + new key: 'ecom_data_action_delete'
40     * + Action.Delete: not really, since it's inside component in fact (self-contained ecom)
41     *
42     * Revision 1.9  2003/04/09 00:05:50  jonen
43     * added request values and functions needed for extended form handling
44     *
45     * Revision 1.8  2003/04/08 17:53:08  joko
46     * NEW: Module 'RemoteAction' in 'phase_startup'
47     *
48     * Revision 1.7  2003/04/07 22:32:27  jonen
49     * + minor changes related to new ecom 'chooser'
50     *
51     * Revision 1.6  2003/04/06 01:32:57  jonen
52     * + minor changes
53     *
54   * Revision 1.5  2003/04/05 21:18:29  joko   * Revision 1.5  2003/04/05 21:18:29  joko
55   * added Chooser and associated 'ecds'-parameter   * added Chooser and associated 'ecds'-parameter
56   * new rule (at bottom) to dispatch datasource-keys to each ecom-component   * new rule (at bottom) to dispatch datasource-keys to each ecom-component
# Line 76  class WebExplorer_MVC extends Site_WebAp Line 123  class WebExplorer_MVC extends Site_WebAp
123      $this->add_model( array(      $this->add_model( array(
124        //args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ),        //args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ),
125        request_args => array(        request_args => array(
126            // ApplicationTopic
127            'topic',
128          // ApplicationPage          // ApplicationPage
129          'ap',          'ap',
130          // important/required parameters for valid ecom-components          // important/required parameters for valid ecom-components
# Line 83  class WebExplorer_MVC extends Site_WebAp Line 132  class WebExplorer_MVC extends Site_WebAp
132          // parameters about data identifiers, locations, sources and associated meta-information          // parameters about data identifiers, locations, sources and associated meta-information
133          'ecom_data_locator_key',          'ecom_data_locator_key',
134          'ecom_data_ident',          'ecom_data_ident',
135          'ecom_data_meta',          'ecom_data_meta', 'ecom_data_meta_x',
136          'ecom_data_form_edit', 'ecom_data_form_cancel',          'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', 'ecom_data_action_create',
137          'ecom_data_source_key'          'ecom_data_form_checkbox', 'ecom_data_form_action',
138            'ecom_data_source_key',
139            'ecom_data_filter',
140        ),        ),
141        request_arg => array(        request_arg => array(
142          'ap' => array( query_arg => 'ap' ),          
143          'ecom_label' => array( query_arg => 'ecl' ),          // a key identifying the current topic
144          'ecom_type' => array( query_arg => 'ect' ),            'topic' => array( query_arg => 't' ),
145          'ecom_abstract_type' => array( query_arg => 'ecat' ),  
146          'ecom_mode' => array( query_arg => 'ecmod' ),          // a key identifying the current page
147          'ecom_data_locator_key' => array( query_arg => 'ecdlk' ),            'ap' => array( query_arg => 'ap' ),
148          'ecom_data_ident' => array( query_arg => 'ecdid' ),          
149          'ecom_data_meta' => array( query_arg => 'ecdm' ),          // ecom, ecom, ecom
150          'ecom_data_form_edit' => array( query_arg => 'ecdfe' ),            
151          'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ),            // component specific arguments (important for the main dispatcher, etc.)
152          'ecom_data_source_key' => array( query_arg => 'ecds' ),            // a label identifying a component
153              'ecom_label' => array( query_arg => 'ecl' ),
154              // data or schema
155              'ecom_type' => array( query_arg => 'ect' ),
156              // item, list or tree
157              'ecom_abstract_type' => array( query_arg => 'ecat' ),
158    
159    
160            // data, data, data
161              
162              // e.g. view, edit
163              'ecom_mode' => array( query_arg => 'ecmod' ),
164              // This should be renamed to 'ecom_data_transport_key'.
165              'ecom_data_locator_key' => array( query_arg => 'ecdlk' ),
166              
167              // This should be enough to identify data Xyz.
168              // e.g. an OID, a GUID, a filename or similar stuff
169              'ecom_data_ident' => array( query_arg => 'ecdid' ),
170              // e.g. a classname or a filename
171              'ecom_data_meta' => array( query_arg => 'ecdm' ),
172              // extended meta, e.g. 2nd parent identifier
173              'ecom_data_meta_x' => array( query_arg => 'ecdmx' ),
174              // filter the data: e.g.
175              //    - an xpath-query (xpq),
176              //    - an abstract/custom filter string or
177              //    - a parent node identifier (maybe revamp as 'ecdpnid')?
178              'ecom_data_filter' => array( query_arg => 'ecdf' ),
179              
180              // Some actions ...
181              // ... required for data items.
182              'ecom_data_action_edit' => array( query_arg => 'ecdfe' ),
183              'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ),
184              'ecom_data_action_delete' => array( query_arg => 'ecdfd' ),
185              'ecom_data_action_create' => array( query_arg => 'ecdfcr' ),
186              // ... required for data lists.
187              'ecom_data_form_action' => array( query_arg => 'ecdfa' ),
188              'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ),
189              
190              // Special argument (should become a non-data-action).
191              // Triggers 'selectSource' at backend api (remote api) which causes a database handle switch.
192              'ecom_data_source_key' => array( query_arg => 'ecds' ),
193    
194        ),        ),
195    
196  /*  /*
197      // block model (what is used for each block)      // block model (what is used for each block)
198        // is this deprecated???
199        block => array(        block => array(
200          'ident' => array( query_arg => 'ident' ),          'ident' => array( query_arg => 'ident' ),
201          'meta' => array( query_arg => 'meta' ),          'meta' => array( query_arg => 'meta' ),
# Line 115  class WebExplorer_MVC extends Site_WebAp Line 208  class WebExplorer_MVC extends Site_WebAp
208    
209      ));      ));
210    
211        
212        // TODO: activate MVC-Views!!!
213        // - Here: Picture a ecom-component as a MVC-View.
214        // - Assign a GUID to each ecom-component!
215        // - Build WebExplorer-Introspection-Module to show stuff like this...    (->WebExplorer::Designer)
216        
217        
218      //$this->setup_views( &$this->_registry );      //$this->setup_views( &$this->_registry );
219    
220      // associate behaviour with "View"-components      // associate behaviour with "View"-components
# Line 142  class WebExplorer_MVC extends Site_WebAp Line 242  class WebExplorer_MVC extends Site_WebAp
242        // COID => '123',        // COID => '123',
243        caption => "Explorer - ExplorerDataItem",        caption => "Explorer - ExplorerDataItem",
244      ));      ));
245                      
246      // FIXME!!! enhance!?!?      // FIXME!!! enhance!?!?
247      // AIM: "dispatch a Request to a View by using rules..."      // AIM: "dispatch a Request to a View by using rules..."
248      // Todo:      // Todo:
# Line 154  class WebExplorer_MVC extends Site_WebAp Line 254  class WebExplorer_MVC extends Site_WebAp
254                
255        // for "module", no component registry is required, just does 'mkObject' under the hood        // for "module", no component registry is required, just does 'mkObject' under the hood
256        module => 'Application::Request::HttpController',        module => 'Application::Request::HttpController',
257          //module_options => blah
258    
259        rules => array(        rules => array(
260                    
261          // get last page state          // get last page state
# Line 161  class WebExplorer_MVC extends Site_WebAp Line 263  class WebExplorer_MVC extends Site_WebAp
263            $requestTracker = mkObject("Application::Request::Tracker");            $requestTracker = mkObject("Application::Request::Tracker");
264            $page_state = $requestTracker->getPointer();            $page_state = $requestTracker->getPointer();
265            $pre_out = $page_state[options];            $pre_out = $page_state[options];
266            //print Dumper($pre_out);            //print "pre_out: " . Dumper($pre_out);
267              
268            // clean-up unwanted variables            // clean-up unwanted variables
269            $label = $_in[ecom_label];            $label = $_in[ecom_label];
270            switch ($_in[ecom_abstract_type]) {            switch ($_in[ecom_abstract_type]) {
271              case "list":              case "list":
272                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]); }
273                  if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); }
274                  break;
275                // 2003-04-16: required for xmltree-to-item transition
276                // if we dont do this the "dotted" filter expression would persist across views
277                case "item":
278                  if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); }
279                  break;
280                case "tree":
281                  if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); }
282                  if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); }
283                break;                break;
284            }            }
285            $_out = $pre_out;            $_out = $pre_out;
286          '),          '),
287    
288            // reset machine
289            create_function('&$_in, &$_out', '
290                // HACK!!!
291                // FIXME: review and implement in a more clean way?
292                //print "RESET!<br/>";
293                $_out[options][ecoms][phase_startup] = "RESET";
294            '),
295    
296          // rewrite idents          // rewrite idents
297          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
298            $idents = array ( ap, );          
299            foreach($idents as $key) {            // old version: ap == explorer
300              $_out[options][idents][$key] = $_in[$key];             // map Topic to Page if exists
301            }             //if ($_in[topic]) {
302               // $_in[ap] = $_in[topic];
303               //}          
304              //$idents = array ( ap );
305              //foreach($idents as $key) {
306              //  $_out[options][idents][$key] = $_in[$key];
307              //}
308              
309              // 2003-06-26: switched from ap=explorer to t=DataBrowser
310              $_out[options][idents][t] = $_in[topic];
311    
312          '),          '),
313                    
314          // check right $_GET[ap]          // check right $_GET[ap] - depreciated
315          create_function('&$_in, &$_out', 'return ($_in[ap] != "explorer") ? print "Wrong application value $_in[ap], sure this is right here?" : null;'),          //create_function('&$_in, &$_out', 'return ($_in[ap] != "explorer") ? print "Wrong application value [ap]: $_in[ap], sure this is right here?<br>" : null;'),
316    
317          // write components variables to out          // write components variables to out
318          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
319            $vars = array( ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta );            $vars = array(
320                ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key,
321                ecom_data_ident, ecom_data_meta, ecom_data_filter, ecom_data_meta_x
322              );
323              //  ecom_call_method, ecom_call_args
324            if($_in[ecom_label]) {            if($_in[ecom_label]) {
325              foreach($vars as $key) {              foreach($vars as $key) {
326                if($_in[$key]) {                if($_in[$key]) {
327                    //print "var: " . $key . " value: " . $_in[$key] . "<br>";
328                  $label = $_in[ecom_label];                  $label = $_in[ecom_label];
329                  $_out[options][ecoms][$label][$key] = $_in[$key];                  $_out[options][ecoms][$label][$key] = $_in[$key];
330                }                }
# Line 205  class WebExplorer_MVC extends Site_WebAp Line 341  class WebExplorer_MVC extends Site_WebAp
341                      nav => array(                      nav => array(
342                                ecom_type => "nav",                                ecom_type => "nav",
343                                ecom_abstract_type => "list",                                ecom_abstract_type => "list",
344                                ecom_mode => "nav",                                ecom_mode => "link",
345                                ecom_data_locator_key => "rpc",                                ecom_data_locator_key => "rpc",
346                                ),                                ),
347                      chooser => array(                      chooser => array(
348                                ecom_type => "chooser",                                ecom_type => "nav",
349                                ecom_abstract_type => "list",                                ecom_abstract_type => "list",
350                                ecom_mode => "nav",                                ecom_mode => "link",
351                                ecom_data_locator_key => "rpc",                                ecom_data_locator_key => "rpc",
352                                ),                                ),
353                    );                    );
# Line 220  class WebExplorer_MVC extends Site_WebAp Line 356  class WebExplorer_MVC extends Site_WebAp
356            return;            return;
357          '),          '),
358    
359            // handle data form action(button)
360            create_function('&$_in, &$_out', '
361              if($_in[ap] == "Benutzerverwaltung" || $_in[topic] == "Benutzerverwaltung") {
362                if(!$_out[options][ecoms][UMnav]) {
363                  $_out[options][ecoms][UMnav] = array(
364                                  ecom_type => "nav",
365                                  ecom_abstract_type => "tree",
366                                  ecom_mode => "link",
367                                  ecom_data_locator_key => "rpc",
368                                  );
369                }
370              }
371            '),
372    
373            // handle data form action(button)
374            create_function('&$_in, &$_out', '
375              $label = $_in[ecom_label];
376              if($_in[ecom_data_form_action]) {
377                //print "from action button pressed!<br>";
378               if(is_array($_in[ecom_data_form_checkbox])) {
379                $cnt = sizeof($_in[ecom_data_form_checkbox]);
380                $tmp = array();
381                foreach($_in[ecom_data_form_checkbox] as $ident) {
382                    if($ident) { array_push($tmp, $ident); }
383                }
384                if($cnt == 1) {
385                   print "Single selection, ident : " . $tmp[0] . "<br>";
386                    $_out[options][ecoms][$label][ecom_data_ident] = $tmp[0];
387                  $_out[options][ecoms][$label][ecom_abstract_type] = "item";
388                } elseif($cnt > 1) {
389                  // TODO: implement multi-selection actions on rows(items) here!!
390                    print "Multi-Selection!! Current Ident(s) $tmp" . "<br>";
391                    $_out[options][ecoms][$label][ecom_data_ident] = $tmp;
392                    $_out[options][ecoms][$label][ecom_abstract_type] = "item";
393                }
394               } else {
395                 print "ident: " . Dumper($_out[options][ecoms][$label][ecom_data_ident]) . "<br>";
396               }
397               $_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident];
398               $_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action];
399               //print "in: " . Dumper($_in) . "<br>";
400               //print "out: " . Dumper($_out) . "<br>";
401              }
402            '),
403    
404    
405          // handle data form buttons          // handle data form buttons
406          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
407            $label = $_in[ecom_label];            $label = $_in[ecom_label];
408            if($_in[ecom_data_form_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; }            if($_in[ecom_data_action_edit]) {
409            if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; }              $_out[options][ecoms][$label][ecom_mode] = "edit";
410                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
411              }
412              if($_in[ecom_data_action_cancel]) {
413                $_out[options][ecoms][$label][ecom_mode] = "view";
414                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
415              }
416    
417              // Action.Create
418              if($_in[ecom_data_action_create]) {
419                //print Dumper($_out[options][ecoms][$label]);
420                $_out[options][ecoms][$label][ecom_mode] = "create";
421                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
422              }
423              
424              // Action.Delete [new of 2003-04-09]
425              if ($_in[ecom_data_action_delete]) {
426                
427                //$_out[options][ecoms][content][ecom_mode] = "view";
428    
429                // the code here vanished to the component itself!
430                // could/should we do this for "edit" and/or "view" actions as well?
431                // look at ecom/FlexibleDataItem!
432    
433                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
434              }
435          '),          '),
436    
437          // propagate datasources to ecoms          // propagate datasources to ecoms
# Line 233  class WebExplorer_MVC extends Site_WebAp Line 440  class WebExplorer_MVC extends Site_WebAp
440          // datasource if requested - otherwise everything will fall back to defaults          // datasource if requested - otherwise everything will fall back to defaults
441          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
442            if ($_in[ecom_data_source_key]) {            if ($_in[ecom_data_source_key]) {
443                
444                print "YAI: ecom_data_source_key<br/>";
445                
446              //print Dumper($_out[options][ecoms]);              //print Dumper($_out[options][ecoms]);
447              //print "ds: " . $_in[ecom_data_source_key] . "<br/>";              //print "ds: " . $_in[ecom_data_source_key] . "<br/>";
448              /*              /*
# Line 243  class WebExplorer_MVC extends Site_WebAp Line 453  class WebExplorer_MVC extends Site_WebAp
453              }              }
454              */              */
455              $_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key];              $_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key];
456    
457    
458                // 2003-04-07 - enhanced
459                // now activates a special ecom-component - a "RemoteAction" - replacing
460                // the "content"-ecom instead of displaying an empty page / overriding any
461                // view reached by "normal dispatching"
462    
463                $_out[options][ecoms][phase_startup] = array(
464                  ecom_type => "call",
465                  ecom_abstract_type => "auto",
466                  ecom_mode => "link",
467                  ecom_data_locator_key => "rpc",
468                  // new attributes/properties/arguments that control further / trigger different DataFlow:
469                  // FIXME: add these to declaration at top!
470                  ecom_call_method => "selectSource",
471                  ecom_call_args => $_in[ecom_data_source_key]
472                );
473    
474            }            }
475          '),          '),
476                    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.19

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