Integrating Web Author with a DITA-aware CMS
Oxygen XML Web Author supports the use of some API extensions and a method from
Oxygen XML Editor that can be used to customize nodes within the DITA
Map view. The following are supported:
- ro.sync.exml.workspace.api.standalone.ditamap.TopicRefTargetInfoProvider - API extension can be used to provide titles for topic references. This should be implemented as an optimization by a CMS that already has the titles of the topics cached in the database. By default, Web Author fetches each topic from the CMS, parses it, and extracts the title.
- ro.sync.exml.workspace.api.editor.page.ditamap.DITAMapNodeRendererCustomizer - API extension allows you to customize the rendering of information in the DITA Map view (for example, titles for topic references). This method is called after Web Author computes the title for topic references.
- ro.sync.ecss.extensions.api.webapp.access.WebappPluginWorkspace.setDITAKeyDefinitionManagerProvider - This method sets an object that provides a DITA keys manager for each open document. This will override the Web Author's default behavior that will fetch the main DITA map and all the nested sub-maps from the CMS, parse them, and determine the keys.
Setting the DITA Context Used to Load the Editor
To open a topic with a specific DITA context, there are two options:
- Use the
ditamap
anddita.val.url
URL parameters added to the OXY-URL. - Use the
workspace.getEditingContextManager()
JavaScript API. A sample plugin that uses this API to set the DITA Map for some popular repository layouts is available on GitHub: https://github.com/oxygenxml/web-author-sample-plugins/tree/master/web-author-impose-ditamap.
Changing the DITA Context After the Editor is Loaded
When a topic is reused in multiple DITA contexts defined by a DITA map and DITAVAL filter,
a CMS may provide the user a widget to switch between these contexts. To implement this
behavior, you need to use the JavaScript API as in the following
example:
var map = "http://example.com/path/to/ditamap";
var filter = "http://example.com/path/to/ditaval";
var isDirty = editor.isDirty();
editor.getActionsManager()
.invokeOperation('ro.sync.servlet.operation.SetDitaMapOperation', {
ditamap: map,
ditaval: filter })
.then(function(result) {
if (result === 'SUCCESS') {
var editingContextManager = workspace.getEditingContextManager();
editingContextManager.updateDitaContext(new sync.api.DitaContext(map, filter));
} else {
alert('FAILED');
}
})
.thenAlways(function () { editor.setDirty(isDirty); });
where map
and filter
are the OXY-URLs of the DITA map and DITAVAL filter files, respectively.