Skip to content

Commit

Permalink
Merge pull request #2955 from ONLYOFFICE/fix/bugfix
Browse files Browse the repository at this point in the history
Fix/bugfix
  • Loading branch information
JuliaRadzhabova authored Apr 22, 2024
2 parents f2d757d + 1e16c5c commit e6be2b5
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 14 deletions.
11 changes: 7 additions & 4 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1076,15 +1076,18 @@
if (config.frameEditorId)
params += "&frameEditorId=" + config.frameEditorId;

var type = config.document ? /^(?:(pdf))$/.exec(config.document.fileType) : null;
if (!(type && typeof type[1] === 'string') && (config.editorConfig && config.editorConfig.mode == 'view' ||
var type = config.document ? /^(?:(pdf)|(oform|docxf))$/.exec(config.document.fileType) : null,
isPdf = type && typeof type[1] === 'string',
oldForm = type && typeof type[2] === 'string';

if (!(isPdf || oldForm) && (config.editorConfig && config.editorConfig.mode == 'view' ||
config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review )))
params += "&mode=view";
if (type && typeof type[1] === 'string' && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view'))
if ((isPdf || oldForm) && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view'))
params += "&mode=fillforms";

if (config.document) {
config.document.isForm = (type && typeof type[1] === 'string') ? config.document.isForm : false;
config.document.isForm = isPdf ? config.document.isForm : oldForm;
(config.document.isForm===true || config.document.isForm===false) && (params += "&isForm=" + config.document.isForm);
}

Expand Down
4 changes: 2 additions & 2 deletions apps/common/main/lib/component/ColorButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ define([
render: function(parentEl) {
Common.UI.Button.prototype.render.call(this, parentEl);

if (/huge/.test(this.options.cls) && this.options.split === true ) {
if (/huge/.test(this.options.cls) && this.options.split === true && !this.options.hideColorLine) {
var btnEl = $('button', this.cmpEl),
btnMenuEl = $(btnEl[1]);
btnMenuEl && btnMenuEl.append( $('<div class="btn-color-value-line"></div>'));
} else
} else if (!this.options.hideColorLine)
$('button:first-child', this.cmpEl).append( $('<div class="btn-color-value-line"></div>'));
this.colorEl = this.cmpEl.find('.btn-color-value-line');

Expand Down
3 changes: 3 additions & 0 deletions apps/documenteditor/embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 id="id-critical-error-title"></h4>
</div>
<div class="modal-body">
Expand Down
3 changes: 3 additions & 0 deletions apps/documenteditor/embed/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 id="id-critical-error-title"></h4>
</div>
<div class="modal-body">
Expand Down
3 changes: 3 additions & 0 deletions apps/documenteditor/embed/index_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 id="id-critical-error-title"></h4>
</div>
<div class="modal-body">
Expand Down
3 changes: 3 additions & 0 deletions apps/documenteditor/embed/index_loader.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 id="id-critical-error-title"></h4>
</div>
<div class="modal-body">
Expand Down
27 changes: 25 additions & 2 deletions apps/documenteditor/embed/js/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,12 @@ DE.ApplicationController = new(function(){

if ( !appOptions.canFillForms || permissions.download === false) {
$('#idt-download-docx').hide();
itemsCount --;
}

if ( !appOptions.canFillForms && !appOptions.isOForm || permissions.download === false) {
$('#idt-download-pdf').hide();
itemsCount -= 2;
itemsCount --;
}

if ( !embedConfig.shareUrl || appOptions.canFillForms) {
Expand Down Expand Up @@ -627,6 +631,17 @@ DE.ApplicationController = new(function(){
}, 2000);
}
});

if (appOptions.isOForm && permissions.download!==false) {
$('#id-critical-error-title').text(me.notcriticalErrorTitle);
$('#id-critical-error-message').html(me.textConvertFormDownload);
$('#id-critical-error-close').text(me.textDownloadPdf).off().on('click', function(){
downloadAs(Asc.c_oAscFileType.PDF);
$('#id-critical-error-dialog').modal('hide');
});
$('#id-critical-error-dialog').modal('show');
}

Common.Gateway.documentReady();
Common.Analytics.trackEvent('Load', 'Complete');
}
Expand All @@ -638,6 +653,7 @@ DE.ApplicationController = new(function(){
$('#id-critical-error-title').text(Asc.c_oLicenseResult.NotBefore === licType ? me.titleLicenseNotActive : me.titleLicenseExp);
$('#id-critical-error-message').html(Asc.c_oLicenseResult.NotBefore === licType ? me.warnLicenseBefore : me.warnLicenseExp);
$('#id-critical-error-close').parent().remove();
$('#id-critical-error-dialog button.close').remove();
$('#id-critical-error-dialog').css('z-index', 20002).modal({backdrop: 'static', keyboard: false, show: true});
return;
}
Expand All @@ -648,6 +664,9 @@ DE.ApplicationController = new(function(){
appOptions.canBranding = params.asc_getCustomization();
appOptions.canBranding && setBranding(config.customization);

var type = /^(?:(docxf|oform))$/.exec(docConfig.fileType);
appOptions.isOForm = !!(type && typeof type[1] === 'string'); // oform and docxf

api.asc_setViewMode(!appOptions.canFillForms);

btnSubmit = $('#id-btn-submit');
Expand Down Expand Up @@ -736,6 +755,7 @@ DE.ApplicationController = new(function(){
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
window.location.reload();
});
$('#id-critical-error-dialog button.close').remove();
$('#id-critical-error-dialog').css('z-index', 20002).modal('show');
return;
}
Expand Down Expand Up @@ -841,6 +861,7 @@ DE.ApplicationController = new(function(){
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
window.location.reload();
});
$('#id-critical-error-dialog button.close').remove();
}
else {
Common.Gateway.reportWarning(id, message);
Expand Down Expand Up @@ -1060,6 +1081,8 @@ DE.ApplicationController = new(function(){
titleLicenseExp: 'License expired',
titleLicenseNotActive: 'License not active',
warnLicenseBefore: 'License not active. Please contact your administrator.',
warnLicenseExp: 'Your license has expired. Please update your license and refresh the page.'
warnLicenseExp: 'Your license has expired. Please update your license and refresh the page.',
textConvertFormDownload: 'Download file as a fillable PDF form to be able to fill it out.',
textDownloadPdf: 'Download pdf'
}
})();
2 changes: 2 additions & 0 deletions apps/documenteditor/embed/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
"DE.ApplicationController.waitText": "Please, wait...",
"DE.ApplicationController.warnLicenseBefore": "License not active. Please contact your administrator.",
"DE.ApplicationController.warnLicenseExp": "Your license has expired. Please update your license and refresh the page.",
"DE.ApplicationController.textConvertFormDownload": "Download file as a fillable PDF form to be able to fill it out.",
"DE.ApplicationController.textDownloadPdf": "Download PDF",
"DE.ApplicationView.txtDownload": "Download",
"DE.ApplicationView.txtDownloadDocx": "Download as DOCX",
"DE.ApplicationView.txtDownloadPdf": "Download as PDF",
Expand Down
4 changes: 1 addition & 3 deletions apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,7 @@ define([

var type = data.doc ? /^(?:(docxf|oform)|(pdf))$/.exec(data.doc.fileType) : false;
this.appOptions.isFormCreator = !!(type && (typeof type[1] === 'string' || typeof type[2] === 'string' && this.appOptions.isPDFForm)) && this.appOptions.canFeatureForms; // show forms only for docxf or oform

type = data.doc ? /^(?:(oform))$/.exec(data.doc.fileType) : false;
this.appOptions.isOForm = !!(type && typeof type[1] === 'string');
this.appOptions.isOForm = !!(type && typeof type[1] === 'string'); // oform and docxf

this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
Expand Down
2 changes: 1 addition & 1 deletion apps/documenteditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3654,7 +3654,7 @@ define([
}
}

config.isOForm && config.canDownloadForms && Common.UI.warning({
config.isOForm && config.canDownload && Common.UI.warning({
msg : config.canRequestSaveAs || !!config.saveAsUrl || config.isOffline ? me.textConvertFormSave : me.textConvertFormDownload,
buttons: [{value: 'ok', caption: config.canRequestSaveAs || !!config.saveAsUrl || config.isOffline ? me.textSavePdf : me.textDownloadPdf}, 'cancel'],
callback: function(btn){
Expand Down
2 changes: 2 additions & 0 deletions apps/pdfeditor/main/app/view/FileMenuPanels.js
Original file line number Diff line number Diff line change
Expand Up @@ -2503,6 +2503,7 @@ define([
parentEl: $markup.findById('#print-prev-page'),
cls: 'btn-prev-page',
iconCls: 'arrow',
scaling: false,
dataHint: '2',
dataHintDirection: 'top'
});
Expand All @@ -2511,6 +2512,7 @@ define([
parentEl: $markup.findById('#print-next-page'),
cls: 'btn-next-page',
iconCls: 'arrow',
scaling: false,
dataHint: '2',
dataHintDirection: 'top'
});
Expand Down
6 changes: 4 additions & 2 deletions apps/pdfeditor/main/app/view/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,11 @@ define([
allowDepress: true,
split: true,
menu: true,
hideColorLine: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: '0, -16',
penOptions: {color: '000000'},
penOptions: {color: 'D43230'},
type: AscPDF.ANNOTATIONS_TYPES.Strikeout
});

Expand All @@ -834,10 +835,11 @@ define([
allowDepress: true,
split: true,
menu: true,
hideColorLine: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: '0, -16',
penOptions: {color: '000000'},
penOptions: {color: '3D8A44'},
type: AscPDF.ANNOTATIONS_TYPES.Underline
});

Expand Down

0 comments on commit e6be2b5

Please sign in to comment.