/[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.10 by joko, Thu Apr 10 06:03:26 2003 UTC revision 1.20 by udo, Sat Nov 22 18:46:33 2003 UTC
# Line 4  Line 4 
4   * $Id$   * $Id$
5   *   *
6   * $Log$   * $Log$
7     * Revision 1.20  2003/11/22 18:46:33  udo
8     * update for expand data item
9     *
10     * Revision 1.19  2003/07/14 09:54:58  jonen
11     * fixed bug related to 'item delete'
12     *
13     * Revision 1.18  2003/07/02 12:18:00  jonen
14     * fixed bugs
15     *
16     * Revision 1.17  2003/06/25 23:45:05  joko
17     * trying to switch from "ap" completely to "t"
18     *
19     * Revision 1.16  2003/05/13 14:53:56  joko
20     * reset mvc-params "filter" and "meta" in tree mode!?
21     *
22     * Revision 1.15  2003/05/10 18:19:55  jonen
23     * + added stuff relating to 'create/add new' links/buttons
24     *
25     * Revision 1.14  2003/04/19 16:20:47  jonen
26     * + added handle of ecom 'UMnav' according to page 'Benutzverwaltung'
27     *
28     * Revision 1.13  2003/04/18 15:30:24  joko
29     * NEW: parameter 'ecom_data_filter' - used for 'items'
30     *   (introduced to filter xml-payload at backend side via xpath queries)
31     * documented global state parameters
32     * some comments
33     *
34     * Revision 1.12  2003/04/18 13:40:54  jonen
35     * + added 'topic' to requested vars which will currently be merged with the 'ap' var
36     *
37     * Revision 1.11  2003/04/11 00:51:10  joko
38     * minor update: just testing stuff...
39     *
40   * Revision 1.10  2003/04/10 06:03:26  joko   * Revision 1.10  2003/04/10 06:03:26  joko
41   * ++ renamed keys: 'ecom_data_form_edit', 'ecom_data_form_cancel' through 'ecom_data_action_edit', 'ecom_data_action_cancel'   * ++ renamed keys: 'ecom_data_form_edit', 'ecom_data_form_cancel' through 'ecom_data_action_edit', 'ecom_data_action_cancel'
42   * + new key: 'ecom_data_action_delete'   * + new key: 'ecom_data_action_delete'
# Line 93  class WebExplorer_MVC extends Site_WebAp Line 126  class WebExplorer_MVC extends Site_WebAp
126      $this->add_model( array(      $this->add_model( array(
127        //args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ),        //args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ),
128        request_args => array(        request_args => array(
129            // ApplicationTopic
130            'topic',
131          // ApplicationPage          // ApplicationPage
132          'ap',          'ap',
133          // important/required parameters for valid ecom-components          // important/required parameters for valid ecom-components
# Line 100  class WebExplorer_MVC extends Site_WebAp Line 135  class WebExplorer_MVC extends Site_WebAp
135          // parameters about data identifiers, locations, sources and associated meta-information          // parameters about data identifiers, locations, sources and associated meta-information
136          'ecom_data_locator_key',          'ecom_data_locator_key',
137          'ecom_data_ident',          'ecom_data_ident',
138          'ecom_data_meta',          'ecom_data_meta', 'ecom_data_meta_x',
139          'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete',          'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete', 'ecom_data_action_create',
140            'ecom_data_action_expand_edit',
141          'ecom_data_form_checkbox', 'ecom_data_form_action',          'ecom_data_form_checkbox', 'ecom_data_form_action',
142          'ecom_data_source_key'          'ecom_data_source_key',
143            'ecom_data_filter',
144        ),        ),
145        request_arg => array(        request_arg => array(
146          'ap' => array( query_arg => 'ap' ),          
147          'ecom_label' => array( query_arg => 'ecl' ),          // a key identifying the current topic
148          'ecom_type' => array( query_arg => 'ect' ),            'topic' => array( query_arg => 't' ),
149          'ecom_abstract_type' => array( query_arg => 'ecat' ),  
150          'ecom_mode' => array( query_arg => 'ecmod' ),          // a key identifying the current page
151          'ecom_data_locator_key' => array( query_arg => 'ecdlk' ),            'ap' => array( query_arg => 'ap' ),
152          'ecom_data_ident' => array( query_arg => 'ecdid' ),          
153          'ecom_data_meta' => array( query_arg => 'ecdm' ),          // ecom, ecom, ecom
154          'ecom_data_action_edit' => array( query_arg => 'ecdfe' ),            
155          'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ),            // component specific arguments (important for the main dispatcher, etc.)
156          'ecom_data_action_delete' => array( query_arg => 'ecdfd' ),            // a label identifying a component
157          'ecom_data_form_action' => array( query_arg => 'ecdfa' ),            'ecom_label' => array( query_arg => 'ecl' ),
158          'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ),            // data or schema
159          'ecom_data_source_key' => array( query_arg => 'ecds' ),            'ecom_type' => array( query_arg => 'ect' ),
160              // item, list or tree
161              'ecom_abstract_type' => array( query_arg => 'ecat' ),
162    
163    
164            // data, data, data
165              
166              // e.g. view, edit
167              'ecom_mode' => array( query_arg => 'ecmod' ),
168              // This should be renamed to 'ecom_data_transport_key'.
169              'ecom_data_locator_key' => array( query_arg => 'ecdlk' ),
170              
171              // This should be enough to identify data Xyz.
172              // e.g. an OID, a GUID, a filename or similar stuff
173              'ecom_data_ident' => array( query_arg => 'ecdid' ),
174              // e.g. a classname or a filename
175              'ecom_data_meta' => array( query_arg => 'ecdm' ),
176              // extended meta, e.g. 2nd parent identifier
177              'ecom_data_meta_x' => array( query_arg => 'ecdmx' ),
178              // filter the data: e.g.
179              //    - an xpath-query (xpq),
180              //    - an abstract/custom filter string or
181              //    - a parent node identifier (maybe revamp as 'ecdpnid')?
182              'ecom_data_filter' => array( query_arg => 'ecdf' ),
183              
184              // Some actions ...
185              // ... required for data items.
186              'ecom_data_action_edit' => array( query_arg => 'ecdfe' ),
187              'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ),
188              'ecom_data_action_delete' => array( query_arg => 'ecdfd' ),
189              'ecom_data_action_create' => array( query_arg => 'ecdfcr' ),
190              // ... required for data lists.
191              'ecom_data_form_action' => array( query_arg => 'ecdfa' ),
192              'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ),
193              // ... required for expanded data items.
194              'ecom_data_action_expand_edit' => array( query_arg => 'ecdfee' ),
195              
196              // Special argument (should become a non-data-action).
197              // Triggers 'selectSource' at backend api (remote api) which causes a database handle switch.
198              'ecom_data_source_key' => array( query_arg => 'ecds' ),
199    
200        ),        ),
201    
202  /*  /*
203      // block model (what is used for each block)      // block model (what is used for each block)
204        // is this deprecated???
205        block => array(        block => array(
206          'ident' => array( query_arg => 'ident' ),          'ident' => array( query_arg => 'ident' ),
207          'meta' => array( query_arg => 'meta' ),          'meta' => array( query_arg => 'meta' ),
# Line 136  class WebExplorer_MVC extends Site_WebAp Line 214  class WebExplorer_MVC extends Site_WebAp
214    
215      ));      ));
216    
217        
218        // TODO: activate MVC-Views!!!
219        // - Here: Picture a ecom-component as a MVC-View.
220        // - Assign a GUID to each ecom-component!
221        // - Build WebExplorer-Introspection-Module to show stuff like this...    (->WebExplorer::Designer)
222        
223        
224      //$this->setup_views( &$this->_registry );      //$this->setup_views( &$this->_registry );
225    
226      // associate behaviour with "View"-components      // associate behaviour with "View"-components
# Line 184  class WebExplorer_MVC extends Site_WebAp Line 269  class WebExplorer_MVC extends Site_WebAp
269            $requestTracker = mkObject("Application::Request::Tracker");            $requestTracker = mkObject("Application::Request::Tracker");
270            $page_state = $requestTracker->getPointer();            $page_state = $requestTracker->getPointer();
271            $pre_out = $page_state[options];            $pre_out = $page_state[options];
272            //print Dumper($pre_out);            //print "pre_out: " . Dumper($pre_out);
273              
274            // clean-up unwanted variables            // clean-up unwanted variables
275            $label = $_in[ecom_label];            $label = $_in[ecom_label];
276            switch ($_in[ecom_abstract_type]) {            switch ($_in[ecom_abstract_type]) {
277              case "list":              case "list":
278                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]); }
279                  if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); }
280                  break;
281                // 2003-04-16: required for xmltree-to-item transition
282                // if we dont do this the "dotted" filter expression would persist across views
283                case "item":
284                  if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); }
285                  break;
286                case "tree":
287                  if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); }
288                  if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); }
289                break;                break;
290            }            }
291            $_out = $pre_out;            $_out = $pre_out;
# Line 200  class WebExplorer_MVC extends Site_WebAp Line 296  class WebExplorer_MVC extends Site_WebAp
296              // HACK!!!              // HACK!!!
297              // FIXME: review and implement in a more clean way?              // FIXME: review and implement in a more clean way?
298              //print "RESET!<br/>";              //print "RESET!<br/>";
               
299              $_out[options][ecoms][phase_startup] = "RESET";              $_out[options][ecoms][phase_startup] = "RESET";
300          '),          '),
301    
302          // rewrite idents          // rewrite idents
303          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
304            $idents = array ( ap, );          
305            foreach($idents as $key) {            // old version: ap == explorer
306              $_out[options][idents][$key] = $_in[$key];             // map Topic to Page if exists
307            }             //if ($_in[topic]) {
308               // $_in[ap] = $_in[topic];
309               //}          
310              //$idents = array ( ap );
311              //foreach($idents as $key) {
312              //  $_out[options][idents][$key] = $_in[$key];
313              //}
314              
315              // 2003-06-26: switched from ap=explorer to t=DataBrowser
316              $_out[options][idents][t] = $_in[topic];
317    
318          '),          '),
319                    
320          // check right $_GET[ap]          // check right $_GET[ap] - depreciated
321          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;'),
322    
323          // write components variables to out          // write components variables to out
324          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
325            $vars = array(            $vars = array(
326              ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta              ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key,
327                ecom_data_ident, ecom_data_meta, ecom_data_filter, ecom_data_meta_x
328            );            );
329            //  ecom_call_method, ecom_call_args            //  ecom_call_method, ecom_call_args
330            if($_in[ecom_label]) {            if($_in[ecom_label]) {
331              foreach($vars as $key) {              foreach($vars as $key) {
332                if($_in[$key]) {                if($_in[$key]) {
333                    //print "var: " . $key . " value: " . $_in[$key] . "<br>";
334                  $label = $_in[ecom_label];                  $label = $_in[ecom_label];
335                  $_out[options][ecoms][$label][$key] = $_in[$key];                  $_out[options][ecoms][$label][$key] = $_in[$key];
336                }                }
# Line 255  class WebExplorer_MVC extends Site_WebAp Line 362  class WebExplorer_MVC extends Site_WebAp
362            return;            return;
363          '),          '),
364    
365            // handle data form action(button)
366            create_function('&$_in, &$_out', '
367              if($_in[ap] == "Benutzerverwaltung" || $_in[topic] == "Benutzerverwaltung") {
368                if(!$_out[options][ecoms][UMnav]) {
369                  $_out[options][ecoms][UMnav] = array(
370                                  ecom_type => "nav",
371                                  ecom_abstract_type => "tree",
372                                  ecom_mode => "link",
373                                  ecom_data_locator_key => "rpc",
374                                  );
375                }
376              }
377            '),
378    
379          // handle data form action(button)          // handle data form action(button)
380          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
381            $label = $_in[ecom_label];            $label = $_in[ecom_label];
382            if($_in[ecom_data_form_action] && is_array($_in[ecom_data_form_checkbox])) {            if($_in[ecom_data_form_action]) {
383                //print "from action button pressed!<br>";
384               if(is_array($_in[ecom_data_form_checkbox])) {
385              $cnt = sizeof($_in[ecom_data_form_checkbox]);              $cnt = sizeof($_in[ecom_data_form_checkbox]);
386                $tmp = array();
387                foreach($_in[ecom_data_form_checkbox] as $ident) {
388                    if($ident) { array_push($tmp, $ident); }
389                }
390              if($cnt == 1) {              if($cnt == 1) {
391                foreach($_in[ecom_data_form_checkbox] as $ident) {                 print "Single selection, ident : " . $tmp[0] . "<br>";
392                  $_out[options][ecoms][$label][ecom_data_ident] = $ident;                  $_out[options][ecoms][$label][ecom_data_ident] = $tmp[0];
               }  
               $_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident];  
               $_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action];  
393                $_out[options][ecoms][$label][ecom_abstract_type] = "item";                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
394              } else {              } elseif($cnt > 1) {
395                // TODO: implement multi-selection actions on rows(items) here!!                // TODO: implement multi-selection actions on rows(items) here!!
396                    print "Multi-Selection!! Current Ident(s) $tmp" . "<br>";
397                    $_out[options][ecoms][$label][ecom_data_ident] = $tmp;
398                    $_out[options][ecoms][$label][ecom_abstract_type] = "item";
399              }              }
400               } else {
401                 print "ident: " . Dumper($_out[options][ecoms][$label][ecom_data_ident]) . "<br>";
402               }
403               $_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident];
404               $_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action];
405               //print "in: " . Dumper($_in) . "<br>";
406               //print "out: " . Dumper($_out) . "<br>";
407            }            }
408          '),          '),
409    
# Line 278  class WebExplorer_MVC extends Site_WebAp Line 411  class WebExplorer_MVC extends Site_WebAp
411          // handle data form buttons          // handle data form buttons
412          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
413            $label = $_in[ecom_label];            $label = $_in[ecom_label];
414            if($_in[ecom_data_action_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; }            if($_in[ecom_data_action_edit]) {
415            if($_in[ecom_data_action_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; }              $_out[options][ecoms][$label][ecom_mode] = "edit";
416                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
417              }
418              if($_in[ecom_data_action_cancel]) {
419                $_out[options][ecoms][$label][ecom_mode] = "view";
420                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
421              }
422    
423              // Action.Create
424              if($_in[ecom_data_action_create]) {
425                //print Dumper($_out[options][ecoms][$label]);
426                $_out[options][ecoms][$label][ecom_mode] = "create";
427                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
428              }
429              if($_in[ecom_data_action_expand_edit]) {
430                //print Dumper($_out[options][ecoms][$label]);
431                $_out[options][ecoms][$label][ecom_mode] = "expandedit";
432                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
433              }
434                        
435            // Action.Delete [new of 2003-04-09]            // Action.Delete [new of 2003-04-09]
436            if ($_in[ecom_data_action_delete]) {            if ($_in[ecom_data_action_delete]) {
437                            
438                //$_out[options][ecoms][content][ecom_mode] = "view";
439    
440              // the code here vanished to the component itself!              // the code here vanished to the component itself!
441              // could/should we do this for "edit" and/or "view" actions as well?              // could/should we do this for "edit" and/or "view" actions as well?
442              // look at ecom/FlexibleDataItem!              // look at ecom/FlexibleDataItem!
443    
444                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
445            }            }
           
446          '),          '),
447    
448          // propagate datasources to ecoms          // propagate datasources to ecoms

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.20

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