ajax front attribute edit

Author Message

Mickael Robin

Tuesday 25 November 2008 8:43:41 am

Hi,

I just began to discover Ajax and really appreciate the eZ Xajax extension (http://projects.ez.no/ezxajax) that enables to use ajax based extensions such as :
http://projects.ez.no/ezxajax_classattribute
http://ez.no/developer/contribs/applications/star_rating

Working on a "productive web application" projet, I was wondering if someone has already managed to <b>let users edit attributes of an existing content from the "view" view and with Ajax</b> (ie. without reloading the page...)?

For example, changing the value of a "status" attribute (selection datatype) from "to do" to "done" or changing the value of the "name" attribute (text line datatype) after a simple double click...

Thanks in advance for sharing code or ideas :-)

André R.

Tuesday 25 November 2008 1:20:28 pm

Some rough code for something like that supporting most simple datatypes:
http://svn.projects.ez.no/ezcore/trunk/ezcore/modules/ezcore/attribute_edit.php

Post with you preferred js library to this url:
<ezp-www-dir>/ezcore/attribute_edit/<object_id>/<attribute_identifier>/<attribute_value>

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

Mickael Robin

Wednesday 26 November 2008 7:22:19 am

Thanks a lot Andre for your answer(s). It will definitely help on the php side.

Now, I need to figure out how to generate and post this url with Ajax so that my page does not refresh when the form is submited.

Do you think the simplest way is to use eZ Xajax ( I'm already waiting for help from this thread : http://projects.ez.no/index.php//ezxajax/forum/general/how_to_pass_variable_from_js_to_php ) or to use another JS library?

Cheers

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

eZ debug

Timing: Jan 18 2025 15:51:41
Script start
Timing: Jan 18 2025 15:51:41
Module start 'layout'
Timing: Jan 18 2025 15:51:41
Module start 'content'
Timing: Jan 18 2025 15:51:43
Module end 'content'
Timing: Jan 18 2025 15:51:43
Script end

Main resources:

Total runtime1.4852 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 587.9063152.6250
Module start 'layout' 0.00470.0024 740.531339.4453
Module start 'content' 0.00711.4765 779.9766535.9063
Module end 'content' 1.48360.0016 1,315.882812.1641
Script end 1.4851  1,328.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2080160.0002
Check MTime0.00130.0902160.0001
Mysql Total
Database connection0.00070.046010.0007
Mysqli_queries1.438296.8355570.0252
Looping result0.00060.0400550.0000
Template Total1.455598.020.7278
Template load0.00200.137520.0010
Template processing1.453597.863520.7267
Template load and register function0.00090.062510.0009
states
state_id_array0.00090.063810.0009
state_identifier_array0.00140.096120.0007
Override
Cache load0.00170.1132210.0001
Sytem overhead
Fetch class attribute can translate value0.00070.047120.0003
Fetch class attribute name0.00170.115240.0004
XML
Image XML parsing0.00060.039020.0003
class_abstraction
Instantiating content class attribute0.00000.000740.0000
General
dbfile0.00100.0672170.0001
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs