mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
[VE] Handle onRefreshFile events
This commit is contained in:
@ -400,6 +400,11 @@ define([
|
|||||||
this.appOptions.wopi = this.editorConfig.wopi;
|
this.appOptions.wopi = this.editorConfig.wopi;
|
||||||
appHeader.setWopi(this.appOptions.wopi);
|
appHeader.setWopi(this.appOptions.wopi);
|
||||||
|
|
||||||
|
if (this.editorConfig.canRequestRefreshFile) {
|
||||||
|
Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
|
||||||
|
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));
|
||||||
|
}
|
||||||
|
|
||||||
Common.Controllers.Desktop.init(this.appOptions);
|
Common.Controllers.Desktop.init(this.appOptions);
|
||||||
Common.UI.HintManager.setMode(this.appOptions);
|
Common.UI.HintManager.setMode(this.appOptions);
|
||||||
},
|
},
|
||||||
@ -481,16 +486,11 @@ define([
|
|||||||
this.api.asc_coAuthoringDisconnect();
|
this.api.asc_coAuthoringDisconnect();
|
||||||
Common.NotificationCenter.trigger('collaboration:sharingdeny');
|
Common.NotificationCenter.trigger('collaboration:sharingdeny');
|
||||||
Common.NotificationCenter.trigger('api:disconnect');
|
Common.NotificationCenter.trigger('api:disconnect');
|
||||||
if (!old_rights)
|
!old_rights && Common.UI.TooltipManager.showTip({ step: 'changeRights', text: _.isEmpty(data.message) ? this.warnProcessRightsChange : data.message,
|
||||||
Common.UI.warning({
|
target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true,
|
||||||
title: this.notcriticalErrorTitle,
|
callback: function() {
|
||||||
maxwidth: 600,
|
me._state.lostEditingRights = false;
|
||||||
msg : _.isEmpty(data.message) ? this.warnProcessRightsChange : data.message,
|
}});
|
||||||
callback: function(){
|
|
||||||
me._state.lostEditingRights = false;
|
|
||||||
me.onEditComplete();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -532,7 +532,7 @@ define([
|
|||||||
|
|
||||||
disableEditing: function(disable, type) {
|
disableEditing: function(disable, type) {
|
||||||
!type && (type = 'disconnect');
|
!type && (type = 'disconnect');
|
||||||
var temp = type==='reconnect';
|
var temp = type==='reconnect' || type==='refresh-file';
|
||||||
Common.NotificationCenter.trigger('editing:disable', disable, {
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
viewMode: disable,
|
viewMode: disable,
|
||||||
statusBar: true,
|
statusBar: true,
|
||||||
@ -706,8 +706,12 @@ define([
|
|||||||
if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
|
if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
|
||||||
this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect);
|
this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect);
|
||||||
this.disableEditing(false, 'reconnect');
|
this.disableEditing(false, 'reconnect');
|
||||||
this.getApplication().getController('Statusbar').hideDisconnectTip();
|
Common.UI.TooltipManager.closeTip('disconnect');
|
||||||
this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect);
|
this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect);
|
||||||
|
} else if (id === Asc.c_oAscAsyncAction['RefreshFile']) {
|
||||||
|
this.disableEditing(false, 'refresh-file');
|
||||||
|
Common.UI.TooltipManager.closeTip('refreshFile');
|
||||||
|
this.getApplication().getController('Statusbar').setStatusCaption('');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type == Asc.c_oAscAsyncActionType.BlockInteraction &&
|
if ( type == Asc.c_oAscAsyncActionType.BlockInteraction &&
|
||||||
@ -799,11 +803,19 @@ define([
|
|||||||
var me = this;
|
var me = this;
|
||||||
statusCallback = function() {
|
statusCallback = function() {
|
||||||
me._state.timerDisconnect = setTimeout(function(){
|
me._state.timerDisconnect = setTimeout(function(){
|
||||||
me.getApplication().getController('Statusbar').showDisconnectTip();
|
Common.UI.TooltipManager.showTip('disconnect');
|
||||||
}, me._state.unloadTimer || 0);
|
}, me._state.unloadTimer || 0);
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['RefreshFile']:
|
||||||
|
title = this.textUpdating;
|
||||||
|
text = this.textUpdating;
|
||||||
|
Common.UI.Menu.Manager.hideAll();
|
||||||
|
this.disableEditing(true, 'refresh-file');
|
||||||
|
Common.UI.TooltipManager.showTip('refreshFile');
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (typeof action.id == 'string'){
|
if (typeof action.id == 'string'){
|
||||||
title = action.id;
|
title = action.id;
|
||||||
@ -1098,10 +1110,18 @@ define([
|
|||||||
buttons: [],
|
buttons: [],
|
||||||
closable: false
|
closable: false
|
||||||
});
|
});
|
||||||
|
if (this._isDocReady || this._isPermissionsInited) { // receive after refresh file
|
||||||
|
this.disableEditing(true);
|
||||||
|
Common.NotificationCenter.trigger('api:disconnect');
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this.onServerVersion(params.asc_getBuildVersion()) || !this.onLanguageLoaded()) return;
|
if ( this.onServerVersion(params.asc_getBuildVersion()) || !this.onLanguageLoaded()) return;
|
||||||
|
if ( this._isDocReady || this._isPermissionsInited ) {
|
||||||
|
this.api.asc_LoadDocument();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (params.asc_getRights() !== Asc.c_oRights.Edit)
|
if (params.asc_getRights() !== Asc.c_oRights.Edit)
|
||||||
this.permissions.edit = this.permissions.review = false;
|
this.permissions.edit = this.permissions.review = false;
|
||||||
@ -1200,6 +1220,7 @@ define([
|
|||||||
this.applyModeCommonElements();
|
this.applyModeCommonElements();
|
||||||
this.applyModeEditorElements();
|
this.applyModeEditorElements();
|
||||||
|
|
||||||
|
this._isPermissionsInited = true;
|
||||||
if ( !this.appOptions.isEdit ) {
|
if ( !this.appOptions.isEdit ) {
|
||||||
Common.NotificationCenter.trigger('app:face', this.appOptions);
|
Common.NotificationCenter.trigger('app:face', this.appOptions);
|
||||||
|
|
||||||
@ -1306,13 +1327,37 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
onError: function(id, level, errData) {
|
onError: function(id, level, errData) {
|
||||||
if (id == Asc.c_oAscError.ID.LoadingScriptError) {
|
switch (id) {
|
||||||
this.showTips([this.scriptLoadError]);
|
case Asc.c_oAscError.ID.LoadingScriptError:
|
||||||
this.tooltip && this.tooltip.getBSTip().$tip.css('z-index', 10000);
|
this.showTips([this.scriptLoadError]);
|
||||||
return;
|
this.tooltip && this.tooltip.getBSTip().$tip.css('z-index', 10000);
|
||||||
} else if (id == Asc.c_oAscError.ID.CanNotPasteImage) {
|
return;
|
||||||
this.showTips([this.errorCannotPasteImg], {timeout: 7000, hideCloseTip: true});
|
case Asc.c_oAscError.ID.CanNotPasteImage:
|
||||||
return;
|
this.showTips([this.errorCannotPasteImg], {timeout: 7000, hideCloseTip: true});
|
||||||
|
return;
|
||||||
|
case Asc.c_oAscError.ID.UpdateVersion:
|
||||||
|
Common.UI.TooltipManager.showTip('updateVersion');
|
||||||
|
return;
|
||||||
|
case Asc.c_oAscError.ID.SessionIdle:
|
||||||
|
Common.UI.TooltipManager.showTip('sessionIdle');
|
||||||
|
return;
|
||||||
|
case Asc.c_oAscError.ID.SessionToken:
|
||||||
|
Common.UI.TooltipManager.showTip('sessionToken');
|
||||||
|
return;
|
||||||
|
case Asc.c_oAscError.ID.UserDrop:
|
||||||
|
if (this._state.lostEditingRights) {
|
||||||
|
this._state.lostEditingRights = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._state.lostEditingRights = true;
|
||||||
|
Common.NotificationCenter.trigger('collaboration:sharingdeny');
|
||||||
|
var me = this;
|
||||||
|
Common.UI.TooltipManager.showTip({ step: 'userDrop', text: this.errorUserDrop,
|
||||||
|
target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true,
|
||||||
|
callback: function() {
|
||||||
|
me._state.lostEditingRights = false;
|
||||||
|
}});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hidePreloader();
|
this.hidePreloader();
|
||||||
@ -1392,16 +1437,6 @@ define([
|
|||||||
config.msg = this.errorDatabaseConnection;
|
config.msg = this.errorDatabaseConnection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Asc.c_oAscError.ID.UserDrop:
|
|
||||||
if (this._state.lostEditingRights) {
|
|
||||||
this._state.lostEditingRights = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._state.lostEditingRights = true;
|
|
||||||
config.msg = this.errorUserDrop;
|
|
||||||
Common.NotificationCenter.trigger('collaboration:sharingdeny');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Asc.c_oAscError.ID.Warning:
|
case Asc.c_oAscError.ID.Warning:
|
||||||
config.msg = this.errorConnectToServer;
|
config.msg = this.errorConnectToServer;
|
||||||
config.closable = false;
|
config.closable = false;
|
||||||
@ -1411,14 +1446,6 @@ define([
|
|||||||
config.msg = this.errorSessionAbsolute;
|
config.msg = this.errorSessionAbsolute;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Asc.c_oAscError.ID.SessionIdle:
|
|
||||||
config.msg = this.errorSessionIdle;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Asc.c_oAscError.ID.SessionToken:
|
|
||||||
config.msg = this.errorSessionToken;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Asc.c_oAscError.ID.AccessDeny:
|
case Asc.c_oAscError.ID.AccessDeny:
|
||||||
config.msg = this.errorAccessDeny;
|
config.msg = this.errorAccessDeny;
|
||||||
break;
|
break;
|
||||||
@ -1445,11 +1472,6 @@ define([
|
|||||||
config.msg = this.errorFileSizeExceed;
|
config.msg = this.errorFileSizeExceed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Asc.c_oAscError.ID.UpdateVersion:
|
|
||||||
config.msg = this.errorUpdateVersionOnDisconnect;
|
|
||||||
config.maxwidth = 600;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Asc.c_oAscError.ID.DirectUrl:
|
case Asc.c_oAscError.ID.DirectUrl:
|
||||||
config.msg = this.errorDirectUrl;
|
config.msg = this.errorDirectUrl;
|
||||||
break;
|
break;
|
||||||
@ -1527,7 +1549,6 @@ define([
|
|||||||
this.disableEditing(true);
|
this.disableEditing(true);
|
||||||
Common.NotificationCenter.trigger('api:disconnect', true); // enable download and print
|
Common.NotificationCenter.trigger('api:disconnect', true); // enable download and print
|
||||||
}
|
}
|
||||||
this._state.lostEditingRights = false;
|
|
||||||
this.onEditComplete();
|
this.onEditComplete();
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
@ -1672,12 +1693,13 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
onUpdateVersion: function(callback) {
|
onUpdateVersion: function(callback) {
|
||||||
|
console.log("Obsolete: The 'onOutdatedVersion' event is deprecated. Please use 'onRequestRefreshFile' event and 'refreshFile' method instead.");
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
me.needToUpdateVersion = true;
|
me.needToUpdateVersion = true;
|
||||||
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||||
Common.UI.warning({
|
Common.UI.TooltipManager.showTip({ step: 'updateVersionReload', text: this.errorUpdateVersion, header: this.titleUpdateVersion,
|
||||||
title: me.titleUpdateVersion,
|
target: '#toolbar', maxwidth: 'none', closable: false, automove: true, noHighlight: true,
|
||||||
msg: this.errorUpdateVersion,
|
|
||||||
callback: function() {
|
callback: function() {
|
||||||
_.defer(function() {
|
_.defer(function() {
|
||||||
Common.Gateway.updateVersion();
|
Common.Gateway.updateVersion();
|
||||||
@ -1706,6 +1728,10 @@ define([
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (this._isDocReady) { // receive after refresh file
|
||||||
|
this.disableEditing(true);
|
||||||
|
Common.NotificationCenter.trigger('api:disconnect');
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1967,6 +1993,62 @@ define([
|
|||||||
data && this.api.asc_openDocumentFromBytes(new Uint8Array(data));
|
data && this.api.asc_openDocumentFromBytes(new Uint8Array(data));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRequestRefreshFile: function() {
|
||||||
|
Common.Gateway.requestRefreshFile();
|
||||||
|
},
|
||||||
|
|
||||||
|
onRefreshFile: function(data) {
|
||||||
|
if (data) {
|
||||||
|
var docInfo = new Asc.asc_CDocInfo();
|
||||||
|
if (data.document) {
|
||||||
|
docInfo.put_Id(data.document.key);
|
||||||
|
docInfo.put_Url(data.document.url);
|
||||||
|
docInfo.put_Title(data.document.title);
|
||||||
|
if (data.document.title) {
|
||||||
|
//Common.Gateway.metaChange({title: data.document.title});
|
||||||
|
appHeader.setDocumentCaption(data.document.title);
|
||||||
|
this.updateWindowTitle(true);
|
||||||
|
this.document.title = data.document.title;
|
||||||
|
}
|
||||||
|
data.document.referenceData && docInfo.put_ReferenceData(data.document.referenceData);
|
||||||
|
}
|
||||||
|
if (data.editorConfig) {
|
||||||
|
docInfo.put_CallbackUrl(data.editorConfig.callbackUrl);
|
||||||
|
}
|
||||||
|
if (data.token)
|
||||||
|
docInfo.put_Token(data.token);
|
||||||
|
|
||||||
|
var _user = new Asc.asc_CUserInfo(); // change for guest!!
|
||||||
|
_user.put_Id(this.appOptions.user.id);
|
||||||
|
_user.put_FullName(this.appOptions.user.fullname);
|
||||||
|
_user.put_IsAnonymousUser(!!this.appOptions.user.anonymous);
|
||||||
|
docInfo.put_UserInfo(_user);
|
||||||
|
|
||||||
|
var _options = $.extend({}, this.document.options, this.editorConfig.actionLink || {});
|
||||||
|
docInfo.put_Options(_options);
|
||||||
|
|
||||||
|
docInfo.put_Format(this.document.fileType);
|
||||||
|
docInfo.put_Lang(this.editorConfig.lang);
|
||||||
|
docInfo.put_Mode(this.editorConfig.mode);
|
||||||
|
docInfo.put_Permissions(this.permissions);
|
||||||
|
docInfo.put_DirectUrl(data.document && data.document.directUrl ? data.document.directUrl : this.document.directUrl);
|
||||||
|
docInfo.put_VKey(data.document && data.document.vkey ? data.document.vkey : this.document.vkey);
|
||||||
|
docInfo.put_EncryptedInfo(data.editorConfig && data.editorConfig.encryptionKeys ? data.editorConfig.encryptionKeys : this.editorConfig.encryptionKeys);
|
||||||
|
|
||||||
|
var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false);
|
||||||
|
docInfo.asc_putIsEnabledMacroses(!!enable);
|
||||||
|
enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false);
|
||||||
|
docInfo.asc_putIsEnabledPlugins(!!enable);
|
||||||
|
|
||||||
|
// var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default
|
||||||
|
// this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer
|
||||||
|
// this.editorConfig.coEditing.mode || 'fast';
|
||||||
|
var coEditMode = 'strict';
|
||||||
|
docInfo.put_CoEditingMode(coEditMode);
|
||||||
|
this.api.asc_refreshFile(docInfo);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.'
|
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), VE.Controllers.Main || {}))
|
})(), VE.Controllers.Main || {}))
|
||||||
|
|||||||
@ -214,14 +214,15 @@ define([
|
|||||||
}, 1);
|
}, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
showDisconnectTip: function () {
|
showDisconnectTip: function (text) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
text = text || this.textDisconnect;
|
||||||
if (!this.disconnectTip) {
|
if (!this.disconnectTip) {
|
||||||
var target = this.statusbar.getStatusLabel();
|
var target = this.statusbar.getStatusLabel();
|
||||||
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
|
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
|
||||||
this.disconnectTip = new Common.UI.SynchronizeTip({
|
this.disconnectTip = new Common.UI.SynchronizeTip({
|
||||||
target : target,
|
target : target,
|
||||||
text : this.textDisconnect,
|
text : text,
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
position: this.statusbar.isVisible() ? undefined : {bottom: 0},
|
position: this.statusbar.isVisible() ? undefined : {bottom: 0},
|
||||||
showLink: false,
|
showLink: false,
|
||||||
@ -233,10 +234,12 @@ define([
|
|||||||
me.disconnectTip = null;
|
me.disconnectTip = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.disconnectTip.setText(text);
|
||||||
}
|
}
|
||||||
this.disconnectTip.show();
|
this.disconnectTip.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
hideDisconnectTip: function() {
|
hideDisconnectTip: function() {
|
||||||
this.disconnectTip && this.disconnectTip.hide();
|
this.disconnectTip && this.disconnectTip.hide();
|
||||||
this.disconnectTip = null;
|
this.disconnectTip = null;
|
||||||
|
|||||||
@ -124,8 +124,16 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
|
var _main = this.getApplication().getController('Main');
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.toolbar.applyLayout(mode);
|
this.toolbar.applyLayout(mode);
|
||||||
|
Common.UI.TooltipManager.addTips({
|
||||||
|
'refreshFile' : {text: _main.textUpdateVersion, header: _main.textUpdating, target: '#toolbar', maxwidth: 'none', showButton: false, automove: true, noHighlight: true, multiple: true},
|
||||||
|
'disconnect' : {text: _main.textConnectionLost, header: _main.textDisconnect, target: '#toolbar', maxwidth: 'none', showButton: false, automove: true, noHighlight: true, multiple: true},
|
||||||
|
'updateVersion' : {text: _main.errorUpdateVersionOnDisconnect, header: _main.titleUpdateVersion, target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true},
|
||||||
|
'sessionIdle' : {text: _main.errorSessionIdle, target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true},
|
||||||
|
'sessionToken' : {text: _main.errorSessionToken, target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
attachCommonUIEvents: function(toolbar) {
|
attachCommonUIEvents: function(toolbar) {
|
||||||
|
|||||||
@ -408,5 +408,8 @@
|
|||||||
"VE.Views.ViewTab.textZoom": "تكبير",
|
"VE.Views.ViewTab.textZoom": "تكبير",
|
||||||
"VE.Views.ViewTab.tipFitPage": "ملائم للصفحة",
|
"VE.Views.ViewTab.tipFitPage": "ملائم للصفحة",
|
||||||
"VE.Views.ViewTab.tipFitWidth": "ملائم للعرض",
|
"VE.Views.ViewTab.tipFitWidth": "ملائم للعرض",
|
||||||
"VE.Views.ViewTab.tipInterfaceTheme": "سمة الواجهة"
|
"VE.Views.ViewTab.tipInterfaceTheme": "سمة الواجهة",
|
||||||
|
"VE.Controllers.Main.textUpdating": "Updating",
|
||||||
|
"VE.Controllers.Main.textUpdateVersion": "The document cannot be edited right now.<br>Trying to update file, please wait...",
|
||||||
|
"VE.Controllers.Main.textConnectionLost": "Trying to connect. Please check connection settings."
|
||||||
}
|
}
|
||||||
@ -292,6 +292,9 @@
|
|||||||
"VE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
|
"VE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
|
||||||
"VE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
|
"VE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
|
||||||
"VE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
|
"VE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
|
||||||
|
"VE.Controllers.Main.textUpdating": "Updating",
|
||||||
|
"VE.Controllers.Main.textUpdateVersion": "The document cannot be edited right now.<br>Trying to update file, please wait...",
|
||||||
|
"VE.Controllers.Main.textConnectionLost": "Trying to connect. Please check connection settings.",
|
||||||
"VE.Controllers.Search.notcriticalErrorTitle": "Warning",
|
"VE.Controllers.Search.notcriticalErrorTitle": "Warning",
|
||||||
"VE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.",
|
"VE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.",
|
||||||
"VE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.",
|
"VE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.",
|
||||||
|
|||||||
@ -408,5 +408,8 @@
|
|||||||
"VE.Views.ViewTab.textZoom": "Масштаб",
|
"VE.Views.ViewTab.textZoom": "Масштаб",
|
||||||
"VE.Views.ViewTab.tipFitPage": "По размеру страницы",
|
"VE.Views.ViewTab.tipFitPage": "По размеру страницы",
|
||||||
"VE.Views.ViewTab.tipFitWidth": "По ширине",
|
"VE.Views.ViewTab.tipFitWidth": "По ширине",
|
||||||
"VE.Views.ViewTab.tipInterfaceTheme": "Тема интерфейса"
|
"VE.Views.ViewTab.tipInterfaceTheme": "Тема интерфейса",
|
||||||
|
"VE.Controllers.Main.textUpdating": "Updating",
|
||||||
|
"VE.Controllers.Main.textUpdateVersion": "The document cannot be edited right now.<br>Trying to update file, please wait...",
|
||||||
|
"VE.Controllers.Main.textConnectionLost": "Trying to connect. Please check connection settings."
|
||||||
}
|
}
|
||||||
@ -78,6 +78,11 @@ class MainController extends Component {
|
|||||||
this.editorConfig.lang && this.api.asc_setLocale(this.editorConfig.lang);
|
this.editorConfig.lang && this.api.asc_setLocale(this.editorConfig.lang);
|
||||||
|
|
||||||
this.loadDefaultMetricSettings();
|
this.loadDefaultMetricSettings();
|
||||||
|
|
||||||
|
if (this.editorConfig.canRequestRefreshFile) {
|
||||||
|
Common.Gateway.on('refreshfile', this.onRefreshFile.bind(this));
|
||||||
|
this.api.asc_registerCallback('asc_onRequestRefreshFile', this.onRequestRefreshFile.bind(this));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadDocument = data => {
|
const loadDocument = data => {
|
||||||
@ -160,7 +165,15 @@ class MainController extends Component {
|
|||||||
title: Asc.c_oLicenseResult.NotBefore === licType ? t('Controller.Main.titleLicenseNotActive') : t('Controller.Main.titleLicenseExp'),
|
title: Asc.c_oLicenseResult.NotBefore === licType ? t('Controller.Main.titleLicenseNotActive') : t('Controller.Main.titleLicenseExp'),
|
||||||
text: Asc.c_oLicenseResult.NotBefore === licType ? t('Controller.Main.warnLicenseBefore') : t('Controller.Main.warnLicenseExp')
|
text: Asc.c_oLicenseResult.NotBefore === licType ? t('Controller.Main.warnLicenseBefore') : t('Controller.Main.warnLicenseExp')
|
||||||
}).open();
|
}).open();
|
||||||
|
if (this._isDocReady || this._isPermissionsInited) { // receive after refresh file
|
||||||
|
Common.Notifications.trigger('api:disconnect');
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( this.onServerVersion(params.asc_getBuildVersion()) ) return;
|
||||||
|
if ( this._isDocReady || this._isPermissionsInited ) {
|
||||||
|
this.api.asc_LoadDocument();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,6 +183,8 @@ class MainController extends Component {
|
|||||||
storeAppOptions.setPermissionOptions(this.document, licType, params, this.permissions, EditorUIController.isSupportEditFeature());
|
storeAppOptions.setPermissionOptions(this.document, licType, params, this.permissions, EditorUIController.isSupportEditFeature());
|
||||||
this.applyMode(storeAppOptions);
|
this.applyMode(storeAppOptions);
|
||||||
|
|
||||||
|
this._isPermissionsInited = true;
|
||||||
|
|
||||||
this.api.asc_LoadDocument();
|
this.api.asc_LoadDocument();
|
||||||
this.api.Resize();
|
this.api.Resize();
|
||||||
};
|
};
|
||||||
@ -528,7 +543,7 @@ class MainController extends Component {
|
|||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
const _t = t('Controller.Main', {returnObjects:true});
|
const _t = t('Controller.Main', {returnObjects:true});
|
||||||
|
|
||||||
if (About.appVersion() !== buildVersion && !window.compareVersions) {
|
if (About.appVersion() !== buildVersion && !About.compareVersions()) {
|
||||||
this.changeServerVersion = true;
|
this.changeServerVersion = true;
|
||||||
f7.dialog.alert(
|
f7.dialog.alert(
|
||||||
_t.errorServerVersion,
|
_t.errorServerVersion,
|
||||||
@ -536,6 +551,9 @@ class MainController extends Component {
|
|||||||
() => {
|
() => {
|
||||||
setTimeout(() => {Common.Gateway.updateVersion()}, 0);
|
setTimeout(() => {Common.Gateway.updateVersion()}, 0);
|
||||||
});
|
});
|
||||||
|
if (this._isDocReady) { // receive after refresh file
|
||||||
|
Common.Notifications.trigger('api:disconnect');
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -757,6 +775,63 @@ class MainController extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onRequestRefreshFile () {
|
||||||
|
Common.Gateway.requestRefreshFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
onRefreshFile (data) {
|
||||||
|
if (data) {
|
||||||
|
let docInfo = new Asc.asc_CDocInfo();
|
||||||
|
if (data.document) {
|
||||||
|
docInfo.put_Id(data.document.key);
|
||||||
|
docInfo.put_Url(data.document.url);
|
||||||
|
docInfo.put_Title(data.document.title);
|
||||||
|
if (data.document.title) {
|
||||||
|
const storeVisioInfo = this.props.storeVisioInfo;
|
||||||
|
storeVisioInfo.changeTitle(data.document.title);
|
||||||
|
this.document.title = data.document.title;
|
||||||
|
Common.Notifications.trigger('setdoctitle', data.document.title);
|
||||||
|
}
|
||||||
|
data.document.referenceData && docInfo.put_ReferenceData(data.document.referenceData);
|
||||||
|
}
|
||||||
|
if (data.editorConfig) {
|
||||||
|
docInfo.put_CallbackUrl(data.editorConfig.callbackUrl);
|
||||||
|
}
|
||||||
|
if (data.token)
|
||||||
|
docInfo.put_Token(data.token);
|
||||||
|
|
||||||
|
const _userOptions = this.props.storeAppOptions.user;
|
||||||
|
const _user = new Asc.asc_CUserInfo();
|
||||||
|
_user.put_Id(_userOptions.id);
|
||||||
|
_user.put_FullName(_userOptions.fullname);
|
||||||
|
_user.put_IsAnonymousUser(_userOptions.anonymous);
|
||||||
|
docInfo.put_UserInfo(_user);
|
||||||
|
|
||||||
|
const _options = Object.assign({}, this.document.options, this.editorConfig.actionLink || {});
|
||||||
|
docInfo.put_Options(_options);
|
||||||
|
|
||||||
|
docInfo.put_Format(this.document.fileType);
|
||||||
|
docInfo.put_Lang(this.editorConfig.lang);
|
||||||
|
docInfo.put_Mode(this.editorConfig.mode);
|
||||||
|
docInfo.put_Permissions(this.permissions);
|
||||||
|
docInfo.put_DirectUrl(data.document && data.document.directUrl ? data.document.directUrl : this.document.directUrl);
|
||||||
|
docInfo.put_VKey(data.document && data.document.vkey ? data.document.vkey : this.document.vkey);
|
||||||
|
docInfo.put_EncryptedInfo(data.editorConfig && data.editorConfig.encryptionKeys ? data.editorConfig.encryptionKeys : this.editorConfig.encryptionKeys);
|
||||||
|
|
||||||
|
let enable = false;//!this.editorConfig.customization || (this.editorConfig.customization.macros!==false);
|
||||||
|
docInfo.asc_putIsEnabledMacroses(!!enable);
|
||||||
|
enable = false;//!this.editorConfig.customization || (this.editorConfig.customization.plugins!==false);
|
||||||
|
docInfo.asc_putIsEnabledPlugins(!!enable);
|
||||||
|
|
||||||
|
// let coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default
|
||||||
|
// this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer
|
||||||
|
// this.editorConfig.coEditing.mode || 'fast';
|
||||||
|
var coEditMode = 'strict';
|
||||||
|
docInfo.put_CoEditingMode(coEditMode);
|
||||||
|
this.api.asc_refreshFile(docInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
|||||||
Reference in New Issue
Block a user