[PE] Signature refactoring (show tip when signature is signed).
This commit is contained in:
parent
ecafc6fcf2
commit
1ec82af44a
|
@ -206,14 +206,40 @@ define([
|
|||
},
|
||||
|
||||
onCoAuthoringDisconnect: function() {
|
||||
if (this.rightmenu)
|
||||
this.rightmenu.SetDisabled('', true, true);
|
||||
this.SetDisabled(true);
|
||||
this.setMode({isEdit: false});
|
||||
},
|
||||
|
||||
SetDisabled: function(disabled, allowSignature) {
|
||||
this.setMode({isEdit: !disabled});
|
||||
this.rightmenu.SetDisabled('', disabled, true, allowSignature);
|
||||
if (this.rightmenu) {
|
||||
this.rightmenu.slideSettings.SetSlideDisabled(disabled, disabled, disabled);
|
||||
this.rightmenu.paragraphSettings.disableControls(disabled);
|
||||
this.rightmenu.shapeSettings.disableControls(disabled);
|
||||
this.rightmenu.textartSettings.disableControls(disabled);
|
||||
this.rightmenu.tableSettings.disableControls(disabled);
|
||||
this.rightmenu.imageSettings.disableControls(disabled);
|
||||
this.rightmenu.chartSettings.disableControls(disabled);
|
||||
|
||||
if (!allowSignature && this.rightmenu.signatureSettings) {
|
||||
this.rightmenu.signatureSettings.disableControls(disabled);
|
||||
this.rightmenu.btnSignature.setDisabled(disabled);
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
this.rightmenu.btnSlide.setDisabled(disabled);
|
||||
this.rightmenu.btnText.setDisabled(disabled);
|
||||
this.rightmenu.btnTable.setDisabled(disabled);
|
||||
this.rightmenu.btnImage.setDisabled(disabled);
|
||||
this.rightmenu.btnShape.setDisabled(disabled);
|
||||
this.rightmenu.btnTextArt.setDisabled(disabled);
|
||||
this.rightmenu.btnChart.setDisabled(disabled);
|
||||
} else {
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
if (selectedElements.length > 0)
|
||||
this.onFocusObject(selectedElements);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onInsertTable: function() {
|
||||
|
|
|
@ -280,29 +280,6 @@ define([
|
|||
return (this.minimizedMode) ? null : this.$el.find(".settings-panel.active")[0].id;
|
||||
},
|
||||
|
||||
SetDisabled: function(id, disabled, all, allowSignature) {
|
||||
if (all) {
|
||||
this.slideSettings.SetSlideDisabled(disabled, disabled, disabled);
|
||||
this.paragraphSettings.disableControls(disabled);
|
||||
this.shapeSettings.disableControls(disabled);
|
||||
this.tableSettings.disableControls(disabled);
|
||||
this.imageSettings.disableControls(disabled);
|
||||
this.chartSettings.disableControls(disabled);
|
||||
|
||||
if (!allowSignature && this.signatureSettings) {
|
||||
this.signatureSettings.disableControls(disabled);
|
||||
this.btnSignature.setDisabled(disabled);
|
||||
}
|
||||
|
||||
} else {
|
||||
var cmp = $("#" + id);
|
||||
if (disabled !== cmp.hasClass('disabled')) {
|
||||
cmp.toggleClass('disabled', disabled);
|
||||
(disabled) ? cmp.attr({disabled: disabled}) : cmp.removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
clearSelection: function() {
|
||||
var target_pane = $(".right-panel");
|
||||
target_pane.find('> .active').removeClass('active');
|
||||
|
|
|
@ -69,7 +69,9 @@ define([
|
|||
DisabledControls: false,
|
||||
DisabledInsertControls: false,
|
||||
validSignatures: undefined,
|
||||
invalidSignatures: undefined
|
||||
invalidSignatures: undefined,
|
||||
DisabledEditing: false,
|
||||
ready: false
|
||||
};
|
||||
this._locked = false;
|
||||
this.lockedControls = [];
|
||||
|
@ -115,16 +117,15 @@ define([
|
|||
setApi: function(api) {
|
||||
this.api = api;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onUpdateSignatures, this));
|
||||
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
|
||||
}
|
||||
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
|
||||
return this;
|
||||
},
|
||||
|
||||
ChangeSettings: function(props) {
|
||||
if (!this._state.validSignatures || !this._state.invalidSignatures) {
|
||||
this.onUpdateSignatures(this.api.asc_getSignatures());
|
||||
}
|
||||
if (!this._state.validSignatures || !this._state.invalidSignatures)
|
||||
this.updateSignatures(this.api.asc_getSignatures());
|
||||
|
||||
this.disableControls(this._locked);
|
||||
},
|
||||
|
@ -154,7 +155,14 @@ define([
|
|||
this.mode = mode;
|
||||
},
|
||||
|
||||
onUpdateSignatures: function(valid){
|
||||
onApiUpdateSignatures: function(valid){
|
||||
if (!this._state.ready) return;
|
||||
|
||||
this.updateSignatures(valid);
|
||||
this.showSignatureTooltip(this._state.validSignatures.length>0 || this._state.invalidSignatures.length>0);
|
||||
},
|
||||
|
||||
updateSignatures: function(valid){
|
||||
var me = this;
|
||||
me._state.validSignatures = [];
|
||||
me._state.invalidSignatures = [];
|
||||
|
@ -174,6 +182,8 @@ define([
|
|||
var width = this.$linksView.width();
|
||||
$('.signature-sign-name', this.cntValidSign).css('max-width', 170-width);
|
||||
$('.signature-sign-name', this.cntInvalidSign).css('max-width', 170-width);
|
||||
|
||||
me.disableEditing(me._state.validSignatures.length>0 || me._state.invalidSignatures.length>0);
|
||||
},
|
||||
|
||||
addInvisibleSign: function(btn) {
|
||||
|
@ -201,36 +211,40 @@ define([
|
|||
},
|
||||
|
||||
onDocumentReady: function() {
|
||||
this.ChangeSettings();
|
||||
this._state.ready = true;
|
||||
|
||||
this.updateSignatures(this.api.asc_getSignatures());
|
||||
this.showSignatureTooltip(this._state.validSignatures.length>0 || this._state.invalidSignatures.length>0);
|
||||
},
|
||||
|
||||
showSignatureTooltip: function(hasSigned) {
|
||||
if (!hasSigned) return;
|
||||
|
||||
var me = this,
|
||||
hasSigned = (me._state.validSignatures.length>0 || me._state.invalidSignatures.length>0);
|
||||
|
||||
hasSigned && this.disableEditing(hasSigned);
|
||||
|
||||
if (!this._state.tip && hasSigned) {
|
||||
this._state.tip = new Common.UI.SynchronizeTip({
|
||||
tip = new Common.UI.SynchronizeTip({
|
||||
target : PE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
|
||||
text : this.txtSignedDocument,
|
||||
showLink: hasSigned,
|
||||
textLink: this.txtContinueEditing,
|
||||
placement: 'left'
|
||||
});
|
||||
this._state.tip.on({
|
||||
tip.on({
|
||||
'dontshowclick': function() {
|
||||
me._state.tip.hide();
|
||||
tip.close();
|
||||
// me.api.editSingedDoc();
|
||||
me.disableEditing(false);
|
||||
},
|
||||
'closeclick': function() {
|
||||
me._state.tip.hide();
|
||||
tip.close();
|
||||
}
|
||||
});
|
||||
this._state.tip.show();
|
||||
}
|
||||
tip.show();
|
||||
},
|
||||
|
||||
disableEditing: function(disable) {
|
||||
if (this._state.DisabledEditing != disable) {
|
||||
this._state.DisabledEditing = disable;
|
||||
|
||||
disable && PE.getController('RightMenu').getView('RightMenu').clearSelection();
|
||||
PE.getController('RightMenu').SetDisabled(disable, true);
|
||||
PE.getController('Toolbar').DisableToolbar(disable, disable);
|
||||
|
@ -245,6 +259,7 @@ define([
|
|||
comments.setPreviewMode(disable);
|
||||
|
||||
this.disableInsertControls(disable);
|
||||
}
|
||||
},
|
||||
|
||||
strSignature: 'Signature',
|
||||
|
|
Loading…
Reference in a new issue