[DE] Disable protect settings when review mode is changed.

This commit is contained in:
Julia Radzhabova 2017-11-28 15:32:07 +03:00
parent 981ce99e64
commit ab99ce6adb
4 changed files with 21 additions and 56 deletions

View file

@ -534,6 +534,8 @@ define([
if (comments)
comments.setPreviewMode(disable);
leftMenu.getMenu('file').miProtect.setDisabled(disable);
if (this.view) {
this.view.$el.find('.no-group-mask').css('opacity', 1);
}

View file

@ -357,7 +357,6 @@ define([
this.rightmenu.chartSettings.disableControls(disabled);
if (!allowSignature && this.rightmenu.signatureSettings) {
this.rightmenu.signatureSettings.disableControls(disabled);
this.rightmenu.btnSignature.setDisabled(disabled);
}

View file

@ -126,6 +126,13 @@ define([
canFocused: false
});
this.miProtect = new Common.UI.MenuItem({
el : $('#fm-btn-protect',this.el),
action : 'protect',
caption : this.btnProtectCaption,
canFocused: false
});
this.miRecent = new Common.UI.MenuItem({
el : $('#fm-btn-recent',this.el),
action : 'recent',
@ -168,12 +175,7 @@ define([
this.miSaveAs,
this.miPrint,
this.miRename,
new Common.UI.MenuItem({
el : $('#fm-btn-protect',this.el),
action : 'protect',
caption : this.btnProtectCaption,
canFocused: false
}),
this.miProtect,
this.miRecent,
this.miNew,
new Common.UI.MenuItem({
@ -221,10 +223,11 @@ define([
show: function(panel, opts) {
if (this.isVisible() && panel===undefined) return;
var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info';
if (!panel)
panel = this.active || ((this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info');
panel = this.active || defPanel;
this.$el.show();
this.selectMenu(panel, opts);
this.selectMenu(panel, opts, defPanel);
this.api.asc_enableKeyEvents(false);
this.fireEvent('menu:show', [this]);
@ -240,8 +243,8 @@ define([
applyMode: function() {
this.miPrint[this.mode.canPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.items[7][(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide']();
this.items[7].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
this.miProtect[(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide']();
this.miProtect.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
this.miRecent[this.mode.canOpenRecent?'show':'hide']();
this.miNew[this.mode.canCreateNew?'show':'hide']();
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
@ -318,10 +321,14 @@ define([
this.document = data.doc;
},
selectMenu: function(menu, opts) {
selectMenu: function(menu, opts, defMenu) {
if ( menu ) {
var item = this._getMenuItem(menu),
var item = this._getMenuItem(menu),
panel = this.panels[menu];
if ( item.isDisabled() ) {
item = this._getMenuItem(defMenu);
panel = this.panels[defMenu];
}
if ( item && panel ) {
$('.fm-btn',this.el).removeClass('active');
item.$el.addClass('active');

View file

@ -67,8 +67,6 @@ define([
var me = this;
this._state = {
DisabledControls: false,
DisabledInsertControls: false,
requestedSignatures: undefined,
validSignatures: undefined,
invalidSignatures: undefined,
@ -76,37 +74,6 @@ define([
ready: false
};
this._locked = false;
this._noApply = false;
this._originalProps = null;
this.templateRequested = _.template([
'<td class="padding-large <% if (signatures.length<1) { %>hidden<% } %>">',
'<table class="<% if (signatures.length<1) { %>hidden<% } %>" style="width:100%">',
'<tr><td colspan="2" class="padding-large"><label class="header"><%= header %></label></td></tr>',
'<% _.each(signatures, function(item) { %>',
'<tr>',
'<td style="padding-bottom: 5px;"><label class="signature-sign-name"><%= Common.Utils.String.htmlEncode(item.name) %></label></td>',
'<td style="padding: 0 5px; vertical-align: top; text-align: right;"><label class="link-solid signature-sign-link" data-value="<%= item.guid %>">' + this.strSign + '</label></td>',
'</tr>',
'<% }); %>',
'</table>',
'</td>'
].join(''));
this.templateValid = _.template([
'<td class="padding-large <% if (signatures.length<1) { %>hidden<% } %>"">',
'<table class="<% if (signatures.length<1) { %>hidden<% } %>" style="width:100%">',
'<tr><td colspan="2" class="padding-large"><label class="header"><%= header %></label></td></tr>',
'<% _.each(signatures, function(item) { %>',
'<tr>',
'<td><div class="signature-sign-name"><%= Common.Utils.String.htmlEncode(item.name) %></div></td>',
'<td rowspan="2" style="padding: 0 5px; vertical-align: top; text-align: right;"><label class="link-solid signature-view-link" data-value="<%= item.guid %>">' + this.strView + '</label></td>',
'</tr>',
'<tr><td style="padding-bottom: 3px;"><label class="signature-sign-name"><%= Common.Utils.String.htmlEncode(item.date) %></label></td></tr>',
'<% }); %>',
'</table>',
'</td>'
].join(''));
this.render();
},
@ -186,22 +153,12 @@ define([
ChangeSettings: function(props) {
if (!this._state.requestedSignatures || !this._state.validSignatures || !this._state.invalidSignatures)
this.updateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
this.disableControls(this._locked);
},
setLocked: function (locked) {
this._locked = locked;
},
disableControls: function(disable) {
if (this._state.DisabledControls!==disable) {
this._state.DisabledControls = disable;
this.$linksSign && this.$linksSign.toggleClass('disabled', disable);
this.$linksView && this.$linksView.toggleClass('disabled', disable);
}
},
setMode: function(mode) {
this.mode = mode;
},