diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js
index ba3621a292..a24c772da8 100644
--- a/apps/common/main/lib/component/Button.js
+++ b/apps/common/main/lib/component/Button.js
@@ -754,7 +754,7 @@ define([
return (this.cmpEl) ? this.cmpEl.is(":visible") : $(this.el).is(":visible");
},
- updateHint: function(hint) {
+ updateHint: function(hint, isHtml) {
this.options.hint = hint;
if (!this.rendered) return;
@@ -780,10 +780,12 @@ define([
this.btnMenuEl.removeData('bs.tooltip');
this.btnEl.tooltip({
+ html: !!isHtml,
title : (typeof hint == 'string') ? hint : hint[0],
placement : this.options.hintAnchor||'cursor'
});
this.btnMenuEl && this.btnMenuEl.tooltip({
+ html: !!isHtml,
title : hint[1],
placement : this.options.hintAnchor||'cursor'
});
diff --git a/apps/documenteditor/main/app/controller/DocProtection.js b/apps/documenteditor/main/app/controller/DocProtection.js
index 2ebff6d292..1910542ab0 100644
--- a/apps/documenteditor/main/app/controller/DocProtection.js
+++ b/apps/documenteditor/main/app/controller/DocProtection.js
@@ -185,7 +185,7 @@ define([
isProtected = (type === Asc.c_oAscEDocProtect.ReadOnly || type === Asc.c_oAscEDocProtect.Comments ||
type === Asc.c_oAscEDocProtect.TrackedChanges || type === Asc.c_oAscEDocProtect.Forms);
me.view.btnProtectDoc.toggle(!!isProtected, true);
- props && me.applyRestrictions(props[0]);
+ props && me.applyRestrictions(type);
});
},
@@ -241,6 +241,7 @@ define([
} else
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.None);
}
+ this.view && this.view.updateProtectionTips(type);
},
onLockDocumentProtection: function(state) {
diff --git a/apps/documenteditor/main/app/view/DocProtection.js b/apps/documenteditor/main/app/view/DocProtection.js
index 1963ab351a..275d9c40fa 100644
--- a/apps/documenteditor/main/app/view/DocProtection.js
+++ b/apps/documenteditor/main/app/view/DocProtection.js
@@ -72,7 +72,7 @@ define([
var _set = Common.enumLock;
this.lockedControls = [];
- this._state = {disabled: false};
+ this._state = {disabled: false, currentProtectHint: this.hintProtectDoc };
this.btnProtectDoc = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
@@ -98,7 +98,7 @@ define([
(new Promise(function (accept, reject) {
accept();
})).then(function(){
- me.btnProtectDoc.updateHint(me.hintProtectDoc);
+ me.btnProtectDoc.updateHint(me._state.currentProtectHint, true);
setEvents.call(me);
});
},
@@ -121,8 +121,25 @@ define([
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',
- txtDocUnlockTitle: 'Unprotect Document',
+ txtDocProtectedView: 'Document is protected.
You may only view this document.',
+ txtDocProtectedTrack: 'Document is protected.
You may edit this document, but all changes will be tracked.',
+ txtDocProtectedComment: 'Document is protected.
You may only insert comments to this document.',
+ txtDocProtectedForms: 'Document is protected.
You may only fill in forms in this document.',
hintProtectDoc: 'Protect document',
txtDocUnlockDescription: 'Enter a password to unprotect document'
}