What do you mean by page? Do you mean the whole page or just the contents (no navigation, no menues, etc). If just the contents are you looking to copy node page content (content based on story, page or other content you add with 'create content'), a list of content, or something else?
Here is a copy of a module I wrote sometime ago to clone a node and have updated for 4.7. Make a directory under modules called clone, and place the code below in a file called clone.module. Enable the module. If people have permission a new link will be added labeled clone. Click the link and the node will be copied and the user placed on the edit page for the copy.
This is should be very useful for most content, but I'm not sure it will work with webform- has anyone tried it yet? I think webform creates new tables where each field has a new ID, so I'm wondering if the "cloned" webform will have new entries in that table, or still point to the original ones?
Also, is this module in the contrib download area? Seems like there could be a potential problem with the last command, if the user has the "clone" permission, but not permission to edit that node type?
to answer my own question, it seems to work OK with webform. The component ID (cid) values are the same in the database, but since the nid values are different the modules seems able to distinguish the data as belonging to different forms.
Are you using some internal form generation utility/module?
I had some pre-existing forms from before I went to Drupal, and I can just cut and paste their code right into the content area for a regular old page/node and they still work fine (provided their cgi/php/pl file is still accessable and properly permissioned (sp?) :)
I haven't bothered using the integrated form modules or whatever cuz there is no way its going to be as good/useful as the solution I already use...
Please test it out. The "clone" link now appears as a tab when viewing a page. Also, it now resets the path and menu settings for the copied node to avoid overwriting the alias or menu placment of the original node.
I don't have flexinode or CCK installed, so I don't know whether this will work correctly with those content types.
Also, right now there is no check that the user can auctally edit the node that they copy- in some cases this may be OK, but in others may cause problems.
I just tried this to translate my form.
But as you said the fields are the same in every nodes. Then translating the name of a field in one form change the name in all others.
You made good job but not what I would like to have. That's very common with CMS.
Ronan
I had wondered if there would be side efffects of having the same component IDs. I'm guessing this wold affect custom theming of forms as well.
I don't think there is an easy way around this without special casing webform in the code. Probably just have to generate now component IDs when the clone is generated. Not a hard task if it's important to you.
That is not so important for me. I think it would be quicker to make new form than to modify modules and test them.
I don't know how you could generate component IDs when the clone is generated. If you want to do a try, I just can be a beta tester. Sorry not to help more.
I'd rather prefer adding i18n to the name of the fields of the webfom. But that is another challenge.
Thanx.
Ronan
Is there anyway to not have the Cloned node get published before editing? It appears the cloned page gets published before editing, and ends up on the front page if the node type is set to be automatically promoted, leaving "Clone of ----" as the lead story. I could adjust the promotion setting, but manually promoting stuff kind of defeats the purpose of the module for me because I want to use it as a time saver.
but the design is intended to make a nearly exact copy (including flags). While it would be possible to introduce a variety of schemes to filter or alter the flags via a settings page, it's not a priority for me.
The module code is pretty modest, and not too hard to hack. If you want to submit a patch as a feature request, I'll look at it. Otherwise, you could describe exactly what you want and offer a bounty.
I guess its not worth it for me to invest any time or money in now, since this module is definitely more of a luxury rather than a necessity for me. Thank you though for the response and the module itself.
I added another feature to the module which may help your use case. For each node type, you can now decide whether to reset the publishing options to the default for that noed type when a clone is made. So, for example, if your defualt for story nodes is (unpublished, not promoted), and you clone a story on the front page the clone can get reset to (unpublished, not promoted).
One problem with this module is when cloning an image node. The cloned node does not require the same image to be uploaded again, so that's a good thing. That way a node can be translated into another language.
However, when the original node is deleted, the image file on the server gets deleted as well, therefore the cloned image node has no image anymore.
It actually should behave like hard linking on Unix. When a hard link is created and the linked file is deleted, the link still has all the data of the linked file. Only when all the links are deleted, then the file content on the hard disk gets deleted as well.
Comments
What do you mean by page?
What do you mean by page? Do you mean the whole page or just the contents (no navigation, no menues, etc). If just the contents are you looking to copy node page content (content based on story, page or other content you add with 'create content'), a list of content, or something else?
What I mean is, create
What I mean is, create another node page that is identicle in Content.
Edit as new module
The Edit as new module does this but it is not updated for 4.7 yet.
Any help?
Any help?
It is very critical that I
It is very critical that I know how to do this as soon as possible. Can anybody please explain how to copy a content page?
Edit Select All Copy?
Couldn't you just copy all the content code to a new page? Or am I missing some nuance of your question?
The node a need to copy is a
The node a need to copy is a 'webform'.
Does this do what you want?
Here is a copy of a module I wrote sometime ago to clone a node and have updated for 4.7. Make a directory under modules called clone, and place the code below in a file called clone.module. Enable the module. If people have permission a new link will be added labeled clone. Click the link and the node will be copied and the user placed on the edit page for the copy.
This is exactly what I
This is exactly what I needed!! THANK YOU!!
Is there anyway to make the
Is there anyway to make the "Clone" link completely invisible to users who do not have pernission to use it?
Replace clone_link with this version
This version will hide the link if they do not have permission
This is sweet!
nevets -- this is some very useful code -- thanks for this.
Cheers,
Bill
-------
http://www.funnymonkey.com
Tools for Teachers
-------
http://www.funnymonkey.com
with webform?
This is should be very useful for most content, but I'm not sure it will work with webform- has anyone tried it yet? I think webform creates new tables where each field has a new ID, so I'm wondering if the "cloned" webform will have new entries in that table, or still point to the original ones?
Also, is this module in the contrib download area? Seems like there could be a potential problem with the last command, if the user has the "clone" permission, but not permission to edit that node type?
---
Work: BioRAFT
seems OK
to answer my own question, it seems to work OK with webform. The component ID (cid) values are the same in the database, but since the nid values are different the modules seems able to distinguish the data as belonging to different forms.
---
Work: BioRAFT
Cut and paste Form code? I've done it...
***Nevermind, wouldn't have helped anyway***
Are you using some internal form generation utility/module?
I had some pre-existing forms from before I went to Drupal, and I can just cut and paste their code right into the content area for a regular old page/node and they still work fine (provided their cgi/php/pl file is still accessable and properly permissioned (sp?) :)
I haven't bothered using the integrated form modules or whatever cuz there is no way its going to be as good/useful as the solution I already use...
I am using the webform
I am using the webform module.
new module- based on above code
I re-worked the code above into an actual contributed module:
http://drupal.org/project/node_clone
Please test it out. The "clone" link now appears as a tab when viewing a page. Also, it now resets the path and menu settings for the copied node to avoid overwriting the alias or menu placment of the original node.
I don't have flexinode or CCK installed, so I don't know whether this will work correctly with those content types.
Also, right now there is no check that the user can auctally edit the node that they copy- in some cases this may be OK, but in others may cause problems.
---
Work: BioRAFT
Node Clone & Webform
I just tried this to translate my form.
But as you said the fields are the same in every nodes. Then translating the name of a field in one form change the name in all others.
You made good job but not what I would like to have. That's very common with CMS.
Ronan
Interesting...
I had wondered if there would be side efffects of having the same component IDs. I'm guessing this wold affect custom theming of forms as well.
I don't think there is an easy way around this without special casing webform in the code. Probably just have to generate now component IDs when the clone is generated. Not a hard task if it's important to you.
---
Work: BioRAFT
Webform translation
That is not so important for me. I think it would be quicker to make new form than to modify modules and test them.
I don't know how you could generate component IDs when the clone is generated. If you want to do a try, I just can be a beta tester. Sorry not to help more.
I'd rather prefer adding i18n to the name of the fields of the webfom. But that is another challenge.
Thanx.
Ronan
Is there anyway to not have
Is there anyway to not have the Cloned node get published before editing? It appears the cloned page gets published before editing, and ends up on the front page if the node type is set to be automatically promoted, leaving "Clone of ----" as the lead story. I could adjust the promotion setting, but manually promoting stuff kind of defeats the purpose of the module for me because I want to use it as a time saver.
well, it's possible
but the design is intended to make a nearly exact copy (including flags). While it would be possible to introduce a variety of schemes to filter or alter the flags via a settings page, it's not a priority for me.
The module code is pretty modest, and not too hard to hack. If you want to submit a patch as a feature request, I'll look at it. Otherwise, you could describe exactly what you want and offer a bounty.
---
Work: BioRAFT
I guess its not worth it for
I guess its not worth it for me to invest any time or money in now, since this module is definitely more of a luxury rather than a necessity for me. Thank you though for the response and the module itself.
see new feature
I added another feature to the module which may help your use case. For each node type, you can now decide whether to reset the publishing options to the default for that noed type when a clone is made. So, for example, if your defualt for story nodes is (unpublished, not promoted), and you clone a story on the front page the clone can get reset to (unpublished, not promoted).
---
Work: BioRAFT
One problem with this module
One problem with this module is when cloning an image node. The cloned node does not require the same image to be uploaded again, so that's a good thing. That way a node can be translated into another language.
However, when the original node is deleted, the image file on the server gets deleted as well, therefore the cloned image node has no image anymore.
It actually should behave like hard linking on Unix. When a hard link is created and the linked file is deleted, the link still has all the data of the linked file. Only when all the links are deleted, then the file content on the hard disk gets deleted as well.
patch?
If you know how to do this, please submit a feature request and a patch.
---
Work: BioRAFT
imagefield cloning now working with Clone module for 5.x
see: http://drupal.org/node/200092
---
Work: BioRAFT
nice work !! :)
nice work !! :)
This Module helped me out a great deal
This Module helped me out a great deal A+ work