{"version":3,"sources":["../js/Audit.js"],"names":["g_oAudit","Audit","prototype","getAnnotationAudit","annotationId","bSVGAnnotation","oJSON","AnnotationId","SessionId","g_szSessionId","$","ajax","type","url","data","JSON","stringify","contentType","dataType","success","response","renderAnnotationAudit","failure","xhr","textStatus","ProcessApiError","error","annotationAudits","oAnnotationAuditHTML","c_szCloseAnnotationAudit","i","length","oAnnotationAudit","actionDescription","g_oSVGText","getUnformattedSVGText","auditTrailId","auditedDate","Date","dateTimeStamp","localeAuditedDate","getTime","getTimezoneOffset","actionType","g_oAnnotations","getDisplayName","userEmailAddress","userDisplayName","formatDate","html","addClass","slideDown","scrollAnnotationAudit","closeAnnotationAudit","bAnimate","iAnimationTime","slideUp","removeClass","iAnnotationAuditPosition","position","top","animate","scrollTop","window"],"mappings":"AAeA,IAAIA,SAAW,IAEd,WACA,aAKA,SAASC,SAOTA,MAAMC,UAAUC,mBAAqB,SAAUC,aAAcC,gBAE5D,IAAIC,MAAQ,CACXC,aAAcH,aACdI,UAAWC,eAIZC,EAAEC,KAAK,CACNC,KAAM,OACNC,IAAK,8CACLC,KAAMC,KAAKC,UAAUV,OACrBW,YAAa,kCACbC,SAAU,OACVC,QAAS,SAAUC,UAElBpB,SAASqB,sBAAsBjB,aAAcgB,SAAUf,iBAExDiB,QAAS,SAAUC,IAAKC,YACvBC,gBAAgBF,IAAKC,aAEtBE,MAAO,SAAUH,IAAKC,YACrBC,gBAAgBF,IAAKC,gBAUxBvB,MAAMC,UAAUmB,sBAAwB,SAAUjB,aAAcuB,iBAAkBtB,gBAEjF,IAAIuB,qBAAuB,GAG3BA,sBAAwB,YAAcxB,aAAe,qEAGrDwB,sBAAwB,cAAgBxB,aAAe,gFAAkFJ,SAAS6B,yBAA2B,gDAG7KD,sBAAwB,SAGxB,IAAK,IAAIE,EAAI,EAAGA,EAAIH,iBAAiBI,OAAQD,IAAK,CAGjD,IAAIE,iBAAmBL,iBAAiBG,GAGpCzB,iBAGH2B,iBAAiBC,kBAAoBC,WAAWC,sBAAsBH,iBAAiBC,oBAIxFL,sBAAwB,YAAcI,iBAAiBI,aAAe,6CAGtE,IAAIC,YAAc,IAAIC,KAAKN,iBAAiBO,eACxCC,kBAAoB,IAAIF,KAAKD,YAAYI,UAAa,IAAQJ,YAAYK,qBAG9Ed,sBAAwB,+CAAiDI,iBAAiBW,WACvF,QAAUC,eAAeC,eAAeb,iBAAiBc,iBAAkBd,iBAAiBe,iBAC5F,QAAUC,WAAWR,mBACrB,OAGHZ,sBAAwB,kDAAoDI,iBAAiBC,kBAAoB,OAGjHL,sBAAwB,SAIzBlB,EAAE,IAAMN,aAAe,6BAA6B6C,KAAKrB,sBAGzDlB,EAAE,IAAMN,aAAe,6BAA6B8C,SAAS,4BAG7DxC,EAAE,IAAMN,aAAe,6BAA6B+C,UAAU,GAAI,GAAI,WAAcnD,SAASoD,sBAAsBhD,iBAOpHH,MAAMC,UAAUmD,qBAAuB,SAAUjD,aAAckD,UAG9D,IAAIC,eAAiBD,SAAW,IAAM,EAGtC5C,EAAE,IAAMN,aAAe,6BAA6BoD,QAAQD,eAAgB,GAAI,WAAc7C,EAAE,IAAMN,aAAe,6BAA6BqD,YAAY,+BAO/JxD,MAAMC,UAAUkD,sBAAwB,SAAUhD,cAGjD,IAAIsD,yBAA2BhD,EAAE,IAAMN,aAAe,6BAA6BuD,WAAWC,IAG9FF,0BAA4B,GAG5BhD,EAAE,wBAAwBmD,QAAQ,CAAEC,UAAW,KAAOJ,yBAA2B,QAMlFK,OAAO9D,MAAQA,MArIhB","file":"Audit-841084bb94.js","sourcesContent":["/*\r\n* Copyright (c) 2018 SGS Europe. All rights reserved.\r\n*\r\n* This program is the CONFIDENTIAL and PROPRIETARY property of 2018 SGS Europe.\r\n* Any unauthorised use, reproduction, or transfer of this program is strictly\r\n* prohibited.\r\n*\r\n* File Name:\tAudit.js\r\n*\r\n* Description:\tJavaScript code for Audit module.\r\n*\r\n* History:\t\t05-FEB-18\tP Dickson\tInitial implementation.\r\n*\r\n*/\r\n\r\nvar g_oAudit = {};\r\n\r\n(function () {\r\n\t\"use strict\";\r\n\r\n\t/**\r\n\t * Create the Audit object.\r\n\t */\r\n\tfunction Audit() {}\r\n\r\n\t/**\r\n\t * Gets the audit trail for an annotation.\r\n\t * @param {int} annotationId - The id of the annotation.\r\n\t * @param {boolean} bSVGAnnotation - Is the annotation created on an SVG document.\r\n\t */\r\n\tAudit.prototype.getAnnotationAudit = function (annotationId, bSVGAnnotation) {\r\n\t\t// Build up the JSON to be sent to the server.\r\n\t\tvar oJSON = {\r\n\t\t\tAnnotationId: annotationId,\r\n\t\t\tSessionId: g_szSessionId\r\n\t\t};\r\n\r\n\t\t// Go the server and request the annotations audit trail.\r\n\t\t$.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: \"internal/GreenlightAudit/getAnnotationAudit\",\r\n\t\t\tdata: JSON.stringify(oJSON),\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tsuccess: function (response) {\r\n\t\t\t\t// Render the annotation audit.\r\n\t\t\t\tg_oAudit.renderAnnotationAudit(annotationId, response, bSVGAnnotation);\r\n\t\t\t},\r\n\t\t\tfailure: function (xhr, textStatus) {\r\n\t\t\t\tProcessApiError(xhr, textStatus);\r\n\t\t\t},\r\n\t\t\terror: function (xhr, textStatus) {\r\n\t\t\t\tProcessApiError(xhr, textStatus);\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\t/**\r\n\t * Renders the audit trail for an annotation.\r\n\t * @param {int} annotationId - The id of the annotation.\r\n\t * @param {obj} annotationAudits - The list of annotation audits to be rendered.\r\n\t */\r\n\tAudit.prototype.renderAnnotationAudit = function (annotationId, annotationAudits, bSVGAnnotation) {\r\n\t\t// Build up the HTML for the audit trail.\r\n\t\tvar oAnnotationAuditHTML = \"\";\r\n\t\t\r\n\t\t// Create a div for closing the annotation audit.\r\n\t\toAnnotationAuditHTML += \"
\";\r\n\r\n\t\t// Add the close button.\r\n\t\toAnnotationAuditHTML += \"\";\r\n\r\n\t\t// Close the div.\r\n\t\toAnnotationAuditHTML += \"
\";\r\n\r\n\t\t// Loop through each of the annotation audit entries.\r\n\t\tfor (var i = 0; i < annotationAudits.length; i++) {\r\n\r\n\t\t\t// Extract the annotation audit entry.\r\n\t\t\tvar oAnnotationAudit = annotationAudits[i];\r\n\r\n\t\t\t// If this is an SVG annotation.\r\n\t\t\tif (bSVGAnnotation) {\r\n\r\n\t\t\t\t// Get the plain text from the action description.\r\n\t\t\t\toAnnotationAudit.actionDescription = g_oSVGText.getUnformattedSVGText(oAnnotationAudit.actionDescription);\r\n\t\t\t}\r\n\r\n\t\t\t// Create a div to hold the annotation audit.\r\n\t\t\toAnnotationAuditHTML += \"
\";\r\n\r\n\t\t\t// Calculate the audited time with the users time-zone offset (we display the time locally, its stored in UTC)\r\n\t\t\tvar auditedDate = new Date(oAnnotationAudit.dateTimeStamp);\r\n\t\t\tvar localeAuditedDate = new Date(auditedDate.getTime() - (60000 * auditedDate.getTimezoneOffset()));\r\n\r\n\t\t\t// Add the details of the annotation audit.\r\n\t\t\toAnnotationAuditHTML += \"

\" + oAnnotationAudit.actionType\r\n\t\t\t\t+ \"
\" + g_oAnnotations.getDisplayName(oAnnotationAudit.userEmailAddress, oAnnotationAudit.userDisplayName)\r\n\t\t\t\t+ \"
\" + formatDate(localeAuditedDate)\r\n\t\t\t\t+ \"

\";\r\n\r\n\t\t\t// Add the action description of the annotation audit.\r\n\t\t\toAnnotationAuditHTML += \"

\" + oAnnotationAudit.actionDescription + \"

\";\r\n\r\n\t\t\t// Close the div for the annotation audit.\r\n\t\t\toAnnotationAuditHTML += \"
\";\r\n\t\t}\r\n\r\n\t\t// Add the annotation audit html to the container.\r\n\t\t$(\"#\" + annotationId + \"_annotationAuditContainer\").html(oAnnotationAuditHTML);\r\n\r\n\t\t// Add the display class to the annotation audit container.\r\n\t\t$(\"#\" + annotationId + \"_annotationAuditContainer\").addClass(\"annotationAuditContainer\");\r\n\r\n\t\t// Show the content of the annotation audit container.\r\n\t\t$(\"#\" + annotationId + \"_annotationAuditContainer\").slideDown(\"\", \"\", function () { g_oAudit.scrollAnnotationAudit(annotationId); });\r\n\t};\r\n\r\n\t/**\r\n\t * Closes the audit trail for an annotation.\r\n\t * @param {int} annotationId - The id of the annotation.\r\n\t */\r\n\tAudit.prototype.closeAnnotationAudit = function (annotationId, bAnimate) {\r\n\r\n\t\t// Determine the animation time.\r\n\t\tvar iAnimationTime = bAnimate ? 400 : 0;\r\n\r\n\t\t// Close the audit for the annotation, then remove the display class for the annotation audit container.\r\n\t\t$(\"#\" + annotationId + \"_annotationAuditContainer\").slideUp(iAnimationTime, \"\", function () { $(\"#\" + annotationId + \"_annotationAuditContainer\").removeClass(\"annotationAuditContainer\"); });\r\n\t};\r\n\r\n\t/**\r\n\t * Scrolls to the audit trail for an annotation.\r\n\t * @param {int} annotationId - The id of the annotation.\r\n\t */\r\n\tAudit.prototype.scrollAnnotationAudit = function (annotationId) {\r\n\r\n\t\t// Get the position of the annotation audit container.\r\n\t\tvar iAnnotationAuditPosition = $(\"#\" + annotationId + \"_annotationAuditContainer\").position().top;\r\n\r\n\t\t// Remove 60px for the height of the divAnnDiv_Header and remove 20px of padding.\r\n\t\tiAnnotationAuditPosition -= 60;\r\n\r\n\t\t// Scroll the annotation audit into view.\r\n\t\t$(\"#divAnnDiv_ListItems\").animate({ scrollTop: \"+=\" + iAnnotationAuditPosition + \"px\" });\r\n\t};\r\n\r\n\t/**\r\n\t * Add the Audit object to the window.\r\n\t */\r\n\twindow.Audit = Audit;\r\n\r\n}());"]}