[horde] Question about Ajax.Request
Mike Poznecki
poz_sa at yahoo.com
Thu Apr 12 14:34:33 UTC 2018
On Wednesday, April 11, 2018, 12:56:53 AM CDT, Ralf Lang <lang at b1-systems.de> wrote:
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 orhttps://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
Thanks Ralf, this helped a bunch.I was able to create a Handler in /imp/lib/Ajax/Application/Handler/and call if from /imp/js/contacts.js using HordeCorde.doAction.My handler is able to $injector.getInstance() on my file in /imp/lib/BUT, my file in /imp/lib still cannot connect to my sqlite database.Can you please tell me how to connect to the database?
More information about the horde
mailing list