[dev] [horde] Question about Ajax.Request

Ralf Lang lang at b1-systems.de
Wed Apr 11 05:56:43 UTC 2018


Ralf Wrote:

> Call HordeCore.doAction() from the client. doAction adds
> security/authentication related stuff to your bare ajax call.
>
> It will call $app/lib/Ajax/Application/ and, implicitly, a Handler. The
> handler needs to have a method name corresponding to the command used in
> doAction. Return an array/hash of serializable data and doAction will
> receive a JSON structure including this data.
>
> I think there is a horde wiki entry explaining this ajax mechanism in
> detail.
>

Mike responded,
>
> I have tried to do it that way, but have been unable to figure out
> what all needs to be done to make that work.
> There is very little documentation for developers on Horde.
>
>
>
I see room for improvement here ;-)

@Marc Unger, can you please read the docs provided in this mail and
update / rewrite https://wiki.horde.org/Doc/Dev/HordeAjaxApplications so
that it is straightforward usable as a tutorial? You can break out into
a sub page if it gets too lengthy.
  

See https://github.com/ralflang/horde-boneyard or
https://github.com/horde/ansel/blob/master/lib/Ajax/Application/Handler.php
for a demo or

https://wiki.horde.org/Doc/Dev/HordeAjaxApplications
https://wiki.horde.org/Doc/Dev/HordeAjaxApplications/Example

for instructions

You basically issue HordeCore.doAction(action, params, opts) in js, this
in turn (via steps omitted here)
calls $App_Ajax_Application in $App/Ajax/Application.php
See example
https://github.com/horde/ansel/blob/master/lib/Ajax/Application.php

The _init function basically loads one or more handler classes which
provide actions
I never really grasped the "Imple" concept, you most likely won't need
it for new code.

A Handler extends Horde_Core_Ajax_Application_Handler and is a
collection of methods which have no parameters and return either a
string (html) or a Horde_Core_Ajax_Response object or an array structure
which gets turned to a json

https://github.com/horde/ansel/blob/master/lib/Ajax/Application/Handler.php


-- 
Ralf Lang
Linux Consultant / Developer
Tel.: +49-170-6381563
Mail: lang at b1-systems.de
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537



More information about the dev mailing list