TIP CopyContrib is not installed on Foswiki.org.

CopyContrib

Copies webs, topics, attachments, or part of them

This extension can be used to copy topics and webs. It allows to select which parts of an item is to copied.

Typical use cases are:

  1. duplicate topic assets: copy attachments, comments or preference settings to another existing topic
  2. deploy wiki applications: copy a selection of topics to a target web
  3. workflow scenarios: separate work on a draft topic from its last approved version by creating a copy first and copy the finished draft over as a newly approved version
  4. versioned webs: create a new web for each version of a product
  5. merge webs: create a new web by copying a list of webs to the new web
  6. publish content: from a closed quality-managed authors-only area to a public read-only web

Usage

The work horse for all operation modes is a single service script called copy. It takes a mode parameter for which a copy agent is created to perform the actual operation. The basic skeleton for a form to call the copy service looks like this:

<form action="%SCRIPTURLPATH{"copy"}%/%WEB%/%TOPIC%" method="post">
  <input type="hidden" name="mode" value="topic" />
  <input type="hidden" name="includepart" value="fields" />
  <input type="hidden" name="includepart" value="form" />

  <input type="text" name="destination" size="80" />

  <!-- more parameters -->

  <input type="submit" />
</form>

Parameters

General

Name Description Default
mode select the type of operation; possible values are:
  • topic: copy one topic or parts of it to a destination topic
  • topics: copy a list of topic to a destination
  • web: copy a web to a destination
 
debug boolean flag to switch on/off debug output; messages are printed to the error log of the web browser off
dry boolean flag to switch on/off a dry mode; if enabled none of the operations will actually be saved permanently off
onlynew boolean flag to enable/disable a check for the destination to already exist; an exception will be raised if enabled and the target object already; the target object will be overwritten in case it already exists and the flag is disabled; to be precise, a new revision will be created in this case on
forcenewrevision force the save to increment the revision counter off
dontlog mark this change so it doesn't appear in the statistics off
minor True if this change is not to be notified off
clear boolean flag; when enabled data on the destination will be deleted first before copying the source data; (exception: text is always cleared before copying it over); when disabled data of source and destination will be merged off
redirectto topic or url where to redirect the browser after a successful copy operation  

Mode: topic

Name Description Default
source the source topic to be copied %BASEWEB%.%BASETOPIC%
destination the destination topic where to copy source to source
includepart, includeparts a list of parts of a topic to be copied; known part-ids are text, attachments, all, preferences, parent, form, fields, or any other custom meta data alias such as comment from MetaCommentPlugin all
excludepart, excludeparts a list of parts to exclude from the copy process  
include<part-id> when meta data is named as is the case for fields you may specify a regular expression in includefields that all fields must match when copying formfields  
exclude<part-id> same as include<part-id> but in reverse logic  

Mode: topics

Name Description Default
source a list of topics to be copied %BASEWEB%.%BASETOPIC%
destination the destination where to copy all source topics to; this can either be a web or a topic; in the latter case all source topcis will be copied to the destination  

All parameters of the topic mode apply to each topic in the source list.

Mode: web

Name Description Default
source the source web to be copied %BASEWEB%
destination the destination web where to copy all topics of the source web to  
template a template web to be used in case the destination web does not exist yet and needs to be created on the base of a template _empty
search search expression to find topics in the source web. See System.QuerySearch for more information .*
include regular expression topics in the source web must match to be included in the copy process  
exclude regluar expression; excludes matching topics from the source web  

Examples

Copy one or more topics to a destination

Source:

separate multiple topics with a comma

Destination:

can be a topic or a web

Include parts:






leave unchecked to copy all

Exclude parts:






Options:





Copy a web but strip all comments

Source:

specify source web

Filter:

specify a search query

Destination:

specify destination web

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Dependencies

None

Change History

25 Sep 2015: added support for unicode foswiki
10 Jun 2014: improved error handling; make messages translatable
30 May 2014: added forcenewrevision, minor and dontlog
22 Oct 2013: initial release

Topic attachments
I Attachment Action Size Date Who Comment
CopyContrib.md5md5 CopyContrib.md5 manage 156 bytes 29 Sep 2015 - 13:26 MichaelDaum  
CopyContrib.sha1sha1 CopyContrib.sha1 manage 180 bytes 29 Sep 2015 - 13:26 MichaelDaum  
CopyContrib.tgztgz CopyContrib.tgz manage 12 K 29 Sep 2015 - 13:25 MichaelDaum  
CopyContrib.zipzip CopyContrib.zip manage 20 K 29 Sep 2015 - 13:25 MichaelDaum  
CopyContrib_installerEXT CopyContrib_installer manage 4 K 29 Sep 2015 - 13:26 MichaelDaum  
Topic revision: r5 - 29 Sep 2015, MichaelDaum - This page was cached on 25 May 2016 - 19:06.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License