[DE] Lock document info for protected document and for other preview modes (view form, final/original)
This commit is contained in:
parent
b9c5b2b014
commit
6f1d3f03a9
|
@ -824,7 +824,7 @@ define([
|
|||
rightMenu: {clear: disable, disable: true},
|
||||
statusBar: true,
|
||||
leftMenu: {disable: false, previewMode: true},
|
||||
fileMenu: {protect: true},
|
||||
fileMenu: {protect: true, info: true},
|
||||
navigation: {disable: false, previewMode: true},
|
||||
comments: {disable: false, previewMode: true},
|
||||
chat: false,
|
||||
|
|
|
@ -324,7 +324,7 @@ define([
|
|||
rightMenu: {clear: disable, disable: true},
|
||||
statusBar: true,
|
||||
leftMenu: {disable: false, previewMode: true},
|
||||
fileMenu: false,
|
||||
fileMenu: {info: true},
|
||||
navigation: {disable: false, previewMode: true},
|
||||
comments: {disable: false, previewMode: true},
|
||||
chat: false,
|
||||
|
|
|
@ -87,6 +87,9 @@ define([
|
|||
},
|
||||
|
||||
initialize: function () {
|
||||
this._state = {
|
||||
infoPreviewMode: false
|
||||
};
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
@ -363,6 +366,7 @@ define([
|
|||
'info' : (new DE.Views.FileMenuPanels.DocumentInfo({menu:this})).render(this.$el.find('#panel-info')),
|
||||
'rights' : (new DE.Views.FileMenuPanels.DocumentRights({menu:this})).render(this.$el.find('#panel-rights'))
|
||||
};
|
||||
this._state.infoPreviewMode && this.panels['info'].setPreviewMode(this._state.infoPreviewMode);
|
||||
}
|
||||
|
||||
if (!this.mode) return;
|
||||
|
@ -568,6 +572,7 @@ define([
|
|||
|
||||
options && options.protect && _btn_protect.setDisabled(disable);
|
||||
options && options.history && _btn_history.setDisabled(disable);
|
||||
options && options.info && (this.panels ? this.panels['info'].setPreviewMode(disable) : this._state.infoPreviewMode = disable );
|
||||
},
|
||||
|
||||
isVisible: function () {
|
||||
|
|
|
@ -1316,7 +1316,16 @@ define([
|
|||
this.menu = options.menu;
|
||||
this.coreProps = null;
|
||||
this.authors = [];
|
||||
this._locked = false;
|
||||
this._state = {
|
||||
_locked: false,
|
||||
docProtection: {
|
||||
isReadOnly: false,
|
||||
isReviewOnly: false,
|
||||
isFormsOnly: false,
|
||||
isCommentsOnly: false
|
||||
},
|
||||
disableEditing: false
|
||||
};
|
||||
},
|
||||
|
||||
render: function(node) {
|
||||
|
@ -1601,7 +1610,7 @@ define([
|
|||
me.authors.push(item);
|
||||
});
|
||||
this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit);
|
||||
!this.mode.isEdit && this._ShowHideInfoItem(this.tblAuthor, !!this.authors.length);
|
||||
this._ShowHideInfoItem(this.tblAuthor, this.mode.isEdit || !!this.authors.length);
|
||||
}
|
||||
this.SetDisabled();
|
||||
},
|
||||
|
@ -1729,6 +1738,8 @@ define([
|
|||
this.api.asc_registerCallback('asc_onGetDocInfoEnd', _.bind(this._onGetDocInfoEnd, this));
|
||||
// this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
|
||||
this.api.asc_registerCallback('asc_onLockCore', _.bind(this.onLockCore, this));
|
||||
Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
|
||||
this.onChangeProtectDocument();
|
||||
this.updateInfo(this.doc);
|
||||
return this;
|
||||
},
|
||||
|
@ -1738,17 +1749,19 @@ define([
|
|||
this.inputAuthor.setVisible(mode.isEdit);
|
||||
this.pnlApply.toggleClass('hidden', !mode.isEdit);
|
||||
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
|
||||
if (!mode.isEdit) {
|
||||
this.inputTitle._input.attr('placeholder', '');
|
||||
this.inputTags._input.attr('placeholder', '');
|
||||
this.inputSubject._input.attr('placeholder', '');
|
||||
this.inputComment._input.attr('placeholder', '');
|
||||
this.inputAuthor._input.attr('placeholder', '');
|
||||
}
|
||||
this.inputTitle._input.attr('placeholder', mode.isEdit ? this.txtAddText : '');
|
||||
this.inputTags._input.attr('placeholder', mode.isEdit ? this.txtAddText : '');
|
||||
this.inputSubject._input.attr('placeholder', mode.isEdit ? this.txtAddText : '');
|
||||
this.inputComment._input.attr('placeholder', mode.isEdit ? this.txtAddText : '');
|
||||
this.inputAuthor._input.attr('placeholder', mode.isEdit ? this.txtAddAuthor : '');
|
||||
this.SetDisabled();
|
||||
return this;
|
||||
},
|
||||
|
||||
setPreviewMode: function(mode) {
|
||||
this._state.disableEditing = mode;
|
||||
},
|
||||
|
||||
_onGetDocInfoStart: function() {
|
||||
var me = this;
|
||||
this.infoObj = {PageCount: 0, WordsCount: 0, ParagraphCount: 0, SymbolsCount: 0, SymbolsWSCount:0};
|
||||
|
@ -1804,20 +1817,31 @@ define([
|
|||
},
|
||||
|
||||
onLockCore: function(lock) {
|
||||
this._locked = lock;
|
||||
this._state._locked = lock;
|
||||
this.updateFileInfo();
|
||||
},
|
||||
|
||||
onChangeProtectDocument: function(props) {
|
||||
if (!props) {
|
||||
var docprotect = DE.getController('DocProtection');
|
||||
props = docprotect ? docprotect.getDocProps() : null;
|
||||
}
|
||||
if (props) {
|
||||
this._state.docProtection = props;
|
||||
}
|
||||
},
|
||||
|
||||
SetDisabled: function() {
|
||||
var disable = !this.mode.isEdit || this._locked;
|
||||
var isProtected = this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly;
|
||||
var disable = !this.mode.isEdit || this._state._locked || isProtected || this._state.disableEditing;
|
||||
this.inputTitle.setDisabled(disable);
|
||||
this.inputTags.setDisabled(disable);
|
||||
this.inputSubject.setDisabled(disable);
|
||||
this.inputComment.setDisabled(disable);
|
||||
this.inputAuthor.setDisabled(disable);
|
||||
this.tblAuthor.find('.close').toggleClass('disabled', this._locked);
|
||||
this.tblAuthor.find('.close').toggleClass('disabled', this._state._locked);
|
||||
this.tblAuthor.toggleClass('disabled', disable);
|
||||
this.btnApply.setDisabled(this._locked);
|
||||
this.btnApply.setDisabled(this._state._locked);
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
|
|
Loading…
Reference in a new issue