Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
208dba78
Commit
208dba78
authored
Feb 26, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented receiving a report about all comments in the document.
parent
2bc86d04
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
37 deletions
+118
-37
word/Editor/Comments.js
word/Editor/Comments.js
+28
-0
word/Private/TrackRevisions.js
word/Private/TrackRevisions.js
+15
-14
word/Private/comments.js
word/Private/comments.js
+75
-23
No files found.
word/Editor/Comments.js
View file @
208dba78
...
...
@@ -210,6 +210,26 @@ function CCommentData()
}
};
}
CCommentData
.
prototype
.
GetUserName
=
function
()
{
return
this
.
m_sUserName
;
};
CCommentData
.
prototype
.
GetDateTime
=
function
()
{
var
nTime
=
parseInt
(
this
.
m_sTime
);
if
(
isNaN
(
nTime
))
nTime
=
0
;
return
nTime
;
};
CCommentData
.
prototype
.
GetRepliesCount
=
function
()
{
return
this
.
Get_RepliesCount
();
};
CCommentData
.
prototype
.
GetReply
=
function
(
nIndex
)
{
return
this
.
Get_Reply
(
nIndex
);
};
function
CCommentDrawingRect
(
X
,
Y
,
W
,
H
,
CommentId
,
InvertTransform
)
{
...
...
@@ -410,6 +430,10 @@ function CComment(Parent, Data)
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId
.
Add
(
this
,
this
.
Id
);
}
CComment
.
prototype
.
GetData
=
function
()
{
return
this
.
Data
;
};
var
comments_NoComment
=
0
;
var
comments_NonActiveComment
=
1
;
...
...
@@ -561,6 +585,10 @@ function CComments()
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId
.
Add
(
this
,
this
.
Id
);
}
CComments
.
prototype
.
GetAllComments
=
function
()
{
return
this
.
m_aComments
;
};
//----------------------------------------------------------------------------------------------------------------------
// Класс для работы внутри параграфа
...
...
word/Private/TrackRevisions.js
View file @
208dba78
...
...
@@ -140,20 +140,21 @@ Asc['asc_docs_api'].prototype.asc_GetTrackRevisionsReportByAuthors = function()
return
oResult
;
};
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_SetTrackRevisions
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_SetTrackRevisions
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_IsTrackRevisions
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_IsTrackRevisions
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
sync_BeginCatchRevisionsChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
sync_BeginCatchRevisionsChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
sync_EndCatchRevisionsChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
sync_EndCatchRevisionsChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
sync_AddRevisionsChange
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
sync_AddRevisionsChange
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_AcceptChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_AcceptChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_RejectChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_RejectChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_HaveRevisionsChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_HaveRevisionsChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_HaveNewRevisionsChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_HaveNewRevisionsChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_GetNextRevisionsChange
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_GetNextRevisionsChange
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_GetPrevRevisionsChange
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_GetPrevRevisionsChange
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
sync_UpdateRevisionsChangesPosition
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
sync_UpdateRevisionsChangesPosition
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_AcceptAllChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_AcceptAllChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_RejectAllChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_RejectAllChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_SetTrackRevisions
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_SetTrackRevisions
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_IsTrackRevisions
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_IsTrackRevisions
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
sync_BeginCatchRevisionsChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
sync_BeginCatchRevisionsChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
sync_EndCatchRevisionsChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
sync_EndCatchRevisionsChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
sync_AddRevisionsChange
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
sync_AddRevisionsChange
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_AcceptChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_AcceptChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_RejectChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_RejectChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_HaveRevisionsChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_HaveRevisionsChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_HaveNewRevisionsChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_HaveNewRevisionsChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_GetNextRevisionsChange
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_GetNextRevisionsChange
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_GetPrevRevisionsChange
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_GetPrevRevisionsChange
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
sync_UpdateRevisionsChangesPosition
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
sync_UpdateRevisionsChangesPosition
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_AcceptAllChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_AcceptAllChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_RejectAllChanges
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_RejectAllChanges
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_GetTrackRevisionsReportByAuthors
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_GetTrackRevisionsReportByAuthors
;
//----------------------------------------------------------------------------------------------------------------------
// CDocument
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Private/comments.js
View file @
208dba78
...
...
@@ -32,27 +32,79 @@
"
use strict
"
;
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_addComment
=
function
(
AscCommentData
)
{
if
(
true
===
AscCommon
.
CollaborativeEditing
.
Get_GlobalLock
())
{
return
;
}
if
(
null
==
this
.
WordControl
.
m_oLogicDocument
)
{
return
;
}
// Комментарий без цитаты позволяем добавить всегда
if
(
true
!==
this
.
can_AddQuotedComment
()
||
false
===
this
.
WordControl
.
m_oLogicDocument
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_Paragraph_Content
))
{
var
CommentData
=
new
CCommentData
();
CommentData
.
Read_FromAscCommentData
(
AscCommentData
);
this
.
WordControl
.
m_oLogicDocument
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_AddComment
);
var
Comment
=
this
.
WordControl
.
m_oLogicDocument
.
Add_Comment
(
CommentData
);
if
(
null
!=
Comment
)
{
this
.
sync_AddComment
(
Comment
.
Get_Id
(),
CommentData
);
}
return
Comment
.
Get_Id
();
}
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_addComment
=
function
(
AscCommentData
)
{
if
(
true
===
AscCommon
.
CollaborativeEditing
.
Get_GlobalLock
())
{
return
;
}
if
(
null
==
this
.
WordControl
.
m_oLogicDocument
)
{
return
;
}
// Комментарий без цитаты позволяем добавить всегда
if
(
true
!==
this
.
can_AddQuotedComment
()
||
false
===
this
.
WordControl
.
m_oLogicDocument
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_Paragraph_Content
))
{
var
CommentData
=
new
CCommentData
();
CommentData
.
Read_FromAscCommentData
(
AscCommentData
);
this
.
WordControl
.
m_oLogicDocument
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_AddComment
);
var
Comment
=
this
.
WordControl
.
m_oLogicDocument
.
Add_Comment
(
CommentData
);
if
(
null
!=
Comment
)
{
this
.
sync_AddComment
(
Comment
.
Get_Id
(),
CommentData
);
}
return
Comment
.
Get_Id
();
}
};
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_GetCommentsReportByAuthors
=
function
()
{
var
oReport
=
{};
function
privateProcessCommentData
(
isTopComment
,
oCommentData
)
{
var
sUserName
=
oCommentData
.
GetUserName
();
var
nDateTime
=
oCommentData
.
GetDateTime
();
if
(
!
oReport
[
sUserName
])
oReport
[
sUserName
]
=
[];
var
arrUserComments
=
oReport
[
sUserName
];
var
nPos
=
0
;
var
nLen
=
arrUserComments
.
length
;
while
(
nPos
<
nLen
)
{
if
(
nDateTime
<
arrUserComments
[
nPos
].
Data
.
GetDateTime
())
break
;
nPos
++
;
}
arrUserComments
.
splice
(
nPos
,
0
,
{
Top
:
isTopComment
,
Data
:
oCommentData
});
for
(
var
nIndex
=
0
,
nCount
=
oCommentData
.
GetRepliesCount
();
nIndex
<
nCount
;
++
nIndex
)
{
privateProcessCommentData
(
false
,
oCommentData
.
GetReply
(
nIndex
))
}
}
var
oLogicDocument
=
this
.
WordControl
.
m_oLogicDocument
;
if
(
!
oLogicDocument
)
return
oReport
;
var
oAllComments
=
oLogicDocument
.
Comments
.
GetAllComments
();
for
(
var
sId
in
oAllComments
)
{
var
oComment
=
oAllComments
[
sId
];
privateProcessCommentData
(
true
,
oComment
.
GetData
());
}
return
oReport
;
};
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_addComment
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_addComment
;
\ No newline at end of file
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_addComment
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_addComment
;
Asc
[
'
asc_docs_api
'
].
prototype
[
'
asc_GetCommentsReportByAuthors
'
]
=
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_GetCommentsReportByAuthors
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment