[DE] Refactoring document protection
This commit is contained in:
parent
9adcc64e9b
commit
6f1ee48c6d
|
@ -145,13 +145,18 @@ define([
|
||||||
}, this, area);
|
}, this, area);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||||
Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
|
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
var filter = Common.localStorage.getKeysFilter();
|
var filter = Common.localStorage.getKeysFilter();
|
||||||
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
||||||
this._state = {
|
this._state = {
|
||||||
disableEditing: false // disable editing when disconnect/signed file/mail merge preview/review final or original/forms preview
|
disableEditing: false, // disable editing when disconnect/signed file/mail merge preview/review final or original/forms preview
|
||||||
|
docProtection: {
|
||||||
|
isReadOnly: false,
|
||||||
|
isReviewOnly: false,
|
||||||
|
isFormsOnly: false,
|
||||||
|
isCommentsOnly: false
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.collection = this.getApplication().getCollection('Common.Collections.Comments');
|
this.collection = this.getApplication().getCollection('Common.Collections.Comments');
|
||||||
|
@ -1655,8 +1660,8 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePreviewMode: function() {
|
updatePreviewMode: function() {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var docProtection = this._state.docProtection;
|
||||||
var viewmode = this._state.disableEditing || !!docProtection.isReadOnly || !!docProtection.isFormsOnly;
|
var viewmode = this._state.disableEditing || docProtection.isReadOnly || docProtection.isFormsOnly;
|
||||||
|
|
||||||
if (this.viewmode === viewmode) return;
|
if (this.viewmode === viewmode) return;
|
||||||
this.viewmode = viewmode;
|
this.viewmode = viewmode;
|
||||||
|
@ -1740,17 +1745,19 @@ define([
|
||||||
accept();
|
accept();
|
||||||
})).then(function(){
|
})).then(function(){
|
||||||
me.onChangeProtectDocument();
|
me.onChangeProtectDocument();
|
||||||
|
Common.NotificationCenter.on('protect:doclock', _.bind(me.onChangeProtectDocument, me));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectDocument: function() {
|
onChangeProtectDocument: function(props) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection');
|
if (!props) {
|
||||||
if (!docProtection) {
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
var cntrl = this.getApplication().getController('DocProtection');
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
docProtection = cntrl ? cntrl.getDocProps() : null;
|
|
||||||
}
|
}
|
||||||
if (docProtection)
|
if (props) {
|
||||||
|
this._state.docProtection = props;
|
||||||
this.updatePreviewMode();
|
this.updatePreviewMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, Common.Controllers.Comments || {}));
|
}, Common.Controllers.Comments || {}));
|
||||||
|
|
|
@ -82,7 +82,8 @@ define([
|
||||||
'reviewchange:view': _.bind(this.onReviewViewClick, this),
|
'reviewchange:view': _.bind(this.onReviewViewClick, this),
|
||||||
'reviewchange:compare': _.bind(this.onCompareClick, this),
|
'reviewchange:compare': _.bind(this.onCompareClick, this),
|
||||||
'lang:document': _.bind(this.onDocLanguage, this),
|
'lang:document': _.bind(this.onDocLanguage, this),
|
||||||
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
|
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this),
|
||||||
|
'protect:update': _.bind(this.onChangeProtectDocument, this)
|
||||||
},
|
},
|
||||||
'Common.Views.ReviewChangesDialog': {
|
'Common.Views.ReviewChangesDialog': {
|
||||||
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
||||||
|
@ -103,7 +104,13 @@ define([
|
||||||
this.viewmode = false;
|
this.viewmode = false;
|
||||||
|
|
||||||
this._state = { posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null, wsLock: false, wsProps: [],
|
this._state = { posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null, wsLock: false, wsProps: [],
|
||||||
disableEditing: false // disable editing when disconnect/signed file/mail merge preview/review final or original/forms preview
|
disableEditing: false, // disable editing when disconnect/signed file/mail merge preview/review final or original/forms preview
|
||||||
|
docProtection: {
|
||||||
|
isReadOnly: false,
|
||||||
|
isReviewOnly: false,
|
||||||
|
isFormsOnly: false,
|
||||||
|
isCommentsOnly: false
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
|
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
|
||||||
|
@ -113,7 +120,6 @@ define([
|
||||||
Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this));
|
Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this));
|
||||||
Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this));
|
Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this));
|
||||||
Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this));
|
Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this));
|
||||||
Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
|
|
||||||
|
|
||||||
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
|
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
|
||||||
this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
|
this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
|
||||||
|
@ -189,8 +195,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePreviewMode: function() {
|
updatePreviewMode: function() {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var viewmode = this._state.disableEditing || this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly;
|
||||||
var viewmode = this._state.disableEditing || !!docProtection.isReadOnly || !!docProtection.isFormsOnly || !!docProtection.isCommentsOnly;
|
|
||||||
|
|
||||||
if (this.viewmode === viewmode) return;
|
if (this.viewmode === viewmode) return;
|
||||||
this.viewmode = viewmode;
|
this.viewmode = viewmode;
|
||||||
|
@ -220,7 +225,7 @@ define([
|
||||||
onApiShowChange: function (sdkchange, isShow) {
|
onApiShowChange: function (sdkchange, isShow) {
|
||||||
var btnlock = true,
|
var btnlock = true,
|
||||||
changes;
|
changes;
|
||||||
if (this.appConfig.canReview && !(this.appConfig.isReviewOnly || Common.Utils.Store.get('docProtection', {}).isReviewOnly)) {
|
if (this.appConfig.canReview && !(this.appConfig.isReviewOnly || this._state.docProtection.isReviewOnly)) {
|
||||||
if (sdkchange && sdkchange.length>0) {
|
if (sdkchange && sdkchange.length>0) {
|
||||||
changes = this.readSDKChange(sdkchange);
|
changes = this.readSDKChange(sdkchange);
|
||||||
btnlock = this.isSelectedChangesLocked(changes, isShow);
|
btnlock = this.isSelectedChangesLocked(changes, isShow);
|
||||||
|
@ -495,7 +500,7 @@ define([
|
||||||
}
|
}
|
||||||
var date = (item.get_DateTime() == '') ? new Date() : new Date(item.get_DateTime()),
|
var date = (item.get_DateTime() == '') ? new Date() : new Date(item.get_DateTime()),
|
||||||
user = me.userCollection.findOriginalUser(item.get_UserId()),
|
user = me.userCollection.findOriginalUser(item.get_UserId()),
|
||||||
isProtectedReview = !!Common.Utils.Store.get('docProtection', {}).isReviewOnly,
|
isProtectedReview = me._state.docProtection.isReviewOnly,
|
||||||
change = new Common.Models.ReviewChange({
|
change = new Common.Models.ReviewChange({
|
||||||
uid : Common.UI.getId(),
|
uid : Common.UI.getId(),
|
||||||
userid : item.get_UserId(),
|
userid : item.get_UserId(),
|
||||||
|
@ -510,6 +515,7 @@ define([
|
||||||
changedata : item,
|
changedata : item,
|
||||||
scope : me.view,
|
scope : me.view,
|
||||||
hint : !me.appConfig.canReview,
|
hint : !me.appConfig.canReview,
|
||||||
|
docProtection: me._state.docProtection,
|
||||||
goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom),
|
goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom),
|
||||||
editable : (me.appConfig.isReviewOnly || isProtectedReview) && (item.get_UserId() == me.currentUserId) || !(me.appConfig.isReviewOnly || isProtectedReview) && (!me.appConfig.canUseReviewPermissions || AscCommon.UserInfoParser.canEditReview(item.get_UserName()))
|
editable : (me.appConfig.isReviewOnly || isProtectedReview) && (item.get_UserId() == me.currentUserId) || !(me.appConfig.isReviewOnly || isProtectedReview) && (!me.appConfig.canUseReviewPermissions || AscCommon.UserInfoParser.canEditReview(item.get_UserName()))
|
||||||
});
|
});
|
||||||
|
@ -614,7 +620,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiTrackRevisionsChange: function(localFlag, globalFlag, userId) {
|
onApiTrackRevisionsChange: function(localFlag, globalFlag, userId) {
|
||||||
if ( this.appConfig.isReviewOnly || Common.Utils.Store.get('docProtection', {}).isReviewOnly) {
|
if ( this.appConfig.isReviewOnly || this._state.docProtection.isReviewOnly) {
|
||||||
this.view.turnChanges(true);
|
this.view.turnChanges(true);
|
||||||
} else
|
} else
|
||||||
if ( this.appConfig.canReview ) {
|
if ( this.appConfig.canReview ) {
|
||||||
|
@ -873,7 +879,8 @@ define([
|
||||||
(!me.appConfig.customization.review || me.appConfig.customization.review.showReviewChanges===undefined) && me.appConfig.customization.showReviewChanges==true) ) {
|
(!me.appConfig.customization.review || me.appConfig.customization.review.showReviewChanges===undefined) && me.appConfig.customization.showReviewChanges==true) ) {
|
||||||
me.dlgChanges = (new Common.Views.ReviewChangesDialog({
|
me.dlgChanges = (new Common.Views.ReviewChangesDialog({
|
||||||
popoverChanges : me.popoverChanges,
|
popoverChanges : me.popoverChanges,
|
||||||
mode : me.appConfig
|
mode : me.appConfig,
|
||||||
|
docProtection : me._state.docProtection
|
||||||
}));
|
}));
|
||||||
var sdk = $('#editor_sdk'),
|
var sdk = $('#editor_sdk'),
|
||||||
offset = sdk.offset();
|
offset = sdk.offset();
|
||||||
|
@ -900,7 +907,6 @@ define([
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
me.onChangeProtectSheet();
|
me.onChangeProtectSheet();
|
||||||
me.onChangeProtectDocument();
|
|
||||||
if (me.view) {
|
if (me.view) {
|
||||||
me.lockToolbar(Common.enumLock.hideComments, !Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true), {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
|
me.lockToolbar(Common.enumLock.hideComments, !Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true), {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
|
||||||
me.lockToolbar(Common.enumLock['Objects'], !!me._state.wsProps['Objects'], {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
|
me.lockToolbar(Common.enumLock['Objects'], !!me._state.wsProps['Objects'], {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
|
||||||
|
@ -1026,32 +1032,32 @@ define([
|
||||||
this.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], {array: [this.view.btnCommentRemove, this.view.btnCommentResolve]});
|
this.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], {array: [this.view.btnCommentRemove, this.view.btnCommentResolve]});
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectDocument: function() {
|
onChangeProtectDocument: function(props) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection');
|
if (!props) {
|
||||||
if (!docProtection) {
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
var cntrl = this.getApplication().getController('DocProtection');
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
docProtection = cntrl ? cntrl.getDocProps() : null;
|
|
||||||
}
|
}
|
||||||
if (docProtection) {
|
if (props) {
|
||||||
this.lockToolbar(Common.enumLock.docLockView, docProtection.isReadOnly);
|
this._state.docProtection = props;
|
||||||
this.lockToolbar(Common.enumLock.docLockForms, docProtection.isFormsOnly);
|
this.lockToolbar(Common.enumLock.docLockView, props.isReadOnly);
|
||||||
this.lockToolbar(Common.enumLock.docLockReview, docProtection.isReviewOnly);
|
this.lockToolbar(Common.enumLock.docLockForms, props.isFormsOnly);
|
||||||
this.lockToolbar(Common.enumLock.docLockComments, docProtection.isCommentsOnly);
|
this.lockToolbar(Common.enumLock.docLockReview, props.isReviewOnly);
|
||||||
|
this.lockToolbar(Common.enumLock.docLockComments, props.isCommentsOnly);
|
||||||
if (this.dlgChanges) {
|
if (this.dlgChanges) {
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockView, docProtection.isReadOnly, {array: [this.dlgChanges.btnAccept, this.dlgChanges.btnReject]});
|
Common.Utils.lockControls(Common.enumLock.docLockView, props.isReadOnly, {array: [this.dlgChanges.btnAccept, this.dlgChanges.btnReject]});
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockForms, docProtection.isFormsOnly, {array: [this.dlgChanges.btnAccept, this.dlgChanges.btnReject]});
|
Common.Utils.lockControls(Common.enumLock.docLockForms, props.isFormsOnly, {array: [this.dlgChanges.btnAccept, this.dlgChanges.btnReject]});
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockReview, docProtection.isReviewOnly, {array: [this.dlgChanges.btnAccept, this.dlgChanges.btnReject]});
|
Common.Utils.lockControls(Common.enumLock.docLockReview, props.isReviewOnly, {array: [this.dlgChanges.btnAccept, this.dlgChanges.btnReject]});
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockComments, docProtection.isCommentsOnly, {array: [this.dlgChanges.btnAccept, this.dlgChanges.btnReject]});
|
Common.Utils.lockControls(Common.enumLock.docLockComments, props.isCommentsOnly, {array: [this.dlgChanges.btnAccept, this.dlgChanges.btnReject]});
|
||||||
}
|
}
|
||||||
if (this.appConfig.canReview) {
|
if (this.appConfig.canReview) {
|
||||||
if (docProtection.isReviewOnly) {
|
if (props.isReviewOnly) {
|
||||||
this.onTurnPreview(true);
|
this.onTurnPreview(true);
|
||||||
this.onApiShowChange();
|
this.onApiShowChange();
|
||||||
} else if (this._state.prevReviewProtected) {
|
} else if (this._state.prevReviewProtected) {
|
||||||
this.onTurnPreview(false);
|
this.onTurnPreview(false);
|
||||||
this.onApiShowChange();
|
this.onApiShowChange();
|
||||||
}
|
}
|
||||||
this._state.prevReviewProtected = docProtection.isReviewOnly;
|
this._state.prevReviewProtected = props.isReviewOnly;
|
||||||
}
|
}
|
||||||
this.updatePreviewMode();
|
this.updatePreviewMode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<div class="btn-goto img-commonctrl"></div>
|
<div class="btn-goto img-commonctrl"></div>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (!hint) { %>
|
<% if (!hint) { %>
|
||||||
<% if (scope.appConfig.isReviewOnly || Common.Utils.Store.get("docProtection", {}).isReviewOnly) { %>
|
<% if (scope.appConfig.isReviewOnly || docProtection.isReviewOnly) { %>
|
||||||
<% if (editable) { %>
|
<% if (editable) { %>
|
||||||
<div class="btn-delete img-commonctrl"></div>
|
<div class="btn-delete img-commonctrl"></div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
@ -1096,19 +1096,3 @@ Common.Utils.getKeyByValue = function(obj, value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Common.Utils.Store = new(function() {
|
|
||||||
var settings = {};
|
|
||||||
|
|
||||||
var _get = function(name, defValue) {
|
|
||||||
return (settings[name]!==undefined) ? settings[name] : defValue;
|
|
||||||
},
|
|
||||||
_set = function(name, value) {
|
|
||||||
settings[name] = value;
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
get: _get,
|
|
||||||
set: _set
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -238,6 +238,10 @@ define([
|
||||||
me.fireEvent('comment:resolveComments', [item.value]);
|
me.fireEvent('comment:resolveComments', [item.value]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Common.NotificationCenter.on('protect:doclock', function (e) {
|
||||||
|
me.fireEvent('protect:update');
|
||||||
|
});
|
||||||
|
me.fireEvent('protect:update');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -691,7 +695,6 @@ define([
|
||||||
me.$el.find(separator_last).hide();
|
me.$el.find(separator_last).hide();
|
||||||
|
|
||||||
Common.NotificationCenter.trigger('tab:visible', 'review', (config.isEdit || config.canViewReview || config.canCoAuthoring && config.canComments) && Common.UI.LayoutManager.isElementVisible('toolbar-collaboration'));
|
Common.NotificationCenter.trigger('tab:visible', 'review', (config.isEdit || config.canViewReview || config.canCoAuthoring && config.canComments) && Common.UI.LayoutManager.isElementVisible('toolbar-collaboration'));
|
||||||
|
|
||||||
setEvents.call(me);
|
setEvents.call(me);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -971,6 +974,7 @@ define([
|
||||||
this.options.tpl = _.template(this.template)(this.options);
|
this.options.tpl = _.template(this.template)(this.options);
|
||||||
this.popoverChanges = this.options.popoverChanges;
|
this.popoverChanges = this.options.popoverChanges;
|
||||||
this.mode = this.options.mode;
|
this.mode = this.options.mode;
|
||||||
|
this.docProtection = this.options.docProtection;
|
||||||
|
|
||||||
var filter = Common.localStorage.getKeysFilter();
|
var filter = Common.localStorage.getKeysFilter();
|
||||||
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
||||||
|
@ -1002,7 +1006,7 @@ define([
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
caption : this.txtAccept,
|
caption : this.txtAccept,
|
||||||
split : true,
|
split : true,
|
||||||
disabled : this.mode.isReviewOnly || Common.Utils.Store.get('docProtection', {}).isReviewOnly || !!Common.Utils.InternalSettings.get(this.appPrefix + "accept-reject-lock"),
|
disabled : this.mode.isReviewOnly || this.docProtection.isReviewOnly || !!Common.Utils.InternalSettings.get(this.appPrefix + "accept-reject-lock"),
|
||||||
lock : [_set.reviewChangelock, _set.isReviewOnly, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.docLockReview],
|
lock : [_set.reviewChangelock, _set.isReviewOnly, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.docLockReview],
|
||||||
menu : this.mode.canUseReviewPermissions ? false : new Common.UI.Menu({
|
menu : this.mode.canUseReviewPermissions ? false : new Common.UI.Menu({
|
||||||
items: [
|
items: [
|
||||||
|
@ -1040,11 +1044,10 @@ define([
|
||||||
this.btnReject.render(this.$window.find('#id-review-button-reject'));
|
this.btnReject.render(this.$window.find('#id-review-button-reject'));
|
||||||
var arr = [this.btnAccept, this.btnReject];
|
var arr = [this.btnAccept, this.btnReject];
|
||||||
Common.Utils.lockControls(Common.enumLock.isReviewOnly, this.mode.isReviewOnly, {array: arr});
|
Common.Utils.lockControls(Common.enumLock.isReviewOnly, this.mode.isReviewOnly, {array: arr});
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
Common.Utils.lockControls(Common.enumLock.docLockView, this.docProtection.isReadOnly, {array: arr});
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockView, docProtection.isReadOnly, {array: arr});
|
Common.Utils.lockControls(Common.enumLock.docLockForms, this.docProtection.isFormsOnly, {array: arr});
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockForms, docProtection.isFormsOnly, {array: arr});
|
Common.Utils.lockControls(Common.enumLock.docLockReview, this.docProtection.isReviewOnly, {array: arr});
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockReview, docProtection.isReviewOnly, {array: arr});
|
Common.Utils.lockControls(Common.enumLock.docLockComments, this.docProtection.isCommentsOnly, {array: arr});
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockComments, docProtection.isCommentsOnly, {array: arr});
|
|
||||||
Common.Utils.lockControls(Common.enumLock.reviewChangelock, !!Common.Utils.InternalSettings.get(this.appPrefix + "accept-reject-lock"), {array: arr});
|
Common.Utils.lockControls(Common.enumLock.reviewChangelock, !!Common.Utils.InternalSettings.get(this.appPrefix + "accept-reject-lock"), {array: arr});
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
|
@ -198,14 +198,13 @@ define([
|
||||||
// var isProtected = this.api.asc_isProtectedDocument();
|
// var isProtected = this.api.asc_isProtectedDocument();
|
||||||
var isProtected = this.view ? this.view.btnProtectDoc.isActive() : false; // test
|
var isProtected = this.view ? this.view.btnProtectDoc.isActive() : false; // test
|
||||||
this.view && this.view.btnProtectDoc.toggle(isProtected, true);
|
this.view && this.view.btnProtectDoc.toggle(isProtected, true);
|
||||||
this.getDocProps(true);
|
Common.NotificationCenter.trigger('protect:doclock', this.getDocProps(true));
|
||||||
Common.NotificationCenter.trigger('protect:doclock');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getDocProps: function(update) {
|
getDocProps: function(update) {
|
||||||
if (!this.appConfig || !this.appConfig.isEdit && !this.appConfig.isRestrictedEdit) return;
|
if (!this.appConfig || !this.appConfig.isEdit && !this.appConfig.isRestrictedEdit) return;
|
||||||
|
|
||||||
if (update || !Common.Utils.Store.get('docProtection')) {
|
if (update || !this._state.docProtection) {
|
||||||
// var docProtected = !!this.api.asc_isProtectedDocument(),
|
// var docProtected = !!this.api.asc_isProtectedDocument(),
|
||||||
// type;
|
// type;
|
||||||
//
|
//
|
||||||
|
@ -215,10 +214,10 @@ define([
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// test //////
|
// test //////
|
||||||
// if (Common.Utils.InternalSettings.get('protect-test-type')===undefined) {
|
if (Common.Utils.InternalSettings.get('protect-test-type')===undefined) {
|
||||||
// this.view && this.view.btnProtectDoc.toggle(true, true);
|
this.view && this.view.btnProtectDoc.toggle(true, true);
|
||||||
// Common.Utils.InternalSettings.set('protect-test-type', Asc.c_oAscProtection.Comments);
|
Common.Utils.InternalSettings.set('protect-test-type', Asc.c_oAscProtection.Forms);
|
||||||
// }
|
}
|
||||||
var docProtected = this.view ? this.view.btnProtectDoc.isActive() : true,
|
var docProtected = this.view ? this.view.btnProtectDoc.isActive() : true,
|
||||||
type;
|
type;
|
||||||
|
|
||||||
|
@ -226,14 +225,14 @@ define([
|
||||||
type = Common.Utils.InternalSettings.get('protect-test-type');
|
type = Common.Utils.InternalSettings.get('protect-test-type');
|
||||||
}
|
}
|
||||||
/////////////
|
/////////////
|
||||||
Common.Utils.Store.set('docProtection', {
|
this._state.docProtection = {
|
||||||
isReadOnly: type===Asc.c_oAscProtection.View,
|
isReadOnly: type===Asc.c_oAscProtection.View,
|
||||||
isCommentsOnly: type===Asc.c_oAscProtection.Comments,
|
isCommentsOnly: type===Asc.c_oAscProtection.Comments,
|
||||||
isReviewOnly: type===Asc.c_oAscProtection.Review,
|
isReviewOnly: type===Asc.c_oAscProtection.Review,
|
||||||
isFormsOnly: type===Asc.c_oAscProtection.Forms
|
isFormsOnly: type===Asc.c_oAscProtection.Forms
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
return Common.Utils.Store.get('docProtection');
|
return this._state.docProtection;
|
||||||
}
|
}
|
||||||
|
|
||||||
}, DE.Controllers.DocProtection || {}));
|
}, DE.Controllers.DocProtection || {}));
|
||||||
|
|
|
@ -187,6 +187,7 @@ define([
|
||||||
me.onDocumentHolderResize();
|
me.onDocumentHolderResize();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Common.NotificationCenter.on('protect:doclock', _.bind(me.onChangeProtectDocument, me));
|
||||||
},
|
},
|
||||||
|
|
||||||
setApi: function(o) {
|
setApi: function(o) {
|
||||||
|
@ -424,6 +425,8 @@ define([
|
||||||
view.menuParaTOCSettings.on('click', _.bind(me.onParaTOCSettings, me));
|
view.menuParaTOCSettings.on('click', _.bind(me.onParaTOCSettings, me));
|
||||||
view.menuTableEquation.menu.on('item:click', _.bind(me.convertEquation, me));
|
view.menuTableEquation.menu.on('item:click', _.bind(me.convertEquation, me));
|
||||||
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
|
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
|
||||||
|
|
||||||
|
me.onChangeProtectDocument();
|
||||||
},
|
},
|
||||||
|
|
||||||
getView: function (name) {
|
getView: function (name) {
|
||||||
|
@ -584,7 +587,7 @@ define([
|
||||||
showObjectMenu: function(event, docElement, eOpts){
|
showObjectMenu: function(event, docElement, eOpts){
|
||||||
var me = this;
|
var me = this;
|
||||||
if (me.api){
|
if (me.api){
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var docProtection = me.documentHolder._docProtection;
|
||||||
var obj = (me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) ?
|
var obj = (me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) ?
|
||||||
me.fillMenuProps(me.api.getSelectedElements()) : me.fillViewMenuProps(me.api.getSelectedElements());
|
me.fillMenuProps(me.api.getSelectedElements()) : me.fillViewMenuProps(me.api.getSelectedElements());
|
||||||
if (obj) me.showPopupMenu(obj.menu_to_show, obj.menu_props, event, docElement, eOpts);
|
if (obj) me.showPopupMenu(obj.menu_to_show, obj.menu_props, event, docElement, eOpts);
|
||||||
|
@ -613,7 +616,7 @@ define([
|
||||||
var me = this,
|
var me = this,
|
||||||
currentMenu = me.documentHolder.currentMenu;
|
currentMenu = me.documentHolder.currentMenu;
|
||||||
if (currentMenu && currentMenu.isVisible() && currentMenu !== me.documentHolder.hdrMenu){
|
if (currentMenu && currentMenu.isVisible() && currentMenu !== me.documentHolder.hdrMenu){
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var docProtection = me.documentHolder._docProtection;
|
||||||
var obj = (me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) ?
|
var obj = (me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) ?
|
||||||
me.fillMenuProps(selectedElements) : me.fillViewMenuProps(selectedElements);
|
me.fillMenuProps(selectedElements) : me.fillViewMenuProps(selectedElements);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
@ -827,7 +830,7 @@ define([
|
||||||
onDialogAddHyperlink: function() {
|
onDialogAddHyperlink: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var win, props, text;
|
var win, props, text;
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var docProtection = me.documentHolder._docProtection;
|
||||||
if (me.api && me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly) && !me.getApplication().getController('LeftMenu').leftMenu.menuFile.isVisible()){
|
if (me.api && me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly) && !me.getApplication().getController('LeftMenu').leftMenu.menuFile.isVisible()){
|
||||||
var handlerDlg = function(dlg, result) {
|
var handlerDlg = function(dlg, result) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
|
@ -1184,7 +1187,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDoubleClickOnChart: function(chart) {
|
onDoubleClickOnChart: function(chart) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var docProtection = this.documentHolder._docProtection;
|
||||||
if (this.mode.isEdit && !(this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) {
|
if (this.mode.isEdit && !(this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) {
|
||||||
var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
|
var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
|
||||||
if (diagramEditor && chart) {
|
if (diagramEditor && chart) {
|
||||||
|
@ -1196,7 +1199,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDoubleClickOnTableOleObject: function(chart) {
|
onDoubleClickOnTableOleObject: function(chart) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var docProtection = this.documentHolder._docProtection;
|
||||||
if (this.mode.isEdit && !(this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) {
|
if (this.mode.isEdit && !(this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) {
|
||||||
var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
|
var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
|
||||||
if (oleEditor && chart) {
|
if (oleEditor && chart) {
|
||||||
|
@ -1901,8 +1904,8 @@ define([
|
||||||
this.api.asc_ViewCertificate(datavalue); //certificate id
|
this.api.asc_ViewCertificate(datavalue); //certificate id
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var docProtection = this.documentHolder._docProtection;
|
||||||
Common.NotificationCenter.trigger('protect:signature', 'visible', this._isDisabled || !!docProtection.isReadOnly || !!docProtection.isFormsOnly || !!docProtection.isCommentsOnly, datavalue);//guid, can edit settings for requested signature
|
Common.NotificationCenter.trigger('protect:signature', 'visible', this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly, datavalue);//guid, can edit settings for requested signature
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
var me = this;
|
var me = this;
|
||||||
|
@ -2315,6 +2318,16 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onChangeProtectDocument: function(props) {
|
||||||
|
if (!props) {
|
||||||
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
|
}
|
||||||
|
if (props && this.documentHolder) {
|
||||||
|
this.documentHolder._docProtection = props;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
editComplete: function() {
|
editComplete: function() {
|
||||||
this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder);
|
this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,18 +434,20 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectDocument: function() {
|
onChangeProtectDocument: function(props) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection');
|
if (!props) {
|
||||||
if (!docProtection) {
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
var cntrl = this.getApplication().getController('DocProtection');
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
docProtection = cntrl ? cntrl.getDocProps() : null;
|
|
||||||
}
|
}
|
||||||
if (docProtection && this.view) {
|
if (props) {
|
||||||
var arr = this.view.getButtons();
|
this._state.docProtection = props;
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockView, docProtection.isReadOnly, {array: arr});
|
if (this.view) {
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockForms, docProtection.isFormsOnly, {array: arr});
|
var arr = this.view.getButtons();
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockReview, docProtection.isReviewOnly, {array: arr});
|
Common.Utils.lockControls(Common.enumLock.docLockView, props.isReadOnly, {array: arr});
|
||||||
Common.Utils.lockControls(Common.enumLock.docLockComments, docProtection.isCommentsOnly, {array: arr});
|
Common.Utils.lockControls(Common.enumLock.docLockForms, props.isFormsOnly, {array: arr});
|
||||||
|
Common.Utils.lockControls(Common.enumLock.docLockReview, props.isReviewOnly, {array: arr});
|
||||||
|
Common.Utils.lockControls(Common.enumLock.docLockComments, props.isCommentsOnly, {array: arr});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,15 @@ define([
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
this.leftMenu = this.createView('LeftMenu').render();
|
this.leftMenu = this.createView('LeftMenu').render();
|
||||||
this.leftMenu.btnSearchBar.on('toggle', _.bind(this.onMenuSearchBar, this));
|
this.leftMenu.btnSearchBar.on('toggle', _.bind(this.onMenuSearchBar, this));
|
||||||
this._state = {disableEditing: false};
|
this._state = {
|
||||||
|
disableEditing: false,
|
||||||
|
docProtection: {
|
||||||
|
isReadOnly: false,
|
||||||
|
isReviewOnly: false,
|
||||||
|
isFormsOnly: false,
|
||||||
|
isCommentsOnly: false
|
||||||
|
}
|
||||||
|
};
|
||||||
Common.util.Shortcuts.delegateShortcuts({
|
Common.util.Shortcuts.delegateShortcuts({
|
||||||
shortcuts: {
|
shortcuts: {
|
||||||
'command+shift+s,ctrl+shift+s': _.bind(this.onShortcut, this, 'save'),
|
'command+shift+s,ctrl+shift+s': _.bind(this.onShortcut, this, 'save'),
|
||||||
|
@ -587,8 +595,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePreviewMode: function() {
|
updatePreviewMode: function() {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {});
|
var viewmode = this._state.disableEditing || this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly;
|
||||||
var viewmode = this._state.disableEditing || !!docProtection.isReadOnly || !!docProtection.isFormsOnly;
|
|
||||||
if (this.viewmode === viewmode) return;
|
if (this.viewmode === viewmode) return;
|
||||||
this.viewmode = viewmode;
|
this.viewmode = viewmode;
|
||||||
|
|
||||||
|
@ -895,14 +902,15 @@ define([
|
||||||
return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
|
return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectDocument: function() {
|
onChangeProtectDocument: function(props) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection');
|
if (!props) {
|
||||||
if (!docProtection) {
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
var cntrl = this.getApplication().getController('DocProtection');
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
docProtection = cntrl ? cntrl.getDocProps() : null;
|
|
||||||
}
|
}
|
||||||
if (docProtection)
|
if (props) {
|
||||||
|
this._state.docProtection = props;
|
||||||
this.updatePreviewMode();
|
this.updatePreviewMode();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
textNoTextFound : 'Text not found',
|
textNoTextFound : 'Text not found',
|
||||||
|
|
|
@ -574,17 +574,17 @@ define([
|
||||||
})).show();
|
})).show();
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectDocument: function() {
|
onChangeProtectDocument: function(props) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection');
|
if (!props) {
|
||||||
if (!docProtection) {
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
var cntrl = this.getApplication().getController('DocProtection');
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
docProtection = cntrl ? cntrl.getDocProps() : null;
|
|
||||||
}
|
}
|
||||||
if (docProtection) {
|
if (props) {
|
||||||
this.lockToolbar(Common.enumLock.docLockView, docProtection.isReadOnly);
|
this._state.docProtection = props;
|
||||||
this.lockToolbar(Common.enumLock.docLockForms, docProtection.isFormsOnly);
|
this.lockToolbar(Common.enumLock.docLockView, props.isReadOnly);
|
||||||
this.lockToolbar(Common.enumLock.docLockReview, docProtection.isReviewOnly);
|
this.lockToolbar(Common.enumLock.docLockForms, props.isFormsOnly);
|
||||||
this.lockToolbar(Common.enumLock.docLockComments, docProtection.isCommentsOnly);
|
this.lockToolbar(Common.enumLock.docLockReview, props.isReviewOnly);
|
||||||
|
this.lockToolbar(Common.enumLock.docLockComments, props.isCommentsOnly);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,14 @@ define([
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.editMode = true;
|
this.editMode = true;
|
||||||
this._initSettings = true;
|
this._initSettings = true;
|
||||||
this._state = {};
|
this._state = {
|
||||||
|
docProtection: {
|
||||||
|
isReadOnly: false,
|
||||||
|
isReviewOnly: false,
|
||||||
|
isFormsOnly: false,
|
||||||
|
isCommentsOnly: false
|
||||||
|
}
|
||||||
|
};
|
||||||
this.addListeners({
|
this.addListeners({
|
||||||
'RightMenu': {
|
'RightMenu': {
|
||||||
'rightmenuclick': this.onRightMenuClick
|
'rightmenuclick': this.onRightMenuClick
|
||||||
|
@ -158,8 +165,7 @@ define([
|
||||||
|
|
||||||
var isChart = false,
|
var isChart = false,
|
||||||
isSmartArtInternal = false,
|
isSmartArtInternal = false,
|
||||||
docProtection = Common.Utils.Store.get('docProtection', {}),
|
isProtected = this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly;
|
||||||
isProtected = !!docProtection.isReadOnly || !!docProtection.isFormsOnly || !!docProtection.isCommentsOnly;
|
|
||||||
|
|
||||||
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
|
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
|
||||||
control_lock = false;
|
control_lock = false;
|
||||||
|
@ -472,16 +478,18 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectDocument: function() {
|
onChangeProtectDocument: function(props) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection');
|
if (!props) {
|
||||||
if (!docProtection) {
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
var cntrl = this.getApplication().getController('DocProtection');
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
docProtection = cntrl ? cntrl.getDocProps() : null;
|
|
||||||
}
|
}
|
||||||
if (docProtection && this.api) {
|
if (props) {
|
||||||
var selectedElements = this.api.getSelectedElements();
|
this._state.docProtection = props;
|
||||||
if (selectedElements.length > 0)
|
if (this.api) {
|
||||||
this.onFocusObject(selectedElements);
|
var selectedElements = this.api.getSelectedElements();
|
||||||
|
if (selectedElements.length > 0)
|
||||||
|
this.onFocusObject(selectedElements);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -3333,17 +3333,17 @@ define([
|
||||||
})).show();
|
})).show();
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectDocument: function() {
|
onChangeProtectDocument: function(props) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection');
|
if (!props) {
|
||||||
if (!docProtection) {
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
var cntrl = this.getApplication().getController('DocProtection');
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
docProtection = cntrl ? cntrl.getDocProps() : null;
|
|
||||||
}
|
}
|
||||||
if (docProtection) {
|
if (props) {
|
||||||
this.toolbar.lockToolbar(Common.enumLock.docLockView, docProtection.isReadOnly);
|
this._state.docProtection = props;
|
||||||
this.toolbar.lockToolbar(Common.enumLock.docLockForms, docProtection.isFormsOnly);
|
this.toolbar.lockToolbar(Common.enumLock.docLockView, props.isReadOnly);
|
||||||
this.toolbar.lockToolbar(Common.enumLock.docLockReview, docProtection.isReviewOnly);
|
this.toolbar.lockToolbar(Common.enumLock.docLockForms, props.isFormsOnly);
|
||||||
this.toolbar.lockToolbar(Common.enumLock.docLockComments, docProtection.isCommentsOnly);
|
this.toolbar.lockToolbar(Common.enumLock.docLockReview, props.isReviewOnly);
|
||||||
|
this.toolbar.lockToolbar(Common.enumLock.docLockComments, props.isCommentsOnly);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,12 @@ define([
|
||||||
this._currentParaObjDisabled = false;
|
this._currentParaObjDisabled = false;
|
||||||
this._currLang = {};
|
this._currLang = {};
|
||||||
this._isDisabled = false;
|
this._isDisabled = false;
|
||||||
|
this._docProtection = {
|
||||||
|
isReadOnly: false,
|
||||||
|
isReviewOnly: false,
|
||||||
|
isFormsOnly: false,
|
||||||
|
isCommentsOnly: false
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
|
@ -152,7 +158,6 @@ define([
|
||||||
signGuid = (value.imgProps && value.imgProps.value && me.mode.isSignatureSupport) ? value.imgProps.value.asc_getSignatureId() : undefined,
|
signGuid = (value.imgProps && value.imgProps.value && me.mode.isSignatureSupport) ? value.imgProps.value.asc_getSignatureId() : undefined,
|
||||||
signProps = (signGuid) ? me.api.asc_getSignatureSetup(signGuid) : null,
|
signProps = (signGuid) ? me.api.asc_getSignatureSetup(signGuid) : null,
|
||||||
isInSign = !!signProps && me._canProtect,
|
isInSign = !!signProps && me._canProtect,
|
||||||
docProtection = Common.Utils.Store.get('docProtection', {}),
|
|
||||||
control_lock = (value.paraProps) ? (!value.paraProps.value.can_DeleteBlockContentControl() || !value.paraProps.value.can_EditBlockContentControl() ||
|
control_lock = (value.paraProps) ? (!value.paraProps.value.can_DeleteBlockContentControl() || !value.paraProps.value.can_EditBlockContentControl() ||
|
||||||
!value.paraProps.value.can_DeleteInlineContentControl() || !value.paraProps.value.can_EditInlineContentControl()) : false,
|
!value.paraProps.value.can_DeleteInlineContentControl() || !value.paraProps.value.can_EditInlineContentControl()) : false,
|
||||||
canComment = !isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled && !control_lock,
|
canComment = !isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled && !control_lock,
|
||||||
|
@ -170,7 +175,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
me.menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
|
me.menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
|
||||||
me.menuViewUndo.setDisabled(!me.api.asc_getCanUndo() || !!docProtection.isReadOnly);
|
me.menuViewUndo.setDisabled(!me.api.asc_getCanUndo() || me._docProtection.isReadOnly);
|
||||||
me.menuViewCopySeparator.setVisible(isInSign);
|
me.menuViewCopySeparator.setVisible(isInSign);
|
||||||
|
|
||||||
var isRequested = (signProps) ? signProps.asc_getRequested() : false;
|
var isRequested = (signProps) ? signProps.asc_getRequested() : false;
|
||||||
|
@ -188,15 +193,15 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
me.menuViewAddComment.setVisible(canComment);
|
me.menuViewAddComment.setVisible(canComment);
|
||||||
me.menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true || !!docProtection.isReadOnly || !!docProtection.isFormsOnly);
|
me.menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true || me._docProtection.isReadOnly || me._docProtection.isFormsOnly);
|
||||||
|
|
||||||
var disabled = value.paraProps && value.paraProps.locked === true;
|
var disabled = value.paraProps && value.paraProps.locked === true;
|
||||||
var cancopy = me.api && me.api.can_CopyCut();
|
var cancopy = me.api && me.api.can_CopyCut();
|
||||||
me.menuViewCopy.setDisabled(!cancopy);
|
me.menuViewCopy.setDisabled(!cancopy);
|
||||||
me.menuViewCut.setVisible(me._fillFormMode && canEditControl);
|
me.menuViewCut.setVisible(me._fillFormMode && canEditControl);
|
||||||
me.menuViewCut.setDisabled(disabled || !cancopy || !!docProtection.isReadOnly || !!docProtection.isCommentsOnly);
|
me.menuViewCut.setDisabled(disabled || !cancopy || me._docProtection.isReadOnly || me._docProtection.isCommentsOnly);
|
||||||
me.menuViewPaste.setVisible(me._fillFormMode && canEditControl);
|
me.menuViewPaste.setVisible(me._fillFormMode && canEditControl);
|
||||||
me.menuViewPaste.setDisabled(disabled || !!docProtection.isReadOnly || !!docProtection.isCommentsOnly);
|
me.menuViewPaste.setDisabled(disabled || me._docProtection.isReadOnly || me._docProtection.isCommentsOnly);
|
||||||
me.menuViewPrint.setVisible(me.mode.canPrint && !me._fillFormMode);
|
me.menuViewPrint.setVisible(me.mode.canPrint && !me._fillFormMode);
|
||||||
me.menuViewPrint.setDisabled(!cancopy);
|
me.menuViewPrint.setDisabled(!cancopy);
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,14 @@ define([
|
||||||
_.extend(this, options);
|
_.extend(this, options);
|
||||||
this.pages = new DE.Models.Pages({current:1, count:1});
|
this.pages = new DE.Models.Pages({current:1, count:1});
|
||||||
this.pages.on('change', _.bind(_updatePagesCaption,this));
|
this.pages.on('change', _.bind(_updatePagesCaption,this));
|
||||||
this._state = {};
|
this._state = {
|
||||||
|
docProtection: {
|
||||||
|
isReadOnly: false,
|
||||||
|
isReviewOnly: false,
|
||||||
|
isFormsOnly: false,
|
||||||
|
isCommentsOnly: false
|
||||||
|
}
|
||||||
|
};
|
||||||
this._isDisabled = false;
|
this._isDisabled = false;
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
@ -371,7 +378,8 @@ define([
|
||||||
});
|
});
|
||||||
this.langMenu.resetItems(arr);
|
this.langMenu.resetItems(arr);
|
||||||
if (this.langMenu.items.length>0) {
|
if (this.langMenu.items.length>0) {
|
||||||
this.btnLanguage.setDisabled(!!this.mode.isDisconnected);
|
var isProtected = this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly;
|
||||||
|
this.btnLanguage.setDisabled(this._isDisabled || !!this.mode.isDisconnected || isProtected);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -404,20 +412,20 @@ define([
|
||||||
|
|
||||||
SetDisabled: function(disable) {
|
SetDisabled: function(disable) {
|
||||||
this._isDisabled = disable;
|
this._isDisabled = disable;
|
||||||
var docProtection = Common.Utils.Store.get('docProtection', {}),
|
var isProtected = this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly;
|
||||||
isProtected = !!docProtection.isReadOnly || !!docProtection.isFormsOnly || !!docProtection.isCommentsOnly
|
|
||||||
this.btnLanguage.setDisabled(disable || this.langMenu.items.length<1 || isProtected);
|
this.btnLanguage.setDisabled(disable || this.langMenu.items.length<1 || isProtected);
|
||||||
this.btnTurnReview && this.btnTurnReview.setDisabled(disable || isProtected);
|
this.btnTurnReview && this.btnTurnReview.setDisabled(disable || isProtected);
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectDocument: function() {
|
onChangeProtectDocument: function(props) {
|
||||||
var docProtection = Common.Utils.Store.get('docProtection');
|
if (!props) {
|
||||||
if (!docProtection) {
|
var docprotect = DE.getController('DocProtection');
|
||||||
var cntrl = DE.getController('DocProtection');
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
docProtection = cntrl ? cntrl.getDocProps() : null;
|
|
||||||
}
|
}
|
||||||
if (docProtection)
|
if (props) {
|
||||||
|
this._state.docProtection = props;
|
||||||
this.SetDisabled(this._isDisabled);
|
this.SetDisabled(this._isDisabled);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiCoAuthoringDisconnect: function() {
|
onApiCoAuthoringDisconnect: function() {
|
||||||
|
|
Loading…
Reference in a new issue