// 0) { localTime = utcTime[0] + timeZoneOffset; if (amPm[1] == "PM") { if (localTime > 12) { localTime = localTime - 12; amPmChg = "AM" } } if (amPm[1] == "AM") { if (localTime > 12) { localTime = localTime - 12; amPmChg = "PM" } } } if (localTime == 0) { localTime = 12; } localTime = localTime + ":" + utcTime[1] + " " + amPmChg; var localDateTime = utcDate + " " + localTime; return localDateTime; } function getURLParameters() { var sURL = window.document.URL.toString(); if (sURL.indexOf("?") > 0) { var arrParams = sURL.split("?"); var arrURLParams = arrParams[1].split("&"); var arrParamNames = new Array(arrURLParams.length); var arrParamValues = new Array(arrURLParams.length); var i = 0; for (i = 0; i < arrURLParams.length; i++) { var sParam = arrURLParams[i].split("="); arrParamNames[i] = sParam[0]; if (sParam[1] != "") arrParamValues[i] = unescape(sParam[1]); else arrParamValues[i] = "No Value"; } for (i = 0; i < arrURLParams.length; i++) { return arrParamValues; } } else { } } function autoIframe(frameId) { try { var ifr = document.getElementById(frameId); var p = ifr.parentNode; ifr.style.height = ifr.document.body.scrollHeight + 5; ifr.style.width = p.offsetWidth; //frame = document.getElementById(frameId); //innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document; //objToResize = (frame.style) ? frame.style : frame; //objToResize.height = innerDoc.body.scrollHeight + 10; } catch (err) { window.status = err.message; } } // AJAX Request function httpRequest() { // Create HTTP request if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlHttp = new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } function makeCall(operation) { httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; userObject = JSON.parse(JSONtext); var queryString = ""; if (userObject.loginxResult == null && userObject.FaultMessage == null && userObject.faultMsg == null) { document.getElementById("statusx").innerHTML = ""; //Slow down the response that the credentials are invalid so is noticable with multiple bad entries for (var v = 0; v < 2000000; v++) { } document.getElementById("subMenu").innerHTML = "
Invalid user credentials. Please try again
"; } // Handles system faults else if (userObject.FaultMessage != null) { document.getElementById("subMenu").innerHTML = "
" + userObject.FaultMessage + "
"; } // Handles data integrity .. missing information needed to continue etc. else if (userObject.faultMsg != null) { document.getElementById("subMenu").innerHTML = "
" + userObject.faultMsg + "
"; } else { document.getElementById("mainview").innerHTML = ""; BuildTable(userObject); document.getElementById("statusx").innerHTML = ""; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/login.svc/ilogin/" url = url + operation; // Build the body of the JSON message var body = '{"userName":\"'; body = body + document.getElementById("uname").value + '\","passWd":\"'; body = body + document.getElementById("passwd").value + '\"}'; uname = document.getElementById("uname").value; // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function frameView(cssUrl) { if (frameHeight == null) { frameHeight = "700px"; } document.write(""); // document.write(""); } function masterView() { // get css style sheet path from cssUrl parameter in the URL string (passed from main JavaScript instance) cssUrl = getURLParameters(); cssUrl = cssUrl[0]; if (cssUrl == "null") { cssUrl = "https://api.rocketlawyer.com/lsw.css"; } document.write( "" + "
" + "
" + "
" + "
 
" + "
" + "
" + "
" + "" + "
" + "
" + "

" + "
" + "
" + "
"); } function loginView() { // Get Login View document.getElementById("details").innerHTML = "Log in Details"; document.getElementById("mainview").innerHTML = "" + "" + "" + "" + "" + ""; "" "
 
" + "
" + "" + "
" + "
 
  
"; } function menuMain() { // This menu appears at the top along the right side // Construct logout link var logOutLink = document.createElement("a"); logOutLink.setAttribute("href", "#"); var onC = "logOut();return false;"; logOutLink.onclick = new Function(onC); var logOutText = document.createTextNode("Log Out"); logOutLink.appendChild(logOutText); document.getElementById("subMenu").innerHTML = "
  
 
" document.getElementById("documentListLnk").appendChild(logOutLink); } function documentMenu(uname) { // This menu appears above each document // Construct document list link var documentListLink = document.createElement("a"); documentListLink.setAttribute("href", "#"); var onC = "getUserInfo(uname);return false;"; documentListLink.onclick = new Function(onC); var documentListText = document.createTextNode("Document List"); documentListLink.appendChild(documentListText); // Construct download link var downloadLink = document.createElement("a"); downloadLink.setAttribute("href", "#"); var onC = "downloadFile(uname);return false;"; downloadLink.onclick = new Function(onC); var downloadText = document.createTextNode("Download"); downloadLink.appendChild(downloadText); // Construct history link var historyLink = document.createElement("a"); historyLink.setAttribute("href", "#"); var onC = "showHistory(uname);return false;"; historyLink.onclick = new Function(onC); var historyText = document.createTextNode("History"); historyLink.appendChild(historyText); // Construct logout link var logOutLink = document.createElement("a"); logOutLink.setAttribute("href", "#"); var onC = "logOut();return false;"; logOutLink.onclick = new Function(onC); var logOutText = document.createTextNode("Log Out"); logOutLink.appendChild(logOutText); var spacer = document.createTextNode(" | "); var spacer2 = document.createTextNode(" | "); var spacer3 = document.createTextNode(" | "); var spacer4 = document.createTextNode(" | "); document.getElementById("subMenu").innerHTML = "
  
 
"; document.getElementById("documentListLnk").appendChild(documentListLink); document.getElementById("documentListLnk").appendChild(spacer); document.getElementById("documentListLnk").appendChild(downloadLink); document.getElementById("documentListLnk").appendChild(spacer2); document.getElementById("documentListLnk").appendChild(historyLink); document.getElementById("documentListLnk").appendChild(spacer3); document.getElementById("documentListLnk").appendChild(logOutLink); } function downloadMenu(uname, history) { // This menu appears above each document // Construct document list link var documentListLink = document.createElement("a"); documentListLink.setAttribute("href", "#"); var onC = "getUserInfo(uname);return false;"; documentListLink.onclick = new Function(onC); var documentListText = document.createTextNode("Document List"); documentListLink.appendChild(documentListText); // Construct preview link var historyLink = document.createElement("a"); historyLink.setAttribute("href", "#"); var onC = "goBack('" + history + "');return false;"; historyLink.onclick = new Function(onC); var historyText = document.createTextNode("Preview"); historyLink.appendChild(historyText); // Construct logout link var logOutLink = document.createElement("a"); logOutLink.setAttribute("href", "#"); var onC = "logOut();return false;"; logOutLink.onclick = new Function(onC); var logOutText = document.createTextNode("Log Out"); logOutLink.appendChild(logOutText); var spacer = document.createTextNode(" | "); var spacer2 = document.createTextNode(" | "); var spacer3 = document.createTextNode(" | "); document.getElementById("subMenu").innerHTML = "
  
 
"; document.getElementById("documentListLnk").appendChild(documentListLink); document.getElementById("documentListLnk").appendChild(spacer); document.getElementById("documentListLnk").appendChild(historyLink); document.getElementById("documentListLnk").appendChild(spacer2); document.getElementById("documentListLnk").appendChild(logOutLink); } function historyMenu(uname, history) { // This menu appears above each document // Construct document list link var documentListLink = document.createElement("a"); documentListLink.setAttribute("href", "#"); var onC = "getUserInfo(uname);return false;"; documentListLink.onclick = new Function(onC); var documentListText = document.createTextNode("Document List"); documentListLink.appendChild(documentListText); // Construct preview link var historyLink = document.createElement("a"); historyLink.setAttribute("href", "#"); var onC = "goBack('" + history + "');return false;"; historyLink.onclick = new Function(onC); var historyText = document.createTextNode("Preview"); historyLink.appendChild(historyText); // Construct download link var downloadLink = document.createElement("a"); downloadLink.setAttribute("href", "#"); var onC = "downloadFile(uname);return false;"; downloadLink.onclick = new Function(onC); var downloadText = document.createTextNode("Download"); downloadLink.appendChild(downloadText); // Construct logout link var logOutLink = document.createElement("a"); logOutLink.setAttribute("href", "#"); var onC = "logOut();return false;"; logOutLink.onclick = new Function(onC); var logOutText = document.createTextNode("Log Out"); logOutLink.appendChild(logOutText); var spacer = document.createTextNode(" | "); var spacer2 = document.createTextNode(" | "); var spacer3 = document.createTextNode(" | "); document.getElementById("subMenu").innerHTML = "
  
 
"; document.getElementById("documentListLnk").appendChild(documentListLink); document.getElementById("documentListLnk").appendChild(spacer); document.getElementById("documentListLnk").appendChild(historyLink); document.getElementById("documentListLnk").appendChild(spacer2); document.getElementById("documentListLnk").appendChild(downloadLink); document.getElementById("documentListLnk").appendChild(spacer3); document.getElementById("documentListLnk").appendChild(logOutLink); } function BuildTable(userObject) { menuMain(); // get the reference for the body document.getElementById("mainview").innerHTML = ""; document.getElementById("details").innerHTML = "Document Details"; // creates a element and a element var tbl = document.createElement("table"); var tblBody = document.createElement("tbody"); // create table headers var tblheader = document.createElement("tr"); var colHeader = document.createElement("td"); colHeader.setAttribute("class", "tt"); var colHeaderText = document.createTextNode(""); var bold = document.createElement("b"); bold.appendChild(colHeaderText); tblheader.appendChild(colHeader); colHeader.appendChild(bold); tblBody.appendChild(tblheader); var colHeader2 = document.createElement("td"); colHeader2.setAttribute("class", "tt"); var colHeaderText2 = document.createTextNode("Created By"); var bold2 = document.createElement("b"); bold2.appendChild(colHeaderText2); tblheader.appendChild(colHeader2); colHeader2.appendChild(bold2); tblBody.appendChild(tblheader); var colHeader3 = document.createElement("td"); colHeader3.setAttribute("class", "tt"); var colHeaderText3 = document.createTextNode("Modified"); var bold3 = document.createElement("b"); bold3.appendChild(colHeaderText3); tblheader.appendChild(colHeader3); colHeader3.appendChild(bold3); tblBody.appendChild(tblheader); // creating all cells for (var j = 0; j < userObject.loginxResult.length; j++) { // creates a table row var row = document.createElement("tr"); row.setAttribute("class", "rowHighlight"); //create document image link var docType = userObject.loginxResult[j].docType; var fileIcon = document.createElement("img"); var iconName; iconName = "My-Account-RL-Icon"; if (userObject.loginxResult[j].extension == ".pdf") { iconName = "My-Account-PDF-Icon"; } if (userObject.loginxResult[j].extension == ".docx") { iconName = "My-Account-RTF-Icon"; } if (userObject.loginxResult[j].extension == ".doc") { iconName = "My-Account-RTF-Icon"; } if (userObject.loginxResult[j].extension == ".xls") { iconName = "My-Account-XLS-Icon"; } if (userObject.loginxResult[j].extension == ".rtf") { iconName = "My-Account-RTF-Icon"; } if (userObject.loginxResult[j].extension == ".htm") { iconName = "My-Account-HTML-Icon"; } if (userObject.loginxResult[j].extension == ".html") { iconName = "My-Account-HTML-Icon"; } if (userObject.loginxResult[j].extension == ".txt") { iconName = "My-Account-TXT-Icon"; } fileIcon.setAttribute("src", "https://api.rocketlawyer.com/images/" + iconName + ".gif"); fileIcon.setAttribute("border", "0"); var imgLink = document.createElement("a"); queryString = "https://api.rocketlawyer.com/iframe/docview.aspx?docId=" + userObject.loginxResult[j].docId + "&secToken=" + userObject.loginxResult[j].secToken; imgLink.setAttribute("href", "#"); var onC = "DoiFrame('" + queryString + "');return false;"; //imgLink.setAttribute("onclick", "func"); imgLink.onclick = new Function(onC); //imgLink.setAttribute("return", "true;"); //embed link in first cell with doc title as link text var linkText = document.createTextNode(userObject.loginxResult[j].title); imgLink.appendChild(fileIcon); imgLink.appendChild(linkText); var cell = document.createElement("td"); cell.setAttribute("class", "tt"); cell.setAttribute("width", "40%"); cell.appendChild(imgLink); var cell2 = document.createElement("td"); cell2.setAttribute("class", "tt"); var cellText2 = document.createTextNode(userObject.loginxResult[j].owner); var cell3 = document.createElement("td"); cell3.setAttribute("class", "tt"); var cellText3 = document.createTextNode(convertToLocalTime(userObject.loginxResult[j].lastModDate)); row.appendChild(cell); cell2.appendChild(cellText2); row.appendChild(cell2); cell3.appendChild(cellText3); row.appendChild(cell3); tbl.appendChild(row); tblBody.appendChild(row); } // put the in the
if (j == 0) { cellText = document.createTextNode("There are no active documents in your list at this time."); cell.appendChild(cellText); row.appendChild(cell); tbl.appendChild(row); tblBody.appendChild(row); } // appends
into tbl.appendChild(tblBody); document.getElementById("mainview").appendChild(tbl); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "0"); } function RefreshTable(getUserInfoObject) { menuMain(); // get the reference for the body document.getElementById("mainview").innerHTML = ""; document.getElementById("details").innerHTML = "Document Details"; // creates a
element and a element var tbl = document.createElement("table"); var tblBody = document.createElement("tbody"); //create table headers var tblheader = document.createElement("tr"); var colHeader = document.createElement("td"); colHeader.setAttribute("class", "tt"); var colHeaderText = document.createTextNode(""); var bold = document.createElement("b"); bold.appendChild(colHeaderText); tblheader.appendChild(colHeader); colHeader.appendChild(bold); tblBody.appendChild(tblheader); var colHeader2 = document.createElement("td"); colHeader2.setAttribute("class", "tt"); var colHeaderText2 = document.createTextNode("Created By"); var bold2 = document.createElement("b"); bold2.appendChild(colHeaderText2); tblheader.appendChild(colHeader2); colHeader2.appendChild(bold2); tblBody.appendChild(tblheader); var colHeader3 = document.createElement("td"); colHeader3.setAttribute("class", "tt"); var colHeaderText3 = document.createTextNode("Modified"); var bold3 = document.createElement("b"); bold3.appendChild(colHeaderText3); tblheader.appendChild(colHeader3); colHeader3.appendChild(bold3); tblBody.appendChild(tblheader); // creating all cells for (var j = 0; j < getUserInfoObject.getUserInfoxResult.length; j++) { // creates a table row var row = document.createElement("tr"); //create document image link var docType = getUserInfoObject.getUserInfoxResult[j].docType; var fileIcon = document.createElement("img"); var iconName; //if (docType == "Normal") { iconName = "My-Account-RL-Icon"; if (getUserInfoObject.getUserInfoxResult[j].extension == ".pdf") { iconName = "My-Account-PDF-Icon"; } if (getUserInfoObject.getUserInfoxResult[j].extension == ".docx") { iconName = "My-Account-RTF-Icon"; } if (getUserInfoObject.getUserInfoxResult[j].extension == ".doc") { iconName = "My-Account-RTF-Icon"; } if (getUserInfoObject.getUserInfoxResult[j].extension == ".xls") { iconName = "My-Account-XLS-Icon"; } if (getUserInfoObject.getUserInfoxResult[j].extension == ".rtf") { iconName = "My-Account-RTF-Icon"; } if (getUserInfoObject.getUserInfoxResult[j].extension == ".htm") { iconName = "My-Account-HTML-Icon"; } if (getUserInfoObject.getUserInfoxResult[j].extension == ".html") { iconName = "My-Account-HTML-Icon"; } if (getUserInfoObject.getUserInfoxResult[j].extension == ".txt") { iconName = "My-Account-TXT-Icon"; } fileIcon.setAttribute("src", "https://api.rocketlawyer.com/images/" + iconName + ".gif"); fileIcon.setAttribute("border", "0"); var imgLink = document.createElement("a"); queryString = "https://api.rocketlawyer.com/iframe/docview.aspx?docId=" + getUserInfoObject.getUserInfoxResult[j].docId + "&secToken=" + getUserInfoObject.getUserInfoxResult[j].secToken; imgLink.setAttribute("href", "#"); var onC = "DoiFrame('" + queryString + "');return false;"; //imgLink.setAttribute("onclick", "func"); imgLink.onclick = new Function(onC); //imgLink.setAttribute("return", "true;"); //embed link in first cell with doc title as link text var linkText = document.createTextNode(getUserInfoObject.getUserInfoxResult[j].title); imgLink.appendChild(fileIcon); imgLink.appendChild(linkText); var cell = document.createElement("td"); cell.setAttribute("class", "tt"); cell.setAttribute("width", "40%"); cell.appendChild(imgLink); var cell2 = document.createElement("td"); cell2.setAttribute("class", "tt"); var cellText2 = document.createTextNode(getUserInfoObject.getUserInfoxResult[j].owner); var cell3 = document.createElement("td"); cell3.setAttribute("class", "tt"); var cellText3 = document.createTextNode(getUserInfoObject.getUserInfoxResult[j].lastModDate); row.appendChild(cell); cell2.appendChild(cellText2); row.appendChild(cell2); cell3.appendChild(cellText3); row.appendChild(cell3); // add the row to the end of the table body tbl.appendChild(row); tblBody.appendChild(row); } // appends
into tbl.appendChild(tblBody); document.getElementById("mainview").appendChild(tbl); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "0"); } function BuildHistTable(histObject) { // get the reference for the body historyMenu(uname, "history"); document.getElementById("mainview").innerHTML = ""; document.getElementById("details").innerHTML = "History Details"; // creates a
element and a element var fldset = document.createElement("fieldset"); var tbl = document.createElement("table"); var tblBody = document.createElement("tbody"); var tblheader = document.createElement("tr"); var colHeader = document.createElement("td"); colHeader.setAttribute("class", "tt"); var colHeaderText = document.createTextNode("Event Date"); var bold = document.createElement("b"); bold.appendChild(colHeaderText); tblheader.appendChild(colHeader); colHeader.appendChild(bold); tblBody.appendChild(tblheader); var colHeader2 = document.createElement("td"); colHeader2.setAttribute("class", "tt"); var colHeaderText2 = document.createTextNode("Title"); var bold2 = document.createElement("b"); bold2.appendChild(colHeaderText2); tblheader.appendChild(colHeader2); colHeader2.appendChild(bold2); tblBody.appendChild(tblheader); var colHeader3 = document.createElement("td"); colHeader3.setAttribute("class", "tt"); var colHeaderText3 = document.createTextNode("Description"); var bold3 = document.createElement("b"); bold3.appendChild(colHeaderText3); tblheader.appendChild(colHeader3); colHeader3.appendChild(bold3); tblBody.appendChild(tblheader); // creating all cells for (var j = 0; j < histObject.historyxResult.length; j++) { // creates a table row var row = document.createElement("tr"); var cell = document.createElement("td"); cell.setAttribute("class", "tt"); cell.setAttribute("width", "35%"); var cellText = document.createTextNode(convertToLocalTime(histObject.historyxResult[j].eventDate)); var cell2 = document.createElement("td"); cell2.setAttribute("width", "10%"); cell2.setAttribute("class", "tt"); var cellText2 = document.createTextNode(histObject.historyxResult[j].noteTitle); var cell3 = document.createElement("td"); cell3.setAttribute("class", "tt"); var cellText3 = document.createTextNode(histObject.historyxResult[j].description); cell.appendChild(cellText); row.appendChild(cell); //if (histObject.historyxResult[j].isNote == "1") { //var imgLink = document.createElement("a"); //index = j; //imgLink.setAttribute("href", "#"); //var onC = "notePanelEdit('" + queryString + "',histObject,'" + j + "');return false;"; //imgLink.onclick = new Function(onC); //imgLink.setAttribute("onclick", "notePanelEdit(queryString,histObject,'" + j + "');return false;"); //imgLink.setAttribute("return", "true;"); //embed link in second cell with note title as link text //imgLink.appendChild(cellText2); //cell2.appendChild(imgLink); //} else { cell2.appendChild(cellText2); //} row.appendChild(cell2); cell3.appendChild(cellText3); row.appendChild(cell3); tblBody.appendChild(row); } // put the in the
tbl.appendChild(tblBody); // appends
into document.getElementById("mainview").appendChild(tbl); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "0"); } function showHistory(uname) { var operation = "historyx"; curId[2] = document.getElementById("statusx").innerHTML; httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; histObject = JSON.parse(JSONtext); if (histObject.historyxResult == "" && histObject.FaultMessage == null) { document.getElementById("statusx").innerHTML = "No history found for this document"; } else if (histObject.FaultMessage != null) { document.getElementById("subMenu").innerHTML = "
" + histObject.FaultMessage + "
"; } else { BuildHistTable(histObject); //document.getElementById("statusx").innerHTML = ""; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/history.svc/ihistory/"; url = url + operation; curId = queryString.split("="); // Set security token uname = curId[2]; curId = curId[1]; curId = curId.split("&"); curId = curId[0]; var body = '{"docKey":\"'; body = body + curId + '\","secToken":\"'; body = body + uname + '\"}'; // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function showNotes(histObject) { // get the reference for the body document.getElementById("mainview").innerHTML = ""; document.getElementById("subMenu").innerHTML = ""; document.getElementById("details").innerHTML = "History Details"; var body = document.getElementsByTagName("body")[0]; // creates a
element and a element var fldset = document.createElement("fieldset"); var tbl = document.createElement("table"); var tblBody = document.createElement("tbody"); var tblheader = document.createElement("tr"); var colHeader = document.createElement("td"); colHeader.setAttribute("class", "tt"); var colHeaderText = document.createTextNode("Event Date"); var bold = document.createElement("b"); bold.appendChild(colHeaderText); tblheader.appendChild(colHeader); colHeader.appendChild(bold); tblBody.appendChild(tblheader); var colHeader2 = document.createElement("td"); colHeader2.setAttribute("class", "tt"); var colHeaderText2 = document.createTextNode("Title"); var bold2 = document.createElement("b"); bold2.appendChild(colHeaderText2); tblheader.appendChild(colHeader2); colHeader2.appendChild(bold2); tblBody.appendChild(tblheader); var colHeader3 = document.createElement("td"); colHeader3.setAttribute("class", "tt"); var colHeaderText3 = document.createTextNode("Description"); var bold3 = document.createElement("b"); bold3.appendChild(colHeaderText3); tblheader.appendChild(colHeader3); colHeader3.appendChild(bold3); tblBody.appendChild(tblheader); // creating all cells for (var j = 0; j < histObject.historyxResult.length; j++) { if (histObject.historyxResult[j].isNote == "1") { // creates a table row var row = document.createElement("tr"); var cell = document.createElement("td"); cell.setAttribute("class", "tt"); var cellText = document.createTextNode(histObject.historyxResult[j].eventDate); var cell2 = document.createElement("td"); cell2.setAttribute("class", "tt"); var cellText2 = document.createTextNode(histObject.historyxResult[j].noteTitle); var imgLink = document.createElement("a"); //index = j; //imgLink.setAttribute("href", "#"); //imgLink.setAttribute("onclick", "notePanelEdit(queryString,histObject,'" + j + "');return false;"); //imgLink.setAttribute("return", "true;"); //embed link in second cell with note title as link text //imgLink.appendChild(cellText2); //cell2.appendChild(imgLink); cell2.appendChild(cellText2); var cell3 = document.createElement("td"); cell3.setAttribute("class", "tt"); var cellText3 = document.createTextNode(histObject.historyxResult[j].description); cell.appendChild(cellText); row.appendChild(cell); cell2.appendChild(imgLink); row.appendChild(cell2); cell3.appendChild(cellText3); row.appendChild(cell3); // add the row to the end of the table body tblBody.appendChild(row); } } // put the in the
tbl.appendChild(tblBody); // appends
into document.getElementById("mainview").appendChild(tbl); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "0"); } function getImages(uname, curId) { var operation = "viewdocx"; var curIdx = curId; httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; viewObject = JSON.parse(JSONtext); if (viewObject.viewdocxResult[0] == 0) { document.getElementById("subMenu").innerHTML = "Document type is not supported for preview or cannot be previewed online at this time

"; } else { documentMenu(uname); iFrameFirstPageView(viewObject, uname, curIdx); } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/viewdoc.svc/iviewdoc/"; url = url + operation; curId = queryString.split("="); // Set security token uname = curId[2]; curId = curId[1]; curId = curId.split("&"); if (curId.length > 0) { curId = curId[0]; } var docId = document.getElementById("statusx").innerHTML; if (docId.length > 3) { docId = docId.split("&"); docId = docId[0]; } var body = '{"docId":\"'; body = body + docId + '\","secToken":\"'; body = body + uname + '\"}'; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function DoiFrame(queryString) { // Call this function for document viewing etc. // Show loading process indicator document.getElementById("subMenu").innerHTML = "

"; curId = queryString.split("="); // Set security token uname = curId[2]; curId = curId[1]; curId = curId.split("&"); if (curId.length > 0) { curId = curId[0]; } document.getElementById("statusx").innerHTML = curId; getImages(uname, curId); return false; } function iFrameFirstPageView(viewObject, uname, curId) { var curIdx = curId; document.getElementById("mainview").innerHTML = ""; document.getElementById("mainview").innerHTML = ""; var ifr = document.createElement("iframe"); ifr.setAttribute("id", "docframe"); // Set security token curId = queryString.split("="); uname = curId[2]; queryString = "https://api.rocketlawyer.com/iframe/docview.aspx?docId=" + curIdx + "&uname=" + uname; ifr.setAttribute("src", queryString); ifr.setAttribute("frameborder", "1"); ifr.setAttribute("scrolling", "yes"); ifr.setAttribute("width", "100%"); ifr.setAttribute("height", "740px"); //var onloadF = "autoIframe('docframe');"; //ifr.onload = new Function(onloadF); ////ifr.setAttribute("onload", onloadF); document.getElementById("mainview").innerHTML = ""; document.getElementById("mainview").appendChild(ifr); } function downloadFile(uname) { // Call this function for document download document.getElementById("details").innerHTML = "Download Details"; var docId = document.getElementById("statusx").innerHTML; document.getElementById("statusx").innerHTML = docId; document.getElementById("mainview").innerHTML = ""; curId = queryString.split("="); // Set security token secToken = curId[2]; curId = curId[1]; downloadMenu(uname, "history"); var iframe = document.createElement("iframe"); iframe.setAttribute("src", "https://api.rocketlawyer.com/iframe/download.aspx?uname=" + uname + "&docid=" + docId); iframe.setAttribute("frameborder", "0"); iframe.setAttribute("scrolling", "no"); iframe.setAttribute("width", "400px"); iframe.setAttribute("height", "150px"); //document.getElementById("subMenu").innerHTML = "Click the 'Home' button to view your document list, when finished"; document.getElementById("mainview").appendChild(iframe); } function uploadFile(uname) { document.getElementById("subMenu").innerHTML = ""; // Call this function for document upload document.getElementById("details").innerHTML = "Import Details"; document.getElementById("mainview").innerHTML = ""; curId = queryString.split("="); // Set security token secToken = curId[2]; curId = curId[1]; var iframe = document.createElement("iframe"); iframe.setAttribute("src", "https://api.rocketlawyer.com/iframe/upload.aspx?uname=" + uname); iframe.setAttribute("frameborder", "0"); iframe.setAttribute("scrolling", "no"); iframe.setAttribute("width", "400px"); iframe.setAttribute("height", "150px"); document.getElementById("mainview").appendChild(iframe); } function getUserInfo(uname) { httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; getUserInfoObject = JSON.parse(JSONtext); var queryString = ""; if (getUserInfoObject.getUserInfoxResult == null) { document.getElementById("statusx").innerHTML = "Invalid user credentials. Please try again"; } else { document.getElementById("mainview").innerHTML = ""; RefreshTable(getUserInfoObject); } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/getUserInfo.svc/igetuserinfo/" url = url + "getUserInfox"; // Build the body of the JSON message var body = '{"secToken":\"'; body = body + uname + '\"}'; // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function notePanel(queryString) { document.getElementById("mainview").innerHTML = "

Title: " + "
(will share note with users having access to this document/file)

" + "      

" + ""; noteShareValue = "false"; document.getElementById("noteShare").value = "Share Note"; } function notePanelEdit(queryString, histObject, index) { document.getElementById("mainview").innerHTML = "

Title: " + "
(will share note with users having access to this document/file)

" + "      

" + " "; if (histObject.historyxResult[index].noteShare == true) { noteShareValue = "true"; document.getElementById("noteShare").value = "Do not Share Note"; } if (histObject.historyxResult[index].noteShare == false) { noteShareValue = "false"; document.getElementById("noteShare").value = "Share Note"; } return false; } function renamePanel(queryString) { document.getElementById("mainview").innerHTML = "

New Name: " + "

"; } function addNote(queryString) { document.getElementById("details").innerHTML = "Note Details"; httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; noteInitObject = JSON.parse(JSONtext); if (noteInitObject.noteInitResult = true) { document.getElementById("statusx").innerHTML = curId; showHistory(uname) } else { document.getElementById("mainview").innerHTML = "You do not have permissions to add notes to this document. Contact the document's owner to get sufficient permissions."; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/history.svc/ihistory/" url = url + "initNote"; curId = queryString.split("="); // Set security token uname = curId[2]; curId = curId[1]; curId = curId.split("&"); curId = curId[0]; // Build the body of the JSON message var body = '{"docKey":\"'; body = body + curId + '\","secToken":\"'; body = body + uname + '\"'; body = body + '\,"noteTitle":\"'; var noteTitle = document.getElementById("noteTitle").value; var noteText = document.getElementById("noteText").value; var noteShare = noteShareValue; body = body + noteTitle + '\","noteText":\"' + noteText body = body + '\","noteShare":' + noteShare + '}'; // Set current document document.getElementById("statusx").innerHTML = curId; // Show loading process indicator document.getElementById("subMenu").innerHTML = "

"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function editNote(queryString, psuedoKey) { document.getElementById("details").innerHTML = "Note Details"; httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; document.getElementById("statusx").innerHTML = JSONtext; noteEditObject = JSON.parse(JSONtext); if (noteEditObject.noteEditResult = true) { document.getElementById("statusx").innerHTML = curId[0]; showHistory(uname) } else { document.getElementById("mainview").innerHTML = "You do not have permissions to add or edit notes for this document. Contact the document's owner to get sufficient permissions."; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/history.svc/ihistory/" url = url + "editNote"; curId = queryString.split("="); // Set security token uname = curId[2]; curId = curId[1]; curId = curId.split("&"); curId = curId[0]; // Build the body of the JSON message var body = '{"docKey":\"'; body = body + curId + '\","secToken":\"'; body = body + uname + '\"'; body = body + '\,"noteTitle":\"'; var noteTitle = document.getElementById("noteTitle").value; var noteText = document.getElementById("noteText").value; var noteShare = noteShareValue; body = body + noteTitle + '\","noteText":\"' + noteText + '\","psuedoKey":' + psuedoKey + ',"noteShare":' + noteShare + '}'; // Set current document document.getElementById("statusx").innerHTML = curId; // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function removeNote(queryString, psuedoKey) { httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; document.getElementById("statusx").innerHTML = JSONtext; noteRemoveObject = JSON.parse(JSONtext); if (noteRemoveObject.noteRemoveResult = true) { document.getElementById("statusx").innerHTML = curId[0]; showHistory(uname) } else { document.getElementById("mainview").innerHTML = "You do not have permissions to remove notes for this document. Contact the document's owner to get sufficient permissions."; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/history.svc/ihistory/" url = url + "removeNote"; curId = queryString.split("="); // Set security token uname = curId[2]; curId = curId[1]; curId = curId.split("&"); curId = curId[0]; // Build the body of the JSON message var body = '{"docKey":\"'; body = body + curId + '\","secToken":\"'; body = body + uname + '\"'; body = body + '\,"noteTitle":\"'; var noteTitle = document.getElementById("noteTitle").value; var noteText = document.getElementById("noteText").value; body = body + noteTitle + '\","noteText":\"' + noteText + '\","psuedoKey":' + psuedoKey + '}'; // Set current document document.getElementById("statusx").innerHTML = curId[0]; // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function noteShareInit() { checkShare = document.getElementById("noteShare").value; if (checkShare == "Share Note") { noteShareValue = "true"; document.getElementById("noteShare").value = "Do not Share Note"; } if (checkShare == "Do not Share Note") { noteShareValue = "false"; document.getElementById("noteShare").value = "Share Note"; } } function docShare() { document.getElementById("mainview").innerHTML = "

Email of Share Contact " + "

" } function docShareInit(queryString) { httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; docShareInitObject = JSON.parse(JSONtext); //clear the ajax load indicator document.getElementById("subMenu").innerHTML = ""; if (docShareInitObject.ShareDocumentResult == true) { document.getElementById("statusx").innerHTML = curId[0]; document.getElementById("mainview").innerHTML = "This document is now shared with the Contact/Person you specified"; } else { document.getElementById("mainview").innerHTML = "You either do not have permissions to share this document OR are not the original owner of the document OR you are trying to share with yourself, which is not allowed."; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/document.svc/idocument/" url = url + "ShareDocument"; curId = queryString.split("="); // Set security token uname = curId[3]; curId = curId[2]; curId = curId.split("&"); // Build the body of the JSON message var body = '{"docKey":\"'; body = body + curId[0] + '\","secToken":\"'; body = body + uname + '\","email":\"' + document.getElementById("docShareEmail").value + '\"}'; // Show loading process indicator document.getElementById("subMenu").innerHTML = "

"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function removeDocumentFile(queryString) { // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; docRemoveObject = JSON.parse(JSONtext); if (docRemoveObject.RemoveDocumentResult = true) { getUserInfo(uname); } else { document.getElementById("mainview").innerHTML = "You do not have permissions to remove this document or document does not exist."; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/document.svc/idocument/" url = url + "RemoveDocument"; curId = queryString.split("="); // Set security token uname = curId[3]; curId = curId[2]; curId = curId.split("&"); if (uname == null) { uname = curId[0]; curId[0] = document.getElementById("statusx").innerHTML; } // Build the body of the JSON message var body = '{"docKey":\"'; body = body + curId[0] + '\","secToken":\"'; body = body + uname + '\"}'; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function copyDocumentFile(queryString) { httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; docCopyObject = JSON.parse(JSONtext); if (docCopyObject.CopyDocumentResult = true) { getUserInfo(uname); } else { document.getElementById("mainview").innerHTML = "You do not have permissions to copy this document or document does not exist."; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/document.svc/idocument/" url = url + "CopyDocument"; curId = queryString.split("="); // Set security token uname = curId[3]; curId = curId[2]; curId = curId.split("&"); if (uname == null) { uname = curId[0]; curId[0] = document.getElementById("statusx").innerHTML; } // Build the body of the JSON message var body = '{"docKey":\"'; body = body + curId[0] + '\","secToken":\"'; body = body + uname + '\"}'; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function renameDocumentFile(queryString) { httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; docRenameObject = JSON.parse(JSONtext); if (docRenameObject.RenameDocumentResult = true) { getUserInfo(uname); } else { document.getElementById("mainview").innerHTML = "You do not have permissions to rename this document or document does not exist."; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/document.svc/idocument/" url = url + "RenameDocument"; curId = queryString.split("="); // Set security token uname = curId[3]; curId = curId[2]; curId = curId.split("&"); if (uname == null) { uname = curId[0]; curId[0] = document.getElementById("statusx").innerHTML; } // Build the body of the JSON message var body = '{"docKey":\"'; body = body + curId[0] + '\","secToken":\"'; body = body + uname + '\","newFileName":\"' + document.getElementById("fileName").value + '\"}'; // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function goBack(goBackOp) { // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; curId = queryString.split("="); // Set security token uname = curId[2]; curId = curId[1]; curId = curId.split("&"); curId = curId[0]; if (goBackOp == "DoiFrame") { DoiFrame(queryString); } if (goBackOp == "history") { DoiFrame(queryString); } if (goBackOp == "notePanel") { //clear the slate (do not want to append) document.getElementById("mainview").innerHTML = ""; showHistory(uname); } } function logOut(queryString) { httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; logOutObject = JSON.parse(JSONtext); if (logOutObject.LoginxResult = true) { window.location.reload(true); } else { document.getElementById("mainview").innerHTML = "There was a problem logging out. Please try logging out again."; } } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/login.svc/ilogin/" url = url + "ClearCurrentUser"; // Build the body of the JSON message var body = ""; // Show loading process indicator document.getElementById("subMenu").innerHTML = "
"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); } function GetCurrentUser() { var currentUserName = null; httpRequest(); // Create result handler xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { JSONtext = xmlHttp.responseText; var returnObject = JSON.parse(JSONtext); currentUserName = returnObject.GetCurrentUserResult; //if (currentUserName != null) // masterView(); } } // Build the operation URL var url = "https://api.rocketlawyer.com/endpoints/login.svc/ilogin/" url = url + "GetCurrentUser"; // Build the body of the JSON message var body = ""; // Show loading process indicator //var oldhtml = document.getElementById("subMenu").innerHTML; //document.getElementById("subMenu").innerHTML = "
"; // Send the HTTP request xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/json"); xmlHttp.send(body); //document.getElementById("subMenu").innerHTML = oldhtml; } // ]]>