Forums / General / button to be coded: save and new item, using copy of previous entry

button to be coded: save and new item, using copy of previous entry

Author Message

Hardy Pottinger

Tuesday 24 February 2004 8:39:06 pm

We're coding a project that will implement a sort of database using eZPublish 3.3 as a base. We've set up a custom class, and it does most of what we want to do, but we have a spec that will likely require us to alter some code... and I wanted some input on the best way to approach it. Ideally, I'd like for us to code in a way that will have minimal impact on future upgradeability (we're still running a major site with a heavily modified version of a 2.2.1 installation... and I don't want to go there again if I don't have to).

We need a button which will save a new entry, and then create a new entry, already populated with data from the previous entry.

Can this be done without modifying the kernel?

Thanks for whatever guidance you can provide!

Hardy Pottinger

Wednesday 25 February 2004 11:12:50 pm

An update, I managed to sort of get what I want with a one-line entry in an overide form for this particular class (design/foobar/override/templates/edit_foobar_entry.tpl). I just drop this in the form with the buttons at the end of the template:

<input type="checkbox" name="RedirectURI" value={concat("/content/copy/",$object.id,"/")} /> save and copy

If you check the box and click submit, you save the original entry and are then redirected to the "do you want the current version or all versions?" intermediate page of the copy process, which is silly, at least in this case... But at least I'm close.

Anyone have any ideas of how to skip this intermediate copy screen? I've tried hard-coding some GET parameters, but it looks like that's not going to work.

If I figure it out first I'll let you know.