Copy documents#
The copy feature in imperia CMS allows users to easily duplicate documents within the content management system. With a user-friendly interface, it is possible to copy one or more documents and paste them into the desired category.
The copy feature in imperia CMS makes it possible to duplicate a document by passing it through the configured copy workflow. As an administrator, you can define within this workflow how the system should behave when a document is copied. For example, you can configure whether the document should only be imported into the workflow or whether the process should be completed entirely. This gives you a high degree of flexibility and control over how copied documents are handled within the content management system.
Activating the copy/paste function#
Configuring the target category for pasting#
- Go to the settings of the category in which you want to activate the insert option.
- Scroll to the Copy options section.
- Activate the Enable pasting checkbox.
- Select the copy workflow.
- Save your settings.
Understanding the permissions#
Users need the Create document permission to paste in the target section and the Read document permission to select the document(s) for copying.
Copy workflow#
The copy workflow is a special workflow in imperia that becomes active when a document is inserted into a category. It allows you to control and modify the copying behavior.
Copy workflow basics#
The copy workflow behaves similarly to a normal imperia workflow, with the difference that it is only run through once when a document has been pasted. After pasting, the regular workflow of the respective category is used when editing the document.
This workflow can be used for automated customization of document properties, conflict resolution for name collisions and interaction with the user interface during the paste process.
New workflow plug-ins for the copy workflow#
Three new workflow plug-ins are available in the copy workflow, which have been specially developed for this purpose:
-
SetupCopy: This plugin updates the path and nodeID of the inserted document. It contains settings for resolving name collisions. If a collision occurs in the path, the file name is changed for MAM documents, while the directory is adjusted for non-MAM documents.
-
MESSAGE: This plugin makes it possible to store a special meta key message (__imperia_workflow_message) in the document. This message can be used to communicate with the user interface and display information or prompts to the user during the paste process.
-
NEWWF: With this plugin, the standard workflow for the target category is restarted and the pasted document is inserted into this workflow. This is useful to ensure that the document is properly integrated into the category and goes through all regular workflow steps.
Configuring the copy workflow#
- Start with the sample copy workflow under
site/sample/grid/imperia/workflow/data/copydoc.xml
. - Copy it to
site/grid/imperia/workflow/data/copydoc.xml
. - You can customize this workflow according to your requirements.
To use the copy workflow for a category, go to the category settings of the respective category and select the desired copy workflow.
Restrictions on pasting#
Pasting restrictions are a powerful tool for administrators to control which documents can be copied to certain categories. By customizing a template, you can define specific conditions and requirements that must be met for the copying to be successful. If you as administrator do not make any specific modifications, the default conditions of the template are applied.
Default behavior#
If you as an administrator do not configure the template for pasting restrictions, the standard template is used. This checks whether certain properties such as template, workflow, metadata file and file name match between the document to be copied and the target category. If one of these conditions is not met, copying is not permitted and a corresponding error message is displayed.
Overwrite default behavior#
- You can find the standard template for insertion restrictions under
site/sample/templates/default_copyrestrictions.htms
. - Copy it to
site/templates
and customize it according to your requirements. - Set the variable
COPYRESTRICTIONS_TEMPLATE
inSystem.conf
to the name of your custom template. For example:COPYRESTRICTIONS_TEMPLATE = custom_template.htms
.
Basics of pasting restrictions template#
The template for pasting restrictions uses a simplified syntax that allows you to define conditions that must be met for a document to be copied to a specific category. If the template returns the value 1, copying is permitted. If not, the template output is displayed as an error message informing the user of the reason why copying is not possible.
Customizing the template#
The template allows access to the familiar imperia variables and constructs such as IF/ELSE to create logical conditions. Here are the most important elements:
-
XX and SECTION: These variables refer to the information of the document to be copied or its category.
-
XX-TARGETSECTION: This variable refers to the information of the target category.
Example:#
#IF("<!--SECTION:template-->" NE "<!--XX-TARGETSECTION(template):ignored-->")
Template does not match
This code section checks whether the template of the document to be copied matches that of the target category. If not, the message "Template does not match" is displayed.