/[cvs]/nfo/php/libs/org.netfrag.glib/Application/Request/HttpController.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/Application/Request/HttpController.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Sat Mar 1 21:11:18 2003 UTC revision 1.5 by jonen, Sun Apr 6 01:39:32 2003 UTC
# Line 5  Line 5 
5   *   *
6   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
7   * @package org.netfrag.glib   * @package org.netfrag.glib
8   * @module Application::Request::HttpController   * @name Application::Request::HttpController
9   *   *
10   */   */
11    
12  /**  /**
13     * <b>Cvs-Log:</b>
14     *
15     * <pre>
16   * $Id$   * $Id$
17   *   *
18   * $Log$   * $Log$
19     * Revision 1.5  2003/04/06 01:39:32  jonen
20     * + now, ask LinkBuilder for GET vars if linkbuilder-ID exists at GET var(s)
21     *
22     * Revision 1.4  2003/03/11 01:22:22  joko
23     * + fixed metadata for phpDocumentor
24     *
25     * Revision 1.3  2003/03/05 18:54:42  joko
26     * updated docu - phpDocumentor is very strict about its 'blocks'...
27     *
28     * Revision 1.2  2003/03/03 21:13:59  joko
29     * + request translation
30     * mungled namespaces
31     * - purged old code
32     *
33   * Revision 1.1  2003/03/01 21:11:18  joko   * Revision 1.1  2003/03/01 21:11:18  joko
34   * + initial commit   * + initial commit
35   *   * </pre>
36   *   *
37   */   */
38    
39    
40  /**  /**
41   * ---   * This requires the Application::Request::BaseController base class
42   *   *
43     */
44    loadModule('Application::Request::BaseController');
45    
46    /**
47     * --- Application::Request::HttpController
48     *
49     * Responsible for GET and POST argument handling.
50     * Does an array_join_merge for now.
51   *   *
52   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
53   * @copyright (c) 2003 - All Rights reserved.   * @copyright (c) 2003 - All Rights reserved.
54   * @license GNU LGPL (GNU Lesser General Public License)   * @license GNU LGPL (GNU Lesser General Public License)
55   *   *
56   * @author-url http://www.netfrag.org/~joko/   * @link http://www.netfrag.org/~joko/
57   * @license-url http://www.gnu.org/licenses/lgpl.txt   * @link http://www.gnu.org/licenses/lgpl.txt
58   *   *
59   * @package org.netfrag.glib   * @package org.netfrag.glib
60   * @module Application::Request::HttpController   * @subpackage Application
61   *   * @name Application::Request::HttpController
  */  
   
 /**  
  * Todo:  
  *  
  *  o xyz  
  *  o bla, bli, blub  
  *  
62   *   *
63   */   */
   
   
 loadModule('Application::Request::BaseController');  
64  class Application_Request_HttpController extends Application_Request_BaseController {  class Application_Request_HttpController extends Application_Request_BaseController {
65    
66   /**   /**
# Line 63  class Application_Request_HttpController Line 77  class Application_Request_HttpController
77    }    }
78    
79    function get_request() {    function get_request() {
80      return array_join_merge($_GET, $_POST);      // FIXME!?
81        if ($lbid = $_GET[lbid]) {
82          // talk to LinkBuilder...
83          $linkbuilder = new LinkBuilder();
84          return $linkbuilder->load($lbid);
85        } else {
86          return php::array_join_merge($_GET, $_POST);
87        }
88      }
89    
90      function get_request_translated() {
91        return $this->translate_request($this->get_request());
92    }    }
93    
94    function perform(&$metadata) {    function perform(&$metadata) {
95    
96        $this->metadata = &$metadata;
97    
98      //print "model: " . Dumper($metadata);      //print "model: " . Dumper($metadata);
99      //print "request: " . Dumper($this->get_request());      //print "request: " . Dumper($this->get_request());
100      $request_raw = $this->get_request();      $request_translated = $this->get_request_translated();
101    
     // 1. map it! mungle request and model together - generic processing here!  
     $request_mapped = array();  
         
       // check all areas  
       foreach ($metadata[areas] as $area_name) {  
         $area_metadata = $metadata[area][$area_name];  
         $http_arg_key = $area_metadata[query_arg];  
         if (in_array($http_arg_key, array_keys($request_raw))) {  
           $request_mapped[$area_name] = $request_raw[$http_arg_key];  
         }  
       }  
       
102      // trace      // trace
103        //print Dumper($request_mapped);        //print Dumper($request_mapped);
104        //exit;        //exit;
105            
     /*  
       
     // set default identifier if still empty  
       if ($page_ident = $this->request['ap']) {  
         $this->_pageIdent = $page_ident;  
   
       } elseif ($topic_ident = $this->request['t']) {  
         $this->_topicIdent = $topic_ident;  
   
       } else {  
         $this->_pageIdent = 'overview';  
         $this->_topicIdent = '';  
       }  
   
       //print "ident: " . $this->_pageIdent . "<br>";  
         
     */  
       
106      // 2. rule it! mungle request through dispatching rules - lambda-style callbacks      // 2. rule it! mungle request through dispatching rules - lambda-style callbacks
107      $results = array();      $results = array();
108      foreach ($this->_rules as $rule) {      foreach ($this->_rules as $rule) {
109        //$in = array();        //$in = array();
110        $in = $request_mapped;        $in = $request_translated;
111        $out = array();        $out = array();
112        call_user_func($rule, &$in, &$out);        call_user_func($rule, &$in, &$out);
113        array_push($results, array( in => $in, out => $out));        array_push($results, array( in => $in, out => $out));
# Line 124  class Application_Request_HttpController Line 121  class Application_Request_HttpController
121      $final = array();      $final = array();
122      foreach ($results as $result) {      foreach ($results as $result) {
123        //print Dumper($result[out]);        //print Dumper($result[out]);
124        $final = array_join_merge($final, $result[out]);        $final = php::array_join_merge($final, $result[out]);
125      }      }
126            
127      // trace      // trace
128        //print Dumper($final);        //print "final: " . Dumper($final);
129        //exit;        //exit;
130            
131      return $final;      return $final;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

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