[dev] Ajax on Horde

Sebastian Birnbach birnbacs at gmail.com
Fri Oct 13 10:34:58 UTC 2017


2017-10-13 10:16 GMT+02:00 Ralf Lang <lang at b1-systems.de>:

> Am 11.10.2017 um 09:33 schrieb Sebastian Birnbach:
>
>> Not much is known about Horde's way to do Ajax. The doc on
>> https://wiki.horde.org/Doc/Dev/HordeAjaxApplications seems to be a bit
>> wobbly and is at least partly outdated.
>>
>> I seek to understand the very basic exchange of information between a
>> client side document and a server side class. Looking into Horde is often
>> like looking into a live organism: too many things going on at the same
>> time to understand an isolated feature.
>>
>> On my own I came about this far:
>>
>> * <app> registers an Ajax handler in <app>/lib/Ajax/Application.php:
>> class IMP_Ajax_Application extends Horde_Core_Ajax_Application{
>>    $this->addHandler(Some_Path_To_Class);
>>   }
>>
>> * <app>/lib/Some/Path/To/Class.php defines the processing code:
>> class IMP_Ajax_Application_Handler_Draft extends
>> Horde_Core_Ajax_Application_Handler{
>>   public function foo() {return "hello world"}
>> }
>>
>> * <app>/js/<app>.js defines a variable that contains a function that
>> eventually calls doAction(action, params, opts)
>> [this bit is unclear to me]
>>
>
> doAction is part of HordeCore js and basically wraps an ajax call to an
> endpoint in /services/, which in turn instanciates
> Horde_Core_Ajax_Application (or rather a class derived from it) and calls
> the method in PHP. It then provides the result in js land to be processed
> by a callback.
>
> doAction also transparently handles tokens to secure the communication
> against XSS.
>
> I've done some steps to use a promise-based substitute of doAction, but
> it's not ready for upstream yet. Due to personal topics, time is very
> limited at the moment.
>

@Luis: thanks again for the working sample
@Ralf: thanks for the clarification. No need to hurry in changing
HordeAjax, I am quite happy shooting at a non-moving target.

>From what I read Horde will return the response of a class to the Ajax
caller.
It is therefore not possible to have the client in application A talk back
to a server side class of application B, right?


>
>
>
> --
> 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