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

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