Merge pull request #2145 from ONLYOFFICE/fix/sign-protect
Fix/sign protect
This commit is contained in:
commit
1b942cf47f
|
@ -56,7 +56,8 @@ define([
|
||||||
maxlength : undefined,
|
maxlength : undefined,
|
||||||
placeHolder : '',
|
placeHolder : '',
|
||||||
spellcheck : false,
|
spellcheck : false,
|
||||||
disabled: false
|
disabled: false,
|
||||||
|
resize: false
|
||||||
},
|
},
|
||||||
|
|
||||||
template: _.template([
|
template: _.template([
|
||||||
|
@ -133,6 +134,7 @@ define([
|
||||||
this._input.on('blur', _.bind(this.onInputChanged, this));
|
this._input.on('blur', _.bind(this.onInputChanged, this));
|
||||||
this._input.on('keydown', _.bind(this.onKeyDown, this));
|
this._input.on('keydown', _.bind(this.onKeyDown, this));
|
||||||
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
|
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
|
||||||
|
if (!this.resize) this._input.css('resize', 'none');
|
||||||
|
|
||||||
if (this.disabled)
|
if (this.disabled)
|
||||||
this.setDisabled(this.disabled);
|
this.setDisabled(this.disabled);
|
||||||
|
@ -140,6 +142,9 @@ define([
|
||||||
|
|
||||||
me.rendered = true;
|
me.rendered = true;
|
||||||
|
|
||||||
|
if (me.value)
|
||||||
|
me.setValue(me.value);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,23 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onAppReady: function (config) {
|
onAppReady: function (config) {
|
||||||
|
var me = this;
|
||||||
|
(new Promise(function (accept, reject) {
|
||||||
|
accept();
|
||||||
|
})).then(function(){
|
||||||
|
me.onChangeProtectDocument();
|
||||||
|
Common.NotificationCenter.on('protect:doclock', _.bind(me.onChangeProtectDocument, me));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onChangeProtectDocument: function(props) {
|
||||||
|
if (!props) {
|
||||||
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
|
}
|
||||||
|
if (props && this.view) {
|
||||||
|
this.view._state.docProtection = props;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addPassword: function() {
|
addPassword: function() {
|
||||||
|
|
|
@ -87,10 +87,17 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (me.appConfig.isSignatureSupport) {
|
if (me.appConfig.isSignatureSupport) {
|
||||||
if (this.btnSignature.menu)
|
if (this.btnSignature.menu) {
|
||||||
this.btnSignature.menu.on('item:click', function (menu, item, e) {
|
this.btnSignature.menu.on('item:click', function (menu, item, e) {
|
||||||
me.fireEvent('protect:signature', [item.value, false]);
|
me.fireEvent('protect:signature', [item.value, false]);
|
||||||
});
|
});
|
||||||
|
this.btnSignature.menu.on('show:after', function (menu, e) {
|
||||||
|
if (me._state) {
|
||||||
|
var isProtected = me._state.docProtection ? me._state.docProtection.isReadOnly || me._state.docProtection.isFormsOnly || me._state.docProtection.isCommentsOnly : false;
|
||||||
|
menu.items && menu.items[1].setDisabled(isProtected || me._state.disabled);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.btnsInvisibleSignature.forEach(function(button) {
|
this.btnsInvisibleSignature.forEach(function(button) {
|
||||||
button.on('click', function (b, e) {
|
button.on('click', function (b, e) {
|
||||||
|
@ -314,13 +321,14 @@ define([
|
||||||
SetDisabled: function (state, canProtect) {
|
SetDisabled: function (state, canProtect) {
|
||||||
this._state.disabled = state;
|
this._state.disabled = state;
|
||||||
this._state.invisibleSignDisabled = state && !canProtect;
|
this._state.invisibleSignDisabled = state && !canProtect;
|
||||||
|
var isProtected = this._state.docProtection ? this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly : false;
|
||||||
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
|
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
|
||||||
if ( button ) {
|
if ( button ) {
|
||||||
button.setDisabled(state && !canProtect);
|
button.setDisabled(state && !canProtect);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
if (this.btnSignature && this.btnSignature.menu) {
|
if (this.btnSignature && this.btnSignature.menu) {
|
||||||
this.btnSignature.menu.items && this.btnSignature.menu.items[1].setDisabled(state); // disable adding signature line
|
this.btnSignature.menu.items && this.btnSignature.menu.items[1].setDisabled(state || isProtected); // disable adding signature line
|
||||||
this.btnSignature.setDisabled(state && !canProtect); // disable adding any signature
|
this.btnSignature.setDisabled(state && !canProtect); // disable adding any signature
|
||||||
}
|
}
|
||||||
this.btnsAddPwd.concat(this.btnsDelPwd, this.btnsChangePwd).forEach(function(button) {
|
this.btnsAddPwd.concat(this.btnsDelPwd, this.btnsChangePwd).forEach(function(button) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ define([
|
||||||
'<div class="input-row">',
|
'<div class="input-row">',
|
||||||
'<label>' + this.textInstructions + '</label>',
|
'<label>' + this.textInstructions + '</label>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<textarea id="id-dlg-sign-settings-instructions" class="form-control" style="width: 100%;height: 35px;margin-bottom: 10px;resize: none;"></textarea>',
|
'<div id="id-dlg-sign-settings-instructions">',
|
||||||
'<div id="id-dlg-sign-settings-date"></div>',
|
'<div id="id-dlg-sign-settings-date"></div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<div class="footer center">',
|
'<div class="footer center">',
|
||||||
|
@ -121,15 +121,12 @@ define([
|
||||||
disabled : this.type=='view'
|
disabled : this.type=='view'
|
||||||
});
|
});
|
||||||
|
|
||||||
me.textareaInstructions = this.$window.find('textarea');
|
me.textareaInstructions = new Common.UI.TextareaField({
|
||||||
me.textareaInstructions.val(this.textDefInstruction);
|
el : $window.find('#id-dlg-sign-settings-instructions'),
|
||||||
me.textareaInstructions.keydown(function (event) {
|
style : 'width: 100%; height: 35px;margin-bottom: 10px;',
|
||||||
if (event.keyCode == Common.UI.Keys.RETURN) {
|
value : this.textDefInstruction,
|
||||||
event.stopPropagation();
|
disabled : this.type=='view'
|
||||||
}
|
|
||||||
});
|
});
|
||||||
(this.type=='view') ? this.textareaInstructions.attr('disabled', 'disabled') : this.textareaInstructions.removeAttr('disabled');
|
|
||||||
this.textareaInstructions.toggleClass('disabled', this.type=='view');
|
|
||||||
|
|
||||||
this.chDate = new Common.UI.CheckBox({
|
this.chDate = new Common.UI.CheckBox({
|
||||||
el: $('#id-dlg-sign-settings-date'),
|
el: $('#id-dlg-sign-settings-date'),
|
||||||
|
@ -160,7 +157,7 @@ define([
|
||||||
value = props.asc_getEmail();
|
value = props.asc_getEmail();
|
||||||
me.inputEmail.setValue(value ? value : '');
|
me.inputEmail.setValue(value ? value : '');
|
||||||
value = props.asc_getInstructions();
|
value = props.asc_getInstructions();
|
||||||
me.textareaInstructions.val(value ? value : '');
|
me.textareaInstructions.setValue(value ? value : '');
|
||||||
me.chDate.setValue(props.asc_getShowDate());
|
me.chDate.setValue(props.asc_getShowDate());
|
||||||
|
|
||||||
me._currentGuid = props.asc_getGuid();
|
me._currentGuid = props.asc_getGuid();
|
||||||
|
@ -174,7 +171,7 @@ define([
|
||||||
props.asc_setSigner1(me.inputName.getValue());
|
props.asc_setSigner1(me.inputName.getValue());
|
||||||
props.asc_setSigner2(me.inputTitle.getValue());
|
props.asc_setSigner2(me.inputTitle.getValue());
|
||||||
props.asc_setEmail(me.inputEmail.getValue());
|
props.asc_setEmail(me.inputEmail.getValue());
|
||||||
props.asc_setInstructions(me.textareaInstructions.val());
|
props.asc_setInstructions(me.textareaInstructions.getValue());
|
||||||
props.asc_setShowDate(me.chDate.getValue()=='checked');
|
props.asc_setShowDate(me.chDate.getValue()=='checked');
|
||||||
(me._currentGuid!==undefined) && props.asc_setGuid(me._currentGuid);
|
(me._currentGuid!==undefined) && props.asc_setGuid(me._currentGuid);
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ define([
|
||||||
if (!this._settings[Common.Utils.documentSettingsType.MailMerge].locked) // lock MailMerge-InsertField, если хотя бы один объект locked
|
if (!this._settings[Common.Utils.documentSettingsType.MailMerge].locked) // lock MailMerge-InsertField, если хотя бы один объект locked
|
||||||
this._settings[Common.Utils.documentSettingsType.MailMerge].locked = value.get_Locked() || isProtected;
|
this._settings[Common.Utils.documentSettingsType.MailMerge].locked = value.get_Locked() || isProtected;
|
||||||
if (!this._settings[Common.Utils.documentSettingsType.Signature].locked) // lock Signature, если хотя бы один объект locked
|
if (!this._settings[Common.Utils.documentSettingsType.Signature].locked) // lock Signature, если хотя бы один объект locked
|
||||||
this._settings[Common.Utils.documentSettingsType.Signature].locked = value.get_Locked() || isProtected;
|
this._settings[Common.Utils.documentSettingsType.Signature].locked = value.get_Locked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (control_props && control_props.get_FormPr() && this.rightmenu.formSettings) {
|
if (control_props && control_props.get_FormPr() && this.rightmenu.formSettings) {
|
||||||
|
@ -265,6 +265,9 @@ define([
|
||||||
if (!this._settings[Common.Utils.documentSettingsType.MailMerge].hidden)
|
if (!this._settings[Common.Utils.documentSettingsType.MailMerge].hidden)
|
||||||
this._settings[Common.Utils.documentSettingsType.MailMerge].panel.setLocked(this._settings[Common.Utils.documentSettingsType.MailMerge].locked);
|
this._settings[Common.Utils.documentSettingsType.MailMerge].panel.setLocked(this._settings[Common.Utils.documentSettingsType.MailMerge].locked);
|
||||||
|
|
||||||
|
if (!this._settings[Common.Utils.documentSettingsType.Signature].hidden)
|
||||||
|
this._settings[Common.Utils.documentSettingsType.Signature].panel.setProtected(isProtected);
|
||||||
|
|
||||||
if (!this.rightmenu.minimizedMode || open) {
|
if (!this.rightmenu.minimizedMode || open) {
|
||||||
var active;
|
var active;
|
||||||
|
|
||||||
|
@ -428,6 +431,7 @@ define([
|
||||||
this._settings[type].hidden = disabled ? 1 : 0;
|
this._settings[type].hidden = disabled ? 1 : 0;
|
||||||
this._settings[type].btn.setDisabled(disabled);
|
this._settings[type].btn.setDisabled(disabled);
|
||||||
this._settings[type].panel.setLocked(this._settings[type].locked);
|
this._settings[type].panel.setLocked(this._settings[type].locked);
|
||||||
|
this._settings[type].panel.setProtected(this._state.docProtection ? this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly : false);
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disabled, allowMerge, allowSignature) {
|
SetDisabled: function(disabled, allowMerge, allowSignature) {
|
||||||
|
|
|
@ -2931,7 +2931,7 @@ define([
|
||||||
|
|
||||||
SetDisabled: function(state, canProtect, fillFormMode) {
|
SetDisabled: function(state, canProtect, fillFormMode) {
|
||||||
this._isDisabled = state;
|
this._isDisabled = state;
|
||||||
this._canProtect = canProtect;
|
this._canProtect = state ? canProtect : true;
|
||||||
this._fillFormMode = state ? fillFormMode : false;
|
this._fillFormMode = state ? fillFormMode : false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ define([
|
||||||
tip: undefined
|
tip: undefined
|
||||||
};
|
};
|
||||||
this._locked = false;
|
this._locked = false;
|
||||||
|
this._protected = false;
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
|
@ -156,6 +157,10 @@ define([
|
||||||
this._locked = locked;
|
this._locked = locked;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setProtected: function (value) {
|
||||||
|
this._protected = value;
|
||||||
|
},
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
},
|
},
|
||||||
|
@ -288,7 +293,7 @@ define([
|
||||||
menu.items[3].setVisible(!requested);
|
menu.items[3].setVisible(!requested);
|
||||||
|
|
||||||
menu.items[0].setDisabled(this._locked);
|
menu.items[0].setDisabled(this._locked);
|
||||||
menu.items[3].setDisabled(this._locked);
|
menu.items[3].setDisabled(this._locked || this._protected);
|
||||||
|
|
||||||
menu.items[1].cmpEl.attr('data-value', record.get('certificateId')); // view certificate
|
menu.items[1].cmpEl.attr('data-value', record.get('certificateId')); // view certificate
|
||||||
menu.items[2].cmpEl.attr('data-value', signed ? 1 : 0); // view or edit signature settings
|
menu.items[2].cmpEl.attr('data-value', signed ? 1 : 0); // view or edit signature settings
|
||||||
|
@ -307,7 +312,7 @@ define([
|
||||||
this.api.asc_ViewCertificate(item.cmpEl.attr('data-value'));
|
this.api.asc_ViewCertificate(item.cmpEl.attr('data-value'));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Common.NotificationCenter.trigger('protect:signature', 'visible', !!parseInt(item.cmpEl.attr('data-value')), guid);// can edit settings for requested signature
|
Common.NotificationCenter.trigger('protect:signature', 'visible', !!parseInt(item.cmpEl.attr('data-value')) || this._protected, guid);// can edit settings for requested signature
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
|
@ -94,13 +94,14 @@
|
||||||
right: 14px;
|
right: 14px;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
border: solid 1px @icon-normal-pressed-ie;
|
border: solid 1px @icon-normal-ie;
|
||||||
border: solid 1px @icon-normal-pressed;
|
border: solid 1px @icon-normal;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
transform: rotate(-135deg);
|
transform: rotate(-135deg);
|
||||||
|
filter: none;
|
||||||
|
|
||||||
&.nomargin {
|
&.nomargin {
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
|
|
|
@ -87,13 +87,14 @@
|
||||||
right: 14px;
|
right: 14px;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
border: solid 1px @icon-normal-pressed-ie;
|
border: solid 1px @icon-normal-ie;
|
||||||
border: solid 1px @icon-normal-pressed;
|
border: solid 1px @icon-normal;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
transform: rotate(-135deg);
|
transform: rotate(-135deg);
|
||||||
|
filter: none;
|
||||||
|
|
||||||
&.nomargin {
|
&.nomargin {
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
|
|
|
@ -4433,7 +4433,7 @@ define([
|
||||||
|
|
||||||
SetDisabled: function(state, canProtect) {
|
SetDisabled: function(state, canProtect) {
|
||||||
this._isDisabled = state;
|
this._isDisabled = state;
|
||||||
this._canProtect = canProtect;
|
this._canProtect = state ? canProtect : true;
|
||||||
this.disableEquationBar();
|
this.disableEquationBar();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -159,13 +159,14 @@
|
||||||
right: 14px;
|
right: 14px;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
border: solid 1px @icon-normal-pressed-ie;
|
border: solid 1px @icon-normal-ie;
|
||||||
border: solid 1px @icon-normal-pressed;
|
border: solid 1px @icon-normal;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
transform: rotate(-135deg);
|
transform: rotate(-135deg);
|
||||||
|
filter: none;
|
||||||
|
|
||||||
&.nomargin {
|
&.nomargin {
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
|
|
Loading…
Reference in a new issue