Merge pull request #34 from ONLYOFFICE/feature/v5.0.6-users

Feature/v5.0.6 users
This commit is contained in:
Alexander Trofimov 2017-11-28 10:27:16 +03:00 committed by GitHub
commit ed50b3a36b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 300 additions and 132 deletions

View file

@ -94,7 +94,7 @@ define([
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this)); Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this)); Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this));
}, },
setConfig: function (data, api) { setConfig: function (data, api) {
this.setApi(api); this.setApi(api);
@ -111,7 +111,7 @@ define([
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this)); this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this)); this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
} }
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiServerDisconnect, this));
} }
}, },
@ -624,6 +624,10 @@ define([
})).show(); })).show();
}, },
onApiServerDisconnect: function() {
this.SetDisabled(true);
},
textInserted: '<b>Inserted:</b>', textInserted: '<b>Inserted:</b>',
textDeleted: '<b>Deleted:</b>', textDeleted: '<b>Deleted:</b>',
textParaInserted: '<b>Paragraph Inserted</b> ', textParaInserted: '<b>Paragraph Inserted</b> ',

View file

@ -331,6 +331,7 @@ define([
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_setDocInfo(docInfo); this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -911,6 +912,8 @@ define([
if (me.appOptions.canBrandingExt) if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main'); Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
} }
}, 50); }, 50);
} else { } else {
@ -932,9 +935,24 @@ define([
Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'});
$(document).on('contextmenu', _.bind(me.onContextMenu, me)); $(document).on('contextmenu', _.bind(me.onContextMenu, me));
},
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers;
}
if (this._isDocReady)
this.applyLicense();
},
applyLicense: function() {
if (this._state.licenseWarning) { if (this._state.licenseWarning) {
value = Common.localStorage.getItem("de-license-warning"); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
var value = Common.localStorage.getItem("de-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime(); var now = (new Date).getTime();
if (now - value > 86400000) { if (now - value > 86400000) {
@ -942,7 +960,7 @@ define([
Common.UI.info({ Common.UI.info({
width: 500, width: 500,
title: this.textNoLicenseTitle, title: this.textNoLicenseTitle,
msg : this.warnNoLicense, msg : this._state.licenseWarning,
buttons: [ buttons: [
{value: 'buynow', caption: this.textBuyNow}, {value: 'buynow', caption: this.textBuyNow},
{value: 'contact', caption: this.textContactUs} {value: 'contact', caption: this.textContactUs}
@ -1030,8 +1048,6 @@ define([
this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string'); this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string');
this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string'); this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string');
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object'); this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding) if (this.appOptions.canBranding)
appHeader.setBranding(this.editorConfig.customization); appHeader.setBranding(this.editorConfig.customization);
@ -2087,7 +2103,7 @@ define([
txtErrorLoadHistory: 'Loading history failed', txtErrorLoadHistory: 'Loading history failed',
textBuyNow: 'Visit website', textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version', textNoLicenseTitle: 'ONLYOFFICE open source version',
warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.', warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales', textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.', errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.',
warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.', warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.',
@ -2121,8 +2137,8 @@ define([
txtStyle_Intense_Quote: 'Intense Quote', txtStyle_Intense_Quote: 'Intense Quote',
txtStyle_List_Paragraph: 'List Paragraph', txtStyle_List_Paragraph: 'List Paragraph',
saveTextText: 'Saving document...', saveTextText: 'Saving document...',
saveTitleText: 'Saving Document' saveTitleText: 'Saving Document',
warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.'
} }
})(), DE.Controllers.Main || {})) })(), DE.Controllers.Main || {}))
}); });

View file

@ -2761,6 +2761,7 @@ define([
onApiCoAuthoringDisconnect: function(disableDownload) { onApiCoAuthoringDisconnect: function(disableDownload) {
this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload}); this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload});
this.editMode = false; this.editMode = false;
this.DisableToolbar(true, true);
}, },
DisableToolbar: function(disable, viewMode, reviewmode) { DisableToolbar: function(disable, viewMode, reviewmode) {

View file

@ -86,7 +86,6 @@ define([
me.btnZoomDown.updateHint(me.tipZoomOut + Common.Utils.String.platformKey('Ctrl+-')); me.btnZoomDown.updateHint(me.tipZoomOut + Common.Utils.String.platformKey('Ctrl+-'));
me.btnZoomUp.updateHint(me.tipZoomIn + Common.Utils.String.platformKey('Ctrl++')); me.btnZoomUp.updateHint(me.tipZoomIn + Common.Utils.String.platformKey('Ctrl++'));
if ( config.isEdit ) {
me.btnLanguage.updateHint(me.tipSetLang); me.btnLanguage.updateHint(me.tipSetLang);
me.btnLanguage.cmpEl.on({ me.btnLanguage.cmpEl.on({
'show.bs.dropdown': function () { 'show.bs.dropdown': function () {
@ -106,7 +105,6 @@ define([
} }
}); });
me.langMenu.on('item:click', _.bind(_clickLanguage, this)); me.langMenu.on('item:click', _.bind(_clickLanguage, this));
}
me.cntZoom.updateHint(me.tipZoomFactor); me.cntZoom.updateHint(me.tipZoomFactor);
me.cntZoom.cmpEl.on({ me.cntZoom.cmpEl.on({
@ -325,6 +323,7 @@ define([
if (this.api) { if (this.api) {
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this)); this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this)); this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
} }
return this; return this;
@ -356,7 +355,7 @@ define([
this.langMenu.doLayout(); this.langMenu.doLayout();
if (this.langMenu.items.length>0) { if (this.langMenu.items.length>0) {
this.btnLanguage.setDisabled(false); this.btnLanguage.setDisabled(!!this.mode.isDisconnected);
} }
}, },
@ -390,6 +389,11 @@ define([
this.btnLanguage.setDisabled(disable || !langs); this.btnLanguage.setDisabled(disable || !langs);
}, },
onApiCoAuthoringDisconnect: function() {
this.setMode({isDisconnected:true});
this.SetDisabled(true);
},
pageIndexText : 'Page {0} of {1}', pageIndexText : 'Page {0} of {1}',
goToPageText : 'Go to Page', goToPageText : 'Go to Page',
tipFitPage : 'Fit to Page', tipFitPage : 'Fit to Page',

View file

@ -2089,59 +2089,8 @@ define([
button.setDisabled(true); button.setDisabled(true);
} }
}); });
this.btnCopy.setDisabled(true);
this.btnPaste.setDisabled(true);
this.btnUndo.setDisabled(true);
this.btnRedo.setDisabled(true);
this.btnIncFontSize.setDisabled(true);
this.btnDecFontSize.setDisabled(true);
this.btnBold.setDisabled(true);
this.btnItalic.setDisabled(true);
this.btnUnderline.setDisabled(true);
this.btnStrikeout.setDisabled(true);
this.btnSuperscript.setDisabled(true);
this.btnSubscript.setDisabled(true);
this.btnHighlightColor.setDisabled(true);
this.btnFontColor.setDisabled(true);
this.btnParagraphColor.setDisabled(true);
this.btnMarkers.setDisabled(true);
this.btnNumbers.setDisabled(true);
this.btnMultilevels.setDisabled(true);
this.btnAlignLeft.setDisabled(true);
this.btnAlignCenter.setDisabled(true);
this.btnAlignRight.setDisabled(true);
this.btnAlignJust.setDisabled(true);
this.btnDecLeftOffset.setDisabled(true);
this.btnIncLeftOffset.setDisabled(true);
this.btnLineSpace.setDisabled(true);
this.btnShowHidenChars.setDisabled(true);
this.btnInsertTable.setDisabled(true);
this.btnInsertImage.setDisabled(true);
this.btnInsertChart.setDisabled(true);
this.btnInsertText.setDisabled(true);
this.btnInsertTextArt.setDisabled(true);
this.btnDropCap.setDisabled(true);
this.btnColumns.setDisabled(true);
this.btnInsertHyperlink.setDisabled(true);
this.btnEditHeader.setDisabled(true);
this.btnInsertShape.setDisabled(true);
this.btnInsertEquation.setDisabled(true);
this.btnPageOrient.setDisabled(true);
this.btnPageMargins.setDisabled(true);
this.btnPageSize.setDisabled(true);
this.btnClearStyle.setDisabled(true);
this.btnCopyStyle.setDisabled(true);
this.btnColorSchemas.setDisabled(true);
this.btnMailRecepients.setDisabled(true);
this.btnHorizontalAlign.setDisabled(true);
this.cmbFontName.setDisabled(true);
this.cmbFontSize.setDisabled(true);
this.listStyles.setDisabled(true);
this.btnNotes.setDisabled(true);
if (mode.disableDownload) if (mode.disableDownload)
this.btnPrint.setDisabled(true); this.btnPrint.setDisabled(true);
this.btnsPageBreak.disable(true);
} }
this.mode = mode; this.mode = mode;

View file

@ -361,6 +361,7 @@
"DE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.", "DE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",
"DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"DE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "DE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"DE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked", "DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked",
"DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled", "DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled",

View file

@ -88,6 +88,7 @@ define([
me.api.asc_registerCallback('asc_onAuthParticipantsChanged',_.bind(me.onApiUsersChanged, me)); me.api.asc_registerCallback('asc_onAuthParticipantsChanged',_.bind(me.onApiUsersChanged, me));
me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onApiUserConnection, me)); me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onApiUserConnection, me));
me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me)); me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me));
Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
me.api.asc_coAuthoringGetUsers(); me.api.asc_coAuthoringGetUsers();
}, },
@ -344,7 +345,7 @@ define([
items[indexAfter] = items.splice(indexBefore, 1, items[indexAfter])[0]; items[indexAfter] = items.splice(indexBefore, 1, items[indexAfter])[0];
}; };
if (!objectLocked && _isEdit) { if (!objectLocked && _isEdit && !me.isDisconnected) {
if (canCopy) { if (canCopy) {
menuItems.push({ menuItems.push({
caption: me.menuCut, caption: me.menuCut,
@ -399,6 +400,10 @@ define([
return menuItems; return menuItems;
}, },
onCoAuthoringDisconnect: function() {
this.isDisconnected = true;
},
textGuest: 'Guest', textGuest: 'Guest',
menuCut: 'Cut', menuCut: 'Cut',
menuCopy: 'Copy', menuCopy: 'Copy',

View file

@ -237,6 +237,7 @@ define([
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_setDocInfo(docInfo); this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -551,10 +552,27 @@ define([
me.api.zoomFitToWidth(); me.api.zoomFitToWidth();
} }
DE.getController('Toolbar').activateControls(); me.applyLicense();
},
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers;
}
if (this._isDocReady && this._state.licenseWarning)
this.applyLicense();
},
applyLicense: function() {
var me = this;
if (me._state.licenseWarning) { if (me._state.licenseWarning) {
value = Common.localStorage.getItem("de-license-warning"); DE.getController('Toolbar').activateViewControls();
DE.getController('Toolbar').deactivateEditControls();
Common.NotificationCenter.trigger('api:disconnect');
var value = Common.localStorage.getItem("de-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime(); var now = (new Date).getTime();
@ -562,7 +580,7 @@ define([
Common.localStorage.setItem("de-license-warning", now); Common.localStorage.setItem("de-license-warning", now);
uiApp.modal({ uiApp.modal({
title: me.textNoLicenseTitle, title: me.textNoLicenseTitle,
text : me.warnNoLicense, text : me._state.licenseWarning,
buttons: [ buttons: [
{ {
text: me.textBuyNow, text: me.textBuyNow,
@ -577,10 +595,11 @@ define([
window.open('mailto:sales@onlyoffice.com', "_blank"); window.open('mailto:sales@onlyoffice.com', "_blank");
} }
} }
], ]
}); });
} }
} } else
DE.getController('Toolbar').activateControls();
}, },
onOpenDocument: function(progress) { onOpenDocument: function(progress) {
@ -638,8 +657,6 @@ define([
me.appOptions.canDownload = me.permissions.download !== false && (!type || typeof type[1] !== 'string'); me.appOptions.canDownload = me.permissions.download !== false && (!type || typeof type[1] !== 'string');
me.appOptions.canReader = (!type || typeof type[1] !== 'string'); me.appOptions.canReader = (!type || typeof type[1] !== 'string');
me._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view';
me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object');
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
@ -1221,7 +1238,7 @@ define([
textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.', textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.',
textBuyNow: 'Visit website', textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version', textNoLicenseTitle: 'ONLYOFFICE open source version',
warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.', warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales', textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download until the connection is restored.', errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download until the connection is restored.',
warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.', warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.',
@ -1258,7 +1275,8 @@ define([
txtStyle_Subtitle: 'Subtitle', txtStyle_Subtitle: 'Subtitle',
txtStyle_Quote: 'Quote', txtStyle_Quote: 'Quote',
txtStyle_Intense_Quote: 'Intense Quote', txtStyle_Intense_Quote: 'Intense Quote',
txtStyle_List_Paragraph: 'List Paragraph' txtStyle_List_Paragraph: 'List Paragraph',
warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.'
} }
})(), DE.Controllers.Main || {})) })(), DE.Controllers.Main || {}))
}); });

View file

@ -79,6 +79,7 @@ define([
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
}, },
setMode: function (mode) { setMode: function (mode) {
@ -138,6 +139,8 @@ define([
// API handlers // API handlers
onApiCanRevert: function(which, can) { onApiCanRevert: function(which, can) {
if (this.isDisconnected) return;
if (which == 'undo') { if (which == 'undo') {
$('#toolbar-undo').toggleClass('disabled', !can); $('#toolbar-undo').toggleClass('disabled', !can);
} else { } else {
@ -146,6 +149,8 @@ define([
}, },
onApiFocusObject: function (objects) { onApiFocusObject: function (objects) {
if (this.isDisconnected) return;
if (objects.length > 0) { if (objects.length > 0) {
var topObject = _.find(objects.reverse(), function (obj) { var topObject = _.find(objects.reverse(), function (obj) {
return obj.get_ObjectType() != Asc.c_oAscTypeSelectElement.SpellCheck; return obj.get_ObjectType() != Asc.c_oAscTypeSelectElement.SpellCheck;
@ -161,6 +166,18 @@ define([
$('#toolbar-edit, #toolbar-add, #toolbar-settings, #toolbar-search, #document-back').removeClass('disabled'); $('#toolbar-edit, #toolbar-add, #toolbar-settings, #toolbar-search, #document-back').removeClass('disabled');
}, },
activateViewControls: function() {
$('#toolbar-search, #document-back').removeClass('disabled');
},
deactivateEditControls: function() {
$('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled');
},
onCoAuthoringDisconnect: function() {
this.isDisconnected = true;
},
dlgLeaveTitleText : 'You leave the application', dlgLeaveTitleText : 'You leave the application',
dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
leaveButtonText : 'Leave this Page', leaveButtonText : 'Leave this Page',

View file

@ -147,6 +147,7 @@
"DE.Controllers.Main.uploadImageTitleText": "Uploading Image", "DE.Controllers.Main.uploadImageTitleText": "Uploading Image",
"DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"DE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "DE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"DE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Search.textNoTextFound": "Text not Found", "DE.Controllers.Search.textNoTextFound": "Text not Found",
"DE.Controllers.Search.textReplaceAll": "Replace All", "DE.Controllers.Search.textReplaceAll": "Replace All",

View file

@ -319,6 +319,7 @@ define([
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_setDocInfo(docInfo); this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -695,6 +696,8 @@ define([
if (me.appOptions.canBrandingExt) if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main'); Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
} }
}, 50); }, 50);
} else { } else {
@ -715,17 +718,32 @@ define([
Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'});
$(document).on('contextmenu', _.bind(me.onContextMenu, me)); $(document).on('contextmenu', _.bind(me.onContextMenu, me));
},
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers;
}
if (this._isDocReady)
this.applyLicense();
},
applyLicense: function() {
if (this._state.licenseWarning) { if (this._state.licenseWarning) {
value = Common.localStorage.getItem("pe-license-warning"); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
var value = Common.localStorage.getItem("pe-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime(); var now = (new Date).getTime();
if (now - value > 86400000) { if (now - value > 86400000) {
Common.localStorage.setItem("de-license-warning", now); Common.localStorage.setItem("pe-license-warning", now);
Common.UI.info({ Common.UI.info({
width: 500, width: 500,
title: this.textNoLicenseTitle, title: this.textNoLicenseTitle,
msg : this.warnNoLicense, msg : this._state.licenseWarning,
buttons: [ buttons: [
{value: 'buynow', caption: this.textBuyNow}, {value: 'buynow', caption: this.textBuyNow},
{value: 'contact', caption: this.textContactUs} {value: 'contact', caption: this.textContactUs}
@ -742,6 +760,15 @@ define([
} }
}, },
disableEditing: function(disable) {
var app = this.getApplication();
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
app.getController('RightMenu').getView('RightMenu').clearSelection();
app.getController('Toolbar').DisableToolbar(disable);
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
}
},
onOpenDocument: function(progress) { onOpenDocument: function(progress) {
var elem = document.getElementById('loadmask-text'); var elem = document.getElementById('loadmask-text');
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
@ -788,8 +815,6 @@ define([
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
this.appOptions.trialMode = params.asc_getLicenseMode(); this.appOptions.trialMode = params.asc_getLicenseMode();
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object'); this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding) if (this.appOptions.canBranding)
appHeader.setBranding(this.editorConfig.customization); appHeader.setBranding(this.editorConfig.customization);
@ -1879,7 +1904,7 @@ define([
textStrict: 'Strict mode', textStrict: 'Strict mode',
textBuyNow: 'Visit website', textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version', textNoLicenseTitle: 'ONLYOFFICE open source version',
warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.', warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales', textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.', errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.',
warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.', warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.',
@ -1910,7 +1935,8 @@ define([
textChangesSaved: 'All changes saved', textChangesSaved: 'All changes saved',
saveTitleText: 'Saving Document', saveTitleText: 'Saving Document',
saveTextText: 'Saving document...', saveTextText: 'Saving document...',
txtLoading: 'Loading...' txtLoading: 'Loading...',
warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.'
} }
})(), PE.Controllers.Main || {})) })(), PE.Controllers.Main || {}))
}); });

View file

@ -186,6 +186,9 @@ define([
var fillViewMenuProps = function(selectedElements) { var fillViewMenuProps = function(selectedElements) {
if (!selectedElements || !_.isArray(selectedElements)) return; if (!selectedElements || !_.isArray(selectedElements)) return;
if (!me.viewModeMenu)
me.createDelayedElementsViewer();
var menu_props = {}, var menu_props = {},
menu_to_show = null; menu_to_show = null;
_.each(selectedElements, function(element, index) { _.each(selectedElements, function(element, index) {
@ -217,6 +220,7 @@ define([
var onContextMenu = function(event){ var onContextMenu = function(event){
_.delay(function(){ _.delay(function(){
if (event.get_Type() == Asc.c_oAscContextMenuTypes.Thumbnails) { if (event.get_Type() == Asc.c_oAscContextMenuTypes.Thumbnails) {
if (me.mode.isEdit)
showPopupMenu.call(me, me.slideMenu, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event); showPopupMenu.call(me, me.slideMenu, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event);
} else { } else {
showObjectMenu.call(me, event); showObjectMenu.call(me, event);

View file

@ -303,6 +303,7 @@ define([
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this)); this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this)); this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
} }
return this; return this;
@ -344,7 +345,7 @@ define([
this.langMenu.doLayout(); this.langMenu.doLayout();
if (this.langMenu.items.length>0) { if (this.langMenu.items.length>0) {
this.btnLanguage.setDisabled(false || this._state.no_paragraph); this.btnLanguage.setDisabled(false || this._state.no_paragraph);
this.btnDocLanguage.setDisabled(false); this.btnDocLanguage.setDisabled(!!this.mode.isDisconnected);
} }
}, },
@ -388,6 +389,11 @@ define([
this.btnLanguage.setDisabled(this._state.no_paragraph); this.btnLanguage.setDisabled(this._state.no_paragraph);
}, },
onApiCoAuthoringDisconnect: function() {
this.setMode({isDisconnected:true});
this.SetDisabled(true);
},
pageIndexText : 'Slide {0} of {1}', pageIndexText : 'Slide {0} of {1}',
goToPageText : 'Go to Slide', goToPageText : 'Go to Slide',
tipFitPage : 'Fit to Slide', tipFitPage : 'Fit to Slide',

View file

@ -278,6 +278,7 @@
"PE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.", "PE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",
"PE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "PE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"PE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "PE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"PE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Statusbar.zoomText": "Zoom {0}%", "PE.Controllers.Statusbar.zoomText": "Zoom {0}%",
"PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?", "PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?",

View file

@ -81,6 +81,7 @@ define([
me.api.asc_registerCallback('asc_onShowPopMenu', _.bind(me.onApiShowPopMenu, me)); me.api.asc_registerCallback('asc_onShowPopMenu', _.bind(me.onApiShowPopMenu, me));
me.api.asc_registerCallback('asc_onHidePopMenu', _.bind(me.onApiHidePopMenu, me)); me.api.asc_registerCallback('asc_onHidePopMenu', _.bind(me.onApiHidePopMenu, me));
me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me)); me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me));
Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
}, },
setMode: function (mode) { setMode: function (mode) {
@ -253,7 +254,7 @@ define([
items[indexAfter] = items.splice(indexBefore, 1, items[indexAfter])[0]; items[indexAfter] = items.splice(indexBefore, 1, items[indexAfter])[0];
}; };
if (!objectLocked && _isEdit) { if (!objectLocked && _isEdit && !me.isDisconnected) {
if (canCopy && isObject) { if (canCopy && isObject) {
menuItems.push({ menuItems.push({
caption: me.menuCut, caption: me.menuCut,
@ -309,6 +310,10 @@ define([
return menuItems; return menuItems;
}, },
onCoAuthoringDisconnect: function() {
this.isDisconnected = true;
},
menuCut: 'Cut', menuCut: 'Cut',
menuCopy: 'Copy', menuCopy: 'Copy',
menuPaste: 'Paste', menuPaste: 'Paste',

View file

@ -236,6 +236,7 @@ define([
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_setDocInfo(docInfo); this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -511,18 +512,35 @@ define([
me.api.zoomFitToPage(); me.api.zoomFitToPage();
} }
PE.getController('Toolbar').activateControls(); me.applyLicense();
},
onLicenseChanged: function(params) {
var licType = params.asc_getLicenseType();
if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers;
}
if (this._isDocReady && this._state.licenseWarning)
this.applyLicense();
},
applyLicense: function() {
var me = this;
if (me._state.licenseWarning) { if (me._state.licenseWarning) {
value = Common.localStorage.getItem("de-license-warning"); PE.getController('Toolbar').activateViewControls();
PE.getController('Toolbar').deactivateEditControls();
Common.NotificationCenter.trigger('api:disconnect');
var value = Common.localStorage.getItem("pe-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime(); var now = (new Date).getTime();
if (now - value > 86400000) { if (now - value > 86400000) {
Common.localStorage.setItem("de-license-warning", now); Common.localStorage.setItem("pe-license-warning", now);
uiApp.modal({ uiApp.modal({
title: me.textNoLicenseTitle, title: me.textNoLicenseTitle,
text : me.warnNoLicense, text : me._state.licenseWarning,
buttons: [ buttons: [
{ {
text: me.textBuyNow, text: me.textBuyNow,
@ -537,10 +555,11 @@ define([
window.open('mailto:sales@onlyoffice.com', "_blank"); window.open('mailto:sales@onlyoffice.com', "_blank");
} }
} }
], ]
}); });
} }
} } else
PE.getController('Toolbar').activateControls();
}, },
onOpenDocument: function(progress) { onOpenDocument: function(progress) {
@ -597,8 +616,6 @@ define([
me.appOptions.canDownloadOrigin = !me.appOptions.nativeApp && me.permissions.download !== false && (type && typeof type[1] === 'string'); me.appOptions.canDownloadOrigin = !me.appOptions.nativeApp && me.permissions.download !== false && (type && typeof type[1] === 'string');
me.appOptions.canDownload = !me.appOptions.nativeApp && me.permissions.download !== false && (!type || typeof type[1] !== 'string'); me.appOptions.canDownload = !me.appOptions.nativeApp && me.permissions.download !== false && (!type || typeof type[1] !== 'string');
me._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view';
me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object');
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
@ -1227,7 +1244,7 @@ define([
textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.', textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.',
textBuyNow: 'Visit website', textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version', textNoLicenseTitle: 'ONLYOFFICE open source version',
warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.', warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales', textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.', errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.',
warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.', warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.',
@ -1259,7 +1276,8 @@ define([
txtImage: 'Image', txtImage: 'Image',
txtSlideNumber: 'Slide number', txtSlideNumber: 'Slide number',
txtSlideSubtitle: 'Slide subtitle', txtSlideSubtitle: 'Slide subtitle',
txtSlideTitle: 'Slide title' txtSlideTitle: 'Slide title',
warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.'
} }
})(), PE.Controllers.Main || {})) })(), PE.Controllers.Main || {}))
}); });

View file

@ -79,6 +79,7 @@ define([
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
}, },
setMode: function (mode) { setMode: function (mode) {
@ -138,6 +139,8 @@ define([
// API handlers // API handlers
onApiCanRevert: function(which, can) { onApiCanRevert: function(which, can) {
if (this.isDisconnected) return;
if (which == 'undo') { if (which == 'undo') {
$('#toolbar-undo').toggleClass('disabled', !can); $('#toolbar-undo').toggleClass('disabled', !can);
} else { } else {
@ -146,6 +149,8 @@ define([
}, },
onApiFocusObject: function (objects) { onApiFocusObject: function (objects) {
if (this.isDisconnected) return;
if (objects.length > 0) { if (objects.length > 0) {
var slide_deleted = false, var slide_deleted = false,
slide_lock = false, slide_lock = false,
@ -172,6 +177,18 @@ define([
$('#toolbar-preview, #toolbar-settings, #toolbar-search, #document-back').removeClass('disabled'); $('#toolbar-preview, #toolbar-settings, #toolbar-search, #document-back').removeClass('disabled');
}, },
activateViewControls: function() {
$('#toolbar-preview, #toolbar-search, #document-back').removeClass('disabled');
},
deactivateEditControls: function() {
$('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled');
},
onCoAuthoringDisconnect: function() {
this.isDisconnected = true;
},
dlgLeaveTitleText : 'You leave the application', dlgLeaveTitleText : 'You leave the application',
dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
leaveButtonText : 'Leave this Page', leaveButtonText : 'Leave this Page',

View file

@ -204,6 +204,7 @@
"PE.Controllers.Main.uploadImageTitleText": "Uploading Image", "PE.Controllers.Main.uploadImageTitleText": "Uploading Image",
"PE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "PE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"PE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "PE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"PE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Search.textNoTextFound": "Text not Found", "PE.Controllers.Search.textNoTextFound": "Text not Found",
"PE.Controllers.Settings.notcriticalErrorTitle": "Warning", "PE.Controllers.Settings.notcriticalErrorTitle": "Warning",

View file

@ -1492,6 +1492,9 @@ define([
iscellmenu = (seltype==Asc.c_oAscSelectionType.RangeCells) && !this.permissions.isEditMailMerge && !this.permissions.isEditDiagram, iscellmenu = (seltype==Asc.c_oAscSelectionType.RangeCells) && !this.permissions.isEditMailMerge && !this.permissions.isEditDiagram,
iscelledit = this.api.isCellEdited; iscelledit = this.api.isCellEdited;
if (!documentHolder.viewModeMenu)
documentHolder.createDelayedElementsViewer();
if (!showMenu && !documentHolder.viewModeMenu.isVisible()) return; if (!showMenu && !documentHolder.viewModeMenu.isVisible()) return;
documentHolder.menuViewUndo.setVisible(this.permissions.canCoAuthoring && this.permissions.canComments); documentHolder.menuViewUndo.setVisible(this.permissions.canCoAuthoring && this.permissions.canComments);

View file

@ -355,6 +355,7 @@ define([
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_setDocInfo(docInfo); this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
}, },
@ -707,6 +708,8 @@ define([
if (me.appOptions.canBrandingExt) if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main'); Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
} }
}, 50); }, 50);
} else { } else {
@ -741,17 +744,34 @@ define([
if (typeof document.hidden !== 'undefined' && document.hidden) { if (typeof document.hidden !== 'undefined' && document.hidden) {
document.addEventListener('visibilitychange', checkWarns); document.addEventListener('visibilitychange', checkWarns);
} else checkWarns(); } else checkWarns();
},
onLicenseChanged: function(params) {
if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return;
var licType = params.asc_getLicenseType();
if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers;
}
if (this._isDocReady)
this.applyLicense();
},
applyLicense: function() {
if (this._state.licenseWarning) { if (this._state.licenseWarning) {
value = Common.localStorage.getItem("de-license-warning"); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect');
var value = Common.localStorage.getItem("sse-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime(); var now = (new Date).getTime();
if (now - value > 86400000) { if (now - value > 86400000) {
Common.localStorage.setItem("de-license-warning", now); Common.localStorage.setItem("sse-license-warning", now);
Common.UI.info({ Common.UI.info({
width: 500, width: 500,
title: this.textNoLicenseTitle, title: this.textNoLicenseTitle,
msg : this.warnNoLicense, msg : this._state.licenseWarning,
buttons: [ buttons: [
{value: 'buynow', caption: this.textBuyNow}, {value: 'buynow', caption: this.textBuyNow},
{value: 'contact', caption: this.textContactUs} {value: 'contact', caption: this.textContactUs}
@ -768,6 +788,14 @@ define([
} }
}, },
disableEditing: function(disable) {
var app = this.getApplication();
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
app.getController('RightMenu').getView('RightMenu').clearSelection();
app.getController('Toolbar').DisableToolbar(disable);
}
},
onOpenDocument: function(progress) { onOpenDocument: function(progress) {
var elem = document.getElementById('loadmask-text'); var elem = document.getElementById('loadmask-text');
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
@ -831,8 +859,6 @@ define([
this.appOptions.forcesave = this.appOptions.canForcesave; this.appOptions.forcesave = this.appOptions.canForcesave;
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.applyModeCommonElements(); this.applyModeCommonElements();
this.applyModeEditorElements(); this.applyModeEditorElements();
@ -2063,7 +2089,7 @@ define([
errorFrmlWrongReferences: 'The function refers to a sheet that does not exist.<br>Please check the data and try again.', errorFrmlWrongReferences: 'The function refers to a sheet that does not exist.<br>Please check the data and try again.',
textBuyNow: 'Visit website', textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version', textNoLicenseTitle: 'ONLYOFFICE open source version',
warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.', warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales', textContactUs: 'Contact sales',
confirmPutMergeRange: 'The source data contains merged cells.<br>They will be unmerged before they are pasted into the table.', confirmPutMergeRange: 'The source data contains merged cells.<br>They will be unmerged before they are pasted into the table.',
errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.', errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.',
@ -2103,7 +2129,8 @@ define([
txtStyle_Total: 'Total', txtStyle_Total: 'Total',
txtStyle_Currency: 'Currency', txtStyle_Currency: 'Currency',
txtStyle_Percent: 'Percent', txtStyle_Percent: 'Percent',
txtStyle_Comma: 'Comma' txtStyle_Comma: 'Comma',
warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.'
} }
})(), SSE.Controllers.Main || {})) })(), SSE.Controllers.Main || {}))
}); });

View file

@ -393,6 +393,7 @@
"SSE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.", "SSE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",
"SSE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "SSE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textWarning": "Warning", "SSE.Controllers.Print.textWarning": "Warning",

View file

@ -82,6 +82,7 @@ define([
this.api.asc_registerCallback('asc_onShowPopMenu', _.bind(this.onApiShowPopMenu, this)); this.api.asc_registerCallback('asc_onShowPopMenu', _.bind(this.onApiShowPopMenu, this));
this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this)); this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
}, },
setMode: function (mode) { setMode: function (mode) {
@ -180,7 +181,7 @@ define([
}, },
onApiShowPopMenu: function(posX, posY) { onApiShowPopMenu: function(posX, posY) {
if ( !_isEdit ) return; if ( !_isEdit || this.isDisconnected) return;
if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal-in, .actions-modal').length > 0) { if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal-in, .actions-modal').length > 0) {
return; return;
@ -334,6 +335,10 @@ define([
return menuItems; return menuItems;
}, },
onCoAuthoringDisconnect: function() {
this.isDisconnected = true;
},
warnMergeLostData: 'Operation can destroy data in the selected cells.<br>Continue?', warnMergeLostData: 'Operation can destroy data in the selected cells.<br>Continue?',
menuCopy: 'Copy', menuCopy: 'Copy',
menuCut: 'Cut', menuCut: 'Cut',

View file

@ -239,6 +239,7 @@ define([
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_setDocInfo(docInfo); this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -534,10 +535,33 @@ define([
mode: me.appOptions.isEdit ? 'edit' : 'view' mode: me.appOptions.isEdit ? 'edit' : 'view'
}); });
SSE.getController('Toolbar').activateControls(); me.applyLicense();
$('.view-main').on('click', function (e) {
uiApp.closeModal('.document-menu.modal-in');
})
},
onLicenseChanged: function(params) {
if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return;
var licType = params.asc_getLicenseType();
if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers;
}
if (this._isDocReady && this._state.licenseWarning)
this.applyLicense();
},
applyLicense: function() {
var me = this;
if (me._state.licenseWarning) { if (me._state.licenseWarning) {
value = Common.localStorage.getItem("sse-license-warning"); SSE.getController('Toolbar').activateViewControls();
SSE.getController('Toolbar').deactivateEditControls();
Common.NotificationCenter.trigger('api:disconnect');
var value = Common.localStorage.getItem("sse-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime(); var now = (new Date).getTime();
@ -545,7 +569,7 @@ define([
Common.localStorage.setItem("sse-license-warning", now); Common.localStorage.setItem("sse-license-warning", now);
uiApp.modal({ uiApp.modal({
title: me.textNoLicenseTitle, title: me.textNoLicenseTitle,
text : me.warnNoLicense, text : me._state.licenseWarning,
buttons: [ buttons: [
{ {
text: me.textBuyNow, text: me.textBuyNow,
@ -560,14 +584,11 @@ define([
window.open('mailto:sales@onlyoffice.com', "_blank"); window.open('mailto:sales@onlyoffice.com', "_blank");
} }
} }
], ]
}); });
} }
} } else
SSE.getController('Toolbar').activateControls();
$('.view-main').on('click', function (e) {
uiApp.closeModal('.document-menu.modal-in');
})
}, },
onOpenDocument: function(progress) { onOpenDocument: function(progress) {
@ -624,8 +645,6 @@ define([
me.appOptions.canDownload = !me.appOptions.nativeApp && (me.permissions.download !== false); me.appOptions.canDownload = !me.appOptions.nativeApp && (me.permissions.download !== false);
me.appOptions.canPrint = (me.permissions.print !== false); me.appOptions.canPrint = (me.permissions.print !== false);
me._state.licenseWarning = !(me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view';
me.applyModeCommonElements(); me.applyModeCommonElements();
me.applyModeEditorElements(); me.applyModeEditorElements();
@ -1365,7 +1384,7 @@ define([
txtErrorLoadHistory: 'Loading history failed', txtErrorLoadHistory: 'Loading history failed',
textBuyNow: 'Visit website', textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version', textNoLicenseTitle: 'ONLYOFFICE open source version',
warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.', warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales', textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download until the connection is restored.', errorViewerDisconnect: 'Connection is lost. You can still view the document,<br>but will not be able to download until the connection is restored.',
warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.', warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.',
@ -1417,7 +1436,8 @@ define([
txtStyle_Total: 'Total', txtStyle_Total: 'Total',
txtStyle_Currency: 'Currency', txtStyle_Currency: 'Currency',
txtStyle_Percent: 'Percent', txtStyle_Percent: 'Percent',
txtStyle_Comma: 'Comma' txtStyle_Comma: 'Comma',
warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.'
} }
})(), SSE.Controllers.Main || {})) })(), SSE.Controllers.Main || {}))
}); });

View file

@ -86,6 +86,7 @@ define([
this.api.asc_registerCallback('asc_onWorkbookLocked', _.bind(this.onApiWorkbookLocked, this)); this.api.asc_registerCallback('asc_onWorkbookLocked', _.bind(this.onApiWorkbookLocked, this));
this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onApiWorksheetLocked, this)); this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onApiWorksheetLocked, this));
this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, this)); this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('sheet:active', this.onApiActiveSheetChanged.bind(this)); Common.NotificationCenter.on('sheet:active', this.onApiActiveSheetChanged.bind(this));
}, },
@ -159,6 +160,8 @@ define([
}, },
onApiCanRevert: function(which, can) { onApiCanRevert: function(which, can) {
if (this.isDisconnected) return;
if (which == 'undo') { if (which == 'undo') {
$('#toolbar-undo').toggleClass('disabled', !can); $('#toolbar-undo').toggleClass('disabled', !can);
} else { } else {
@ -167,6 +170,8 @@ define([
}, },
onApiSelectionChanged: function(info) { onApiSelectionChanged: function(info) {
if (this.isDisconnected) return;
if ( !info ) info = this.api.asc_getCellInfo(); if ( !info ) info = this.api.asc_getCellInfo();
var islocked = false; var islocked = false;
@ -195,6 +200,18 @@ define([
$('#toolbar-settings, #toolbar-search, #document-back').removeClass('disabled'); $('#toolbar-settings, #toolbar-search, #document-back').removeClass('disabled');
}, },
activateViewControls: function() {
$('#toolbar-search, #document-back').removeClass('disabled');
},
deactivateEditControls: function() {
$('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled');
},
onCoAuthoringDisconnect: function() {
this.isDisconnected = true;
},
dlgLeaveTitleText : 'You leave the application', dlgLeaveTitleText : 'You leave the application',
dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
leaveButtonText : 'Leave this Page', leaveButtonText : 'Leave this Page',

View file

@ -256,6 +256,7 @@
"SSE.Controllers.Main.uploadImageTitleText": "Uploading Image", "SSE.Controllers.Main.uploadImageTitleText": "Uploading Image",
"SSE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "SSE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.",
"SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Search.textNoTextFound": "Text not found", "SSE.Controllers.Search.textNoTextFound": "Text not found",
"SSE.Controllers.Search.textReplaceAll": "Replace All", "SSE.Controllers.Search.textReplaceAll": "Replace All",