/[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.12 by jonen, Fri Apr 18 13:40:54 2003 UTC revision 1.21 by jonen, Sun Dec 14 01:51:29 2003 UTC
# Line 4  Line 4 
4   * $Id$   * $Id$
5   *   *
6   * $Log$   * $Log$
7     * Revision 1.21  2003/12/14 01:51:29  jonen
8     * implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes
9     *
10     * Revision 1.20  2003/11/22 18:46:33  udo
11     * update for expand data item
12     *
13     * Revision 1.19  2003/07/14 09:54:58  jonen
14     * fixed bug related to 'item delete'
15     *
16     * Revision 1.18  2003/07/02 12:18:00  jonen
17     * fixed bugs
18     *
19     * Revision 1.17  2003/06/25 23:45:05  joko
20     * trying to switch from "ap" completely to "t"
21     *
22     * Revision 1.16  2003/05/13 14:53:56  joko
23     * reset mvc-params "filter" and "meta" in tree mode!?
24     *
25     * Revision 1.15  2003/05/10 18:19:55  jonen
26     * + added stuff relating to 'create/add new' links/buttons
27     *
28     * Revision 1.14  2003/04/19 16:20:47  jonen
29     * + added handle of ecom 'UMnav' according to page 'Benutzverwaltung'
30     *
31     * Revision 1.13  2003/04/18 15:30:24  joko
32     * NEW: parameter 'ecom_data_filter' - used for 'items'
33     *   (introduced to filter xml-payload at backend side via xpath queries)
34     * documented global state parameters
35     * some comments
36     *
37   * Revision 1.12  2003/04/18 13:40:54  jonen   * Revision 1.12  2003/04/18 13:40:54  jonen
38   * + added 'topic' to requested vars which will currently be merged with the 'ap' var   * + added 'topic' to requested vars which will currently be merged with the 'ap' var
39   *   *
# Line 108  class WebExplorer_MVC extends Site_WebAp Line 138  class WebExplorer_MVC extends Site_WebAp
138          // parameters about data identifiers, locations, sources and associated meta-information          // parameters about data identifiers, locations, sources and associated meta-information
139          'ecom_data_locator_key',          'ecom_data_locator_key',
140          'ecom_data_ident',          'ecom_data_ident',
141          'ecom_data_meta',          'ecom_data_meta', 'ecom_data_meta_x', 'ecom_data_meta_xe',
142          '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',
143            'ecom_data_action_expand_edit', 'ecom_data_action_select',
144          'ecom_data_form_checkbox', 'ecom_data_form_action',          'ecom_data_form_checkbox', 'ecom_data_form_action',
145          'ecom_data_source_key'          'ecom_data_source_key',
146            'ecom_data_filter',
147        ),        ),
148        request_arg => array(        request_arg => array(
149          'topic' => array( query_arg => 't' ),          
150          'ap' => array( query_arg => 'ap' ),          // a key identifying the current topic
151          'ecom_label' => array( query_arg => 'ecl' ),            'topic' => array( query_arg => 't' ),
152          'ecom_type' => array( query_arg => 'ect' ),  
153          'ecom_abstract_type' => array( query_arg => 'ecat' ),          // a key identifying the current page
154          'ecom_mode' => array( query_arg => 'ecmod' ),            'ap' => array( query_arg => 'ap' ),
155          'ecom_data_locator_key' => array( query_arg => 'ecdlk' ),          
156          'ecom_data_ident' => array( query_arg => 'ecdid' ),          // ecom, ecom, ecom
157          'ecom_data_meta' => array( query_arg => 'ecdm' ),            
158          'ecom_data_action_edit' => array( query_arg => 'ecdfe' ),            // component specific arguments (important for the main dispatcher, etc.)
159          'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ),            // a label identifying a component
160          'ecom_data_action_delete' => array( query_arg => 'ecdfd' ),            'ecom_label' => array( query_arg => 'ecl' ),
161          'ecom_data_form_action' => array( query_arg => 'ecdfa' ),            // data or schema
162          'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ),            'ecom_type' => array( query_arg => 'ect' ),
163          'ecom_data_source_key' => array( query_arg => 'ecds' ),            // item, list or tree
164              'ecom_abstract_type' => array( query_arg => 'ecat' ),
165    
166    
167            // data, data, data
168              
169              // e.g. view, edit
170              'ecom_mode' => array( query_arg => 'ecmod' ),
171              // This should be renamed to 'ecom_data_transport_key'.
172              'ecom_data_locator_key' => array( query_arg => 'ecdlk' ),
173              
174              // This should be enough to identify data Xyz.
175              // e.g. an OID, a GUID, a filename or similar stuff
176              'ecom_data_ident' => array( query_arg => 'ecdid' ),
177              // e.g. a classname or a filename
178              'ecom_data_meta' => array( query_arg => 'ecdm' ),
179              // extended meta, e.g. 2nd parent identifier
180              'ecom_data_meta_x' => array( query_arg => 'ecdmx' ),
181              'ecom_data_meta_xe' => array( query_arg => 'ecdmxe' ),
182              // filter the data: e.g.
183              //    - an xpath-query (xpq),
184              //    - an abstract/custom filter string or
185              //    - a parent node identifier (maybe revamp as 'ecdpnid')?
186              'ecom_data_filter' => array( query_arg => 'ecdf' ),
187              
188              // Some actions ...
189              // ... required for data items.
190              'ecom_data_action_edit' => array( query_arg => 'ecdfe' ),
191              'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ),
192              'ecom_data_action_delete' => array( query_arg => 'ecdfd' ),
193              'ecom_data_action_create' => array( query_arg => 'ecdfcr' ),
194              // ... required for data lists.
195              'ecom_data_form_action' => array( query_arg => 'ecdfa' ),
196              'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ),
197              // ... required for expanded data items.
198              'ecom_data_action_expand_edit' => array( query_arg => 'ecdfee' ),
199              // ... required for selecting existing objects as reference
200              'ecom_data_action_select' => array( query_arg => 'ecdfsel' ),
201              
202              // Special argument (should become a non-data-action).
203              // Triggers 'selectSource' at backend api (remote api) which causes a database handle switch.
204              'ecom_data_source_key' => array( query_arg => 'ecds' ),
205    
206        ),        ),
207    
208  /*  /*
209      // block model (what is used for each block)      // block model (what is used for each block)
210        // is this deprecated???
211        block => array(        block => array(
212          'ident' => array( query_arg => 'ident' ),          'ident' => array( query_arg => 'ident' ),
213          'meta' => array( query_arg => 'meta' ),          'meta' => array( query_arg => 'meta' ),
# Line 145  class WebExplorer_MVC extends Site_WebAp Line 220  class WebExplorer_MVC extends Site_WebAp
220    
221      ));      ));
222    
223        
224        // TODO: activate MVC-Views!!!
225        // - Here: Picture a ecom-component as a MVC-View.
226        // - Assign a GUID to each ecom-component!
227        // - Build WebExplorer-Introspection-Module to show stuff like this...    (->WebExplorer::Designer)
228        
229        
230      //$this->setup_views( &$this->_registry );      //$this->setup_views( &$this->_registry );
231    
232      // associate behaviour with "View"-components      // associate behaviour with "View"-components
# Line 193  class WebExplorer_MVC extends Site_WebAp Line 275  class WebExplorer_MVC extends Site_WebAp
275            $requestTracker = mkObject("Application::Request::Tracker");            $requestTracker = mkObject("Application::Request::Tracker");
276            $page_state = $requestTracker->getPointer();            $page_state = $requestTracker->getPointer();
277            $pre_out = $page_state[options];            $pre_out = $page_state[options];
278            //print Dumper($pre_out);            //print "pre_out: " . Dumper($pre_out);
279              
280            // clean-up unwanted variables            // clean-up unwanted variables
281            $label = $_in[ecom_label];            $label = $_in[ecom_label];
282            switch ($_in[ecom_abstract_type]) {            switch ($_in[ecom_abstract_type]) {
283              case "list":              case "list":
284                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_mode] != "select") {
285                    if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); }
286                    if ($pre_out[options][ecoms][$label][ecom_data_meta_x]) { unset($pre_out[options][ecoms][$label][ecom_data_meta_x]); }
287                  }
288                  break;
289                // 2003-04-16: required for xmltree-to-item transition
290                // if we dont do this the "dotted" filter expression would persist across views
291                case "item":
292                  if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); }
293                  break;
294                case "tree":
295                  if ($pre_out[options][ecoms][$label][ecom_data_filter]) { unset($pre_out[options][ecoms][$label][ecom_data_filter]); }
296                  if ($pre_out[options][ecoms][$label][ecom_data_meta]) { unset($pre_out[options][ecoms][$label][ecom_data_meta]); }
297                break;                break;
298            }            }
299            $_out = $pre_out;            $_out = $pre_out;
# Line 209  class WebExplorer_MVC extends Site_WebAp Line 304  class WebExplorer_MVC extends Site_WebAp
304              // HACK!!!              // HACK!!!
305              // FIXME: review and implement in a more clean way?              // FIXME: review and implement in a more clean way?
306              //print "RESET!<br/>";              //print "RESET!<br/>";
               
307              $_out[options][ecoms][phase_startup] = "RESET";              $_out[options][ecoms][phase_startup] = "RESET";
308          '),          '),
309    
310          // rewrite idents          // rewrite idents
311          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
312            
313              // old version: ap == explorer
314             // map Topic to Page if exists             // map Topic to Page if exists
315             if($_in[topic]) {             //if ($_in[topic]) {
316              $_in[ap] = $_in[topic];             // $_in[ap] = $_in[topic];
317            }             //}          
318            $idents = array ( ap, );            //$idents = array ( ap );
319            foreach($idents as $key) {            //foreach($idents as $key) {
320              $_out[options][idents][$key] = $_in[$key];            //  $_out[options][idents][$key] = $_in[$key];
321            }            //}
322              
323              // 2003-06-26: switched from ap=explorer to t=DataBrowser
324              $_out[options][idents][t] = $_in[topic];
325    
326          '),          '),
327                    
328          // check right $_GET[ap]          // check right $_GET[ap] - depreciated
329          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;'),
330    
331          // write components variables to out          // write components variables to out
332          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
333            $vars = array(            $vars = array(
334              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,
335                ecom_data_ident, ecom_data_meta, ecom_data_filter, ecom_data_meta_x
336            );            );
337            //  ecom_call_method, ecom_call_args            //  ecom_call_method, ecom_call_args
338            if($_in[ecom_label]) {            if($_in[ecom_label]) {
339              foreach($vars as $key) {              foreach($vars as $key) {
340                if($_in[$key]) {                if($_in[$key]) {
341                    //print "var: " . $key . " value: " . $_in[$key] . "<br>";
342                  $label = $_in[ecom_label];                  $label = $_in[ecom_label];
343                  $_out[options][ecoms][$label][$key] = $_in[$key];                  $_out[options][ecoms][$label][$key] = $_in[$key];
344                }                }
# Line 268  class WebExplorer_MVC extends Site_WebAp Line 370  class WebExplorer_MVC extends Site_WebAp
370            return;            return;
371          '),          '),
372    
373            // handle data form action(button)
374            create_function('&$_in, &$_out', '
375              if($_in[ap] == "Benutzerverwaltung" || $_in[topic] == "Benutzerverwaltung") {
376                if(!$_out[options][ecoms][UMnav]) {
377                  $_out[options][ecoms][UMnav] = array(
378                                  ecom_type => "nav",
379                                  ecom_abstract_type => "tree",
380                                  ecom_mode => "link",
381                                  ecom_data_locator_key => "rpc",
382                                  );
383                }
384              }
385            '),
386    
387          // handle data form action(button)          // handle data form action(button)
388          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
389            $label = $_in[ecom_label];            $label = $_in[ecom_label];
390            if($_in[ecom_data_form_action] && is_array($_in[ecom_data_form_checkbox])) {            if($_in[ecom_data_form_action]) {
391                //print "from action button pressed!<br>";
392               if(is_array($_in[ecom_data_form_checkbox])) {
393              $cnt = sizeof($_in[ecom_data_form_checkbox]);              $cnt = sizeof($_in[ecom_data_form_checkbox]);
394                $tmp = array();
395                foreach($_in[ecom_data_form_checkbox] as $ident) {
396                    if($ident) { array_push($tmp, $ident); }
397                }
398              if($cnt == 1) {              if($cnt == 1) {
399                foreach($_in[ecom_data_form_checkbox] as $ident) {                 print "Single selection, ident : " . $tmp[0] . "<br>";
400                  $_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];  
401                $_out[options][ecoms][$label][ecom_abstract_type] = "item";                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
402              } else {              } elseif($cnt > 1) {
403                // TODO: implement multi-selection actions on rows(items) here!!                // TODO: implement multi-selection actions on rows(items) here!!
404                    print "Multi-Selection!! Current Ident(s) $tmp" . "<br>";
405                    $_out[options][ecoms][$label][ecom_data_ident] = $tmp;
406                    $_out[options][ecoms][$label][ecom_abstract_type] = "item";
407              }              }
408               } else {
409                 print "ident: " . Dumper($_out[options][ecoms][$label][ecom_data_ident]) . "<br>";
410               }
411               $_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident];
412               $_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action];
413               //print "in: " . Dumper($_in) . "<br>";
414               //print "out: " . Dumper($_out) . "<br>";
415            }            }
416          '),          '),
417    
# Line 291  class WebExplorer_MVC extends Site_WebAp Line 419  class WebExplorer_MVC extends Site_WebAp
419          // handle data form buttons          // handle data form buttons
420          create_function('&$_in, &$_out', '          create_function('&$_in, &$_out', '
421            $label = $_in[ecom_label];            $label = $_in[ecom_label];
422            if($_in[ecom_data_action_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; }            if($_in[ecom_data_action_edit]) {
423            if($_in[ecom_data_action_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; }              $_out[options][ecoms][$label][ecom_mode] = "edit";
424                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
425              }
426              if($_in[ecom_data_action_cancel]) {
427                $_out[options][ecoms][$label][ecom_mode] = "view";
428                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
429              }
430    
431              // Action.Create
432              if($_in[ecom_data_action_create]) {
433                //print Dumper($_out[options][ecoms][$label]);
434                $_out[options][ecoms][$label][ecom_mode] = "create";
435                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
436              }
437              if($_in[ecom_data_action_expand_edit]) {
438                //print Dumper($_out[options][ecoms][$label]);
439                $_out[options][ecoms][$label][ecom_mode] = "expandedit";
440                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
441              }
442                        
443            // Action.Delete [new of 2003-04-09]            // Action.Delete [new of 2003-04-09]
444            if ($_in[ecom_data_action_delete]) {            if ($_in[ecom_data_action_delete]) {
# Line 303  class WebExplorer_MVC extends Site_WebAp Line 449  class WebExplorer_MVC extends Site_WebAp
449              // 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?
450              // look at ecom/FlexibleDataItem!              // look at ecom/FlexibleDataItem!
451    
452                $_out[options][ecoms][$label][ecom_abstract_type] = "item";
453              }
454              // Action.Select
455              if($_in[ecom_data_action_select]) {
456               if(is_array($_in[ecom_data_form_checkbox])) {
457                $cnt = sizeof($_in[ecom_data_form_checkbox]);
458                $tmp = array();
459                foreach($_in[ecom_data_form_checkbox] as $ident) {
460                    if($ident) { array_push($tmp, $ident); }
461                }
462                if($cnt == 1) {
463                  print "Single selection, ident : " . $tmp[0] . "<br>";
464                  $_out[options][ecoms][$label][ecom_data_ident] = $tmp[0];
465                  $_out[options][ecoms][$label][ecom_abstract_type] = "item";
466                } elseif($cnt > 1) {
467                  // TODO: implement multi-selection actions on rows(items) here!!
468                    print "Cannot do Multi-Selections with Action SELECT!!" . "<br>";
469                }
470    
471                $requestTracker = mkObject("Application::Request::Tracker");
472                $page_state = $requestTracker->getPointer();
473                $pre_out = $page_state[options];
474                //print "pre_out: " . Dumper($pre_out);
475    
476                $_out[options][ecoms][$label][ecom_mode] = "select";
477                $_out[options][ecoms][$label][ecom_data_meta_xe] = $pre_out[options][ecoms][$label][ecom_data_meta];
478                $_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident];
479               }
480            }            }
           
481          '),          '),
482    
483          // propagate datasources to ecoms          // propagate datasources to ecoms

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.21

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