RoundTrip API examples

Here is an example HTML file, which shows how to use the RoundTrip API.

<html>
<head>
  <script LANGUAGE="JavaScript">	
function taskStartEventHandler(eventId, taskId, callbackId)
  {
    if(eventId == 78)	//taskStart event is fired whenever a RoundTrip process is started
    {
      ViewONE.setEventHandlerCallbackResponse(callbackId, "ok");
    }
  }
​
function taskStartedEventHandler(eventId, taskId, callbackId)
  {
    if(eventId == 79)//taskStart event is fired when the callback for taskStart has been called
    {
      //No function required but can be used as a process monitoring point
    }
  }
​
function taskStatusEventHandler(eventId, taskId, status, jsonResponse)
  {
    if(eventId == 80)//taskStatus event is fired when the taskStarted event has been called
      {
        if(status == "ok")
          {
            var obj = JSON.parse(jsonResponse);
            // here is where you need to send the URL to your new servlet. 
          } 
        else 
          { 
            alert("Redaction Failed");
          }
      }
  }
  </script>
</head>
​
<script type="text/javascript" src="/viewone/v1files/viewone.js">
</script>
<body>
  <object 
    class="com.ibm.dv.client.Viewer"
    id="ViewONE"
    width="600"
    height="600">
					 
      <!-- New/updated parameters -->		 
      <param name="eventInterest1" value="78" />
      <param name="eventHandler1" value="taskStartEventHandler" />
      <param name="eventInterest2" value="79" />
      <param name="eventHandler2" value="taskStartedEventHandler" />
      <param name="eventInterest3" value="80" />
      <param name="eventHandler3" value="taskStatusEventHandler" />	
								
      <!-- you need to specify one of these two parameters depending on your use-case. For more information, see the HTML parameter API reference >			
      <param name="initialeditmode" value="redact" />
      <param name="annotationsToggleBurn" value="mixed"/-->
​
			
      <!-- Removed parameters as no longer relevant
      <param name="eventhandler" value="..."/>
      <param name="eventInterest" value="..."/>
      -->
			
  </object>
</body>
</html>