Commit c5e78a6e authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Реализовал частичное применение изменений

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62847 954022d7-b5bf-4e40-9824-e11837661b57
parent c964071e
...@@ -2532,23 +2532,37 @@ ...@@ -2532,23 +2532,37 @@
this.docId = null; this.docId = null;
this.url = null; this.url = null;
this.urlChanges = null; this.urlChanges = null;
this.currentChangeId = null; this.currentChangeId = -1;
this.newChangeId = -1;
this.colors = null; this.colors = null;
this.changes = null;
if (newObj) this.update(newObj); if (newObj) this.update(newObj);
} }
asc_CVersionHistory.prototype.update = function (newObj) { asc_CVersionHistory.prototype.update = function (newObj) {
var bUpdate = (this.docId !== newObj.docId || this.url !== newObj.url || var bUpdate = (this.docId !== newObj.docId || this.url !== newObj.url ||
this.urlChanges !== newObj.urlChanges || this.currentChangeId === newObj.currentChangeId); this.urlChanges !== newObj.urlChanges || this.currentChangeId > newObj.currentChangeId);
if (bUpdate) { if (bUpdate) {
this.docId = newObj.docId; this.docId = newObj.docId;
this.url = newObj.url; this.url = newObj.url;
this.urlChanges = newObj.urlChanges; this.urlChanges = newObj.urlChanges;
this.currentChangeId = newObj.currentChangeId; this.currentChangeId = -1;
this.colors = newObj.colors; this.changes = null;
} }
this.colors = newObj.colors;
this.newChangeId = newObj.currentChangeId;
return bUpdate; return bUpdate;
}; };
asc_CVersionHistory.prototype.applyChanges = function (editor) {
var color;
this.newChangeId = (null == this.newChangeId) ? (this.changes.length - 1) : this.newChangeId;
for (var i = this.currentChangeId + 1; i <= this.newChangeId && i < this.changes.length; ++i) {
color = this.colors[i];
editor._coAuthoringSetChanges(this.changes[i], color ?
new CDocumentColor((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF) :
new CDocumentColor(191, 255, 199));
}
};
asc_CVersionHistory.prototype.asc_setDocId = function(val) {this.docId = val;}; asc_CVersionHistory.prototype.asc_setDocId = function(val) {this.docId = val;};
asc_CVersionHistory.prototype.asc_setUrl = function(val) {this.url = val;}; asc_CVersionHistory.prototype.asc_setUrl = function(val) {this.url = val;};
asc_CVersionHistory.prototype.asc_setUrlChanges = function(val) {this.urlChanges = val;}; asc_CVersionHistory.prototype.asc_setUrlChanges = function(val) {this.urlChanges = val;};
......
...@@ -7132,13 +7132,8 @@ function _onOpenCommand(fCallback, incomeObject) { ...@@ -7132,13 +7132,8 @@ function _onOpenCommand(fCallback, incomeObject) {
} }
if (result.changes && editor.VersionHistory) { if (result.changes && editor.VersionHistory) {
var arrColors = editor.VersionHistory.colors, color; editor.VersionHistory.changes = result.changes;
for (var i = 0; i < result.changes.length; ++i) { editor.VersionHistory.applyChanges(editor);
color = arrColors[i];
editor._coAuthoringSetChanges(result.changes[i], color ?
new CDocumentColor((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF) :
new CDocumentColor(191, 255, 199));
}
} }
if (result.bSerFormat) if (result.bSerFormat)
...@@ -7500,6 +7495,10 @@ asc_docs_api.prototype.asc_showRevision = function (newObj) { ...@@ -7500,6 +7495,10 @@ asc_docs_api.prototype.asc_showRevision = function (newObj) {
this.DocInfo.put_Url(this.VersionHistory.url); this.DocInfo.put_Url(this.VersionHistory.url);
documentUrlChanges = this.VersionHistory.urlChanges; documentUrlChanges = this.VersionHistory.urlChanges;
this.LoadDocument(); this.LoadDocument();
} else if (this.VersionHistory.currentChangeId < newObj.currentChangeId) {
// Нужно только добавить некоторые изменения
editor.VersionHistory.applyChanges(editor);
CollaborativeEditing.Apply_OtherChanges();
} }
}; };
asc_docs_api.prototype.asc_undoAllChanges = function () asc_docs_api.prototype.asc_undoAllChanges = function ()
......
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