Forums / Setup & design / ezpublish edit button for frontend editing of content items

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

eZ debug

Timing: Jan 17 2025 22:58:37
Script start
Timing: Jan 17 2025 22:58:37
Module start 'content'
Timing: Jan 17 2025 22:58:39
Module end 'content'
Timing: Jan 17 2025 22:58:39
Script end

Main resources:

Total runtime1.4757 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.0082 587.9688180.8047
Module start 'content' 0.00821.3433 768.7734563.8203
Module end 'content' 1.35150.1241 1,332.5938337.3359
Script end 1.4756  1,669.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.2701210.0002
Check MTime0.00140.0938210.0001
Mysql Total
Database connection0.00110.073010.0011
Mysqli_queries1.400194.87672000.0070
Looping result0.00190.13201980.0000
Template Total1.439697.620.7198
Template load0.00230.152920.0011
Template processing1.437397.398320.7187
Template load and register function0.00010.007610.0001
states
state_id_array0.00100.068110.0010
state_identifier_array0.00350.237320.0018
Override
Cache load0.00180.1244320.0001
Sytem overhead
Fetch class attribute can translate value0.00130.089730.0004
Fetch class attribute name0.00090.058460.0001
XML
Image XML parsing0.00220.149730.0007
class_abstraction
Instantiating content class attribute0.00000.000970.0000
General
dbfile0.00800.5437270.0003
String conversion0.00000.000430.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/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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs