Re: Ajax on Horde
Sebastian Birnbach <[email protected]> Fri, 13 Oct 2017 12:34:58 +0200
| Newsgroups | gmane.comp.horde.devel |
|---|---|
| Message-ID | <CACTNBFM71MoYBytJX0B6LXL5DXDE--GdSnaLuYKVuV7ecZ7f-Q@mail.gmail.com> |
2017-10-13 10:16 GMT+02:00 Ralf Lang <[email protected]>: > 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: [email protected] > B1 Systems GmbH > Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de > GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 > -- dev mailing list Frequently Asked Questions: http://wiki.horde.org/FAQ To unsubscribe, mail: [email protected]