[DE] Update hint in protected document
This commit is contained in:
parent
022c65cf3d
commit
0f2568e5b1
|
@ -754,7 +754,7 @@ define([
|
||||||
return (this.cmpEl) ? this.cmpEl.is(":visible") : $(this.el).is(":visible");
|
return (this.cmpEl) ? this.cmpEl.is(":visible") : $(this.el).is(":visible");
|
||||||
},
|
},
|
||||||
|
|
||||||
updateHint: function(hint) {
|
updateHint: function(hint, isHtml) {
|
||||||
this.options.hint = hint;
|
this.options.hint = hint;
|
||||||
|
|
||||||
if (!this.rendered) return;
|
if (!this.rendered) return;
|
||||||
|
@ -780,10 +780,12 @@ define([
|
||||||
this.btnMenuEl.removeData('bs.tooltip');
|
this.btnMenuEl.removeData('bs.tooltip');
|
||||||
|
|
||||||
this.btnEl.tooltip({
|
this.btnEl.tooltip({
|
||||||
|
html: !!isHtml,
|
||||||
title : (typeof hint == 'string') ? hint : hint[0],
|
title : (typeof hint == 'string') ? hint : hint[0],
|
||||||
placement : this.options.hintAnchor||'cursor'
|
placement : this.options.hintAnchor||'cursor'
|
||||||
});
|
});
|
||||||
this.btnMenuEl && this.btnMenuEl.tooltip({
|
this.btnMenuEl && this.btnMenuEl.tooltip({
|
||||||
|
html: !!isHtml,
|
||||||
title : hint[1],
|
title : hint[1],
|
||||||
placement : this.options.hintAnchor||'cursor'
|
placement : this.options.hintAnchor||'cursor'
|
||||||
});
|
});
|
||||||
|
|
|
@ -185,7 +185,7 @@ define([
|
||||||
isProtected = (type === Asc.c_oAscEDocProtect.ReadOnly || type === Asc.c_oAscEDocProtect.Comments ||
|
isProtected = (type === Asc.c_oAscEDocProtect.ReadOnly || type === Asc.c_oAscEDocProtect.Comments ||
|
||||||
type === Asc.c_oAscEDocProtect.TrackedChanges || type === Asc.c_oAscEDocProtect.Forms);
|
type === Asc.c_oAscEDocProtect.TrackedChanges || type === Asc.c_oAscEDocProtect.Forms);
|
||||||
me.view.btnProtectDoc.toggle(!!isProtected, true);
|
me.view.btnProtectDoc.toggle(!!isProtected, true);
|
||||||
props && me.applyRestrictions(props[0]);
|
props && me.applyRestrictions(type);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -241,6 +241,7 @@ define([
|
||||||
} else
|
} else
|
||||||
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.None);
|
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.None);
|
||||||
}
|
}
|
||||||
|
this.view && this.view.updateProtectionTips(type);
|
||||||
},
|
},
|
||||||
|
|
||||||
onLockDocumentProtection: function(state) {
|
onLockDocumentProtection: function(state) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ define([
|
||||||
|
|
||||||
var _set = Common.enumLock;
|
var _set = Common.enumLock;
|
||||||
this.lockedControls = [];
|
this.lockedControls = [];
|
||||||
this._state = {disabled: false};
|
this._state = {disabled: false, currentProtectHint: this.hintProtectDoc };
|
||||||
|
|
||||||
this.btnProtectDoc = new Common.UI.Button({
|
this.btnProtectDoc = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
@ -98,7 +98,7 @@ define([
|
||||||
(new Promise(function (accept, reject) {
|
(new Promise(function (accept, reject) {
|
||||||
accept();
|
accept();
|
||||||
})).then(function(){
|
})).then(function(){
|
||||||
me.btnProtectDoc.updateHint(me.hintProtectDoc);
|
me.btnProtectDoc.updateHint(me._state.currentProtectHint, true);
|
||||||
setEvents.call(me);
|
setEvents.call(me);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -121,8 +121,25 @@ define([
|
||||||
this.fireEvent('show', this);
|
this.fireEvent('show', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateProtectionTips: function(type) {
|
||||||
|
var str = this.txtProtectDoc;
|
||||||
|
if (type === Asc.c_oAscEDocProtect.ReadOnly) {
|
||||||
|
str = this.txtDocProtectedView;
|
||||||
|
} else if (type === Asc.c_oAscEDocProtect.Comments) {
|
||||||
|
str = this.txtDocProtectedComment;
|
||||||
|
} else if (type === Asc.c_oAscEDocProtect.Forms) {
|
||||||
|
str = this.txtDocProtectedForms;
|
||||||
|
} else if (type === Asc.c_oAscEDocProtect.TrackedChanges){ // none or tracked changes
|
||||||
|
str = this.txtDocProtectedTrack;
|
||||||
|
}
|
||||||
|
this.btnProtectDoc.updateHint(str, true);
|
||||||
|
this._state.currentProtectHint = str;
|
||||||
|
},
|
||||||
txtProtectDoc: 'Protect Document',
|
txtProtectDoc: 'Protect Document',
|
||||||
txtDocUnlockTitle: 'Unprotect Document',
|
txtDocProtectedView: 'Document is protected.<br>You may only view this document.',
|
||||||
|
txtDocProtectedTrack: 'Document is protected.<br>You may edit this document, but all changes will be tracked.',
|
||||||
|
txtDocProtectedComment: 'Document is protected.<br>You may only insert comments to this document.',
|
||||||
|
txtDocProtectedForms: 'Document is protected.<br>You may only fill in forms in this document.',
|
||||||
hintProtectDoc: 'Protect document',
|
hintProtectDoc: 'Protect document',
|
||||||
txtDocUnlockDescription: 'Enter a password to unprotect document'
|
txtDocUnlockDescription: 'Enter a password to unprotect document'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue