[DE] Refactoring document protection
This commit is contained in:
		
							parent
							
								
									fba576115c
								
							
						
					
					
						commit
						f8b95b54ab
					
				| 
						 | 
				
			
			@ -144,12 +144,15 @@ define([
 | 
			
		|||
                    }
 | 
			
		||||
                }, this, area);
 | 
			
		||||
            }.bind(this));
 | 
			
		||||
            Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
 | 
			
		||||
            Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
 | 
			
		||||
        },
 | 
			
		||||
        onLaunch: function () {
 | 
			
		||||
            var filter = Common.localStorage.getKeysFilter();
 | 
			
		||||
            this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
 | 
			
		||||
            this._state = {viewmode: false};
 | 
			
		||||
            this._state = {
 | 
			
		||||
                disableEditing: false // disable editing when disconnect/signed file/mail merge preview/review final or original/forms preview
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            this.collection                     =   this.getApplication().getCollection('Common.Collections.Comments');
 | 
			
		||||
            this.setComparator();
 | 
			
		||||
| 
						 | 
				
			
			@ -1647,14 +1650,13 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
 | 
			
		||||
        setPreviewMode: function(mode) {
 | 
			
		||||
            this._state.viewmode = mode;
 | 
			
		||||
            this._state.disableEditing = mode;
 | 
			
		||||
            this.updatePreviewMode();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        updatePreviewMode: function() {
 | 
			
		||||
            var lockMode = this._state.docProtection ? this._state.docProtection.lockMode : undefined;
 | 
			
		||||
            lockMode = (lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Forms);
 | 
			
		||||
            var viewmode = this._state.viewmode || lockMode;
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
            var viewmode = this._state.disableEditing || !!docProtection.isReadOnly || !!docProtection.isFormsOnly;
 | 
			
		||||
 | 
			
		||||
            if (this.viewmode === viewmode) return;
 | 
			
		||||
            this.viewmode = viewmode;
 | 
			
		||||
| 
						 | 
				
			
			@ -1732,15 +1734,23 @@ define([
 | 
			
		|||
            this.updateComments(true);
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
        onAppReady: function (config) {
 | 
			
		||||
            var me = this;
 | 
			
		||||
            (new Promise(function (accept, reject) {
 | 
			
		||||
                accept();
 | 
			
		||||
            })).then(function(){
 | 
			
		||||
                me.onChangeProtectDocument();
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function() {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection');
 | 
			
		||||
            if (!docProtection) {
 | 
			
		||||
                var cntrl = this.getApplication().getController('DocProtection');
 | 
			
		||||
                docProtection = cntrl ? cntrl.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            if (props) {
 | 
			
		||||
                this._state.docProtection = props;
 | 
			
		||||
            if (docProtection)
 | 
			
		||||
                this.updatePreviewMode();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }, Common.Controllers.Comments || {}));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,7 +102,9 @@ define([
 | 
			
		|||
            this.userCollection =   this.getApplication().getCollection('Common.Collections.Users');
 | 
			
		||||
            this.viewmode = false;
 | 
			
		||||
 | 
			
		||||
            this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null, wsLock: false, wsProps: [], viewmode: false};
 | 
			
		||||
            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
 | 
			
		||||
                          };
 | 
			
		||||
 | 
			
		||||
            Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
 | 
			
		||||
            Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
 | 
			
		||||
| 
						 | 
				
			
			@ -180,14 +182,13 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
 | 
			
		||||
        setPreviewMode: function(mode) { //disable accept/reject in popover
 | 
			
		||||
            this._state.viewmode = mode;
 | 
			
		||||
            this._state.disableEditing = mode;
 | 
			
		||||
            this.updatePreviewMode();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        updatePreviewMode: function() {
 | 
			
		||||
            var lockMode = this._state.docProtection ? this._state.docProtection.lockMode : undefined;
 | 
			
		||||
            lockMode = (lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Forms || lockMode===Asc.c_oAscProtection.Comments);
 | 
			
		||||
            var viewmode = this._state.viewmode || lockMode;
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
            var viewmode = this._state.disableEditing || !!docProtection.isReadOnly || !!docProtection.isFormsOnly || !!docProtection.isCommentsOnly;
 | 
			
		||||
 | 
			
		||||
            if (this.viewmode === viewmode) return;
 | 
			
		||||
            this.viewmode = viewmode;
 | 
			
		||||
| 
						 | 
				
			
			@ -1022,17 +1023,17 @@ define([
 | 
			
		|||
            this.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], {array: [this.view.btnCommentRemove, this.view.btnCommentResolve]});
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
        onChangeProtectDocument: function() {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection');
 | 
			
		||||
            if (!docProtection) {
 | 
			
		||||
                var cntrl = this.getApplication().getController('DocProtection');
 | 
			
		||||
                docProtection = cntrl ? cntrl.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            if (props) {
 | 
			
		||||
                this._state.docProtection = props;
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockView, props.docLock && (props.lockMode===Asc.c_oAscProtection.View));
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockForms, props.docLock && (props.lockMode===Asc.c_oAscProtection.Forms));
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockReview, props.docLock && (props.lockMode===Asc.c_oAscProtection.Review));
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockComments, props.docLock && (props.lockMode===Asc.c_oAscProtection.Comments));
 | 
			
		||||
            if (docProtection) {
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockView, docProtection.isReadOnly);
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockForms, docProtection.isFormsOnly);
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockReview, docProtection.isReviewOnly);
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockComments, docProtection.isCommentsOnly);
 | 
			
		||||
                this.updatePreviewMode();
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1096,3 +1096,19 @@ 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
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -190,6 +190,7 @@ define([
 | 
			
		|||
                resolve();
 | 
			
		||||
            })).then(function () {
 | 
			
		||||
                // me.view.btnProtectDoc.toggle(me.api.asc_isProtectedDocument(), true);
 | 
			
		||||
                // me.onChangeProtectDocument();
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -197,14 +198,14 @@ define([
 | 
			
		|||
            // var isProtected = this.api.asc_isProtectedDocument();
 | 
			
		||||
            var isProtected = this.view.btnProtectDoc.isActive(); // test
 | 
			
		||||
            this.view && this.view.btnProtectDoc.toggle(isProtected, true);
 | 
			
		||||
            var props = this.getDocProps(true);
 | 
			
		||||
            Common.NotificationCenter.trigger('protect:doclock', props);
 | 
			
		||||
            this.getDocProps(true);
 | 
			
		||||
            Common.NotificationCenter.trigger('protect:doclock');
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        getDocProps: function(update) {
 | 
			
		||||
            if (!this.appConfig || !this.appConfig.isEdit && !this.appConfig.isRestrictedEdit) return;
 | 
			
		||||
 | 
			
		||||
            if (update || !this._state.docProtection) {
 | 
			
		||||
            if (update || !Common.Utils.Store.get('docProtection')) {
 | 
			
		||||
                // var docProtected = !!this.api.asc_isProtectedDocument(),
 | 
			
		||||
                //     type;
 | 
			
		||||
                //
 | 
			
		||||
| 
						 | 
				
			
			@ -221,10 +222,14 @@ define([
 | 
			
		|||
                    type = Common.Utils.InternalSettings.get('protect-test-type');
 | 
			
		||||
                }
 | 
			
		||||
                /////////////
 | 
			
		||||
                this._state.docProtection = {docLock: docProtected, lockMode: type};
 | 
			
		||||
                Common.Utils.Store.set('docProtection', {
 | 
			
		||||
                    isReadOnly: type===Asc.c_oAscProtection.View,
 | 
			
		||||
                    isCommentsOnly: type===Asc.c_oAscProtection.Comments,
 | 
			
		||||
                    isReviewOnly: type===Asc.c_oAscProtection.Review,
 | 
			
		||||
                    isFormsOnly: type===Asc.c_oAscProtection.Forms
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return this._state.docProtection;
 | 
			
		||||
            return Common.Utils.Store.get('docProtection');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }, DE.Controllers.DocProtection || {}));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -226,7 +226,6 @@ define([
 | 
			
		|||
                    this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this));
 | 
			
		||||
                    this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this));
 | 
			
		||||
                }
 | 
			
		||||
                Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
 | 
			
		||||
                this.documentHolder.setApi(this.api);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -585,8 +584,8 @@ define([
 | 
			
		|||
        showObjectMenu: function(event, docElement, eOpts){
 | 
			
		||||
            var me = this;
 | 
			
		||||
            if (me.api){
 | 
			
		||||
                var lockMode = this.documentHolder.docProtection ? this.documentHolder.docProtection.lockMode : undefined;
 | 
			
		||||
                var obj = (me.mode.isEdit && !(me._isDisabled || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Comments || lockMode===Asc.c_oAscProtection.Forms)) ?
 | 
			
		||||
                var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
                var obj = (me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) ?
 | 
			
		||||
                            me.fillMenuProps(me.api.getSelectedElements()) : me.fillViewMenuProps(me.api.getSelectedElements());
 | 
			
		||||
                if (obj) me.showPopupMenu(obj.menu_to_show, obj.menu_props, event, docElement, eOpts);
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -614,8 +613,8 @@ define([
 | 
			
		|||
            var me = this,
 | 
			
		||||
                currentMenu = me.documentHolder.currentMenu;
 | 
			
		||||
            if (currentMenu && currentMenu.isVisible() && currentMenu !== me.documentHolder.hdrMenu){
 | 
			
		||||
                var lockMode = me.documentHolder.docProtection ? me.documentHolder.docProtection.lockMode : undefined;
 | 
			
		||||
                var obj = (me.mode.isEdit && !(me._isDisabled || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Comments || lockMode===Asc.c_oAscProtection.Forms)) ?
 | 
			
		||||
                var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
                var obj = (me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) ?
 | 
			
		||||
                            me.fillMenuProps(selectedElements) : me.fillViewMenuProps(selectedElements);
 | 
			
		||||
                if (obj) {
 | 
			
		||||
                    if (obj.menu_to_show===currentMenu) {
 | 
			
		||||
| 
						 | 
				
			
			@ -828,8 +827,8 @@ define([
 | 
			
		|||
        onDialogAddHyperlink: function() {
 | 
			
		||||
            var me = this;
 | 
			
		||||
            var win, props, text;
 | 
			
		||||
            var lockMode = me.documentHolder.docProtection ? me.documentHolder.docProtection.lockMode : undefined;
 | 
			
		||||
            if (me.api && me.mode.isEdit && !(me._isDisabled || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Comments || lockMode===Asc.c_oAscProtection.Forms) && !me.getApplication().getController('LeftMenu').leftMenu.menuFile.isVisible()){
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
            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) {
 | 
			
		||||
                    if (result == 'ok') {
 | 
			
		||||
                        props = dlg.getSettings();
 | 
			
		||||
| 
						 | 
				
			
			@ -1185,8 +1184,8 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
 | 
			
		||||
        onDoubleClickOnChart: function(chart) {
 | 
			
		||||
            var lockMode = this.documentHolder.docProtection ? this.documentHolder.docProtection.lockMode : undefined;
 | 
			
		||||
            if (this.mode.isEdit && !(this._isDisabled || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Comments || lockMode===Asc.c_oAscProtection.Forms)) {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
            if (this.mode.isEdit && !(this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) {
 | 
			
		||||
                var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
 | 
			
		||||
                if (diagramEditor && chart) {
 | 
			
		||||
                    diagramEditor.setEditMode(true);
 | 
			
		||||
| 
						 | 
				
			
			@ -1197,8 +1196,8 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
 | 
			
		||||
        onDoubleClickOnTableOleObject: function(chart) {
 | 
			
		||||
            var lockMode = this.documentHolder.docProtection ? this.documentHolder.docProtection.lockMode : undefined;
 | 
			
		||||
            if (this.mode.isEdit && !(this._isDisabled || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Comments || lockMode===Asc.c_oAscProtection.Forms)) {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
            if (this.mode.isEdit && !(this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) {
 | 
			
		||||
                var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
 | 
			
		||||
                if (oleEditor && chart) {
 | 
			
		||||
                    oleEditor.setEditMode(true);
 | 
			
		||||
| 
						 | 
				
			
			@ -1902,8 +1901,8 @@ define([
 | 
			
		|||
                    this.api.asc_ViewCertificate(datavalue); //certificate id
 | 
			
		||||
                    break;
 | 
			
		||||
                case 2:
 | 
			
		||||
                    var lockMode = this.documentHolder.docProtection ? this.documentHolder.docProtection.lockMode : undefined;
 | 
			
		||||
                    Common.NotificationCenter.trigger('protect:signature', 'visible', this._isDisabled || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Comments || lockMode===Asc.c_oAscProtection.Forms, datavalue);//guid, can edit settings for requested signature
 | 
			
		||||
                    var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
                    Common.NotificationCenter.trigger('protect:signature', 'visible', this._isDisabled || !!docProtection.isReadOnly || !!docProtection.isFormsOnly || !!docProtection.isCommentsOnly, datavalue);//guid, can edit settings for requested signature
 | 
			
		||||
                    break;
 | 
			
		||||
                case 3:
 | 
			
		||||
                    var me = this;
 | 
			
		||||
| 
						 | 
				
			
			@ -2318,16 +2317,6 @@ define([
 | 
			
		|||
 | 
			
		||||
        editComplete: function() {
 | 
			
		||||
            this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder);
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            if (props) {
 | 
			
		||||
                this.documentHolder && (this.documentHolder.docProtection = props);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -378,6 +378,7 @@ define([
 | 
			
		|||
                    me.view.btnHighlight.currentColor = clr;
 | 
			
		||||
                }
 | 
			
		||||
                config.isEdit && config.canFeatureContentControl && config.isFormCreator && me.showCreateFormTip(); // show tip only when create form in docxf
 | 
			
		||||
                me.onChangeProtectDocument();
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -433,18 +434,18 @@ define([
 | 
			
		|||
            }
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
        onChangeProtectDocument: function() {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection');
 | 
			
		||||
            if (!docProtection) {
 | 
			
		||||
                var cntrl = this.getApplication().getController('DocProtection');
 | 
			
		||||
                docProtection = cntrl ? cntrl.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            if (props) {
 | 
			
		||||
                this._state.docProtection = props;
 | 
			
		||||
            if (docProtection) {
 | 
			
		||||
                var arr = this.view.getButtons();
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.docLockView, props.docLock && (props.lockMode===Asc.c_oAscProtection.View)),   {array: arr};
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.docLockForms, props.docLock && (props.lockMode===Asc.c_oAscProtection.Forms),   {array: arr});
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.docLockReview, props.docLock && (props.lockMode===Asc.c_oAscProtection.Review),   {array: arr});
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.docLockComments, props.docLock && (props.lockMode===Asc.c_oAscProtection.Comments),   {array: arr});
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.docLockView, docProtection.isReadOnly,   {array: arr});
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.docLockForms, docProtection.isFormsOnly,   {array: arr});
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.docLockReview, docProtection.isReviewOnly,   {array: arr});
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.docLockComments, docProtection.isCommentsOnly,   {array: arr});
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -119,7 +119,7 @@ define([
 | 
			
		|||
        onLaunch: function() {
 | 
			
		||||
            this.leftMenu = this.createView('LeftMenu').render();
 | 
			
		||||
            this.leftMenu.btnSearchBar.on('toggle', _.bind(this.onMenuSearchBar, this));
 | 
			
		||||
            this._state = {viewmode: false};
 | 
			
		||||
            this._state = {disableEditing: false};
 | 
			
		||||
            Common.util.Shortcuts.delegateShortcuts({
 | 
			
		||||
                shortcuts: {
 | 
			
		||||
                    'command+shift+s,ctrl+shift+s': _.bind(this.onShortcut, this, 'save'),
 | 
			
		||||
| 
						 | 
				
			
			@ -216,7 +216,7 @@ define([
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            (this.mode.trialMode || this.mode.isBeta) && this.leftMenu.setDeveloperMode(this.mode.trialMode, this.mode.isBeta, this.mode.buildVersion);
 | 
			
		||||
 | 
			
		||||
            this.onChangeProtectDocument();
 | 
			
		||||
            Common.util.Shortcuts.resumeEvents();
 | 
			
		||||
            return this;
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			@ -582,14 +582,13 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
 | 
			
		||||
        setPreviewMode: function(mode) {
 | 
			
		||||
            this._state.viewmode = mode;
 | 
			
		||||
            this._state.disableEditing = mode;
 | 
			
		||||
            this.updatePreviewMode();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        updatePreviewMode: function() {
 | 
			
		||||
            var lockMode = this._state.docProtection ? this._state.docProtection.lockMode : undefined;
 | 
			
		||||
            lockMode = (lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Forms);
 | 
			
		||||
            var viewmode = this._state.viewmode || lockMode;
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection', {});
 | 
			
		||||
            var viewmode = this._state.disableEditing || !!docProtection.isReadOnly || !!docProtection.isFormsOnly;
 | 
			
		||||
            if (this.viewmode === viewmode) return;
 | 
			
		||||
            this.viewmode = viewmode;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -896,15 +895,14 @@ define([
 | 
			
		|||
            return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
        onChangeProtectDocument: function() {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection');
 | 
			
		||||
            if (!docProtection) {
 | 
			
		||||
                var cntrl = this.getApplication().getController('DocProtection');
 | 
			
		||||
                docProtection = cntrl ? cntrl.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            if (props) {
 | 
			
		||||
                this._state.docProtection = props;
 | 
			
		||||
            if (docProtection)
 | 
			
		||||
                this.updatePreviewMode();
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        textNoTextFound         : 'Text not found',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,6 +94,7 @@ define([
 | 
			
		|||
            Common.Gateway.on('setactionlink', function (url) {
 | 
			
		||||
                console.log('url with actions: ' + url);
 | 
			
		||||
            }.bind(this));
 | 
			
		||||
            Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        setApi: function (api) {
 | 
			
		||||
| 
						 | 
				
			
			@ -573,18 +574,28 @@ define([
 | 
			
		|||
            })).show();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
        onChangeProtectDocument: function() {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection');
 | 
			
		||||
            if (!docProtection) {
 | 
			
		||||
                var cntrl = this.getApplication().getController('DocProtection');
 | 
			
		||||
                docProtection = cntrl ? cntrl.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            if (props) {
 | 
			
		||||
                this._state.docProtection = props;
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockView, props.docLock && (props.lockMode===Asc.c_oAscProtection.View));
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockForms, props.docLock && (props.lockMode===Asc.c_oAscProtection.Forms));
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockReview, props.docLock && (props.lockMode===Asc.c_oAscProtection.Review));
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockComments, props.docLock && (props.lockMode===Asc.c_oAscProtection.Comments));
 | 
			
		||||
            if (docProtection) {
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockView, docProtection.isReadOnly);
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockForms, docProtection.isFormsOnly);
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockReview, docProtection.isReviewOnly);
 | 
			
		||||
                this.lockToolbar(Common.enumLock.docLockComments, docProtection.isCommentsOnly);
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onAppReady: function (config) {
 | 
			
		||||
            var me = this;
 | 
			
		||||
            (new Promise(function (accept, reject) {
 | 
			
		||||
                accept();
 | 
			
		||||
            })).then(function(){
 | 
			
		||||
                me.view && me.view.onAppReady(config);
 | 
			
		||||
                me.onChangeProtectDocument();
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }, DE.Controllers.Links || {}));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -98,7 +98,6 @@ define([
 | 
			
		|||
                this.api.asc_registerCallback('asc_onImgWrapStyleChanged', this.onApiWrappingStyleChanged.bind(this));
 | 
			
		||||
                this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', this.onApiCoAuthoringDisconnect.bind(this));
 | 
			
		||||
                this.api.asc_registerCallback('asc_onFocusObject', this.onApiFocusObject.bind(this));
 | 
			
		||||
                Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
 | 
			
		||||
                return this;
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -255,20 +254,6 @@ define([
 | 
			
		|||
 | 
			
		||||
                this.api.ImgApply(props);
 | 
			
		||||
                this.toolbar.fireEvent('editcomplete', this.toolbar);
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
            onChangeProtectDocument: function(props) {
 | 
			
		||||
                if (!props) {
 | 
			
		||||
                    var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                    props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
                }
 | 
			
		||||
                if (props) {
 | 
			
		||||
                    this._state.docProtection = props;
 | 
			
		||||
                    this.toolbar.lockToolbar(Common.enumLock.docLockView, props.docLock && (props.lockMode===Asc.c_oAscProtection.View));
 | 
			
		||||
                    this.toolbar.lockToolbar(Common.enumLock.docLockForms, props.docLock && (props.lockMode===Asc.c_oAscProtection.Forms));
 | 
			
		||||
                    this.toolbar.lockToolbar(Common.enumLock.docLockReview, props.docLock && (props.lockMode===Asc.c_oAscProtection.Review));
 | 
			
		||||
                    this.toolbar.lockToolbar(Common.enumLock.docLockComments, props.docLock && (props.lockMode===Asc.c_oAscProtection.Comments));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    })());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,8 +158,8 @@ define([
 | 
			
		|||
 | 
			
		||||
            var isChart = false,
 | 
			
		||||
                isSmartArtInternal = false,
 | 
			
		||||
                lockMode = this._state.docProtection ? this._state.docProtection.lockMode : undefined;
 | 
			
		||||
            lockMode = (lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Forms || lockMode===Asc.c_oAscProtection.Comments);
 | 
			
		||||
                docProtection = Common.Utils.Store.get('docProtection', {}),
 | 
			
		||||
                isProtected = !!docProtection.isReadOnly || !!docProtection.isFormsOnly || !!docProtection.isCommentsOnly;
 | 
			
		||||
 | 
			
		||||
            var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
 | 
			
		||||
                control_lock = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -189,7 +189,7 @@ define([
 | 
			
		|||
                        if (value.get_ShapeProperties().asc_getTextArtProperties()) {
 | 
			
		||||
                            this._settings[Common.Utils.documentSettingsType.TextArt].props = value;
 | 
			
		||||
                            this._settings[Common.Utils.documentSettingsType.TextArt].hidden = 0;
 | 
			
		||||
                            this._settings[Common.Utils.documentSettingsType.TextArt].locked = value.get_Locked() || content_locked || lockMode;
 | 
			
		||||
                            this._settings[Common.Utils.documentSettingsType.TextArt].locked = value.get_Locked() || content_locked || isProtected;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    control_lock = control_lock || value.get_Locked();
 | 
			
		||||
| 
						 | 
				
			
			@ -201,11 +201,11 @@ define([
 | 
			
		|||
                }
 | 
			
		||||
                this._settings[settingsType].props = value;
 | 
			
		||||
                this._settings[settingsType].hidden = 0;
 | 
			
		||||
                this._settings[settingsType].locked = value.get_Locked() || content_locked || lockMode;
 | 
			
		||||
                this._settings[settingsType].locked = value.get_Locked() || content_locked || isProtected;
 | 
			
		||||
                if (!this._settings[Common.Utils.documentSettingsType.MailMerge].locked) // lock MailMerge-InsertField, если хотя бы один объект locked
 | 
			
		||||
                    this._settings[Common.Utils.documentSettingsType.MailMerge].locked = value.get_Locked() || lockMode;
 | 
			
		||||
                    this._settings[Common.Utils.documentSettingsType.MailMerge].locked = value.get_Locked() || isProtected;
 | 
			
		||||
                if (!this._settings[Common.Utils.documentSettingsType.Signature].locked) // lock Signature, если хотя бы один объект locked
 | 
			
		||||
                    this._settings[Common.Utils.documentSettingsType.Signature].locked = value.get_Locked() || lockMode;
 | 
			
		||||
                    this._settings[Common.Utils.documentSettingsType.Signature].locked = value.get_Locked() || isProtected;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (control_props && control_props.get_FormPr() && this.rightmenu.formSettings) {
 | 
			
		||||
| 
						 | 
				
			
			@ -214,7 +214,7 @@ define([
 | 
			
		|||
                    spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.None) {
 | 
			
		||||
                    settingsType = Common.Utils.documentSettingsType.Form;
 | 
			
		||||
                    this._settings[settingsType].props = control_props;
 | 
			
		||||
                    this._settings[settingsType].locked = control_lock || lockMode;
 | 
			
		||||
                    this._settings[settingsType].locked = control_lock || isProtected;
 | 
			
		||||
                    this._settings[settingsType].hidden = 0;
 | 
			
		||||
                    if (control_props.get_FormPr().get_Fixed())
 | 
			
		||||
                        this._settings[Common.Utils.documentSettingsType.TextArt].hidden = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -358,7 +358,6 @@ define([
 | 
			
		|||
                }
 | 
			
		||||
                this.api.asc_registerCallback('asc_onError',             _.bind(this.onError, this));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (this.editMode && this.api) {
 | 
			
		||||
                // this.rightmenu.shapeSettings.createDelayedElements();
 | 
			
		||||
                var selectedElements = this.api.getSelectedElements();
 | 
			
		||||
| 
						 | 
				
			
			@ -366,6 +365,7 @@ define([
 | 
			
		|||
                    this.onFocusObject(selectedElements);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            this.onChangeProtectDocument();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onDoubleClickOnObject: function(obj) {
 | 
			
		||||
| 
						 | 
				
			
			@ -472,17 +472,17 @@ define([
 | 
			
		|||
            }
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
        onChangeProtectDocument: function() {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection');
 | 
			
		||||
            if (!docProtection) {
 | 
			
		||||
                var cntrl = this.getApplication().getController('DocProtection');
 | 
			
		||||
                docProtection = cntrl ? cntrl.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            if (props) {
 | 
			
		||||
                this._state.docProtection = props;
 | 
			
		||||
            if (docProtection && this.api) {
 | 
			
		||||
                var selectedElements = this.api.getSelectedElements();
 | 
			
		||||
                if (selectedElements.length > 0)
 | 
			
		||||
                    this.onFocusObject(selectedElements);
 | 
			
		||||
            }
 | 
			
		||||
            var selectedElements = this.api.getSelectedElements();
 | 
			
		||||
            if (selectedElements.length > 0)
 | 
			
		||||
                this.onFocusObject(selectedElements);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +122,6 @@ define([
 | 
			
		|||
                    me.statusbar.$el.find('.hide-select-tools').removeClass('hide-select-tools');
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
 | 
			
		||||
            Common.NotificationCenter.on('app:ready', me.onAppReady.bind(me));
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -358,14 +357,6 @@ define([
 | 
			
		|||
            }
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            props && this.statusbar.onChangeProtectDocument(props);
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        zoomText        : 'Zoom {0}%',
 | 
			
		||||
        textHasChanges  : 'New changes have been tracked',
 | 
			
		||||
        textTrackChanges: 'The document is opened with the Track Changes mode enabled',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3162,6 +3162,7 @@ define([
 | 
			
		|||
        createDelayedElements: function() {
 | 
			
		||||
            this.toolbar.createDelayedElements();
 | 
			
		||||
            this.attachUIEvents(this.toolbar);
 | 
			
		||||
            this.onChangeProtectDocument();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onAppShowed: function (config) {
 | 
			
		||||
| 
						 | 
				
			
			@ -3332,17 +3333,17 @@ define([
 | 
			
		|||
            })).show();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onChangeProtectDocument: function(props) {
 | 
			
		||||
            if (!props) {
 | 
			
		||||
                var docprotect = this.getApplication().getController('DocProtection');
 | 
			
		||||
                props = docprotect ? docprotect.getDocProps() : null;
 | 
			
		||||
        onChangeProtectDocument: function() {
 | 
			
		||||
            var docProtection = Common.Utils.Store.get('docProtection');
 | 
			
		||||
            if (!docProtection) {
 | 
			
		||||
                var cntrl = this.getApplication().getController('DocProtection');
 | 
			
		||||
                docProtection = cntrl ? cntrl.getDocProps() : null;
 | 
			
		||||
            }
 | 
			
		||||
            if (props) {
 | 
			
		||||
                this._state.docProtection = props;
 | 
			
		||||
                this.toolbar.lockToolbar(Common.enumLock.docLockView, props.docLock && (props.lockMode===Asc.c_oAscProtection.View));
 | 
			
		||||
                this.toolbar.lockToolbar(Common.enumLock.docLockForms, props.docLock && (props.lockMode===Asc.c_oAscProtection.Forms));
 | 
			
		||||
                this.toolbar.lockToolbar(Common.enumLock.docLockReview, props.docLock && (props.lockMode===Asc.c_oAscProtection.Review));
 | 
			
		||||
                this.toolbar.lockToolbar(Common.enumLock.docLockComments, props.docLock && (props.lockMode===Asc.c_oAscProtection.Comments));
 | 
			
		||||
            if (docProtection) {
 | 
			
		||||
                this.toolbar.lockToolbar(Common.enumLock.docLockView, docProtection.isReadOnly);
 | 
			
		||||
                this.toolbar.lockToolbar(Common.enumLock.docLockForms, docProtection.isFormsOnly);
 | 
			
		||||
                this.toolbar.lockToolbar(Common.enumLock.docLockReview, docProtection.isReviewOnly);
 | 
			
		||||
                this.toolbar.lockToolbar(Common.enumLock.docLockComments, docProtection.isCommentsOnly);
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -152,7 +152,7 @@ define([
 | 
			
		|||
                        signGuid = (value.imgProps && value.imgProps.value && me.mode.isSignatureSupport) ? value.imgProps.value.asc_getSignatureId() : undefined,
 | 
			
		||||
                        signProps = (signGuid) ? me.api.asc_getSignatureSetup(signGuid) : null,
 | 
			
		||||
                        isInSign = !!signProps && me._canProtect,
 | 
			
		||||
                        lockMode = me.docProtection ? me.docProtection.lockMode : undefined,
 | 
			
		||||
                        docProtection = Common.Utils.Store.get('docProtection', {}),
 | 
			
		||||
                        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,
 | 
			
		||||
                        canComment = !isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled && !control_lock,
 | 
			
		||||
| 
						 | 
				
			
			@ -170,7 +170,7 @@ define([
 | 
			
		|||
                    }
 | 
			
		||||
 | 
			
		||||
                    me.menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
 | 
			
		||||
                    me.menuViewUndo.setDisabled(!me.api.asc_getCanUndo() || lockMode===Asc.c_oAscProtection.View);
 | 
			
		||||
                    me.menuViewUndo.setDisabled(!me.api.asc_getCanUndo() || !!docProtection.isReadOnly);
 | 
			
		||||
                    me.menuViewCopySeparator.setVisible(isInSign);
 | 
			
		||||
 | 
			
		||||
                    var isRequested = (signProps) ? signProps.asc_getRequested() : false;
 | 
			
		||||
| 
						 | 
				
			
			@ -188,15 +188,15 @@ define([
 | 
			
		|||
                    }
 | 
			
		||||
 | 
			
		||||
                    me.menuViewAddComment.setVisible(canComment);
 | 
			
		||||
                    me.menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Forms);
 | 
			
		||||
                    me.menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true || !!docProtection.isReadOnly || !!docProtection.isFormsOnly);
 | 
			
		||||
 | 
			
		||||
                    var disabled = value.paraProps && value.paraProps.locked === true;
 | 
			
		||||
                    var cancopy = me.api && me.api.can_CopyCut();
 | 
			
		||||
                    me.menuViewCopy.setDisabled(!cancopy);
 | 
			
		||||
                    me.menuViewCut.setVisible(me._fillFormMode && canEditControl);
 | 
			
		||||
                    me.menuViewCut.setDisabled(disabled || !cancopy || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Comments);
 | 
			
		||||
                    me.menuViewCut.setDisabled(disabled || !cancopy || !!docProtection.isReadOnly || !!docProtection.isCommentsOnly);
 | 
			
		||||
                    me.menuViewPaste.setVisible(me._fillFormMode && canEditControl);
 | 
			
		||||
                    me.menuViewPaste.setDisabled(disabled || lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Comments);
 | 
			
		||||
                    me.menuViewPaste.setDisabled(disabled || !!docProtection.isReadOnly || !!docProtection.isCommentsOnly);
 | 
			
		||||
                    me.menuViewPrint.setVisible(me.mode.canPrint && !me._fillFormMode);
 | 
			
		||||
                    me.menuViewPrint.setDisabled(!cancopy);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -269,7 +269,6 @@ define([
 | 
			
		|||
                this.paragraphControls.push(this.btnTableFiguresUpdate);
 | 
			
		||||
                Common.Utils.lockControls(Common.enumLock.disableOnStart, true, {array: this.paragraphControls});
 | 
			
		||||
                this._state = {disabled: false};
 | 
			
		||||
                Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
            render: function (el) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -160,6 +160,8 @@ define([
 | 
			
		|||
            me.zoomMenu.on('item:click', function(menu, item) {
 | 
			
		||||
                me.fireEvent('zoom:value', [item.value]);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            me.onChangeProtectDocument();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        DE.Views.Statusbar = Backbone.View.extend(_.extend({
 | 
			
		||||
| 
						 | 
				
			
			@ -334,6 +336,7 @@ define([
 | 
			
		|||
                    this.api.asc_registerCallback('asc_onCurrentPage',  _.bind(_onCurrentPage, this));
 | 
			
		||||
                    this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
 | 
			
		||||
                    Common.NotificationCenter.on('api:disconnect',      _.bind(this.onApiCoAuthoringDisconnect, this));
 | 
			
		||||
                    Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return this;
 | 
			
		||||
| 
						 | 
				
			
			@ -401,17 +404,20 @@ define([
 | 
			
		|||
 | 
			
		||||
            SetDisabled: function(disable) {
 | 
			
		||||
                this._isDisabled = disable;
 | 
			
		||||
                var lockMode = this._state.docProtection ? this._state.docProtection.lockMode : undefined;
 | 
			
		||||
                lockMode = (lockMode===Asc.c_oAscProtection.View || lockMode===Asc.c_oAscProtection.Forms || lockMode===Asc.c_oAscProtection.Comments);
 | 
			
		||||
                this.btnLanguage.setDisabled(disable || this.langMenu.items.length<1 || lockMode);
 | 
			
		||||
                this.btnTurnReview && this.btnTurnReview.setDisabled(disable || lockMode);
 | 
			
		||||
                var docProtection = Common.Utils.Store.get('docProtection', {}),
 | 
			
		||||
                    isProtected = !!docProtection.isReadOnly || !!docProtection.isFormsOnly || !!docProtection.isCommentsOnly
 | 
			
		||||
                this.btnLanguage.setDisabled(disable || this.langMenu.items.length<1 || isProtected);
 | 
			
		||||
                this.btnTurnReview && this.btnTurnReview.setDisabled(disable || isProtected);
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
            onChangeProtectDocument: function(props) {
 | 
			
		||||
                if (props) {
 | 
			
		||||
                    this._state.docProtection = props;
 | 
			
		||||
                    this.SetDisabled(this._isDisabled);
 | 
			
		||||
            onChangeProtectDocument: function() {
 | 
			
		||||
                var docProtection = Common.Utils.Store.get('docProtection');
 | 
			
		||||
                if (!docProtection) {
 | 
			
		||||
                    var cntrl = DE.getController('DocProtection');
 | 
			
		||||
                    docProtection = cntrl ? cntrl.getDocProps() : null;
 | 
			
		||||
                }
 | 
			
		||||
                if (docProtection)
 | 
			
		||||
                    this.SetDisabled(this._isDisabled);
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
            onApiCoAuthoringDisconnect: function() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue