[dev] Ajax on Horde

Ralf Lang lang at b1-systems.de
Fri Oct 13 11:13:23 UTC 2017


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

see services/ajax.php

The intended command is divided into an "app" part and an "action" part.
The app's corresponding ajax_application class is instanciated and the 
"action" is triggered upon it. I haven't tried now but it should be able 
to call other apps' methods.

For robustness, your code should be aware of the possibility that some 
other app is currently not active and give some meaningful response, for 
example a horde_notification or a redbox with info on what to do now. Or 
handle it gracefully be turning off features.

The other option is to call create handlers to call out to other 
application's public api.

$registry->call('thisapp/thataction', $params)

There are also some predefined handlers which can be registered.

https://dev.horde.org/api/master/lib/Core/class-Horde_Core_Ajax_Application_Handler_Chunk.html

https://dev.horde.org/api/master/lib/Core/class-Horde_Core_Ajax_Application_Handler_Email.html

https://dev.horde.org/api/master/lib/Core/class-Horde_Core_Ajax_Application_Handler_Groups.html

https://dev.horde.org/api/master/lib/Core/class-Horde_Core_Ajax_Application_Handler_Imple.html

https://dev.horde.org/api/master/lib/Core/class-Horde_Core_Ajax_Application_Handler_Noop.html

https://dev.horde.org/api/master/lib/Core/class-Horde_Core_Ajax_Application_Handler_Prefs.html

In theory, you might be able to also register handlers which belong to 
another app. In practice, this will probably fail if the corresponding 
app's setup depends on some resources your app does not provide.



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