ezpublish edit button for frontend editing of content items

Author Message

nicholas king

Monday 07 March 2011 8:33:39 am

Hello all, i have a question about frontend editing of content objects within a page.

currently i have this template

"

{def $current_user=fetch( 'user', 'current_user' )}{if $current_user.contentobject.can_edit|eq(true)}<a href="/content/edit/{$active_node.contentobject_id}/">[edit]</a>

"

which allows for a edit button to be displayed next to content objects on a page. This gets around some of the shortcomings of the ezwebtoolbar which only allows editing of the current node.

My question however is this, when someone edits the items using this button they are redirected back to / instead of the node from where they clicked the button. I have tried mimicking the the way the webtoolbar does editing through a web form, but still it redirects back to the / page. Any ideas on how to get the editor to redirect back to the page the button was clicked from.

Thanks

Nicholas

Frédéric DAVID

Tuesday 08 March 2011 3:21:47 am

Hi,

to override publish redirection, you can add a hidden button in your edit form.

<input type="hidden" name="RedirectURIAfterPublish" value="your_custom_url" />

You have the same for discard. The button name will be RedirectIfDiscarded

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

nicholas king

Tuesday 08 March 2011 6:26:27 am

Hello Frederic,

I have tried this and it still redirects back to /

currently i have this code

<form method="post" action="/content/action" class="left">
<input type="hidden" name="ContentLanguageCode" value="eng-GB" /> <input type="image" src="/extension/ezwt/design/standard/images/websitetoolbar/ezwt-icon-edit.gif" name="EditButton" title="Edit:{$active_node.data_map.name.content}" /> <input type="hidden" name="HasMainAssignment" value="1" /> <input type="hidden" name="ContentObjectID" value="{$active_node.contentobject_id}" /> <input type="hidden" name="NodeID" value="{$active_node.node_id}" /> <input type="hidden" name="ContentNodeID" value="{$active_node.node_id}" /> <input type="hidden" name="ContentObjectLanguageCode" value="eng-GB" /> <input type="hidden" name="RedirectURIAfterPublish" value="{$active_node.path_identification_string}" /> <input type="hidden" name="RedirectIfDiscarded" value="{$active_node.path_identification_string}" /> </form>

Frédéric DAVID

Tuesday 08 March 2011 8:41:14 am

I think your form is wrong.

When you edit a objet ( content/edit ), the form action is content/edit, and not content/action like your example.

You have to do the change in your template template/content/edit.tpl ( override the template is the best way )

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

nicholas king

Wednesday 09 March 2011 2:28:36 am

Hello Frederic i have tried as you have suggested and still no success :-(, the page still redirects back to the home page. I don't really want to create a override template as the button i have created is already in wide use i would rather ammend my current template with the solution.

Thanks

Nicholas

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 02:05:03
Script start
Timing: Jan 18 2025 02:05:03
Module start 'layout'
Timing: Jan 18 2025 02:05:03
Module start 'content'
Timing: Jan 18 2025 02:05:04
Module end 'content'
Timing: Jan 18 2025 02:05:04
Script end

Main resources:

Total runtime0.6693 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.2891152.6563
Module start 'layout' 0.00650.0032 741.945339.5156
Module start 'content' 0.00970.6586 781.4609558.7109
Module end 'content' 0.66830.0010 1,340.171916.0938
Script end 0.6693  1,356.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4558160.0002
Check MTime0.00130.1872160.0001
Mysql Total
Database connection0.00060.089910.0006
Mysqli_queries0.619492.5411630.0098
Looping result0.00040.0643610.0000
Template Total0.640295.620.3201
Template load0.00210.315120.0011
Template processing0.638195.331920.3190
Template load and register function0.00010.015910.0001
states
state_id_array0.00100.156110.0010
state_identifier_array0.00070.106720.0004
Override
Cache load0.00180.2680320.0001
Sytem overhead
Fetch class attribute can translate value0.00070.106320.0004
Fetch class attribute name0.00090.128760.0001
XML
Image XML parsing0.00070.106820.0004
class_abstraction
Instantiating content class attribute0.00000.002070.0000
General
dbfile0.00080.1256160.0001
String conversion0.00000.001840.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs