Magnolia 6.0 reached end of life on June 26, 2019. This branch is no longer supported, see End-of-life policy.
Magnolia versions pages, assets and contacts by default when they are published and unpublished. You can also configure versioning for any other content type.
A fresh Magnolia installation does not have versioned content. Demo content is bootstrapped and immediately marked as "published". You see a green publication status icon but no publication has actually happened.
You can enable versioning in a content app by triggering the activate/deactivate
command chains in the versions
catalog instead of the activate/deactivate
commands in the default
catalog. Here is the process to enable versioning in the Categories app.
In the Configuration app > /modules/categorization/apps/categories/subApps/browser
:
Change the activate
and deactivate
action definitions.
In the /actions/activate
and /deactivate
nodes add a catalog
property and set the value to versioned
. This calls the chained version command configured in the activation
module in modules/activation/commands/versioned/activate
and /deactivate
.
Node name | Value |
---|---|
modules | |
categorization | |
apps | |
categories | |
subApps | |
browser | |
actions | |
activate | |
availability | |
catalog | versioned |
class | info.magnolia.ui.framework.action.ActivationActionDefinition |
command | activate |
icon | icon-publish |
recursive | true |
deactivate | |
availability | |
catalog | versioned |
class | info.magnolia.ui.framework.action.DeactivationActionDefinition |
command | deactivate |
icon | icon-unpublish |
Add the Show versions action configuration.
In the /actions
node add the /showVersions
configuration as shown below. Alternatively, you can simply extend the configuration in another content app, for example the configuration in the Contacts app configured in
./modules/contacts/apps/contacts/subApps/browser/actions/showVersions
Node name | Value |
---|---|
browser | |
actions | |
activate | |
deactivate | |
showVersions | |
availability | |
rules | |
HasVersionsRule | |
implementationClass | info.magnolia.ui.framework.availability.HasVersionsRule |
class | info.magnolia.ui.contentapp.browser.action.ShowVersionsActionDefinition |
icon | icon-show-versions |
Add the Show versions action to the action bar.
In the /actionbar/sections/category/groups
node, add the /versionsActions
configuration shown below. Alternatively, you can simply extend the configuration in another content app, for example the configuration in the Contacts app configured in
.
/modules/contacts/apps/contacts/subApps/browser/actionbar/sections/contact/groups/versionsActions
Node name | Value |
---|---|
browser | |
actions | |
actionbar | |
sections | |
root | |
deletedFolder | |
deletedCategory | |
folder | |
category | |
groups | |
addActions | |
editActions | |
activationActions | |
importExportActions | |
versionsActions | |
items | |
showVersions |
In the Categories app, create a few versions by activating and deactivating an item and then execute the Show versions action to open the VERSIONS dialog.
The number of versions you can create depends on the Magnolia edition:
In the Enterprise Edition, the number of versions is unlimited and you can set it in configuration. By default, 10 versions are stored.
The number of versions is configured in /server/versions
:
Node name | Value |
---|---|
server | |
version | |
active | true |
maxVersionIndex | 10 |
Properties:
active
enables and disables versioning.maxVersionIndex
sets the number of versions to store.Previous versions are deleted when you change to a smaller number and create a version. It's OK to change the number. The index won't be affected until a new version is created. For example, if node ‘A' has 10 versions and you change the max version index to 2, you will still see all 10 versions until the next versioning occurs. Once node 'A' is versioned again, all previous 9 versions will be removed.
Versions are created when VersionCommand is triggered. A new version of the content is created and added to the version file. VersionCommand
provides for standard and recursive versioning, and the addition of a version comment.
Command definitions that call versionCommand
are configured for the activate
and deactivate
command chains in the Activation module.
Here's the command definition in the activation
module in the Configuration app > /modules/activation/commands/versioned/activate/version
and /deactivate/version
.
Node name | Value |
---|---|
modules | |
activation | |
commands | |
default | |
versioned | |
activate | |
version | |
class | info.magnolia.commands.impl.VersionCommand |
enabled | true |
activate | |
deactivate | |
version | |
class | info.magnolia.commands.impl.VersionCommand |
enabled | true |
deactivate |
The command chains are triggered when the Publish, Unpublish and Publish deletion actions are executed in the various apps that use them. Here's the action definition for the Publish action in the Assets app configured in the Configuration app > /modules/dam/apps/assets/subApps/browser/actions/activate.
Node name | Value |
---|---|
modules | |
dam | |
apps | |
assets | |
subApps | |
browser | |
actions | |
activate | |
availability | |
catalog | versioned |
class | info.magnolia.ui.framework.action.ActivationActionDefinition |
command | activate |
icon | icon-publish |
Version comparison relies on functionality provided by the Diff module. The module uses the daisydiff java library to compare HTML files. Diff is an Enterprise Edition feature.
See Diff configuration.