diff --git a/apps/visioeditor/main/app/controller/Main.js b/apps/visioeditor/main/app/controller/Main.js
index 0df60c8583..a286b09e11 100644
--- a/apps/visioeditor/main/app/controller/Main.js
+++ b/apps/visioeditor/main/app/controller/Main.js
@@ -400,6 +400,11 @@ define([
this.appOptions.wopi = this.editorConfig.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.UI.HintManager.setMode(this.appOptions);
},
@@ -481,16 +486,11 @@ define([
this.api.asc_coAuthoringDisconnect();
Common.NotificationCenter.trigger('collaboration:sharingdeny');
Common.NotificationCenter.trigger('api:disconnect');
- if (!old_rights)
- Common.UI.warning({
- title: this.notcriticalErrorTitle,
- maxwidth: 600,
- msg : _.isEmpty(data.message) ? this.warnProcessRightsChange : data.message,
- callback: function(){
- me._state.lostEditingRights = false;
- me.onEditComplete();
- }
- });
+ !old_rights && Common.UI.TooltipManager.showTip({ step: 'changeRights', text: _.isEmpty(data.message) ? this.warnProcessRightsChange : data.message,
+ target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true,
+ callback: function() {
+ me._state.lostEditingRights = false;
+ }});
}
},
@@ -532,7 +532,7 @@ define([
disableEditing: function(disable, type) {
!type && (type = 'disconnect');
- var temp = type==='reconnect';
+ var temp = type==='reconnect' || type==='refresh-file';
Common.NotificationCenter.trigger('editing:disable', disable, {
viewMode: disable,
statusBar: true,
@@ -706,8 +706,12 @@ define([
if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect);
this.disableEditing(false, 'reconnect');
- this.getApplication().getController('Statusbar').hideDisconnectTip();
+ Common.UI.TooltipManager.closeTip('disconnect');
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 &&
@@ -799,11 +803,19 @@ define([
var me = this;
statusCallback = function() {
me._state.timerDisconnect = setTimeout(function(){
- me.getApplication().getController('Statusbar').showDisconnectTip();
+ Common.UI.TooltipManager.showTip('disconnect');
}, me._state.unloadTimer || 0);
};
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:
if (typeof action.id == 'string'){
title = action.id;
@@ -1098,10 +1110,18 @@ define([
buttons: [],
closable: false
});
+ if (this._isDocReady || this._isPermissionsInited) { // receive after refresh file
+ this.disableEditing(true);
+ Common.NotificationCenter.trigger('api:disconnect');
+ }
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)
this.permissions.edit = this.permissions.review = false;
@@ -1200,6 +1220,7 @@ define([
this.applyModeCommonElements();
this.applyModeEditorElements();
+ this._isPermissionsInited = true;
if ( !this.appOptions.isEdit ) {
Common.NotificationCenter.trigger('app:face', this.appOptions);
@@ -1306,13 +1327,37 @@ define([
},
onError: function(id, level, errData) {
- if (id == Asc.c_oAscError.ID.LoadingScriptError) {
- this.showTips([this.scriptLoadError]);
- this.tooltip && this.tooltip.getBSTip().$tip.css('z-index', 10000);
- return;
- } else if (id == Asc.c_oAscError.ID.CanNotPasteImage) {
- this.showTips([this.errorCannotPasteImg], {timeout: 7000, hideCloseTip: true});
- return;
+ switch (id) {
+ case Asc.c_oAscError.ID.LoadingScriptError:
+ this.showTips([this.scriptLoadError]);
+ this.tooltip && this.tooltip.getBSTip().$tip.css('z-index', 10000);
+ return;
+ case Asc.c_oAscError.ID.CanNotPasteImage:
+ 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();
@@ -1392,16 +1437,6 @@ define([
config.msg = this.errorDatabaseConnection;
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:
config.msg = this.errorConnectToServer;
config.closable = false;
@@ -1411,14 +1446,6 @@ define([
config.msg = this.errorSessionAbsolute;
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:
config.msg = this.errorAccessDeny;
break;
@@ -1445,11 +1472,6 @@ define([
config.msg = this.errorFileSizeExceed;
break;
- case Asc.c_oAscError.ID.UpdateVersion:
- config.msg = this.errorUpdateVersionOnDisconnect;
- config.maxwidth = 600;
- break;
-
case Asc.c_oAscError.ID.DirectUrl:
config.msg = this.errorDirectUrl;
break;
@@ -1527,7 +1549,6 @@ define([
this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect', true); // enable download and print
}
- this._state.lostEditingRights = false;
this.onEditComplete();
}, this);
}
@@ -1672,12 +1693,13 @@ define([
},
onUpdateVersion: function(callback) {
+ console.log("Obsolete: The 'onOutdatedVersion' event is deprecated. Please use 'onRequestRefreshFile' event and 'refreshFile' method instead.");
+
var me = this;
me.needToUpdateVersion = true;
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
- Common.UI.warning({
- title: me.titleUpdateVersion,
- msg: this.errorUpdateVersion,
+ Common.UI.TooltipManager.showTip({ step: 'updateVersionReload', text: this.errorUpdateVersion, header: this.titleUpdateVersion,
+ target: '#toolbar', maxwidth: 'none', closable: false, automove: true, noHighlight: true,
callback: function() {
_.defer(function() {
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 false;
@@ -1967,6 +1993,62 @@ define([
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.
Please contact your Document Server administrator.'
}
})(), VE.Controllers.Main || {}))
diff --git a/apps/visioeditor/main/app/controller/Statusbar.js b/apps/visioeditor/main/app/controller/Statusbar.js
index 8226404ca4..8bbb88bb14 100644
--- a/apps/visioeditor/main/app/controller/Statusbar.js
+++ b/apps/visioeditor/main/app/controller/Statusbar.js
@@ -214,14 +214,15 @@ define([
}, 1);
},
- showDisconnectTip: function () {
+ showDisconnectTip: function (text) {
var me = this;
+ text = text || this.textDisconnect;
if (!this.disconnectTip) {
var target = this.statusbar.getStatusLabel();
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
this.disconnectTip = new Common.UI.SynchronizeTip({
target : target,
- text : this.textDisconnect,
+ text : text,
placement: 'top',
position: this.statusbar.isVisible() ? undefined : {bottom: 0},
showLink: false,
@@ -233,10 +234,12 @@ define([
me.disconnectTip = null;
}
});
+ } else {
+ this.disconnectTip.setText(text);
}
this.disconnectTip.show();
},
-
+
hideDisconnectTip: function() {
this.disconnectTip && this.disconnectTip.hide();
this.disconnectTip = null;
diff --git a/apps/visioeditor/main/app/controller/Toolbar.js b/apps/visioeditor/main/app/controller/Toolbar.js
index c04ea2b794..8237dc502a 100644
--- a/apps/visioeditor/main/app/controller/Toolbar.js
+++ b/apps/visioeditor/main/app/controller/Toolbar.js
@@ -124,8 +124,16 @@ define([
},
setMode: function(mode) {
+ var _main = this.getApplication().getController('Main');
this.mode = 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) {
diff --git a/apps/visioeditor/main/locale/ar.json b/apps/visioeditor/main/locale/ar.json
index 57063e04b2..b42d2177a8 100644
--- a/apps/visioeditor/main/locale/ar.json
+++ b/apps/visioeditor/main/locale/ar.json
@@ -408,5 +408,8 @@
"VE.Views.ViewTab.textZoom": "تكبير",
"VE.Views.ViewTab.tipFitPage": "ملائم للصفحة",
"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.
Trying to update file, please wait...",
+ "VE.Controllers.Main.textConnectionLost": "Trying to connect. Please check connection settings."
}
\ No newline at end of file
diff --git a/apps/visioeditor/main/locale/en.json b/apps/visioeditor/main/locale/en.json
index 13c7da2f91..f424b444d4 100644
--- a/apps/visioeditor/main/locale/en.json
+++ b/apps/visioeditor/main/locale/en.json
@@ -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.
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.textUpdating": "Updating",
+ "VE.Controllers.Main.textUpdateVersion": "The document cannot be edited right now.
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.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.",
diff --git a/apps/visioeditor/main/locale/ru.json b/apps/visioeditor/main/locale/ru.json
index cc53cb3382..382d956382 100644
--- a/apps/visioeditor/main/locale/ru.json
+++ b/apps/visioeditor/main/locale/ru.json
@@ -408,5 +408,8 @@
"VE.Views.ViewTab.textZoom": "Масштаб",
"VE.Views.ViewTab.tipFitPage": "По размеру страницы",
"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.
Trying to update file, please wait...",
+ "VE.Controllers.Main.textConnectionLost": "Trying to connect. Please check connection settings."
}
\ No newline at end of file
diff --git a/apps/visioeditor/mobile/src/controller/Main.jsx b/apps/visioeditor/mobile/src/controller/Main.jsx
index 220e7aa9dd..c792e0255b 100644
--- a/apps/visioeditor/mobile/src/controller/Main.jsx
+++ b/apps/visioeditor/mobile/src/controller/Main.jsx
@@ -78,6 +78,11 @@ class MainController extends Component {
this.editorConfig.lang && this.api.asc_setLocale(this.editorConfig.lang);
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 => {
@@ -160,7 +165,15 @@ class MainController extends Component {
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')
}).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;
}
@@ -170,6 +183,8 @@ class MainController extends Component {
storeAppOptions.setPermissionOptions(this.document, licType, params, this.permissions, EditorUIController.isSupportEditFeature());
this.applyMode(storeAppOptions);
+ this._isPermissionsInited = true;
+
this.api.asc_LoadDocument();
this.api.Resize();
};
@@ -528,7 +543,7 @@ class MainController extends Component {
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
- if (About.appVersion() !== buildVersion && !window.compareVersions) {
+ if (About.appVersion() !== buildVersion && !About.compareVersions()) {
this.changeServerVersion = true;
f7.dialog.alert(
_t.errorServerVersion,
@@ -536,6 +551,9 @@ class MainController extends Component {
() => {
setTimeout(() => {Common.Gateway.updateVersion()}, 0);
});
+ if (this._isDocReady) { // receive after refresh file
+ Common.Notifications.trigger('api:disconnect');
+ }
return true;
}
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 () {
return (