The audit trail tracks users' activities within your application. The default audit trail tracks, for example, when users log in or when they open a document. Customize the audit trail by adding your own custom events. To do so, customize existing Javascript.
Procedure
- Navigate to your LiveContent S1000D home directory.
- From the file wietmsd-etc.jar in this location, extract the scripts/ directory to your custom etc/ directory.
In the extracted directory, you see a file Utils.js, which contains a generic audit trail event creation function called createAuditEvent(), and a number of other scripts that call this function to register an event.
- Customize the audit trail by doing one of the following:
- Modify the scripts that call
createAuditEvent().
- Modify
createAuditEvent() itself.
- Add new events to the scripts.
CAUTION:
Make sure to back up any script file before modifying it. Your modifications can have a severe negative impact on the functionality of your application.
- If you modify
createAuditEvent(), ensure that the function continues to create an XML snippet that records the events and its pertinent information, and that minimally has a root element called <event> and a first-level child element called <eventType>. The function loads this XML snippet in an XML DOM document and sends it to the server to be recorded:
createAuditEvent(type, eventObj) {
// Create XML body
var xmlBody = "<event><eventType>" + type + "</eventType>" ;
// pull all of the properties from the eventObj:
for(var i in eventObj) {
if (i == "title") {
xmlBody += "<" + i + ">" + escape(eventObj[i]) + "</" + i + ">";
} else {
xmlBody += "<" + i + ">" + eventObj[i] + "</" + i + ">";
}
}
// Insert our Data and close the structure:
xmlBody += "<start-date>" + CVPortal.getDateXML() + "</start-date>" +
"<start-time>" + CVPortal.getTimeXML() + "</start-time>" +
"</event>" ;
// Post the Data to the audit trail:
var url = CVPortal.getURLwithBaseParams() + "&target=audittrail&action=event";
CVPortal.ajaxPostXMLData(url, xmlBody);
}