Commit 710a99c8 authored by Ilya Kirillov's avatar Ilya Kirillov

Deleted test function with builder script.

parent 96fc81d5
......@@ -5149,166 +5149,4 @@
Api.prototype.private_CreateApiDocContent = function(oDocContent){
return new ApiDocumentContent(oDocContent);
};
}(window, null));
function TEST_BUILDER_REPORT()
{
var oApi = editor;
var oDocument = oApi.GetDocument();
var oCommentsReport = oDocument.GetCommentsReport();
console.log(oCommentsReport);
var oReviewReport = oDocument.GetReviewReport();
console.log(oReviewReport);
var oParagraph = oApi.CreateParagraph();
oDocument.Push(oParagraph);
oParagraph.AddText("Comments report");
var nRows = 1;
for (var sUserName in oCommentsReport)
{
nRows += oCommentsReport[sUserName].length;
}
var nCols = 6;
var oTable = oApi.CreateTable(nCols, nRows);
oDocument.Push(oTable);
function privateFillCell(nCurRow, nCurCol, sText)
{
var oRow = oTable.GetRow(nCurRow);
var oCell = oRow.GetCell(nCurCol);
var oCellContent = oCell.GetContent();
var oRun = oCellContent.GetElement(0).AddText(sText);
return {Cell : oCell, Run : oRun};
}
privateFillCell(0, 0, "Name");
privateFillCell(0, 1, "Date");
privateFillCell(0, 2, "");
privateFillCell(0, 3, "Solved");
privateFillCell(0, 4, "Text");
privateFillCell(0, 5, "Quote text");
var nCurRow = 1;
for (var sUserName in oCommentsReport)
{
var arrUserComments = oCommentsReport[sUserName];
var arrCells = [];
for (var nIndex = 0, nCount = arrUserComments.length; nIndex < nCount; ++nIndex, ++nCurRow)
{
var oCommentInfo = oCommentsReport[sUserName][nIndex];
arrCells.push(privateFillCell(nCurRow, 0, "").Cell);
privateFillCell(nCurRow, 1, (new Date(oCommentInfo["Date"])).toLocaleString());
privateFillCell(nCurRow, 2, oCommentInfo["IsAnswer"] === true ? "answer" : "comment");
if (oCommentInfo["IsAnswer"] !== true)
{
if (oCommentInfo["IsSolved"] === true)
privateFillCell(nCurRow, 3, "yes").Run.SetColor(0, 255, 0);
else
privateFillCell(nCurRow, 3, "no").Run.SetColor(255, 0, 0);
}
privateFillCell(nCurRow, 4, oCommentInfo["CommentMessage"] ? oCommentInfo["CommentMessage"] : "");
privateFillCell(nCurRow, 5, oCommentInfo["QuoteText"] ? oCommentInfo["QuoteText"] : "");
}
var oMergedCell = oTable.MergeCells(arrCells);
if (oMergedCell)
{
var oCellContent = oMergedCell.GetContent();
oCellContent.GetElement(0).AddText(sUserName);
}
else if (arrCells.length > 0)
{
var oCellContent = arrCells[0].GetContent();
oCellContent.GetElement(0).AddText(sUserName);
}
}
oTable.SetStyle(oDocument.GetStyle("Bordered"));
oParagraph = oApi.CreateParagraph();
oDocument.Push(oParagraph);
oParagraph.AddText("Review report");
nRows = 1;
for (var sUserName in oReviewReport)
{
nRows += oReviewReport[sUserName].length;
}
nCols = 4;
oTable = oApi.CreateTable(nCols, nRows);
oDocument.Push(oTable);
privateFillCell(0, 0, "Name");
privateFillCell(0, 1, "Date");
privateFillCell(0, 2, "Action");
privateFillCell(0, 3, "");
var nCurRow = 1;
for (var sUserName in oReviewReport)
{
var arrUserChanges = oReviewReport[sUserName];
var arrCells = [];
for (var nIndex = 0, nCount = arrUserChanges.length; nIndex < nCount; ++nIndex, ++nCurRow)
{
var oChangeInfo = arrUserChanges[nIndex];
arrCells.push(privateFillCell(nCurRow, 0, "").Cell);
privateFillCell(nCurRow, 1, (new Date(oChangeInfo["Date"])).toLocaleString());
var sType = oChangeInfo["Type"];
if ("TextAdd" === sType)
{
privateFillCell(nCurRow, 2, "Added text");
privateFillCell(nCurRow, 3, oChangeInfo["Value"]);
}
else if ("TextRem" === sType)
{
privateFillCell(nCurRow, 2, "Removed text");
privateFillCell(nCurRow, 3, oChangeInfo["Value"]).Run.SetStrikeout(true);
}
else if ("TextPr" === sType)
{
privateFillCell(nCurRow, 2, "Formatted text");
}
else if ("ParaAdd" === sType)
{
privateFillCell(nCurRow, 2, "Added paragraph");
}
else if ("ParaRem" === sType)
{
privateFillCell(nCurRow, 2, "Removed paragraph");
}
else if ("ParaPr" === sType)
{
privateFillCell(nCurRow, 2, "Formatted paragraph");
}
else
{
privateFillCell(nCurRow, 2, "Unknown change");
}
}
var oMergedCell = oTable.MergeCells(arrCells);
if (oMergedCell)
{
var oCellContent = oMergedCell.GetContent();
oCellContent.GetElement(0).AddText(sUserName);
}
else if (arrCells.length > 0)
{
var oCellContent = arrCells[0].GetContent();
oCellContent.GetElement(0).AddText(sUserName);
}
}
oTable.SetStyle(oDocument.GetStyle("Bordered"));
oDocument.Document.Recalculate_FromStart();
}
\ No newline at end of file
}(window, null));
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment