Merge pull request #2237 from ONLYOFFICE/fix/bugfix

Fix Bug 61196
This commit is contained in:
Julia Radzhabova
2023-02-15 20:26:35 +03:00
committed by GitHub
12 changed files with 42 additions and 39 deletions

View File

@ -98,7 +98,7 @@ define([
this.appConfig = mode;
this.currentUserId = mode.user.id;
this.appConfig.isEdit && (this.view = this.createView('DocProtection', {
this.appConfig.isEdit && this.appConfig.canProtect && (this.view = this.createView('DocProtection', {
mode: mode
}));

View File

@ -1549,7 +1549,7 @@ define([
this.appOptions.isBeta = params.asc_getIsBeta();
this.appOptions.isSignatureSupport= this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport() && (this.permissions.protect!==false);
this.appOptions.isPasswordSupport = this.appOptions.isEdit && this.api.asc_isProtectionSupport() && (this.permissions.protect!==false);
this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport);
this.appOptions.canProtect = (this.permissions.protect!==false);
this.appOptions.canEditContentControl = (this.permissions.modifyContentControl!==false);
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
this.appOptions.canSubmitForms = false; // this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm;

View File

@ -3275,16 +3275,17 @@ define([
// if ($panel) me.toolbar.addTab(tab, $panel, 6);
// }
// }
tab = {action: 'protect', caption: me.toolbar.textTabProtect, layoutname: 'toolbar-protect', dataHintTitle: 'T'};
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ($panel) {
config.canProtect && $panel.append($('<div class="separator long"></div>'));
var doctab = me.getApplication().getController('DocProtection');
$panel.append(doctab.createToolbarPanel());
me.toolbar.addTab(tab, $panel, 6);
me.toolbar.setVisible('protect', Common.UI.LayoutManager.isElementVisible('toolbar-protect'));
Array.prototype.push.apply(me.toolbar.lockControls, doctab.getView('DocProtection').getButtons());
if ( config.canProtect ) {
tab = {action: 'protect', caption: me.toolbar.textTabProtect, layoutname: 'toolbar-protect', dataHintTitle: 'T'};
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ($panel) {
(config.isSignatureSupport || config.isPasswordSupport) && $panel.append($('<div class="separator long"></div>'));
var doctab = me.getApplication().getController('DocProtection');
$panel.append(doctab.createToolbarPanel());
me.toolbar.addTab(tab, $panel, 6);
me.toolbar.setVisible('protect', Common.UI.LayoutManager.isElementVisible('toolbar-protect'));
Array.prototype.push.apply(me.toolbar.lockControls, doctab.getView('DocProtection').getButtons());
}
}
var links = me.getApplication().getController('Links');

View File

@ -401,8 +401,8 @@ define([
this.miPrint[this.mode.canPrint && !this.mode.canPreviewPrint ?'show':'hide']();
this.miPrintWithPreview[this.mode.canPreviewPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miProtect[this.mode.canProtect ?'show':'hide']();
separatorVisible = (this.mode.canDownload || this.mode.canDownloadOrigin || this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') || this.mode.canPrint || this.mode.canProtect ||
this.miProtect[(this.mode.isSignatureSupport || this.mode.isPasswordSupport) ?'show':'hide']();
separatorVisible = (this.mode.canDownload || this.mode.canDownloadOrigin || this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') || this.mode.canPrint || (this.mode.isSignatureSupport || this.mode.isPasswordSupport) ||
!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights || this.mode.canRename && !this.mode.isDesktopApp) && !this.mode.isDisconnected;
this.miProtect.$el.find('+.devider')[separatorVisible?'show':'hide']();
separatorVisible && (lastSeparator = this.miProtect.$el.find('+.devider'));
@ -462,7 +462,7 @@ define([
!this.panels['recent'] && (this.panels['recent'] = (new DE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render());
}
if (this.mode.canProtect) {
if (this.mode.isSignatureSupport || this.mode.isPasswordSupport) {
!this.panels['protect'] && (this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render());
this.panels['protect'].setMode(this.mode);
}

View File

@ -1220,7 +1220,7 @@ define([
this.appOptions.isBeta = params.asc_getIsBeta();
this.appOptions.isSignatureSupport= this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport() && (this.permissions.protect!==false);
this.appOptions.isPasswordSupport = this.appOptions.isEdit && this.api.asc_isProtectionSupport() && (this.permissions.protect!==false);
this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport);
this.appOptions.canProtect = (this.permissions.protect!==false);
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments;
@ -1370,7 +1370,7 @@ define([
fontsControllers && fontsControllers.setApi(me.api);
rightmenuController && rightmenuController.setApi(me.api);
if (me.appOptions.canProtect)
if (me.appOptions.isSignatureSupport || me.appOptions.isPasswordSupport)
application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
var viewport = this.getApplication().getController('Viewport').getView('Viewport');

View File

@ -2689,7 +2689,7 @@ define([
}
if ( config.isDesktopApp ) {
if ( config.canProtect ) { // don't add protect panel to toolbar
if (config.isSignatureSupport || config.isPasswordSupport) { // don't add protect panel to toolbar
tab = {action: 'protect', caption: me.toolbar.textTabProtect, layoutname: 'toolbar-protect', dataHintTitle: 'T'};
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ($panel)

View File

@ -397,8 +397,8 @@ define([
this.miPrint[this.mode.canPrint && !this.mode.canPreviewPrint ?'show':'hide']();
this.miPrintWithPreview[this.mode.canPreviewPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miProtect[this.mode.canProtect ?'show':'hide']();
separatorVisible = (this.mode.canDownload || this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') || this.mode.canPrint || this.mode.canProtect ||
this.miProtect[(this.mode.isSignatureSupport || this.mode.isPasswordSupport) ?'show':'hide']();
separatorVisible = (this.mode.canDownload || this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') || this.mode.canPrint || (this.mode.isSignatureSupport || this.mode.isPasswordSupport) ||
!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights || this.mode.canRename && !this.mode.isDesktopApp) && !this.mode.isDisconnected;
this.miProtect.$el.find('+.devider')[separatorVisible?'show':'hide']();
separatorVisible && (lastSeparator = this.miProtect.$el.find('+.devider'));
@ -458,7 +458,7 @@ define([
!this.panels['recent'] && (this.panels['recent'] = (new PE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render());
}
if (this.mode.canProtect) {
if (this.mode.isSignatureSupport || this.mode.isPasswordSupport) {
!this.panels['protect'] && (this.panels['protect'] = (new PE.Views.FileMenuPanels.ProtectDoc({menu:this})).render());
this.panels['protect'].setMode(this.mode);
}

View File

@ -1337,7 +1337,7 @@ define([
&& !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
this.appOptions.isPasswordSupport = this.appOptions.isEdit && this.api.asc_isProtectionSupport() && (this.permissions.protect!==false)
&& !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport);
this.appOptions.canProtect = (this.permissions.protect!==false) && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments;

View File

@ -2560,7 +2560,7 @@ define([
this._state.prstyle = undefined;
}
if ( this.appConfig.isDesktopApp && this.appConfig.canProtect ) {
if ( this.appConfig.isDesktopApp && (this.appConfig.isSignatureSupport || this.appConfig.isPasswordSupport) ) {
this.getApplication().getController('Common.Controllers.Protection').SetDisabled(is_cell_edited, false);
}
} else {
@ -4567,23 +4567,25 @@ define([
me.toolbar.processPanelVisible(null, true, true);
}
var tab = {action: 'protect', caption: me.toolbar.textTabProtect, layoutname: 'toolbar-protect', dataHintTitle: 'T'};
var $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ($panel) {
config.canProtect && $panel.append($('<div class="separator long"></div>'));
var wbtab = me.getApplication().getController('WBProtection');
$panel.append(wbtab.createToolbarPanel());
me.toolbar.addTab(tab, $panel, 7);
me.toolbar.setVisible('protect', Common.UI.LayoutManager.isElementVisible('toolbar-protect'));
Array.prototype.push.apply(me.toolbar.lockControls, wbtab.getView('WBProtection').getButtons());
if ( config.canProtect ) {
var tab = {action: 'protect', caption: me.toolbar.textTabProtect, layoutname: 'toolbar-protect', dataHintTitle: 'T'};
var $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ($panel) {
(config.isSignatureSupport || config.isPasswordSupport) && $panel.append($('<div class="separator long"></div>'));
var wbtab = me.getApplication().getController('WBProtection');
$panel.append(wbtab.createToolbarPanel());
me.toolbar.addTab(tab, $panel, 7);
me.toolbar.setVisible('protect', Common.UI.LayoutManager.isElementVisible('toolbar-protect'));
Array.prototype.push.apply(me.toolbar.lockControls, wbtab.getView('WBProtection').getButtons());
}
}
}
}
if ( !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
tab = {caption: me.toolbar.textTabView, action: 'view', extcls: config.isEdit ? 'canedit' : '', layoutname: 'toolbar-view', dataHintTitle: 'W'};
var tab = {caption: me.toolbar.textTabView, action: 'view', extcls: config.isEdit ? 'canedit' : '', layoutname: 'toolbar-view', dataHintTitle: 'W'};
var viewtab = me.getApplication().getController('ViewTab');
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
$panel = viewtab.createToolbarPanel();
var $panel = viewtab.createToolbarPanel();
if ($panel) {
me.toolbar.addTab(tab, $panel, 8);
me.toolbar.setVisible('view', Common.UI.LayoutManager.isElementVisible('toolbar-view'));

View File

@ -98,7 +98,7 @@ define([
setMode: function(mode) {
this.appConfig = mode;
this.appConfig.isEdit && (this.view = this.createView('WBProtection', {
this.appConfig.isEdit && this.appConfig.canProtect && (this.view = this.createView('WBProtection', {
mode: mode
}));

View File

@ -368,8 +368,8 @@ define([
this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
this.miPrintWithPreview[this.mode.canPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miProtect[this.mode.canProtect ?'show':'hide']();
separatorVisible = (this.mode.canDownload || this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') || this.mode.canPrint || this.mode.canProtect ||
this.miProtect[(this.mode.isSignatureSupport || this.mode.isPasswordSupport) ?'show':'hide']();
separatorVisible = (this.mode.canDownload || this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') || this.mode.canPrint || (this.mode.isSignatureSupport || this.mode.isPasswordSupport) ||
!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights || this.mode.canRename && !this.mode.isDesktopApp) && !this.mode.isDisconnected;
this.miProtect.$el.find('+.devider')[separatorVisible?'show':'hide']();
separatorVisible && (lastSeparator = this.miProtect.$el.find('+.devider'));
@ -429,7 +429,7 @@ define([
!this.panels['recent'] && (this.panels['recent'] = (new SSE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render());
}
if (this.mode.canProtect) {
if (this.mode.isSignatureSupport || this.mode.isPasswordSupport) {
!this.panels['protect'] && (this.panels['protect'] = (new SSE.Views.FileMenuPanels.ProtectDoc({menu:this})).render());
this.panels['protect'].setMode(this.mode);
}

View File

@ -745,7 +745,7 @@ define([
this.tabMenu.items[7].setDisabled(select.length>1);
this.tabMenu.items[8].setDisabled(issheetlocked || isdocprotected);
this.tabMenu.items[7].setVisible(!this.mode.isEditOle);
this.tabMenu.items[7].setVisible(!this.mode.isEditOle && this.mode.canProtect);
this.tabMenu.items[7].setCaption(this.api.asc_isProtectedSheet() ? this.itemUnProtect : this.itemProtect);
if (select.length === 1) {