Single click copy then edit?

Author Message

Brendan Pike

Monday 26 March 2007 11:30:25 pm

I want to enable users to with a single click, create a copy of an object and then place them immediately in edit mode of the newly copied object. I want to do this within the templates if possible.

I succeeded in the copy part by placing the copy button within its own form and holding the required values for example:

<form action="/content/copy" method="post">
<input type="hidden" name="ObjectID" value="30707" />
<input type="hidden" name="BrowseActionName" value="CopyNode" />
<input class="button" name="SelectButton" value="Select" type="submit">
<input type="hidden" name="SelectedNodeIDArray[]" value="1543">
</form>

But to place the user in edit mode is more difficult, I don't think I can use the usual RedirectURI function because I don't yet know the NodeID of the object that will be created. I briefly tested the new BackToEdit checkbox that can be enabled in the admin side but I think it only works once already in edit mode.

So can this be done, or if it can't is there a way I can alter the name of the new object so it can be easily identified as the copy and not the original?

Thanks

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Ɓukasz Serwatka

Tuesday 27 March 2007 12:09:12 am

This is not supported by default. Copy is finalized with publish operation, so It should be possible to run after-publish workflow event that redirects user to edit mode after copy, then you can have new node/object ID, etc. You can give a try.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Brendan Pike

Thursday 29 March 2007 9:40:41 pm

Thanks for your reply Luke

If I was to use a work to throw a user immediately into edit mode after making a copy how would that workflow distinguish between a normal publish object and a fresh copy?

Also any idea's about how to rename or make the copied object easy to identify?

Cheers

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Kristof Coomans

Thursday 29 March 2007 11:37:14 pm

Hi Brendan

You can also redirect to edit mode with a small hack in kernel/content/copy.php:

Replace

return $Module->redirectToView( 'view', array( 'full', $newParentNodeID ) );

with

return $Module->redirectToView( 'edit', array( $newObject->attribute( 'id' ) ) );

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

James Ward

Friday 25 April 2008 9:28:59 am

Kristof,
You are the man. I can't tell you how much time this saved me. Hack works great in ez3.10.

working at www.wardnet.com
blogging at www.jamesward.ca

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 19 2025 00:13:11
Script start
Timing: Jan 19 2025 00:13:11
Module start 'layout'
Timing: Jan 19 2025 00:13:11
Module start 'content'
Timing: Jan 19 2025 00:13:12
Module end 'content'
Timing: Jan 19 2025 00:13:12
Script end

Main resources:

Total runtime1.1727 sec
Peak memory usage4,096.0000 KB
Database Queries67

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 587.9141152.6250
Module start 'layout' 0.00650.0037 740.539139.4453
Module start 'content' 0.01021.1609 779.9844645.0313
Module end 'content' 1.17110.0016 1,425.015616.1641
Script end 1.1726  1,441.1797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.3279160.0002
Check MTime0.00150.1249160.0001
Mysql Total
Database connection0.00160.132910.0016
Mysqli_queries1.106894.3809670.0165
Looping result0.00080.0663650.0000
Template Total1.139397.220.5696
Template load0.00190.159220.0009
Template processing1.137496.993520.5687
Template load and register function0.00020.021010.0002
states
state_id_array0.00160.139610.0016
state_identifier_array0.00090.078720.0005
Override
Cache load0.00160.1329290.0001
Sytem overhead
Fetch class attribute can translate value0.00060.053940.0002
Fetch class attribute name0.00160.136080.0002
XML
Image XML parsing0.00390.332240.0010
class_abstraction
Instantiating content class attribute0.00000.001580.0000
General
dbfile0.00360.3037300.0001
String conversion0.00000.000940.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
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/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: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs