Edit content from the view module?

Author Message

Nathan Kelly

Wednesday 28 February 2007 12:03:19 am

Hi,

is this possible?

I want my Admins and Editors to be able to edit certain attributes of an object directly from the view module... To explain:

I have a news article and the editor decides that this article has graced the main news page for long enough, so he decides the article should be archived, if he edits the article he can check the (custom) [archive_article] checkbox in the Admin interface.

This works as expected but it took 4 steps to achieve, one to login to Admin, two to find and select the article from the content tree, three to edit the article and select the archive option and four to re publish the article, all of which can be done from the front end but it still requires more steps than it should (2). It seems this can be done in on step if it's possible to edit an attribute from the view module (check the box, click save, done).

What I want to be able to do is simple in theory but I'm not sure if it's doable? I want the archive checkbox to be present on the node view with a save button right next to it:

[x] Archive [Save]

This way an editor can simply check the box and hit save and the article is now archived, no extra steps needed and he just saved 2 minutes of valuable time, additionally I'd like to extend this functionality to other objects and attributes where needed (blog comment removal etc...).

Is there any way to do this? I have tried a few things, like I can get the {attribute_edit_gui} to show the attribute but the form action is obviously the key to making this work, and I'm not sure what form action to use or if the edit action will even work from the view module?

Can anyone give me an idea of how I might accomplish this?

Cheers!

Pardon me while I burst into flames...

Xavier Dutoit

Wednesday 28 February 2007 12:07:27 am

You create an extension and create a ajax function to handle it.

Shouldn't be too complicated if you've coded php with ez. Have a look at the xajax extension.

X+

http://www.sydesy.com

Nathan Kelly

Wednesday 28 February 2007 12:27:34 am

Aaahhh,

I'm finding that posting a question on the forum usually answers the question for you the second you click the post button.

I worked it out, so never mind me... Just pretend you didn't see this!

I'll post my solution once it's fine tuned!

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Wednesday 28 February 2007 12:48:54 am

Hmm maybe I spoke too soon...

The versioning system is getting in the way, I can check the box and click save but then I have to select which version I want to edit, it won't let me edit the current version, no, I have to copy it and save it then edit it... OMG it's an on/off attribute why would I need versions?

Ok thanks for the idea X, I think I'll give xajax a whirl, it's already in use on the site so it shouldn't be too hard to set it up to do this.

Cheers!

Pardon me while I burst into flames...

Xavier Dutoit

Wednesday 28 February 2007 1:37:28 am

Hi,

Well, you have two versions, one checked the other unchecked, it makes sense to me...

Feel free to share your result about the ajax thing...

X+

http://www.sydesy.com

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 31 2025 06:26:41
Script start
Timing: Jan 31 2025 06:26:41
Module start 'layout'
Timing: Jan 31 2025 06:26:41
Module start 'content'
Timing: Jan 31 2025 06:26:41
Module end 'content'
Timing: Jan 31 2025 06:26:41
Script end

Main resources:

Total runtime0.0130 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.1406151.2109
Module start 'layout' 0.00450.0021 739.351636.6641
Module start 'content' 0.00670.0049 776.015694.1875
Module end 'content' 0.01160.0014 870.203137.9922
Script end 0.0130  908.1953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002519.0730140.0002
Check MTime0.00128.9331140.0001
Mysql Total
Database connection0.00075.232010.0007
Mysqli_queries0.001813.612130.0006
Looping result0.00000.084210.0000
Template Total0.00118.610.0011
Template load0.00085.968210.0008
Template processing0.00032.620610.0003
Override
Cache load0.00064.270610.0006
General
dbfile0.00118.326980.0001
String conversion0.00000.053140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

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

Time used to render debug report: 0.0001 secs