Forums / Developer / Edit content from the view module?

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