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

eZ debug

Timing: Jan 19 2025 00:10:31
Script start
Timing: Jan 19 2025 00:10:31
Module start 'content'
Timing: Jan 19 2025 00:10:32
Module end 'content'
Timing: Jan 19 2025 00:10:32
Script end

Main resources:

Total runtime1.1769 sec
Peak memory usage4,096.0000 KB
Database Queries200

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 587.7344180.8281
Module start 'content' 0.00611.0026 768.5625570.3906
Module end 'content' 1.00870.1682 1,338.9531337.3672
Script end 1.1769  1,676.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00520.4376210.0002
Check MTime0.00180.1555210.0001
Mysql Total
Database connection0.00060.049410.0006
Mysqli_queries1.078791.65442000.0054
Looping result0.00300.25821980.0000
Template Total1.139096.820.5695
Template load0.00430.369420.0022
Template processing1.134696.403520.5673
Template load and register function0.00010.007510.0001
states
state_id_array0.00150.130310.0015
state_identifier_array0.00080.066120.0004
Override
Cache load0.00390.3312390.0001
Sytem overhead
Fetch class attribute can translate value0.00260.223030.0009
Fetch class attribute name0.00110.093270.0002
XML
Image XML parsing0.00150.125030.0005
class_abstraction
Instantiating content class attribute0.00000.0021100.0000
General
dbfile0.00550.4673330.0002
String conversion0.00000.000730.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0007 secs