[opencms-dev] copy a Resource and its siblings as a new Resource

Christian Steinert christian_steinert at web.de
Thu Sep 28 10:49:32 CEST 2006


Peter korn schrieb:
> Hi,
>
> i have a problem (OpenCms 6.0.4). I want to copy a complete site. The siblings in the site should be siblings in the copy too. But they should not be a sibling from the resource in the source site.
>
> So i need a function to copy a Resource with its siblings to a  new Resource with it siblings.
>
> In the copy dialog there are only the options to create siblings (then all siblings in the source and in the destination Site points to one file) or to copy the files as a new Resource (then the new Site contains no siblings any more, the en and de folders are no longer linked)
>
> Did i miss this feature in the workplace dialogs, or is it not possible?
> Is there a way to copy it with the api? Or is this feature implemented or planned in the new OpenCms version?
>
>
> thanks 
>
> Peter
>   
If i understand this correctly then you have someting like

/x/foo.html
/x/bar.html
with foo.html and bar.html being siblings.


Then you want to copy /x/ to /y/ and get

/x/foo.html
/x/bar.html

/y/foo.html
/y/bar.html


with /x/foo.html and /x/bar.html being siblings,  /y/foo.html and
/y/bar.html being siblings, but the /x/ folder having no siblings in
common with the /y/ folder.

Such a copy feature does not exist. You would have to write this
yourself by doing sth like
- going through the source folder tree and for each file
  - check, if this file has siblings
  - check if a copy of one of the siblings has been created in the
target folder
    - if none of the original siblings has been created, then the file
must be created as a separate copy
    - if one of the original siblings has been copied then the current
file must be made into a sibling of the existing file

CmsObject should give you the ability to get all files in a complete
folder hierarchy, to create copies, to create siblings, to check if a
file exists already and to request the existing siblings of a given
resource.

hth
christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3269 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060928/ca6ecb4d/attachment.bin>


More information about the opencms-dev mailing list