/[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.4 by jonen, Fri Apr 4 23:59:19 2003 UTC revision 1.14 by jonen, Sat Apr 19 16:20:47 2003 UTC
# Line 4  Line 4 
4   * $Id$   * $Id$
5   *   *
6   * $Log$   * $Log$
7     * Revision 1.14  2003/04/19 16:20:47  jonen
8     * + added handle of ecom 'UMnav' according to page 'Benutzverwaltung'
9     *
10     * Revision 1.13  2003/04/18 15:30:24  joko
11     * NEW: parameter 'ecom_data_filter' - used for 'items'
12     *   (introduced to filter xml-payload at backend side via xpath queries)
13     * documented global state parameters
14     * some comments
15     *
16     * Revision 1.12  2003/04/18 13:40:54  jonen
17     * + added 'topic' to requested vars which will currently be merged with the 'ap' var
18     *
19     * Revision 1.11  2003/04/11 00:51:10  joko
20     * minor update: just testing stuff...
21     *
22     * Revision 1.10  2003/04/10 06:03:26  joko
23     * ++ renamed keys: 'ecom_data_form_edit', 'ecom_data_form_cancel' through 'ecom_data_action_edit', 'ecom_data_action_cancel'
24     * + new key: 'ecom_data_action_delete'
25     * + Action.Delete: not really, since it's inside component in fact (self-contained ecom)
26     *
27     * Revision 1.9  2003/04/09 00:05:50  jonen
28     * added request values and functions needed for extended form handling
29     *
30     * Revision 1.8  2003/04/08 17:53:08  joko
31     * NEW: Module 'RemoteAction' in 'phase_startup'
32     *
33     * Revision 1.7  2003/04/07 22:32:27  jonen
34     * + minor changes related to new ecom 'chooser'
35     *
36     * Revision 1.6  2003/04/06 01:32:57  jonen
37     * + minor changes
38     *
39     * Revision 1.5  2003/04/05 21:18:29  joko
40     * added Chooser and associated 'ecds'-parameter
41     * new rule (at bottom) to dispatch datasource-keys to each ecom-component
42     *
43   * Revision 1.4  2003/04/04 23:59:19  jonen   * Revision 1.4  2003/04/04 23:59:19  jonen
44   * + minor changes according to data form submits   * + minor changes according to data form submits
45   *   *
# Line 71  class WebExplorer_MVC extends Site_WebAp Line 107  class WebExplorer_MVC extends Site_WebAp
107    
108      $this->add_model( array(      $this->add_model( array(
109        //args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ),        //args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ),
110        request_args => array( 'ap', 'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode', 'ecom_data_locator_key',        request_args => array(
111                                           'ecom_data_ident', 'ecom_data_meta', 'ecom_data_form_edit', 'ecom_data_form_cancel' ),          // ApplicationTopic
112            'topic',
113            // ApplicationPage
114            'ap',
115            // important/required parameters for valid ecom-components
116            'ecom_label', 'ecom_type', 'ecom_abstract_type', 'ecom_mode',
117            // parameters about data identifiers, locations, sources and associated meta-information
118            'ecom_data_locator_key',
119            'ecom_data_ident',
120            'ecom_data_meta',
121            'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete',
122            'ecom_data_form_checkbox', 'ecom_data_form_action',
123            'ecom_data_source_key',
124            'ecom_data_filter',
125          ),
126        request_arg => array(        request_arg => array(
127          'ap' => array( query_arg => 'ap' ),          
128          'ecom_label' => array( query_arg => 'ecl' ),          // a key identifying the current topic
129          'ecom_type' => array( query_arg => 'ect' ),            'topic' => array( query_arg => 't' ),
130          'ecom_abstract_type' => array( query_arg => 'ecat' ),  
131          'ecom_mode' => array( query_arg => 'ecmod' ),          // a key identifying the current page
132          'ecom_data_locator_key' => array( query_arg => 'ecdlk' ),            'ap' => array( query_arg => 'ap' ),
133          'ecom_data_ident' => array( query_arg => 'ecdid' ),          
134          'ecom_data_meta' => array( query_arg => 'ecdm' ),          // ecom, ecom, ecom
135          'ecom_data_form_edit' => array( query_arg => 'ecdfe' ),            
136          'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ),            // component specific arguments (important for the main dispatcher, etc.)
137              // a label identifying a component
138              'ecom_label' => array( query_arg => 'ecl' ),
139              // data or schema
140              'ecom_type' => array( query_arg => 'ect' ),
141              // item, list or tree
142              'ecom_abstract_type' => array( query_arg => 'ecat' ),
143    
144    
145            // data, data, data
146              
147              // e.g. view, edit
148              'ecom_mode' => array( query_arg => 'ecmod' ),
149              // This should be renamed to 'ecom_data_transport_key'.
150              'ecom_data_locator_key' => array( query_arg => 'ecdlk' ),
151              
152              // This should be enough to identify data Xyz.
153              // e.g. an OID, a GUID, a filename or similar stuff
154              'ecom_data_ident' => array( query_arg => 'ecdid' ),
155              // e.g. a classname or a filename
156              'ecom_data_meta' => array( query_arg => 'ecdm' ),
157              // filter the data: e.g.
158              //    - an xpath-query (xpq),
159              //    - an abstract/custom filter string or
160              //    - a parent node identifier (maybe revamp as 'ecdpnid')?
161              'ecom_data_filter' => array( query_arg => 'ecdf' ),
162              
163              // Some actions ...
164              // ... required for data items.
165              'ecom_data_action_edit' => array( query_arg => 'ecdfe' ),
166              'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ),
167              'ecom_data_action_delete' => array( query_arg => 'ecdfd' ),
168              // ... required for data lists.
169              'ecom_data_form_action' => array( query_arg => 'ecdfa' ),
170              'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ),
171              
172              // Special argument (should become a non-data-action).
173              // Triggers 'selectSource' at backend api (remote api) which causes a database handle switch.
174              'ecom_data_source_key' => array( query_arg => 'ecds' ),
175    
176        ),        ),
177    
178  /*  /*
179      // block model (what is used for each block)      // block model (what is used for each block)
180        // is this deprecated???
181        block => array(        block => array(
182          'ident' => array( query_arg => 'ident' ),          'ident' => array( query_arg => 'ident' ),
183          'meta' => array( query_arg => 'meta' ),          'meta' => array( query_arg => 'meta' ),
# Line 100  class WebExplorer_MVC extends Site_WebAp Line 190  class WebExplorer_MVC extends Site_WebAp
190    
191      ));      ));
192    
193        
194        // TODO: activate MVC-Views!!!
195        // - Here: Picture a ecom-component as a MVC-View.
196        // - Assign a GUID to each ecom-component!
197        // - Build WebExplorer-Introspection-Module to show stuff like this...    (->WebExplorer::Designer)
198        
199        
200      //$this->setup_views( &$this->_registry );      //$this->setup_views( &$this->_registry );
201    
202      // associate behaviour with "View"-components      // associate behaviour with "View"-components
# Line 127  class WebExplorer_MVC extends Site_WebAp Line 224  class WebExplorer_MVC extends Site_WebAp
224        // COID => '123',        // COID => '123',
225        caption => "Explorer - ExplorerDataItem",        caption => "Explorer - ExplorerDataItem",
226      ));      ));
227                      
228      // FIXME!!! enhance!?!?      // FIXME!!! enhance!?!?
229      // AIM: "dispatch a Request to a View by using rules..."      // AIM: "dispatch a Request to a View by using rules..."
230      // Todo:      // Todo:
# Line 136  class WebExplorer_MVC extends Site_WebAp Line 233  class WebExplorer_MVC extends Site_WebAp
233      //    Enhance this backend and introduce a mechanism to trigger      //    Enhance this backend and introduce a mechanism to trigger
234      //    a true callback to process a rule (or: "as a rule") on top of that.      //    a true callback to process a rule (or: "as a rule") on top of that.
235      $this->add_controller( array(      $this->add_controller( array(
236          
237        // 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
238        module => 'Application::Request::HttpController',        module => 'Application::Request::HttpController',
239          //module_options => blah
240    
241        rules => array(        rules => array(
242                    
243          // get last page state          // get last page state
# Line 146  class WebExplorer_MVC extends Site_WebAp Line 246  class WebExplorer_MVC extends Site_WebAp
246            $page_state = $requestTracker->getPointer();            $page_state = $requestTracker->getPointer();
247            $pre_out = $page_state[options];            $pre_out = $page_state[options];
248            //print Dumper($pre_out);            //print Dumper($pre_out);
249              
250            // clean-up unwanted variables            // clean-up unwanted variables
251            $label = $_in[ecom_label];            $label = $_in[ecom_label];
252            switch ($_in[ecom_abstract_type]) {            switch ($_in[ecom_abstract_type]) {
253              case "list":              case "list":
254                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]); }
255                  break;
256                // 2003-04-16: required for xmltree-to-item transition
257                // if we dont do this the "dotted" filter expression would persist across views
258                case "item":
259                  if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); }
260                break;                break;
261            }            }
262            $_out = $pre_out;            $_out = $pre_out;
263          '),          '),
264    
265            // reset machine
266            create_function('&$_in, &$_out', '
267                // HACK!!!
268                // FIXME: review and implement in a more clean way?
269                //print "RESET!<br/>";
270                $_out[options][ecoms][phase_startup] = "RESET";
271            '),
272    
273          // rewrite idents          // rewrite idents
274          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
275               // map Topic to Page if exists
276               if($_in[topic]) {
277                $_in[ap] = $_in[topic];
278              }
279            $idents = array ( ap, );            $idents = array ( ap, );
280            foreach($idents as $key) {            foreach($idents as $key) {
281              $_out[options][idents][$key] = $_in[$key];              $_out[options][idents][$key] = $_in[$key];
# Line 166  class WebExplorer_MVC extends Site_WebAp Line 283  class WebExplorer_MVC extends Site_WebAp
283          '),          '),
284                    
285          // check right $_GET[ap]          // check right $_GET[ap]
286          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;'),
287    
288          // write components variables to out          // write components variables to out
289          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
290            $vars = array( ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta );            $vars = array(
291                ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key,
292                ecom_data_ident, ecom_data_meta, ecom_data_filter
293              );
294              //  ecom_call_method, ecom_call_args
295            if($_in[ecom_label]) {            if($_in[ecom_label]) {
296              foreach($vars as $key) {              foreach($vars as $key) {
297                if($_in[$key]) {                if($_in[$key]) {
# Line 183  class WebExplorer_MVC extends Site_WebAp Line 304  class WebExplorer_MVC extends Site_WebAp
304            return;            return;
305          '),          '),
306    
307          // create default ecoms (navigation, etc.)          // create default ecoms (navigation, chooser [as of 2003-04-05] etc.)
308          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
309            if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) {            if(!$_out[options][ecoms] || !is_array($_out[options][ecoms])) {
310              $_out[options][ecoms] = array(              $_out[options][ecoms] = array(
311                      nav => array(                      nav => array(
312                                ecom_type => "nav",                                ecom_type => "nav",
313                                ecom_abstract_type => "list",                                ecom_abstract_type => "list",
314                                ecom_mode => "nav",                                ecom_mode => "link",
315                                  ecom_data_locator_key => "rpc",
316                                  ),
317                        chooser => array(
318                                  ecom_type => "nav",
319                                  ecom_abstract_type => "list",
320                                  ecom_mode => "link",
321                                ecom_data_locator_key => "rpc",                                ecom_data_locator_key => "rpc",
322                                ),                                ),
323                    );                    );
# Line 199  class WebExplorer_MVC extends Site_WebAp Line 326  class WebExplorer_MVC extends Site_WebAp
326            return;            return;
327          '),          '),
328    
329            // handle data form action(button)
330            create_function('&$_in, &$_out', '
331              if($_in[ap] == "Benutzerverwaltung" || $_in[topic] == "Benutzerverwaltung") {
332                if(!$_out[options][ecoms][UMnav]) {
333                  $_out[options][ecoms][UMnav] = array(
334                                  ecom_type => "nav",
335                                  ecom_abstract_type => "tree",
336                                  ecom_mode => "link",
337                                  ecom_data_locator_key => "rpc",
338                                  );
339                }
340              }
341            '),
342    
343            // handle data form action(button)
344            create_function('&$_in, &$_out', '
345              $label = $_in[ecom_label];
346              if($_in[ecom_data_form_action] && is_array($_in[ecom_data_form_checkbox])) {
347                $cnt = sizeof($_in[ecom_data_form_checkbox]);
348                if($cnt == 1) {
349                  foreach($_in[ecom_data_form_checkbox] as $ident) {
350                    $_out[options][ecoms][$label][ecom_data_ident] = $ident;
351                  }
352                  $_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident];
353                  $_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action];
354                  $_out[options][ecoms][$label][ecom_abstract_type] = "item";
355                } else {
356                  // TODO: implement multi-selection actions on rows(items) here!!
357                }
358              }
359            '),
360    
361    
362          // handle data form buttons          // handle data form buttons
363          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
364            $label = $_in[ecom_label];            $label = $_in[ecom_label];
365            if($_in[ecom_data_form_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; }            if($_in[ecom_data_action_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; }
366            if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; }            if($_in[ecom_data_action_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; }
367              
368              // Action.Delete [new of 2003-04-09]
369              if ($_in[ecom_data_action_delete]) {
370                
371                //$_out[options][ecoms][content][ecom_mode] = "view";
372    
373                // the code here vanished to the component itself!
374                // could/should we do this for "edit" and/or "view" actions as well?
375                // look at ecom/FlexibleDataItem!
376    
377              }
378            
379            '),
380    
381            // propagate datasources to ecoms
382            // datasource-change requested? enhance logic here!
383            // by now each ecom-component gets injected the very same
384            // datasource if requested - otherwise everything will fall back to defaults
385            create_function('&$_in, &$_out', '
386              if ($_in[ecom_data_source_key]) {
387                
388                print "YAI: ecom_data_source_key<br/>";
389                
390                //print Dumper($_out[options][ecoms]);
391                //print "ds: " . $_in[ecom_data_source_key] . "<br/>";
392                /*
393                foreach ($_out[options][ecoms] as $name => $ecom) {
394                  print "name: $name<br/>";
395                  //$_out[options][sources][selected] = $_in[ecom_data_source];
396                  $_out[options][ecoms][$name][ecom_data_source_key] = $_in[ecom_data_source_key];
397                }
398                */
399                $_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key];
400    
401    
402                // 2003-04-07 - enhanced
403                // now activates a special ecom-component - a "RemoteAction" - replacing
404                // the "content"-ecom instead of displaying an empty page / overriding any
405                // view reached by "normal dispatching"
406    
407                $_out[options][ecoms][phase_startup] = array(
408                  ecom_type => "call",
409                  ecom_abstract_type => "auto",
410                  ecom_mode => "link",
411                  ecom_data_locator_key => "rpc",
412                  // new attributes/properties/arguments that control further / trigger different DataFlow:
413                  // FIXME: add these to declaration at top!
414                  ecom_call_method => "selectSource",
415                  ecom_call_args => $_in[ecom_data_source_key]
416                );
417    
418              }
419          '),          '),
420            
421    
422  /*  /*
423          // translate value of argument "action" (olist => list.view, oedit => item.edit)          // translate value of argument "action" (olist => list.view, oedit => item.edit)

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.14

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