[DE] Restore from changes in versions history.
This commit is contained in:
parent
4dc23c41ee
commit
b33f00e0a7
|
@ -162,10 +162,11 @@ Common.Gateway = new(function() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
requestRestore: function(revision) {
|
requestRestore: function(revision, url) {
|
||||||
_postMessage({
|
_postMessage({
|
||||||
event: 'onRequestRestore',
|
event: 'onRequestRestore',
|
||||||
data: revision
|
data: revision,
|
||||||
|
url: url
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ define([
|
||||||
|
|
||||||
setApi: function(api) {
|
setApi: function(api) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -87,11 +88,22 @@ define([
|
||||||
historyView.btnBackToDocument.on('click', _.bind(this.onClickBackToDocument, this));
|
historyView.btnBackToDocument.on('click', _.bind(this.onClickBackToDocument, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onDownloadUrl: function(url) {
|
||||||
|
if (this.isFromSelectRevision !== undefined)
|
||||||
|
Common.Gateway.requestRestore(this.isFromSelectRevision, url);
|
||||||
|
this.isFromSelectRevision = undefined;
|
||||||
|
},
|
||||||
|
|
||||||
onSelectRevision: function(picker, item, record, e) {
|
onSelectRevision: function(picker, item, record, e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
var btn = $(e.target);
|
var btn = $(e.target);
|
||||||
if (btn && btn.hasClass('revision-restore')) {
|
if (btn && btn.hasClass('revision-restore')) {
|
||||||
Common.Gateway.requestRestore(record.get('revision'));
|
if (record.get('isRevision'))
|
||||||
|
Common.Gateway.requestRestore(record.get('revision'));
|
||||||
|
else {
|
||||||
|
this.isFromSelectRevision = record.get('revision');
|
||||||
|
this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,8 @@ define([
|
||||||
docIdPrev: '',
|
docIdPrev: '',
|
||||||
arrColors: [], // array of user colors for all changes of current version
|
arrColors: [], // array of user colors for all changes of current version
|
||||||
markedAsVersion: false,
|
markedAsVersion: false,
|
||||||
canRestore: false
|
canRestore: false,
|
||||||
|
isRevision: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -324,6 +324,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAs: function() {
|
onDownloadAs: function() {
|
||||||
|
this._state.isFromGatewayDownloadAs = true;
|
||||||
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
||||||
(type && typeof type[1] === 'string') ? this.api.asc_DownloadOrigin(true) : this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
|
(type && typeof type[1] === 'string') ? this.api.asc_DownloadOrigin(true) : this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
|
||||||
},
|
},
|
||||||
|
@ -443,7 +444,9 @@ define([
|
||||||
created: change.created,
|
created: change.created,
|
||||||
docId: version.key,
|
docId: version.key,
|
||||||
docIdPrev: docIdPrev,
|
docIdPrev: docIdPrev,
|
||||||
selected: false
|
selected: false,
|
||||||
|
canRestore: this.appOptions.canHistoryRestore,
|
||||||
|
isRevision: false
|
||||||
}));
|
}));
|
||||||
arrColors.push(user.get('colorval'));
|
arrColors.push(user.get('colorval'));
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1428,9 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadUrl: function(url) {
|
onDownloadUrl: function(url) {
|
||||||
Common.Gateway.downloadAs(url);
|
if (this._state.isFromGatewayDownloadAs)
|
||||||
|
Common.Gateway.downloadAs(url);
|
||||||
|
this._state.isFromGatewayDownloadAs = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
onUpdateVersion: function(callback) {
|
onUpdateVersion: function(callback) {
|
||||||
|
|
Loading…
Reference in a new issue