Merge pull request #1149 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova 2021-09-02 02:02:18 +03:00 committed by GitHub
commit 7dd118d67e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 169 additions and 66 deletions

View file

@ -37,6 +37,8 @@ define([
var me = this;
if (!Common.Utils.isBrowserSupported()){
Common.Utils.showBrowserRestriction();
$('#editor_sdk').hide().remove();
$('#toolbar').hide().remove();
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
return;
}
@ -132,6 +134,12 @@ define([
});
window.onbeforeunload = _.bind(this.onBeforeUnload, this);
this.warnNoLicense = this.warnNoLicense.replace(/%1/g, '{{COMPANY_NAME}}');
this.warnNoLicenseUsers = this.warnNoLicenseUsers.replace(/%1/g, '{{COMPANY_NAME}}');
this.textNoLicenseTitle = this.textNoLicenseTitle.replace(/%1/g, '{{COMPANY_NAME}}');
this.warnLicenseExceeded = this.warnLicenseExceeded.replace(/%1/g, '{{COMPANY_NAME}}');
this.warnLicenseUsersExceeded = this.warnLicenseUsersExceeded.replace(/%1/g, '{{COMPANY_NAME}}');
},
onDocumentResize: function() {
@ -383,7 +391,6 @@ define([
}
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
// this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this));
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -438,6 +445,8 @@ define([
if (params.asc_getRights() !== Asc.c_oRights.Edit)
this.permissions.edit = this.permissions.review = false;
this.appOptions.trialMode = params.asc_getLicenseMode();
this.appOptions.isBeta = params.asc_getIsBeta();
this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);
this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm;
this.appOptions.canFillForms = this.appOptions.canLicense && (this.permissions.fillForms===true) && (this.editorConfig.mode !== 'view');
@ -529,6 +538,44 @@ define([
});
},
applyLicense: function() {
if (this._state.licenseType) {
var license = this._state.licenseType,
buttons = ['ok'],
primary = 'ok';
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0 &&
(license===Asc.c_oLicenseResult.SuccessLimit || license===Asc.c_oLicenseResult.ExpiredLimited || this.appOptions.permissionsLicense===Asc.c_oLicenseResult.SuccessLimit)) {
license = (license===Asc.c_oLicenseResult.ExpiredLimited) ? this.warnLicenseLimitedNoAccess : this.warnLicenseLimitedRenewed;
} else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) {
license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded;
} else {
license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers;
buttons = [{value: 'buynow', caption: this.textBuyNow}, {value: 'contact', caption: this.textContactUs}];
primary = 'buynow';
}
var value = Common.localStorage.getItem("de-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
if (now - value > 86400000) {
Common.UI.info({
maxwidth: 500,
title: this.textNoLicenseTitle,
msg : license,
buttons: buttons,
primary: primary,
callback: function(btn) {
Common.localStorage.setItem("de-license-warning", now);
if (btn == 'buynow')
window.open('{{PUBLISHER_URL}}', "_blank");
else if (btn == 'contact')
window.open('mailto:{{SALES_EMAIL}}', "_blank");
}
});
}
}
},
onLongActionBegin: function(type, id) {
var action = {id: id, type: type};
this.stackLongActions.push(action);
@ -950,9 +997,12 @@ define([
if (this.appOptions.canFillForms) {
this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this));
this.api.asc_registerCallback('asc_onHideContentControlsActions', _.bind(this.onHideContentControlsActions, this));
// this.api.asc_SetHighlightRequiredFields(true);
this.api.asc_SetHighlightRequiredFields(true);
}
if (this.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded
this.applyLicense();
Common.Gateway.on('processmouse', _.bind(this.onProcessMouse, this));
Common.Gateway.on('downloadas', _.bind(this.onDownloadAs, this));
Common.Gateway.on('requestclose', _.bind(this.onRequestClose, this));
@ -1188,8 +1238,6 @@ define([
txtClose: 'Close',
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
textNext: 'Next Field',
textClear: 'Clear All Fields',
textSubmited: '<b>Form submitted successfully</b><br>Click to close the tip.',
errorSubmit: 'Submit failed.',
errorEditingDownloadas: 'An error occurred during the work with the document.<br>Use the \'Download as...\' option to save the file backup copy to your computer hard drive.',
@ -1200,6 +1248,20 @@ define([
errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",
textCloseTip: "Click to close the tip.",
txtPressLink: 'Press Ctrl and click link',
txtEmpty: '(Empty)'
txtEmpty: '(Empty)',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.',
titleUpdateVersion: 'Version changed',
errorUpdateVersion: 'The file version has been changed. The page will be reloaded.',
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
warnLicenseExceeded: "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact your administrator to learn more.",
warnLicenseUsersExceeded: "You've reached the user limit for %1 editors. Contact your administrator to learn more.",
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.",
warnNoLicenseUsers: "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
textBuyNow: 'Visit website',
textNoLicenseTitle: 'License limit reached',
textContactUs: 'Contact sales'
}, DE.Controllers.ApplicationController));
});

View file

@ -23,7 +23,7 @@
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 10000;
z-index: 1001;
}
.loadmask > .brendpanel {
@ -113,6 +113,7 @@
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"></script>
<![endif]-->
<script src="../../common/main/lib/util/themeinit.js"></script>
</head>
<body class="embed-body theme-classic-light theme-type-light">
@ -126,7 +127,8 @@
<script>
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); };
check = function(regex){ return regex.test(userAgent); },
stopLoading = false;
if (!check(/opera/) && (check(/msie/) || check(/trident/))) {
var m = /msie (\d+\.\d+)/.exec(userAgent);
if (m && parseFloat(m[1]) < 10.0) {
@ -134,11 +136,20 @@
'<div id="id-error-mask" class="errormask">',
'<div class="error-body" align="center">',
'<div id="id-error-mask-title" class="title">Your browser is not supported.</div>',
'<div id="id-error-mask-text">Sorry, ONLYOFFICE Document is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'<div id="id-error-mask-text">Sorry, Document Editor is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'</div>',
'</div>'
);
stopLoading = true;
}
} else
if (check(/windows\snt/i)) {
var re = /chrome\/(\d+)/i.exec(userAgent);
if (!!re && !!re[1] && !(re[1] > 49)) {
setTimeout(function () {
document.getElementsByTagName('body')[0].className += "winxp";
},0);
}
}
function getUrlParams() {
@ -169,14 +180,21 @@
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
if (stopLoading) {
document.body.removeChild(document.getElementById('loading-mask'));
} else {
var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
}
</script>
</script>
<div id="editor_sdk" class="viewer" style="overflow: hidden;" tabindex="-1"></div>
@ -208,10 +226,6 @@
<!--vendor-->
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../../vendor/jquery.browser/dist/jquery.browser.min.js"></script>
<!--<script type="text/javascript" src="../../../vendor/bootstrap/dist/js/bootstrap.js"></script>-->
<!--<script type="text/javascript" src="../../../vendor/sockjs/sockjs.min.js"></script>-->
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
<script type="text/javascript" src="../../../../sdkjs/develop/sdkjs/word/scripts.js"></script>
@ -219,28 +233,17 @@
window.sdk_scripts.forEach(function(item){
document.write('<script type="text/javascript" src="' + item + '"><\/script>');
});
</script>
window.requireTimeourError = function(){
var reqerr;
<!--application-->
<script type="text/javascript">
var isBrowserSupported = function() {
return ($.browser.msie && parseFloat($.browser.version) > 9) ||
($.browser.chrome && parseFloat($.browser.version) > 7) ||
($.browser.safari && parseFloat($.browser.version) > 4) ||
($.browser.opera && parseFloat($.browser.version) > 10.4) ||
($.browser.mozilla && parseFloat($.browser.version) > 3.9);
if ( lang == 'de') reqerr = 'Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.';
else if ( lang == 'es') reqerr = 'La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.';
else if ( lang == 'fr') reqerr = 'La connexion est trop lente, certains des composants n\'ons pas pu être chargé. Veuillez recharger la page.';
else if ( lang == 'ru') reqerr = 'Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.';
else reqerr = 'The connection is too slow, some of the components could not be loaded. Please reload the page.';
return reqerr;
};
if (!isBrowserSupported()){
document.write(
'<div id="id-error-mask" class="errormask">',
'<div class="error-body" align="center">',
'<div id="id-error-mask-title" class="title">Your browser is not supported.</div>',
'<div id="id-error-mask-text">Sorry, ONLYOFFICE Document is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'</div>',
'</div>'
);
}
</script>
<script data-main="app_dev" src="../../../vendor/requirejs/require.js"></script>
</body>

View file

@ -21,7 +21,7 @@
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 10000;
z-index: 1001;
}
.loadmask > .brendpanel {
@ -119,7 +119,8 @@
<script>
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); };
check = function(regex){ return regex.test(userAgent); },
stopLoading = false;
if (!check(/opera/) && (check(/msie/) || check(/trident/))) {
var m = /msie (\d+\.\d+)/.exec(userAgent);
if (m && parseFloat(m[1]) < 10.0) {
@ -127,12 +128,21 @@
'<div id="id-error-mask" class="errormask">',
'<div class="error-body" align="center">',
'<div id="id-error-mask-title" class="title">Your browser is not supported.</div>',
'<div id="id-error-mask-text">Sorry, ONLYOFFICE Document is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'<div id="id-error-mask-text">Sorry, Document Editor is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'</div>',
'</div>'
);
stopLoading = true;
}
}
} else
if (check(/windows\snt/i)) {
var re = /chrome\/(\d+)/i.exec(userAgent);
if (!!re && !!re[1] && !(re[1] > 49)) {
setTimeout(function () {
document.getElementsByTagName('html')[0].className += "winxp";
},0);
}
}
function getUrlParams() {
var e,
@ -197,30 +207,44 @@
<span id="box-tools"></span>
</div>
</div>
<script>
if (stopLoading) {
document.body.removeChild(document.getElementById('loading-mask'));
} else {
var elem = document.querySelector('.loading-logo img');
if (elem) {
logo && (elem.setAttribute('src', logo));
elem.style.opacity = 1;
}
}
</script>
<script>
window.requireTimeourError = function(){
var reqerr;
<script type="text/javascript" src="../../../vendor/jquery/jquery.browser.min.js"></script>
if ( lang == 'de') reqerr = 'Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.';
else if ( lang == 'es') reqerr = 'La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.';
else if ( lang == 'fr') reqerr = 'La connexion est trop lente, certains des composants n\'ons pas pu être chargé. Veuillez recharger la page.';
else if ( lang == 'ru') reqerr = 'Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.';
else reqerr = 'The connection is too slow, some of the components could not be loaded. Please reload the page.';
<!--application-->
<script type="text/javascript">
var isBrowserSupported = function() {
return ($.browser.msie && parseFloat($.browser.version) > 9) ||
($.browser.chrome && parseFloat($.browser.version) > 7) ||
($.browser.safari && parseFloat($.browser.version) > 4) ||
($.browser.opera && parseFloat($.browser.version) > 10.4) ||
($.browser.mozilla && parseFloat($.browser.version) > 3.9);
return reqerr;
};
if (!isBrowserSupported()){
document.write(
'<div id="id-error-mask" class="errormask">',
'<div class="error-body" align="center">',
'<div id="id-error-mask-title" class="title">Your browser is not supported.</div>',
'<div id="id-error-mask-text">Sorry, ONLYOFFICE Document is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'</div>',
'</div>'
);
}
var requireTimeoutID = setTimeout(function(){
window.alert(window.requireTimeourError());
window.location.reload();
}, 30000);
var require = {
waitSeconds: 30,
callback: function(){
clearTimeout(requireTimeoutID);
}
};
</script>
<!--application-->
<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>
</body>
</html>

View file

@ -21,14 +21,11 @@
"DE.ApplicationController.notcriticalErrorTitle": "Warning",
"DE.ApplicationController.scriptLoadError": "The connection is too slow, some of the components could not be loaded. Please reload the page.",
"DE.ApplicationController.textAnonymous": "Anonymous",
"DE.ApplicationController.textClear": "Clear All Fields",
"DE.ApplicationController.textGotIt": "Got it",
"DE.ApplicationController.textGuest": "Guest",
"DE.ApplicationController.textLoadingDocument": "Loading document",
"DE.ApplicationController.textNext": "Next Field",
"DE.ApplicationController.textOf": "of",
"DE.ApplicationController.textRequired": "Fill all required fields to send form.",
"DE.ApplicationController.textSubmit": "Submit",
"DE.ApplicationController.textSubmited": "<b>Form submitted successfully</b><br>Click to close the tip",
"DE.ApplicationController.txtClose": "Close",
"DE.ApplicationController.unknownErrorText": "Unknown error.",
@ -36,6 +33,20 @@
"DE.ApplicationController.waitText": "Please, wait...",
"DE.ApplicationController.txtEmpty": "(Empty)",
"DE.ApplicationController.txtPressLink": "Press Ctrl and click link",
"DE.ApplicationController.textCloseTip": "Click to close the tip.",
"DE.ApplicationController.titleServerVersion": "Editor updated",
"DE.ApplicationController.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.",
"DE.ApplicationController.titleUpdateVersion": "Version changed",
"DE.ApplicationController.errorUpdateVersion": "The file version has been changed. The page will be reloaded.",
"DE.ApplicationController.warnLicenseLimitedRenewed": "License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access",
"DE.ApplicationController.warnLicenseLimitedNoAccess": "License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.",
"DE.ApplicationController.warnLicenseExceeded": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact your administrator to learn more.",
"DE.ApplicationController.warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.",
"DE.ApplicationController.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.",
"DE.ApplicationController.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"DE.ApplicationController.textBuyNow": "Visit website",
"DE.ApplicationController.textNoLicenseTitle": "License limit reached",
"DE.ApplicationController.textContactUs": "Contact sales",
"DE.ApplicationView.txtDownload": "Download",
"DE.ApplicationView.txtDownloadDocx": "Download as docx",
"DE.ApplicationView.txtDownloadPdf": "Download as pdf",
@ -43,5 +54,8 @@
"DE.ApplicationView.txtFileLocation": "Open file location",
"DE.ApplicationView.txtFullScreen": "Full Screen",
"DE.ApplicationView.txtPrint": "Print",
"DE.ApplicationView.txtShare": "Share"
"DE.ApplicationView.txtShare": "Share",
"DE.ApplicationView.textSubmit": "Submit",
"DE.ApplicationView.textClear": "Clear All Fields",
"DE.ApplicationView.textNext": "Next Field"
}