Login / Editing objects with AJAX

Author Message

Jérôme Vieilledent

Friday 29 August 2008 5:52:06 am

Hello

I would like to know if it was possible to login to eZPublish and edit content objects via AJAX and/or webservices... Indeed, I would like to allow my visitors to edit comments without having to display a dedicated page for the form (for example with a DIV fading in the page of the current viewed article).
Moreover, I plan to develop a webapp (or native Application like Wordpress has) for iPhone allowing contributors to manage content of their website on the iPhone. But I wonder how eZPublish can manage publishing this way...
Any idea ?

Thanks

Marco Zinn

Saturday 30 August 2008 3:06:26 am

Hi Jérôme,

as far as i know, ezPublish has a build-in SOAP server, so it should be possible to create an extension providing a webservice for editing object (or: creating comment objects, in your case).
But, if your client as a webbrowser, i guess, it's much easier to create an eZ publish template, which fits your need.
If i understand you right, you want to have a "comment box" inside the normal "view" template. I think, this should be possible by merging the "content/view/full" template with the "content/edit" template.
That is: insert the form of the edit template of the "comment" class into the "full view" template of the article/folder/product/whatever-template.

Just a wild guess, but that would be my approach.

Marco
http://www.hyperroad-design.com

André R.

Saturday 30 August 2008 3:27:40 pm

That is: insert the form of the edit template of the "comment" class into the "full view" template of the article/folder/product/whatever-template.

You'll need a custom view for that as well, the normal content/edit view creates a draft on every view so wouldn't work in this setting.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Paul Borgermans

Monday 01 September 2008 2:12:17 am

Not really Ajax, but it avoids the creation of drafts when displaying a form:

http://projects.ez.no/powercontent

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Jérôme Vieilledent

Monday 01 September 2008 2:31:31 am

Thanks all for your replies :-)
Wouldn't it be easier if I called the content/edit view via AJAX ? I mean, for example a user clicks on "New comment" button which makes appear the comment box in javascript. The JS code then makes an AJAX call to display the right form... Of course I should first make an override rule for the pagelayout so that only the form would appear.
But what if the user closes the window without clicking on the Cancel button ? Is there a cronjob to clean the empty drafts ?

Paul Borgermans

Monday 01 September 2008 2:39:51 am

With the powercontent contrib, you won't have an empty draft. Ajaxify this mechanism would be a good option, but you can already have the quick comment form with some DHTML operating on a display attribute

Hth
Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Jérôme Vieilledent

Monday 01 September 2008 3:06:34 am

If I understand well this extension, I just have to "prepare" my comment form in a hidden DIV, for example with the help of the <i>powercontent_attribute_create_gui</i> function.
My form doesn't submit to <i>/content/action</i> any more, but to <i>/powercontent/action</i>.
Then when the user clicks on the submit button, the comment will automatically be published ? If so, it's exactly what I need :-)

About the SOAP API, is there a place where I can find up-to-date documentation ?

Xavier Dutoit

Tuesday 02 September 2008 1:15:51 pm

Hi,

that's exactly the way it works indeed.

There is an option (hidden field) to automatically publish the content, don't forget to set it so you can come back to the page.

X+

P.S. You will have problems with spams, and some captcha extensions don't work with powercontent... ended up dirty tweeking, but might be a better option out there.

http://www.sydesy.com

Jérôme Vieilledent

Monday 08 September 2008 8:03:14 am

You will have problems with spams, and some captcha extensions don't work with powercontent... ended up dirty tweeking, but might be a better option out there.

In my case, only registered users would be able to post comments, so I think this extension exactly suits my needs :-)

Gaetano Giunta

Friday 18 June 2010 6:10:46 am

@Jerome: take a look at ezwebservicesapi

Principal Consultant International Business
Member of the Community Project Board

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.