CreateCopyFunction
From Wikipedia
I just wanted to give you a short notice that it is very easy to include a copy function to modules which are based on the module designer.
As an example you can look at projects_forms.php and projects_data.php Unfortunately as baer is down its not in the cvs yet but it will be asap.
In order to implement the copy function all you really have to do is call the old project(or whatever module you are using) again when hitting the copy button and unset the ID as soon as the fields array is build. That way you can see the values of the old project, but it is treated as a new one and as soon as you hit the "OK" button the project is saved as a new project. In order to avoid confusion one should rename the old title to "copy old title".
You can achieve that by following these steps:
1.Forms: 1.1 include a "copy" button in the forms which calls the _data.php script For example: $buttons[] = array('type' => 'submit', 'name' => 'copy', 'value' => __('copy'), 'active' => false); 1.2. include this line before the tabs area is build/ displayed to unset the ID if necessary: $ID=prepare_ID_for_copy($ID,$copy);
2. Data: 2.1. When you handle the post data, check if "copy" is set (or whatever name the "copy" button has) 2.2 In case it is set: rename the title by including this line (in which "name" is the db_field where the title for the project is stored, please replace that with the according field name if you are using another module) and make sure you include the "_forms.php" script at the end of your _data.php script: $fields = change_fields_for_copy($fields,'name');
Nina

