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 @@
this.docId = null;
this.url = null;
this.urlChanges = null;
this.currentChangeId = null;
this.currentChangeId = -1;
this.newChangeId = -1;
this.colors = null;
this.changes = null;
if (newObj) this.update(newObj);
}
asc_CVersionHistory.prototype.update = function (newObj) {
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) {
this.docId = newObj.docId;
this.url = newObj.url;
this.urlChanges = newObj.urlChanges;
this.currentChangeId = newObj.currentChangeId;
this.colors = newObj.colors;
this.currentChangeId = -1;
this.changes = null;
}
this.colors = newObj.colors;
this.newChangeId = newObj.currentChangeId;
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_setUrl = function(val) {this.url = val;};
asc_CVersionHistory.prototype.asc_setUrlChanges = function(val) {this.urlChanges = val;};
......
......@@ -7132,13 +7132,8 @@ function _onOpenCommand(fCallback, incomeObject) {
}
if (result.changes && editor.VersionHistory) {
var arrColors = editor.VersionHistory.colors, color;
for (var i = 0; i < result.changes.length; ++i) {
color = arrColors[i];
editor._coAuthoringSetChanges(result.changes[i], color ?
new CDocumentColor((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF) :
new CDocumentColor(191, 255, 199));
}
editor.VersionHistory.changes = result.changes;
editor.VersionHistory.applyChanges(editor);
}
if (result.bSerFormat)
......@@ -7500,6 +7495,10 @@ asc_docs_api.prototype.asc_showRevision = function (newObj) {
this.DocInfo.put_Url(this.VersionHistory.url);
documentUrlChanges = this.VersionHistory.urlChanges;
this.LoadDocument();
} else if (this.VersionHistory.currentChangeId < newObj.currentChangeId) {
// Нужно только добавить некоторые изменения
editor.VersionHistory.applyChanges(editor);
CollaborativeEditing.Apply_OtherChanges();
}
};
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