/[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.9 by jonen, Wed Apr 9 00:05:50 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   * Revision 1.9  2003/04/09 00:05:50  jonen
28   * added request values and functions needed for extended form handling   * added request values and functions needed for extended form handling
29   *   *
# Line 88  class WebExplorer_MVC extends Site_WebAp Line 108  class WebExplorer_MVC extends Site_WebAp
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(        request_args => array(
111            // ApplicationTopic
112            'topic',
113          // ApplicationPage          // ApplicationPage
114          'ap',          'ap',
115          // important/required parameters for valid ecom-components          // important/required parameters for valid ecom-components
# Line 96  class WebExplorer_MVC extends Site_WebAp Line 118  class WebExplorer_MVC extends Site_WebAp
118          'ecom_data_locator_key',          'ecom_data_locator_key',
119          'ecom_data_ident',          'ecom_data_ident',
120          'ecom_data_meta',          'ecom_data_meta',
121          'ecom_data_form_edit', 'ecom_data_form_cancel',          'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete',
122          'ecom_data_form_checkbox', 'ecom_data_form_action',          'ecom_data_form_checkbox', 'ecom_data_form_action',
123          'ecom_data_source_key'          '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          'ecom_data_form_action' => array( query_arg => 'ecdfa' ),            // a label identifying a component
138          'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ),            'ecom_label' => array( query_arg => 'ecl' ),
139          'ecom_data_source_key' => array( query_arg => 'ecds' ),            // 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 130  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 173  class WebExplorer_MVC extends Site_WebAp Line 240  class WebExplorer_MVC extends Site_WebAp
240    
241        rules => array(        rules => array(
242                    
   
243          // get last page state          // get last page state
244          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
245            $requestTracker = mkObject("Application::Request::Tracker");            $requestTracker = mkObject("Application::Request::Tracker");
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 199  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?<br>" : 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 238  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)          // handle data form action(button)
344          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
# Line 261  class WebExplorer_MVC extends Site_WebAp Line 362  class WebExplorer_MVC extends Site_WebAp
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          // propagate datasources to ecoms
# Line 272  class WebExplorer_MVC extends Site_WebAp Line 385  class WebExplorer_MVC extends Site_WebAp
385          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
386            if ($_in[ecom_data_source_key]) {            if ($_in[ecom_data_source_key]) {
387                            
388              //print "YAI<br/>";              print "YAI: ecom_data_source_key<br/>";
389                            
390              //print Dumper($_out[options][ecoms]);              //print Dumper($_out[options][ecoms]);
391              //print "ds: " . $_in[ecom_data_source_key] . "<br/>";              //print "ds: " . $_in[ecom_data_source_key] . "<br/>";
# Line 297  class WebExplorer_MVC extends Site_WebAp Line 410  class WebExplorer_MVC extends Site_WebAp
410                ecom_mode => "link",                ecom_mode => "link",
411                ecom_data_locator_key => "rpc",                ecom_data_locator_key => "rpc",
412                // new attributes/properties/arguments that control further / trigger different DataFlow:                // new attributes/properties/arguments that control further / trigger different DataFlow:
413                  // FIXME: add these to declaration at top!
414                ecom_call_method => "selectSource",                ecom_call_method => "selectSource",
415                ecom_call_args => $_in[ecom_data_source_key]                ecom_call_args => $_in[ecom_data_source_key]
416              );              );

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

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