[PE] Signature refactoring (show tip when signature is signed).
This commit is contained in:
parent
539c66ed47
commit
21fe777282
|
@ -206,14 +206,40 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onCoAuthoringDisconnect: function() {
|
onCoAuthoringDisconnect: function() {
|
||||||
if (this.rightmenu)
|
this.SetDisabled(true);
|
||||||
this.rightmenu.SetDisabled('', true, true);
|
|
||||||
this.setMode({isEdit: false});
|
this.setMode({isEdit: false});
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disabled, allowSignature) {
|
SetDisabled: function(disabled, allowSignature) {
|
||||||
this.setMode({isEdit: !disabled});
|
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() {
|
onInsertTable: function() {
|
||||||
|
|
|
@ -280,29 +280,6 @@ define([
|
||||||
return (this.minimizedMode) ? null : this.$el.find(".settings-panel.active")[0].id;
|
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() {
|
clearSelection: function() {
|
||||||
var target_pane = $(".right-panel");
|
var target_pane = $(".right-panel");
|
||||||
target_pane.find('> .active').removeClass('active');
|
target_pane.find('> .active').removeClass('active');
|
||||||
|
|
|
@ -69,7 +69,9 @@ define([
|
||||||
DisabledControls: false,
|
DisabledControls: false,
|
||||||
DisabledInsertControls: false,
|
DisabledInsertControls: false,
|
||||||
validSignatures: undefined,
|
validSignatures: undefined,
|
||||||
invalidSignatures: undefined
|
invalidSignatures: undefined,
|
||||||
|
DisabledEditing: false,
|
||||||
|
ready: false
|
||||||
};
|
};
|
||||||
this._locked = false;
|
this._locked = false;
|
||||||
this.lockedControls = [];
|
this.lockedControls = [];
|
||||||
|
@ -115,16 +117,15 @@ define([
|
||||||
setApi: function(api) {
|
setApi: function(api) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
if (this.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));
|
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
ChangeSettings: function(props) {
|
ChangeSettings: function(props) {
|
||||||
if (!this._state.validSignatures || !this._state.invalidSignatures) {
|
if (!this._state.validSignatures || !this._state.invalidSignatures)
|
||||||
this.onUpdateSignatures(this.api.asc_getSignatures());
|
this.updateSignatures(this.api.asc_getSignatures());
|
||||||
}
|
|
||||||
|
|
||||||
this.disableControls(this._locked);
|
this.disableControls(this._locked);
|
||||||
},
|
},
|
||||||
|
@ -154,7 +155,14 @@ define([
|
||||||
this.mode = mode;
|
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;
|
var me = this;
|
||||||
me._state.validSignatures = [];
|
me._state.validSignatures = [];
|
||||||
me._state.invalidSignatures = [];
|
me._state.invalidSignatures = [];
|
||||||
|
@ -174,6 +182,8 @@ define([
|
||||||
var width = this.$linksView.width();
|
var width = this.$linksView.width();
|
||||||
$('.signature-sign-name', this.cntValidSign).css('max-width', 170-width);
|
$('.signature-sign-name', this.cntValidSign).css('max-width', 170-width);
|
||||||
$('.signature-sign-name', this.cntInvalidSign).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) {
|
addInvisibleSign: function(btn) {
|
||||||
|
@ -201,50 +211,55 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDocumentReady: function() {
|
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,
|
var me = this,
|
||||||
hasSigned = (me._state.validSignatures.length>0 || me._state.invalidSignatures.length>0);
|
tip = new Common.UI.SynchronizeTip({
|
||||||
|
|
||||||
hasSigned && this.disableEditing(hasSigned);
|
|
||||||
|
|
||||||
if (!this._state.tip && hasSigned) {
|
|
||||||
this._state.tip = new Common.UI.SynchronizeTip({
|
|
||||||
target : PE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
|
target : PE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
|
||||||
text : this.txtSignedDocument,
|
text : this.txtSignedDocument,
|
||||||
showLink: hasSigned,
|
showLink: hasSigned,
|
||||||
textLink: this.txtContinueEditing,
|
textLink: this.txtContinueEditing,
|
||||||
placement: 'left'
|
placement: 'left'
|
||||||
});
|
});
|
||||||
this._state.tip.on({
|
tip.on({
|
||||||
'dontshowclick': function() {
|
'dontshowclick': function() {
|
||||||
me._state.tip.hide();
|
tip.close();
|
||||||
// me.api.editSingedDoc();
|
// me.api.editSingedDoc();
|
||||||
me.disableEditing(false);
|
me.disableEditing(false);
|
||||||
},
|
},
|
||||||
'closeclick': function() {
|
'closeclick': function() {
|
||||||
me._state.tip.hide();
|
tip.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this._state.tip.show();
|
tip.show();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disable) {
|
disableEditing: function(disable) {
|
||||||
disable && PE.getController('RightMenu').getView('RightMenu').clearSelection();
|
if (this._state.DisabledEditing != disable) {
|
||||||
PE.getController('RightMenu').SetDisabled(disable, true);
|
this._state.DisabledEditing = disable;
|
||||||
PE.getController('Toolbar').DisableToolbar(disable, disable);
|
|
||||||
PE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
|
||||||
PE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
|
||||||
PE.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
|
|
||||||
|
|
||||||
var leftMenu = PE.getController('LeftMenu').leftMenu;
|
disable && PE.getController('RightMenu').getView('RightMenu').clearSelection();
|
||||||
leftMenu.btnComments.setDisabled(disable);
|
PE.getController('RightMenu').SetDisabled(disable, true);
|
||||||
var comments = PE.getController('Common.Controllers.Comments');
|
PE.getController('Toolbar').DisableToolbar(disable, disable);
|
||||||
if (comments)
|
PE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
||||||
comments.setPreviewMode(disable);
|
PE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||||
|
PE.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
|
||||||
|
|
||||||
this.disableInsertControls(disable);
|
var leftMenu = PE.getController('LeftMenu').leftMenu;
|
||||||
|
leftMenu.btnComments.setDisabled(disable);
|
||||||
|
var comments = PE.getController('Common.Controllers.Comments');
|
||||||
|
if (comments)
|
||||||
|
comments.setPreviewMode(disable);
|
||||||
|
|
||||||
|
this.disableInsertControls(disable);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
strSignature: 'Signature',
|
strSignature: 'Signature',
|
||||||
|
|
Loading…
Reference in a new issue