[commits] [Wiki] changed: Doc/Dev/HordeAjaxApplications

Wiki Guest wikiguest at horde.org
Tue Aug 6 18:05:20 UTC 2013


guest [86.56.18.115]  Tue, 06 Aug 2013 18:05:20 +0000

Modified page: http://wiki.horde.org/Doc/Dev/HordeAjaxApplications
New Revision:  8
Change log:  Remove Horde Controller

@@ -102,71 +102,8 @@
  extends Horde_Core_Ajax_Application_Handler

  Seems like the difference between Horde 5 and Horde 4 is that each  
action has its own Handler class rather than a methods in the  
$App_Ajax_Application class?

-
-++ Horde_Controllers
-
-Horde Controllers seem to be somewhat independent from the stuff  
described above
-Controllers need Horde_Routes and need rewrite rules
-
-Ajax application controllers do not live in lib but in
-$app/app/controllers/
-
-Example:
-
-class Nag_CompleteTask_Controller in nag/app/controllers/CompleteTask.php
-<code>
-<?php
-class Nag_CompleteTask_Controller extends Horde_Controller_Base
-{
-    public function processRequest(Horde_Controller_Request $request,  
Horde_Controller_Response $response)
-    {
-        /* Toggle the task's completion status if we're provided with a
-         * valid task ID. */
-        $requestVars = $request->getRequestVars();
-        if (isset($requestVars['task']) && isset($requestVars['tasklist'])) {
-            $nag_task = new Nag_CompleteTask();
-            $result = $nag_task->result($requestVars['task'],  
$requestVars['tasklist']);
-        } else {
-            $result = array('error' => 'missing parameters');
-        }
-
-        $requestVars = $request->getGetVars();
-        if (!empty($requestVars['format']) &&
-            $requestVars['format'] == 'json') {
-            $response->setContentType('application/json');
-            $response->setBody(json_encode($result));
-        } elseif ($requestVars['url']) {
-            $response->setRedirectUrl($requestVars['url']);
-        }
-    }
-}
-?>
-</code>
-
-
-
-A Horde Controller based app needs a config/routes.php file.
-
-For example
-<code>
-<?php
-/**
- * Setup default routes
- */
-$mapper->connect('/t/complete',
-    array(
-        'controller' => 'CompleteTask',
-    ));
-?>
-</code>
-
-defines a route for a call like www.myhorde.de/nag/t/complete to be  
handled by the CompleteTask controller seen above.
-
-The endpoint script is horde/rampage.php  - rampage.php currently  
seems to handle only authenticated calls.
-
-The controller is passed the request (in this case, a json request)  
and handles it (with a json answer in this case)

  ++ Client side js infrastructure
  important hordecore.js HordeCore class methods:
  * doAction(action, params, opts) - client side method for ajax  
requests against Horde_Ajax_Application



More information about the commits mailing list