Forums / Developer / Single click copy then edit?

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

eZ debug

Timing: Jan 18 2025 20:55:32
Script start
Timing: Jan 18 2025 20:55:32
Module start 'content'
Timing: Jan 18 2025 20:55:33
Module end 'content'
Timing: Jan 18 2025 20:55:33
Script end

Main resources:

Total runtime0.9521 sec
Peak memory usage4,096.0000 KB
Database Queries204

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 587.7109180.8359
Module start 'content' 0.00780.7934 768.5469650.1094
Module end 'content' 0.80130.1508 1,418.6563337.0625
Script end 0.9521  1,755.7188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4263210.0002
Check MTime0.00140.1515210.0001
Mysql Total
Database connection0.00090.098610.0009
Mysqli_queries0.862790.60662040.0042
Looping result0.00230.23672020.0000
Template Total0.921896.820.4609
Template load0.00200.215120.0010
Template processing0.919796.599320.4599
Template load and register function0.00020.016910.0002
states
state_id_array0.00140.149910.0014
state_identifier_array0.00150.159920.0008
Override
Cache load0.00170.1793290.0001
Sytem overhead
Fetch class attribute can translate value0.00150.162350.0003
Fetch class attribute name0.00120.128980.0002
XML
Image XML parsing0.00310.329350.0006
class_abstraction
Instantiating content class attribute0.00000.001480.0000
General
dbfile0.00961.0081410.0002
String conversion0.00000.001030.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
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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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