Forums / Developer / Login / Editing objects with AJAX

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

eZ debug

Timing: Jan 31 2025 09:15:32
Script start
Timing: Jan 31 2025 09:15:32
Module start 'content'
Timing: Jan 31 2025 09:15:32
Module end 'content'
Timing: Jan 31 2025 09:15:32
Script end

Main resources:

Total runtime0.2723 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.9297180.8359
Module start 'content' 0.00600.0081 768.7656106.0078
Module end 'content' 0.01410.2581 874.7734534.5469
Script end 0.2722  1,409.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00331.1972200.0002
Check MTime0.00120.4558200.0001
Mysql Total
Database connection0.00070.249010.0007
Mysqli_queries0.220981.13611410.0016
Looping result0.00120.45391390.0000
Template Total0.257894.710.2578
Template load0.00070.260110.0007
Template processing0.257094.401210.2570
Override
Cache load0.00050.177410.0005
Sytem overhead
Fetch class attribute can translate value0.00100.372810.0010
XML
Image XML parsing0.00040.139210.0004
General
dbfile0.01053.8744200.0005
String conversion0.00000.001530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs