Commit e0d74aa3 authored by konovalovsergey's avatar konovalovsergey

internal onlyoffice field for comment time

parent 32079517
......@@ -183,7 +183,8 @@ function asc_CCommentData(obj) {
bDocument: 11,
bSolved: 12,
aReplies: 13,
bHidden: 14
bHidden: 14,
sOOTime: 15
};
this.bHidden = false;
......@@ -197,6 +198,7 @@ function asc_CCommentData(obj) {
// Common
this.sText = "";
this.sTime = "";
this.sOOTime = "";
this.sUserId = "";
this.sUserName = "";
this.bDocument = true; // For compatibility with 'Word Comment Control'
......@@ -215,6 +217,7 @@ function asc_CCommentData(obj) {
// Common
this.sText = obj.sText;
this.sTime = obj.sTime;
this.sOOTime = obj.sOOTime;
this.sUserId = obj.sUserId;
this.sUserName = obj.sUserName;
this.bDocument = obj.bDocument;
......@@ -266,6 +269,9 @@ asc_CCommentData.prototype = {
asc_putTime: function(val) { this.sTime = val; },
asc_getTime: function() { return this.sTime; },
asc_putOnlyOfficeTime: function(val) { this.sOOTime = val; },
asc_getOnlyOfficeTime: function() { return this.sOOTime; },
asc_putUserId: function(val) { this.sUserId = val; },
asc_getUserId: function() { return this.sUserId; },
......@@ -321,6 +327,7 @@ asc_CCommentData.prototype = {
case this.Properties.nLevel: return this.nLevel; break;
case this.Properties.sText: return this.sText; break;
case this.Properties.sTime: return this.sTime; break;
case this.Properties.sOOTime: return this.sOOTime; break;
case this.Properties.sUserId: return this.sUserId; break;
case this.Properties.sUserName: return this.sUserName; break;
case this.Properties.bDocument: return this.bDocument; break;
......@@ -340,6 +347,7 @@ asc_CCommentData.prototype = {
case this.Properties.nLevel: this.nLevel = value; break;
case this.Properties.sText: this.sText = value; break;
case this.Properties.sTime: this.sTime = value; break;
case this.Properties.sOOTime: this.sOOTime = value; break;
case this.Properties.sUserId: this.sUserId = value; break;
case this.Properties.sUserName: this.sUserName = value; break;
case this.Properties.bDocument: this.bDocument = value; break;
......@@ -1479,6 +1487,8 @@ CCellCommentator.prototype.Redo = function(type, data) {
prot["asc_getQuoteText"] = prot.asc_getQuoteText;
prot["asc_putTime"] = prot.asc_putTime;
prot["asc_getTime"] = prot.asc_getTime;
prot["asc_putOnlyOfficeTime"] = prot.asc_putOnlyOfficeTime;
prot["asc_getOnlyOfficeTime"] = prot.asc_getOnlyOfficeTime;
prot["asc_putUserId"] = prot.asc_putUserId;
prot["asc_getUserId"] = prot.asc_getUserId;
prot["asc_putUserName"] = prot.asc_putUserName;
......
......@@ -547,7 +547,8 @@
Solved : 5,
Document : 6,
Replies : 7,
Reply : 8
Reply : 8,
OOTime : 9
};
var c_oSer_ConditionalFormatting = {
Pivot : 0,
......@@ -3822,6 +3823,14 @@
this.memory.WriteByte(c_oSer_CommentData.Time);
this.memory.WriteString2(this.DateToISO8601(oDate));
}
var sOOTime = oCommentData.asc_getOnlyOfficeTime();
if(null != sOOTime && "" !== sOOTime)
{
var oDate = new Date(sOOTime - 0);
this.memory.WriteByte(c_oSer_CommentData.OOTime);
this.memory.WriteString2(this.DateToISO8601(oDate));
}
var sUserId = oCommentData.asc_getUserId();
if(null != sUserId)
{
......@@ -6831,6 +6840,12 @@
if(null != oDate)
oCommentData.asc_putTime(oDate.getTime() + "");
}
else if ( c_oSer_CommentData.OOTime == type )
{
var oDate = this.Iso8601ToDate(this.stream.GetString2LE(length));
if(null != oDate)
oCommentData.asc_putOnlyOfficeTime(oDate.getTime() + "");
}
else if ( c_oSer_CommentData.UserId == type )
oCommentData.asc_putUserId(this.stream.GetString2LE(length));
else if ( c_oSer_CommentData.UserName == type )
......
......@@ -583,6 +583,12 @@ CWriteCommentData.prototype =
this.AdditionalData += ("0;" + this.Data.m_sUserId.length + ";" + this.Data.m_sUserId + ";" );
this.AdditionalData += ("1;" + this.Data.m_sUserName.length + ";" + this.Data.m_sUserName + ";" );
this.AdditionalData += ("2;1;" + (this.Data.m_bSolved ? "1;" : "0;"));
if (this.Data.m_sOOTime)
{
var d = new Date(this.Data.m_sOOTime - 0);
var WriteOOTime = this.DateToISO8601(d);
this.AdditionalData += ("3;" + WriteOOTime.length + ";" + WriteOOTime);
}
}
},
......@@ -638,6 +644,11 @@ CWriteCommentData.prototype =
_comment_data.m_sUserName = _value;
else if (2 == _attr)
_comment_data.m_bSolved = ("1" == _value) ? true : false;
else if (3 == _attr)
{
var _time = this.Iso8601ToDate(_value);
_comment_data.m_sOOTime = _time;
}
}
}
};
......@@ -668,6 +679,7 @@ function CCommentData()
{
this.m_sText = "";
this.m_sTime = "";
this.m_sOOTime = "";
this.m_sUserId = "";
this.m_sUserName = "";
this.m_sQuoteText = null;
......@@ -740,6 +752,7 @@ CCommentData.prototype =
{
this.m_sText = AscCommentData.asc_getText();
this.m_sTime = AscCommentData.asc_getTime();
this.m_sOOTime = AscCommentData.asc_getOnlyOfficeTime();
this.m_sUserId = AscCommentData.asc_getUserId();
this.m_sQuoteText = AscCommentData.asc_getQuoteText();
this.m_bSolved = AscCommentData.asc_getSolved();
......@@ -758,6 +771,7 @@ CCommentData.prototype =
{
// String : m_sText
// String : m_sTime
// String : m_sOOTime
// String : m_sUserId
// String : m_sUserName
// Bool : Null ли QuoteText
......@@ -769,6 +783,7 @@ CCommentData.prototype =
var Count = this.m_aReplies.length;
Writer.WriteString2( this.m_sText );
Writer.WriteString2( this.m_sTime );
Writer.WriteString2( this.m_sOOTime );
Writer.WriteString2( this.m_sUserId );
Writer.WriteString2( this.m_sUserName );
......@@ -792,6 +807,7 @@ CCommentData.prototype =
{
// String : m_sText
// String : m_sTime
// String : m_sOOTime
// String : m_sUserId
// Bool : Null ли QuoteText
// String : (Если предыдущий параметр false) QuoteText
......@@ -801,6 +817,7 @@ CCommentData.prototype =
this.m_sText = Reader.GetString2();
this.m_sTime = Reader.GetString2();
this.m_sOOTime = Reader.GetString2();
this.m_sUserId = Reader.GetString2();
this.m_sUserName = Reader.GetString2();
......
......@@ -4289,6 +4289,7 @@ background-repeat: no-repeat;\
{
this.m_sText = (undefined != obj.m_sText ) ? obj.m_sText : "";
this.m_sTime = (undefined != obj.m_sTime ) ? obj.m_sTime : "";
this.m_sOOTime = (undefined != obj.m_sOOTime ) ? obj.m_sOOTime : "";
this.m_sUserId = (undefined != obj.m_sUserId ) ? obj.m_sUserId : "";
this.m_sQuoteText = (undefined != obj.m_sQuoteText) ? obj.m_sQuoteText : null;
this.m_bSolved = (undefined != obj.m_bSolved ) ? obj.m_bSolved : false;
......@@ -4308,6 +4309,7 @@ background-repeat: no-repeat;\
{
this.m_sText = "";
this.m_sTime = "";
this.m_sOOTime = "";
this.m_sUserId = "";
this.m_sQuoteText = null;
this.m_bSolved = false;
......@@ -4332,6 +4334,14 @@ background-repeat: no-repeat;\
{
this.m_sTime = v;
};
asc_CCommentData.prototype.asc_getOnlyOfficeTime = function()
{
return this.m_sOOTime;
};
asc_CCommentData.prototype.asc_putOnlyOfficeTime = function(v)
{
this.m_sOOTime = v;
};
asc_CCommentData.prototype.asc_getUserId = function()
{
return this.m_sUserId;
......@@ -7211,6 +7221,8 @@ background-repeat: no-repeat;\
asc_CCommentData.prototype['asc_putText'] = asc_CCommentData.prototype.asc_putText;
asc_CCommentData.prototype['asc_getTime'] = asc_CCommentData.prototype.asc_getTime;
asc_CCommentData.prototype['asc_putTime'] = asc_CCommentData.prototype.asc_putTime;
asc_CCommentData.prototype['asc_getOnlyOfficeTime'] = asc_CCommentData.prototype.asc_getOnlyOfficeTime;
asc_CCommentData.prototype['asc_putOnlyOfficeTime'] = asc_CCommentData.prototype.asc_putOnlyOfficeTime;
asc_CCommentData.prototype['asc_getUserId'] = asc_CCommentData.prototype.asc_getUserId;
asc_CCommentData.prototype['asc_putUserId'] = asc_CCommentData.prototype.asc_putUserId;
asc_CCommentData.prototype['asc_getUserName'] = asc_CCommentData.prototype.asc_getUserName;
......
......@@ -40,6 +40,7 @@ function CCommentData()
{
this.m_sText = "";
this.m_sTime = "";
this.m_sOOTime = "";
this.m_sUserId = "";
this.m_sUserName = "";
this.m_sQuoteText = null;
......@@ -52,6 +53,7 @@ function CCommentData()
NewData.m_sText = this.m_sText;
NewData.m_sTime = this.m_sTime;
NewData.m_sOOTime = this.m_sOOTime;
NewData.m_sUserId = this.m_sUserId;
NewData.m_sUserName = this.m_sUserName;
NewData.m_sQuoteText = this.m_sQuoteText;
......@@ -128,6 +130,7 @@ function CCommentData()
{
this.m_sText = AscCommentData.asc_getText();
this.m_sTime = AscCommentData.asc_getTime();
this.m_sOOTime = AscCommentData.asc_getOnlyOfficeTime();
this.m_sUserId = AscCommentData.asc_getUserId();
this.m_sQuoteText = AscCommentData.asc_getQuoteText();
this.m_bSolved = AscCommentData.asc_getSolved();
......@@ -146,6 +149,7 @@ function CCommentData()
{
// String : m_sText
// String : m_sTime
// String : m_sOOTime
// String : m_sUserId
// String : m_sUserName
// Bool : Null ли QuoteText
......@@ -157,6 +161,7 @@ function CCommentData()
var Count = this.m_aReplies.length;
Writer.WriteString2( this.m_sText );
Writer.WriteString2( this.m_sTime );
Writer.WriteString2( this.m_sOOTime );
Writer.WriteString2( this.m_sUserId );
Writer.WriteString2( this.m_sUserName );
......@@ -180,6 +185,7 @@ function CCommentData()
{
// String : m_sText
// String : m_sTime
// String : m_sOOTime
// String : m_sUserId
// Bool : Null ли QuoteText
// String : (Если предыдущий параметр false) QuoteText
......@@ -189,6 +195,7 @@ function CCommentData()
this.m_sText = Reader.GetString2();
this.m_sTime = Reader.GetString2();
this.m_sOOTime = Reader.GetString2();
this.m_sUserId = Reader.GetString2();
this.m_sUserName = Reader.GetString2();
......
......@@ -541,7 +541,8 @@ var c_oSer_CommentsType = {
Text: 6,
QuoteText: 7,
Solved: 8,
Replies: 9
Replies: 9,
OOData: 10
};
var c_oSer_StyleType = {
......@@ -1014,6 +1015,72 @@ var g_sErrorCharCountMessage = "g_sErrorCharCountMessage";
var g_nErrorCharCount = 30000;
var g_nErrorParagraphCount = 1000;
function getCommentAdditionalData (comment) {
var AdditionalData = "";
if(null != comment.m_sOOTime && "" != comment.m_sOOTime)
{
AdditionalData += "teamlab_data:";
var dateStr = new Date(comment.m_sOOTime - 0).toISOString().slice(0, 19) + 'Z';
AdditionalData += "0;" + dateStr.length + ";" + dateStr + ";";
}
return AdditionalData;
};
function ReadNextInteger(_parsed)
{
var _len = _parsed.data.length;
var _found = -1;
var _Found = ";".charCodeAt(0);
for (var i = _parsed.pos; i < _len; i++)
{
if (_Found == _parsed.data.charCodeAt(i))
{
_found = i;
break;
}
}
if (-1 == _found)
return -1;
var _ret = parseInt(_parsed.data.substr(_parsed.pos, _found - _parsed.pos));
if (isNaN(_ret))
return -1;
_parsed.pos = _found + 1;
return _ret;
};
function ParceAdditionalData(AdditionalData, _comment_data)
{
if (AdditionalData.indexOf("teamlab_data:") != 0)
return;
var _parsed = { data : AdditionalData, pos : "teamlab_data:".length };
while (true)
{
var _attr = ReadNextInteger(_parsed);
if (-1 == _attr)
break;
var _len = ReadNextInteger(_parsed);
if (-1 == _len)
break;
var _value = _parsed.data.substr(_parsed.pos, _len);
_parsed.pos += (_len + 1);
if (0 == _attr){
var dateMs = Date.parse(_value);
if (isNaN(dateMs)) {
dateMs = new Date().getTime();
}
_comment_data.OODate = dateMs + "";
}
}
}
function CreateThemeUnifill(color, tint, shade){
var ret = null;
if(null != color){
......@@ -5563,6 +5630,12 @@ function BinaryCommentsTableWriter(memory, doc, oMapCommentId)
{
this.bs.WriteItem(c_oSer_CommentsType.Replies, function(){oThis.WriteReplies(comment.m_aReplies);});
}
var dataStr = getCommentAdditionalData(comment);
if (dataStr)
{
this.memory.WriteByte(c_oSer_CommentsType.OOData);
this.memory.WriteString2(dataStr);
}
};
this.WriteReplies = function(aComments)
{
......@@ -6467,6 +6540,8 @@ function BinaryFileReader(doc, openParams)
oCommentObj.m_sUserId = comment.UserId;
if(null != comment.Date)
oCommentObj.m_sTime = comment.Date;
if(null != comment.OODate)
oCommentObj.m_sOOTime = comment.OODate;
if(null != comment.Text)
oCommentObj.m_sText = comment.Text;
if(null != comment.Solved)
......@@ -13500,6 +13575,10 @@ function Binary_CommentsTableReader(doc, oReadResult, stream, oComments)
return oThis.ReadReplies(t,l,oNewImage.Replies);
});
}
else if ( c_oSer_CommentsType.OOData === type )
{
ParceAdditionalData(this.stream.GetString2LE(length), oNewImage);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
......
......@@ -5380,6 +5380,7 @@ background-repeat: no-repeat;\
{
this.m_sText = (undefined != obj.m_sText ) ? obj.m_sText : "";
this.m_sTime = (undefined != obj.m_sTime ) ? obj.m_sTime : "";
this.m_sOOTime = (undefined != obj.m_sOOTime ) ? obj.m_sOOTime : "";
this.m_sUserId = (undefined != obj.m_sUserId ) ? obj.m_sUserId : "";
this.m_sQuoteText = (undefined != obj.m_sQuoteText) ? obj.m_sQuoteText : null;
this.m_bSolved = (undefined != obj.m_bSolved ) ? obj.m_bSolved : false;
......@@ -5399,6 +5400,7 @@ background-repeat: no-repeat;\
{
this.m_sText = "";
this.m_sTime = "";
this.m_sOOTime = "";
this.m_sUserId = "";
this.m_sQuoteText = null;
this.m_bSolved = false;
......@@ -5423,6 +5425,14 @@ background-repeat: no-repeat;\
{
this.m_sTime = v;
};
asc_CCommentDataWord.prototype.asc_getOnlyOfficeTime = function()
{
return this.m_sOOTime;
};
asc_CCommentDataWord.prototype.asc_putOnlyOfficeTime = function(v)
{
this.m_sOOTime = v;
};
asc_CCommentDataWord.prototype.asc_getUserId = function()
{
return this.m_sUserId;
......@@ -8789,6 +8799,8 @@ background-repeat: no-repeat;\
asc_CCommentDataWord.prototype['asc_putText'] = asc_CCommentDataWord.prototype.asc_putText;
asc_CCommentDataWord.prototype['asc_getTime'] = asc_CCommentDataWord.prototype.asc_getTime;
asc_CCommentDataWord.prototype['asc_putTime'] = asc_CCommentDataWord.prototype.asc_putTime;
asc_CCommentDataWord.prototype['asc_getOnlyOfficeTime'] = asc_CCommentDataWord.prototype.asc_getOnlyOfficeTime;
asc_CCommentDataWord.prototype['asc_putOnlyOfficeTime'] = asc_CCommentDataWord.prototype.asc_putOnlyOfficeTime;
asc_CCommentDataWord.prototype['asc_getUserId'] = asc_CCommentDataWord.prototype.asc_getUserId;
asc_CCommentDataWord.prototype['asc_putUserId'] = asc_CCommentDataWord.prototype.asc_putUserId;
asc_CCommentDataWord.prototype['asc_getUserName'] = asc_CCommentDataWord.prototype.asc_getUserName;
......
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