Merge pull request #960 from ONLYOFFICE/feature/disable-editing
Feature/disable editing
This commit is contained in:
commit
05c9b13687
|
@ -69,7 +69,7 @@ Common.IrregularStack = function(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var _get = function(obj) {
|
var _get = function(obj) {
|
||||||
var index = _indexOf(obj, _weakCompare);
|
var index = (typeof obj === 'object')? _indexOf(obj, _weakCompare) : obj;
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
return _stack[index];
|
return _stack[index];
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -79,10 +79,15 @@ Common.IrregularStack = function(config) {
|
||||||
return !(_indexOf(obj, _strongCompare) < 0);
|
return !(_indexOf(obj, _strongCompare) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _length = function() {
|
||||||
|
return _stack.length;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
push: _push,
|
push: _push,
|
||||||
pop: _pop,
|
pop: _pop,
|
||||||
get: _get,
|
get: _get,
|
||||||
exist: _exist
|
exist: _exist,
|
||||||
|
length: _length
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -728,25 +728,26 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disable) {
|
disableEditing: function(disable) {
|
||||||
var app = this.getApplication();
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
app.getController('Toolbar').DisableToolbar(disable, false, true);
|
viewMode: false,
|
||||||
app.getController('DocumentHolder').getView().SetDisabled(disable);
|
reviewMode: true,
|
||||||
|
fillFormwMode: false,
|
||||||
if (this.appConfig.canReview) {
|
allowMerge: false,
|
||||||
app.getController('RightMenu').getView('RightMenu').clearSelection();
|
allowSignature: false,
|
||||||
app.getController('RightMenu').SetDisabled(disable, false);
|
allowProtect: false,
|
||||||
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
rightMenu: {clear: true, disable: true},
|
||||||
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
|
statusBar: true,
|
||||||
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
|
leftMenu: {disable: false, previewMode: true},
|
||||||
}
|
fileMenu: {protect: true},
|
||||||
|
navigation: {disable: false, previewMode: true},
|
||||||
var comments = app.getController('Common.Controllers.Comments');
|
comments: {disable: false, previewMode: true},
|
||||||
if (comments)
|
chat: false,
|
||||||
comments.setPreviewMode(disable);
|
review: false,
|
||||||
|
viewport: false,
|
||||||
var leftMenu = app.getController('LeftMenu');
|
documentHolder: true,
|
||||||
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
|
toolbar: true,
|
||||||
leftMenu.setPreviewMode(disable);
|
plugins: true
|
||||||
|
}, 'review');
|
||||||
|
|
||||||
if (this.view) {
|
if (this.view) {
|
||||||
this.view.$el.find('.no-group-mask.review').css('opacity', 1);
|
this.view.$el.find('.no-group-mask.review').css('opacity', 1);
|
||||||
|
|
|
@ -253,19 +253,26 @@ define([
|
||||||
if (this._state.DisabledEditing != disable) {
|
if (this._state.DisabledEditing != disable) {
|
||||||
this._state.DisabledEditing = disable;
|
this._state.DisabledEditing = disable;
|
||||||
|
|
||||||
var app = this.getApplication();
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
var rightMenuController = app.getController('RightMenu');
|
viewMode: false,
|
||||||
rightMenuController.getView('RightMenu').clearSelection();
|
reviewMode: false,
|
||||||
rightMenuController.SetDisabled(disable);
|
fillFormwMode: true,
|
||||||
app.getController('Toolbar').DisableToolbar(disable, false, false, true);
|
allowMerge: false,
|
||||||
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
allowSignature: false,
|
||||||
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
allowProtect: false,
|
||||||
app.getController('DocumentHolder').getView().SetDisabled(disable);
|
rightMenu: {clear: true, disable: true},
|
||||||
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
|
statusBar: true,
|
||||||
app.getController('LeftMenu').setPreviewMode(disable);
|
leftMenu: {disable: false, previewMode: true},
|
||||||
var comments = app.getController('Common.Controllers.Comments');
|
fileMenu: false,
|
||||||
if (comments)
|
navigation: {disable: false, previewMode: true},
|
||||||
comments.setPreviewMode(disable);
|
comments: {disable: false, previewMode: true},
|
||||||
|
chat: false,
|
||||||
|
review: true,
|
||||||
|
viewport: false,
|
||||||
|
documentHolder: true,
|
||||||
|
toolbar: true,
|
||||||
|
plugins: false
|
||||||
|
}, 'forms');
|
||||||
if (this.view)
|
if (this.view)
|
||||||
this.view.$el.find('.no-group-mask.form-view').css('opacity', 1);
|
this.view.$el.find('.no-group-mask.form-view').css('opacity', 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -666,21 +666,29 @@ define([
|
||||||
this.dlgSearch && this.dlgSearch.setMode(this.viewmode ? 'no-replace' : 'search');
|
this.dlgSearch && this.dlgSearch.setMode(this.viewmode ? 'no-replace' : 'search');
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disable, disableFileMenu) {
|
SetDisabled: function(disable, options) {
|
||||||
this.mode.isEdit = !disable;
|
if (this.leftMenu._state.disabled !== disable) {
|
||||||
|
this.leftMenu._state.disabled = disable;
|
||||||
|
if (disable) {
|
||||||
|
this.previsEdit = this.mode.isEdit;
|
||||||
|
this.prevcanEdit = this.mode.canEdit;
|
||||||
|
this.mode.isEdit = this.mode.canEdit = !disable;
|
||||||
|
} else {
|
||||||
|
this.mode.isEdit = this.previsEdit;
|
||||||
|
this.mode.canEdit = this.prevcanEdit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (disable) this.leftMenu.close();
|
if (disable) this.leftMenu.close();
|
||||||
|
|
||||||
/** coauthoring begin **/
|
if (!options || options.comments && options.comments.disable)
|
||||||
this.leftMenu.btnComments.setDisabled(disable);
|
this.leftMenu.btnComments.setDisabled(disable);
|
||||||
var comments = this.getApplication().getController('Common.Controllers.Comments');
|
if (!options || options.chat)
|
||||||
if (comments)
|
this.leftMenu.btnChat.setDisabled(disable);
|
||||||
comments.setPreviewMode(disable);
|
if (!options || options.navigation && options.navigation.disable)
|
||||||
this.setPreviewMode(disable);
|
this.leftMenu.btnNavigation.setDisabled(disable);
|
||||||
this.leftMenu.btnChat.setDisabled(disable);
|
|
||||||
/** coauthoring end **/
|
|
||||||
this.leftMenu.btnPlugins.setDisabled(disable);
|
this.leftMenu.btnPlugins.setDisabled(disable);
|
||||||
this.leftMenu.btnNavigation.setDisabled(disable);
|
|
||||||
if (disableFileMenu) this.leftMenu.getMenu('file').SetDisabled(disable);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
|
|
|
@ -161,6 +161,11 @@ define([
|
||||||
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.stackDisableActions = new Common.IrregularStack({
|
||||||
|
strongCompare : function(obj1, obj2){return obj1.type === obj2.type;},
|
||||||
|
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||||
|
});
|
||||||
|
|
||||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false, isDocModified: false};
|
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false, isDocModified: false};
|
||||||
this.languages = null;
|
this.languages = null;
|
||||||
|
|
||||||
|
@ -213,7 +218,7 @@ define([
|
||||||
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
||||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||||
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||||
|
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
|
||||||
|
|
||||||
this.isShowOpenDialog = false;
|
this.isShowOpenDialog = false;
|
||||||
|
|
||||||
|
@ -704,18 +709,84 @@ define([
|
||||||
return"#"+("000000"+color.toString(16)).substr(-6);
|
return"#"+("000000"+color.toString(16)).substr(-6);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disableEditing: function(disable, temp) {
|
||||||
disableEditing: function(disable) {
|
|
||||||
var app = this.getApplication();
|
var app = this.getApplication();
|
||||||
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
app.getController('RightMenu').getView('RightMenu').clearSelection();
|
viewMode: disable,
|
||||||
app.getController('RightMenu').SetDisabled(disable, false);
|
reviewMode: false,
|
||||||
|
fillFormwMode: false,
|
||||||
|
allowMerge: false,
|
||||||
|
allowSignature: false,
|
||||||
|
allowProtect: false,
|
||||||
|
rightMenu: {clear: true, disable: true},
|
||||||
|
statusBar: true,
|
||||||
|
leftMenu: {disable: true, previewMode: true},
|
||||||
|
fileMenu: {protect: true, history: temp},
|
||||||
|
navigation: {disable: !temp, previewMode: true},
|
||||||
|
comments: {disable: !temp, previewMode: true},
|
||||||
|
chat: true,
|
||||||
|
review: true,
|
||||||
|
viewport: true,
|
||||||
|
documentHolder: true,
|
||||||
|
toolbar: true,
|
||||||
|
plugins: false
|
||||||
|
}, temp ? 'reconnect' : 'disconnect');
|
||||||
|
},
|
||||||
|
|
||||||
|
onEditingDisable: function(disable, options, type) {
|
||||||
|
var app = this.getApplication();
|
||||||
|
|
||||||
|
var action = {type: type, disable: disable, options: options};
|
||||||
|
if (disable && !this.stackDisableActions.get({type: type}))
|
||||||
|
this.stackDisableActions.push(action);
|
||||||
|
!disable && this.stackDisableActions.pop({type: type});
|
||||||
|
var prev_options = !disable && (this.stackDisableActions.length()>0) ? this.stackDisableActions.get(this.stackDisableActions.length()-1) : null;
|
||||||
|
|
||||||
|
if (options.rightMenu && app.getController('RightMenu')) {
|
||||||
|
options.rightMenu.clear && app.getController('RightMenu').getView('RightMenu').clearSelection();
|
||||||
|
options.rightMenu.disable && app.getController('RightMenu').SetDisabled(disable, options.allowMerge, options.allowSignature);
|
||||||
|
}
|
||||||
|
if (options.statusBar) {
|
||||||
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
||||||
}
|
}
|
||||||
app.getController('LeftMenu').SetDisabled(disable, true);
|
if (options.review) {
|
||||||
app.getController('Toolbar').DisableToolbar(disable, disable);
|
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||||
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
}
|
||||||
app.getController('Viewport').SetDisabled(disable);
|
if (options.viewport) {
|
||||||
|
app.getController('Viewport').SetDisabled(disable);
|
||||||
|
}
|
||||||
|
if (options.toolbar) {
|
||||||
|
app.getController('Toolbar').DisableToolbar(disable, options.viewMode, options.reviewMode, options.fillFormwMode);
|
||||||
|
}
|
||||||
|
if (options.documentHolder) {
|
||||||
|
app.getController('DocumentHolder').getView().SetDisabled(disable, options.allowProtect);
|
||||||
|
}
|
||||||
|
if (options.leftMenu) {
|
||||||
|
if (options.leftMenu.disable)
|
||||||
|
app.getController('LeftMenu').SetDisabled(disable, options);
|
||||||
|
if (options.leftMenu.previewMode)
|
||||||
|
app.getController('LeftMenu').setPreviewMode(disable);
|
||||||
|
}
|
||||||
|
if (options.fileMenu) {
|
||||||
|
app.getController('LeftMenu').leftMenu.getMenu('file').SetDisabled(disable, options.fileMenu);
|
||||||
|
if (options.leftMenu.disable)
|
||||||
|
app.getController('LeftMenu').leftMenu.getMenu('file').applyMode();
|
||||||
|
}
|
||||||
|
if (options.comments) {
|
||||||
|
var comments = this.getApplication().getController('Common.Controllers.Comments');
|
||||||
|
if (comments && options.comments.previewMode)
|
||||||
|
comments.setPreviewMode(disable);
|
||||||
|
}
|
||||||
|
if (options.navigation && options.navigation.previewMode) {
|
||||||
|
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
|
||||||
|
}
|
||||||
|
if (options.plugins) {
|
||||||
|
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prev_options) {
|
||||||
|
this.onEditingDisable(prev_options.disable, prev_options.options, prev_options.type);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onRequestClose: function() {
|
onRequestClose: function() {
|
||||||
|
@ -845,6 +916,10 @@ define([
|
||||||
Common.Utils.InternalSettings.get("de-settings-livecomment") ? this.api.asc_showComments(Common.Utils.InternalSettings.get("de-settings-resolvedcomment")) : this.api.asc_hideComments();
|
Common.Utils.InternalSettings.get("de-settings-livecomment") ? this.api.asc_showComments(Common.Utils.InternalSettings.get("de-settings-resolvedcomment")) : this.api.asc_hideComments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
|
||||||
|
this.disableEditing(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
if ( type == Asc.c_oAscAsyncActionType.BlockInteraction &&
|
if ( type == Asc.c_oAscAsyncActionType.BlockInteraction &&
|
||||||
(!this.getApplication().getController('LeftMenu').dlgSearch || !this.getApplication().getController('LeftMenu').dlgSearch.isVisible()) &&
|
(!this.getApplication().getController('LeftMenu').dlgSearch || !this.getApplication().getController('LeftMenu').dlgSearch.isVisible()) &&
|
||||||
(!this.getApplication().getController('Toolbar').dlgSymbolTable || !this.getApplication().getController('Toolbar').dlgSymbolTable.isVisible()) &&
|
(!this.getApplication().getController('Toolbar').dlgSymbolTable || !this.getApplication().getController('Toolbar').dlgSymbolTable.isVisible()) &&
|
||||||
|
@ -945,6 +1020,12 @@ define([
|
||||||
title = this.loadingDocumentTitleText + ' ';
|
title = this.loadingDocumentTitleText + ' ';
|
||||||
text = this.loadingDocumentTextText;
|
text = this.loadingDocumentTextText;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['Disconnect']:
|
||||||
|
text = this.textDisconnect;
|
||||||
|
this.disableEditing(true, true);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (typeof action.id == 'string'){
|
if (typeof action.id == 'string'){
|
||||||
title = action.id;
|
title = action.id;
|
||||||
|
@ -2425,17 +2506,7 @@ define([
|
||||||
warningDocumentIsLocked: function() {
|
warningDocumentIsLocked: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var _disable_ui = function (disable) {
|
var _disable_ui = function (disable) {
|
||||||
me.disableEditing(disable);
|
me.disableEditing(disable, true);
|
||||||
var app = me.getApplication();
|
|
||||||
app.getController('DocumentHolder').getView().SetDisabled(disable);
|
|
||||||
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
|
|
||||||
|
|
||||||
var leftMenu = app.getController('LeftMenu');
|
|
||||||
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
|
|
||||||
leftMenu.setPreviewMode(disable);
|
|
||||||
|
|
||||||
var comments = app.getController('Common.Controllers.Comments');
|
|
||||||
if (comments) comments.setPreviewMode(disable);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Common.Utils.warningDocumentIsLocked({disablefunc: _disable_ui});
|
Common.Utils.warningDocumentIsLocked({disablefunc: _disable_ui});
|
||||||
|
@ -2922,7 +2993,8 @@ define([
|
||||||
txtNoTableOfFigures: "No table of figures entries found.",
|
txtNoTableOfFigures: "No table of figures entries found.",
|
||||||
txtTableOfFigures: 'Table of figures',
|
txtTableOfFigures: 'Table of figures',
|
||||||
txtStyle_endnote_text: 'Endnote Text',
|
txtStyle_endnote_text: 'Endnote Text',
|
||||||
txtTOCHeading: 'TOC Heading'
|
txtTOCHeading: 'TOC Heading',
|
||||||
|
textDisconnect: 'Connection is lost'
|
||||||
}
|
}
|
||||||
})(), DE.Controllers.Main || {}))
|
})(), DE.Controllers.Main || {}))
|
||||||
});
|
});
|
|
@ -182,6 +182,10 @@ define([
|
||||||
caption : this.btnHistoryCaption,
|
caption : this.btnHistoryCaption,
|
||||||
canFocused: false
|
canFocused: false
|
||||||
});
|
});
|
||||||
|
if ( !!this.options.miHistory ) {
|
||||||
|
this.miHistory.setDisabled(this.options.miHistory.isDisabled());
|
||||||
|
delete this.options.miHistory;
|
||||||
|
}
|
||||||
|
|
||||||
this.miHelp = new Common.UI.MenuItem({
|
this.miHelp = new Common.UI.MenuItem({
|
||||||
el : $markup.elementById('#fm-btn-help'),
|
el : $markup.elementById('#fm-btn-help'),
|
||||||
|
@ -271,6 +275,8 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
applyMode: function() {
|
applyMode: function() {
|
||||||
|
if (!this.rendered) return;
|
||||||
|
|
||||||
if (!this.panels) {
|
if (!this.panels) {
|
||||||
this.panels = {
|
this.panels = {
|
||||||
'opts' : (new DE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')),
|
'opts' : (new DE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')),
|
||||||
|
@ -363,8 +369,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!delay) {
|
if (!delay) {
|
||||||
if ( this.rendered )
|
this.applyMode();
|
||||||
this.applyMode();
|
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
@ -411,14 +416,12 @@ define([
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disable) {
|
SetDisabled: function(disable, options) {
|
||||||
var _btn_save = this.getButton('save'),
|
var _btn_protect = this.getButton('protect'),
|
||||||
_btn_rename = this.getButton('rename'),
|
_btn_history = this.getButton('history');
|
||||||
_btn_protect = this.getButton('protect');
|
|
||||||
|
|
||||||
_btn_save[(disable || !this.mode.isEdit)?'hide':'show']();
|
options && options.protect && _btn_protect.setDisabled(disable);
|
||||||
_btn_protect[(disable || !this.mode.isEdit)?'hide':'show']();
|
options && options.history && _btn_history.setDisabled(disable);
|
||||||
_btn_rename[(disable || !this.mode.canRename || this.mode.isDesktopApp) ?'hide':'show']();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isVisible: function () {
|
isVisible: function () {
|
||||||
|
@ -435,6 +438,9 @@ define([
|
||||||
} else
|
} else
|
||||||
if (type == 'protect') {
|
if (type == 'protect') {
|
||||||
return this.options.miProtect ? this.options.miProtect : (this.options.miProtect = new Common.UI.MenuItem({}));
|
return this.options.miProtect ? this.options.miProtect : (this.options.miProtect = new Common.UI.MenuItem({}));
|
||||||
|
} else
|
||||||
|
if (type == 'history') {
|
||||||
|
return this.options.miHistory ? this.options.miHistory : (this.options.miHistory = new Common.UI.MenuItem({}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (type == 'save') {
|
if (type == 'save') {
|
||||||
|
@ -445,6 +451,9 @@ define([
|
||||||
}else
|
}else
|
||||||
if (type == 'protect') {
|
if (type == 'protect') {
|
||||||
return this.miProtect;
|
return this.miProtect;
|
||||||
|
}else
|
||||||
|
if (type == 'history') {
|
||||||
|
return this.miHistory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -86,7 +86,7 @@ define([
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.minimizedMode = true;
|
this.minimizedMode = true;
|
||||||
this._state = {};
|
this._state = {disabled: false};
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
|
|
|
@ -799,18 +799,26 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disable) {
|
disableEditing: function(disable) {
|
||||||
DE.getController('Toolbar').DisableToolbar(disable, disable);
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
DE.getController('RightMenu').SetDisabled(disable, true);
|
viewMode: disable,
|
||||||
DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
reviewMode: false,
|
||||||
DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
fillFormwMode: false,
|
||||||
DE.getController('DocumentHolder').getView().SetDisabled(disable);
|
allowMerge: true,
|
||||||
DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable);
|
allowSignature: false,
|
||||||
|
allowProtect: false,
|
||||||
var comments = DE.getController('Common.Controllers.Comments');
|
rightMenu: {clear: false, disable: true},
|
||||||
if (comments)
|
statusBar: true,
|
||||||
comments.setPreviewMode(disable);
|
leftMenu: {disable: false, previewMode: true},
|
||||||
|
fileMenu: false,
|
||||||
DE.getController('LeftMenu').setPreviewMode(disable);
|
navigation: {disable: false, previewMode: true},
|
||||||
|
comments: {disable: false, previewMode: true},
|
||||||
|
chat: false,
|
||||||
|
review: true,
|
||||||
|
viewport: false,
|
||||||
|
documentHolder: true,
|
||||||
|
toolbar: true,
|
||||||
|
plugins: false
|
||||||
|
}, 'mailmerge');
|
||||||
|
|
||||||
this.lockControls(DE.enumLockMM.preview, disable, {array: [this.btnInsField, this.btnEditData]});
|
this.lockControls(DE.enumLockMM.preview, disable, {array: [this.btnInsField, this.btnEditData]});
|
||||||
},
|
},
|
||||||
|
|
|
@ -393,22 +393,26 @@ define([
|
||||||
if (this._state.DisabledEditing != disable) {
|
if (this._state.DisabledEditing != disable) {
|
||||||
this._state.DisabledEditing = disable;
|
this._state.DisabledEditing = disable;
|
||||||
|
|
||||||
var rightMenuController = DE.getController('RightMenu');
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
if (disable && rightMenuController.rightmenu.GetActivePane() !== 'id-signature-settings')
|
viewMode: disable,
|
||||||
rightMenuController.rightmenu.clearSelection();
|
reviewMode: false,
|
||||||
rightMenuController.SetDisabled(disable, false, true);
|
fillFormwMode: false,
|
||||||
DE.getController('Toolbar').DisableToolbar(disable, disable);
|
allowMerge: false,
|
||||||
DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
allowSignature: true,
|
||||||
DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
allowProtect: true,
|
||||||
DE.getController('DocumentHolder').getView().SetDisabled(disable, true);
|
rightMenu: {clear: disable && (DE.getController('RightMenu').rightmenu.GetActivePane() !== 'id-signature-settings'), disable: true},
|
||||||
DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable);
|
statusBar: true,
|
||||||
|
leftMenu: {disable: false, previewMode: true},
|
||||||
// var leftMenu = DE.getController('LeftMenu').leftMenu;
|
fileMenu: false,
|
||||||
// leftMenu.btnComments.setDisabled(disable);
|
navigation: {disable: false, previewMode: true},
|
||||||
DE.getController('LeftMenu').setPreviewMode(disable);
|
comments: {disable: false, previewMode: true},
|
||||||
var comments = DE.getController('Common.Controllers.Comments');
|
chat: false,
|
||||||
if (comments)
|
review: true,
|
||||||
comments.setPreviewMode(disable);
|
viewport: false,
|
||||||
|
documentHolder: true,
|
||||||
|
toolbar: true,
|
||||||
|
plugins: false
|
||||||
|
}, 'signature');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -768,21 +768,28 @@ define([
|
||||||
Common.Gateway.requestHistory();
|
Common.Gateway.requestHistory();
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disable, disableFileMenu) {
|
SetDisabled: function(disable, options) {
|
||||||
this.mode.isEdit = !disable;
|
if (this.leftMenu._state.disabled !== disable) {
|
||||||
|
this.leftMenu._state.disabled = disable;
|
||||||
|
if (disable) {
|
||||||
|
this.previsEdit = this.mode.isEdit;
|
||||||
|
this.prevcanEdit = this.mode.canEdit;
|
||||||
|
this.mode.isEdit = this.mode.canEdit = !disable;
|
||||||
|
} else {
|
||||||
|
this.mode.isEdit = this.previsEdit;
|
||||||
|
this.mode.canEdit = this.prevcanEdit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (disable) this.leftMenu.close();
|
if (disable) this.leftMenu.close();
|
||||||
|
|
||||||
/** coauthoring begin **/
|
if (!options || options.comments && options.comments.disable)
|
||||||
this.leftMenu.btnComments.setDisabled(disable);
|
this.leftMenu.btnComments.setDisabled(disable);
|
||||||
var comments = this.getApplication().getController('Common.Controllers.Comments');
|
if (!options || options.chat)
|
||||||
if (comments)
|
this.leftMenu.btnChat.setDisabled(disable);
|
||||||
comments.setPreviewMode(disable);
|
|
||||||
this.setPreviewMode(disable);
|
|
||||||
this.leftMenu.btnChat.setDisabled(disable);
|
|
||||||
/** coauthoring end **/
|
|
||||||
this.leftMenu.btnPlugins.setDisabled(disable);
|
this.leftMenu.btnPlugins.setDisabled(disable);
|
||||||
this.leftMenu.btnThumbs.setDisabled(disable);
|
this.leftMenu.btnThumbs.setDisabled(disable);
|
||||||
if (disableFileMenu) this.leftMenu.getMenu('file').SetDisabled(disable);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
textNoTextFound : 'Text not found',
|
textNoTextFound : 'Text not found',
|
||||||
|
|
|
@ -145,7 +145,10 @@ define([
|
||||||
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
|
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
|
||||||
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||||
});
|
});
|
||||||
|
this.stackDisableActions = new Common.IrregularStack({
|
||||||
|
strongCompare : function(obj1, obj2){return obj1.type === obj2.type;},
|
||||||
|
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||||
|
});
|
||||||
// Initialize viewport
|
// Initialize viewport
|
||||||
|
|
||||||
if (!Common.Utils.isBrowserSupported()){
|
if (!Common.Utils.isBrowserSupported()){
|
||||||
|
@ -190,6 +193,7 @@ define([
|
||||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||||
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||||
Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
|
Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
|
||||||
|
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
|
||||||
|
|
||||||
this.isShowOpenDialog = false;
|
this.isShowOpenDialog = false;
|
||||||
|
|
||||||
|
@ -604,7 +608,11 @@ define([
|
||||||
if (this.appOptions.isEdit && (id==Asc.c_oAscAsyncAction['Save'] || id==Asc.c_oAscAsyncAction['ForceSaveButton']) && (!this._state.fastCoauth || this._state.usersCount<2))
|
if (this.appOptions.isEdit && (id==Asc.c_oAscAsyncAction['Save'] || id==Asc.c_oAscAsyncAction['ForceSaveButton']) && (!this._state.fastCoauth || this._state.usersCount<2))
|
||||||
this.synchronizeChanges();
|
this.synchronizeChanges();
|
||||||
|
|
||||||
if (type == Asc.c_oAscAsyncActionType.BlockInteraction && !((id == Asc.c_oAscAsyncAction['LoadDocumentFonts'] || id == Asc.c_oAscAsyncAction['ApplyChanges']) && (this.dontCloseDummyComment || this.inTextareaControl || Common.Utils.ModalWindow.isVisible() || this.inFormControl))) {
|
if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
|
||||||
|
this.disableEditing(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == Asc.c_oAscAsyncActionType.BlockInteraction && !((id == Asc.c_oAscAsyncAction['LoadDocumentFonts'] || id == Asc.c_oAscAsyncAction['ApplyChanges']) && (this.dontCloseDummyComment || this.inTextareaControl || Common.Utils.ModalWindow.isVisible() || this.inFormControl))) {
|
||||||
this.onEditComplete(this.loadMask);
|
this.onEditComplete(this.loadMask);
|
||||||
this.api.asc_enableKeyEvents(true);
|
this.api.asc_enableKeyEvents(true);
|
||||||
}
|
}
|
||||||
|
@ -694,6 +702,12 @@ define([
|
||||||
title = this.loadingDocumentTitleText + ' ';
|
title = this.loadingDocumentTitleText + ' ';
|
||||||
text = this.loadingDocumentTextText;
|
text = this.loadingDocumentTextText;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['Disconnect']:
|
||||||
|
text = this.textDisconnect;
|
||||||
|
this.disableEditing(true, true);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (typeof action.id == 'string'){
|
if (typeof action.id == 'string'){
|
||||||
title = action.id;
|
title = action.id;
|
||||||
|
@ -965,17 +979,71 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disable) {
|
disableEditing: function(disable, temp) {
|
||||||
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
|
viewMode: disable,
|
||||||
|
allowSignature: false,
|
||||||
|
rightMenu: {clear: true, disable: true},
|
||||||
|
statusBar: true,
|
||||||
|
leftMenu: {disable: true, previewMode: true},
|
||||||
|
fileMenu: {protect: true, history: temp},
|
||||||
|
comments: {disable: !temp, previewMode: true},
|
||||||
|
chat: true,
|
||||||
|
review: true,
|
||||||
|
viewport: true,
|
||||||
|
documentHolder: true,
|
||||||
|
toolbar: true
|
||||||
|
}, temp ? 'reconnect' : 'disconnect');
|
||||||
|
},
|
||||||
|
|
||||||
|
onEditingDisable: function(disable, options, type) {
|
||||||
var app = this.getApplication();
|
var app = this.getApplication();
|
||||||
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
|
|
||||||
app.getController('RightMenu').getView('RightMenu').clearSelection();
|
var action = {type: type, disable: disable, options: options};
|
||||||
app.getController('RightMenu').SetDisabled(disable, false);
|
if (disable && !this.stackDisableActions.get({type: type}))
|
||||||
|
this.stackDisableActions.push(action);
|
||||||
|
!disable && this.stackDisableActions.pop({type: type});
|
||||||
|
var prev_options = !disable && (this.stackDisableActions.length()>0) ? this.stackDisableActions.get(this.stackDisableActions.length()-1) : null;
|
||||||
|
|
||||||
|
if (options.rightMenu && app.getController('RightMenu')) {
|
||||||
|
options.rightMenu.clear && app.getController('RightMenu').getView('RightMenu').clearSelection();
|
||||||
|
options.rightMenu.disable && app.getController('RightMenu').SetDisabled(disable, options.allowSignature);
|
||||||
|
}
|
||||||
|
if (options.statusBar) {
|
||||||
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
||||||
}
|
}
|
||||||
app.getController('LeftMenu').SetDisabled(disable, true);
|
if (options.review) {
|
||||||
app.getController('Toolbar').DisableToolbar(disable);
|
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||||
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
}
|
||||||
app.getController('Viewport').SetDisabled(disable);
|
if (options.viewport) {
|
||||||
|
app.getController('Viewport').SetDisabled(disable);
|
||||||
|
}
|
||||||
|
if (options.toolbar) {
|
||||||
|
app.getController('Toolbar').DisableToolbar(disable, options.viewMode);
|
||||||
|
}
|
||||||
|
if (options.documentHolder) {
|
||||||
|
app.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
|
||||||
|
}
|
||||||
|
if (options.leftMenu) {
|
||||||
|
if (options.leftMenu.disable)
|
||||||
|
app.getController('LeftMenu').SetDisabled(disable, options);
|
||||||
|
if (options.leftMenu.previewMode)
|
||||||
|
app.getController('LeftMenu').setPreviewMode(disable);
|
||||||
|
}
|
||||||
|
if (options.fileMenu) {
|
||||||
|
app.getController('LeftMenu').leftMenu.getMenu('file').SetDisabled(disable, options.fileMenu);
|
||||||
|
if (options.leftMenu.disable)
|
||||||
|
app.getController('LeftMenu').leftMenu.getMenu('file').applyMode();
|
||||||
|
}
|
||||||
|
if (options.comments) {
|
||||||
|
var comments = this.getApplication().getController('Common.Controllers.Comments');
|
||||||
|
if (comments && options.comments.previewMode)
|
||||||
|
comments.setPreviewMode(disable);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prev_options) {
|
||||||
|
this.onEditingDisable(prev_options.disable, prev_options.options, prev_options.type);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onOpenDocument: function(progress) {
|
onOpenDocument: function(progress) {
|
||||||
|
@ -2072,16 +2140,7 @@ define([
|
||||||
var me = this;
|
var me = this;
|
||||||
Common.Utils.warningDocumentIsLocked({
|
Common.Utils.warningDocumentIsLocked({
|
||||||
disablefunc: function (disable) {
|
disablefunc: function (disable) {
|
||||||
var app = me.getApplication();
|
me.disableEditing(disable, true);
|
||||||
me.disableEditing(disable);
|
|
||||||
app.getController('RightMenu').SetDisabled(disable, true);
|
|
||||||
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
|
||||||
app.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
|
|
||||||
var leftMenu = app.getController('LeftMenu');
|
|
||||||
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
|
|
||||||
leftMenu.setPreviewMode(disable);
|
|
||||||
var comments = app.getController('Common.Controllers.Comments');
|
|
||||||
if (comments) comments.setPreviewMode(disable);
|
|
||||||
}});
|
}});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2712,7 +2771,8 @@ define([
|
||||||
txtErrorLoadHistory: 'Loading history failed',
|
txtErrorLoadHistory: 'Loading history failed',
|
||||||
leavePageTextOnClose: 'All unsaved changes in this document will be lost.<br> Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.',
|
leavePageTextOnClose: 'All unsaved changes in this document will be lost.<br> Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.',
|
||||||
textTryUndoRedoWarn: 'The Undo/Redo functions are disabled for the Fast co-editing mode.',
|
textTryUndoRedoWarn: 'The Undo/Redo functions are disabled for the Fast co-editing mode.',
|
||||||
txtNone: 'None'
|
txtNone: 'None',
|
||||||
|
textDisconnect: 'Connection is lost'
|
||||||
}
|
}
|
||||||
})(), PE.Controllers.Main || {}))
|
})(), PE.Controllers.Main || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -140,6 +140,10 @@ define([
|
||||||
caption : this.btnRenameCaption,
|
caption : this.btnRenameCaption,
|
||||||
canFocused: false
|
canFocused: false
|
||||||
});
|
});
|
||||||
|
if ( !!this.options.miRename ) {
|
||||||
|
this.miRename.setDisabled(this.options.miRename.isDisabled());
|
||||||
|
delete this.options.miRename;
|
||||||
|
}
|
||||||
|
|
||||||
this.miProtect = new Common.UI.MenuItem({
|
this.miProtect = new Common.UI.MenuItem({
|
||||||
el : $markup.elementById('#fm-btn-protect'),
|
el : $markup.elementById('#fm-btn-protect'),
|
||||||
|
@ -186,6 +190,10 @@ define([
|
||||||
caption : this.btnHistoryCaption,
|
caption : this.btnHistoryCaption,
|
||||||
canFocused: false
|
canFocused: false
|
||||||
});
|
});
|
||||||
|
if ( !!this.options.miHistory ) {
|
||||||
|
this.miHistory.setDisabled(this.options.miHistory.isDisabled());
|
||||||
|
delete this.options.miHistory;
|
||||||
|
}
|
||||||
|
|
||||||
this.items = [];
|
this.items = [];
|
||||||
this.items.push(
|
this.items.push(
|
||||||
|
@ -267,6 +275,8 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
applyMode: function() {
|
applyMode: function() {
|
||||||
|
if (!this.rendered) return;
|
||||||
|
|
||||||
if (!this.panels) {
|
if (!this.panels) {
|
||||||
this.panels = {
|
this.panels = {
|
||||||
'opts' : (new PE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')),
|
'opts' : (new PE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')),
|
||||||
|
@ -357,8 +367,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!delay) {
|
if (!delay) {
|
||||||
if ( this.rendered )
|
this.applyMode();
|
||||||
this.applyMode();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -433,6 +442,9 @@ define([
|
||||||
} else
|
} else
|
||||||
if (type == 'protect') {
|
if (type == 'protect') {
|
||||||
return this.options.miProtect ? this.options.miProtect : (this.options.miProtect = new Common.UI.MenuItem({}));
|
return this.options.miProtect ? this.options.miProtect : (this.options.miProtect = new Common.UI.MenuItem({}));
|
||||||
|
} else
|
||||||
|
if (type == 'history') {
|
||||||
|
return this.options.miHistory ? this.options.miHistory : (this.options.miHistory = new Common.UI.MenuItem({}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (type == 'save') {
|
if (type == 'save') {
|
||||||
|
@ -443,18 +455,19 @@ define([
|
||||||
} else
|
} else
|
||||||
if (type == 'protect') {
|
if (type == 'protect') {
|
||||||
return this.miProtect;
|
return this.miProtect;
|
||||||
|
}else
|
||||||
|
if (type == 'history') {
|
||||||
|
return this.miHistory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disable) {
|
SetDisabled: function(disable, options) {
|
||||||
var _btn_save = this.getButton('save'),
|
var _btn_protect = this.getButton('protect'),
|
||||||
_btn_rename = this.getButton('rename'),
|
_btn_history = this.getButton('history');
|
||||||
_btn_protect = this.getButton('protect');
|
|
||||||
|
|
||||||
_btn_save[(disable || !this.mode.isEdit)?'hide':'show']();
|
options && options.protect && _btn_protect.setDisabled(disable);
|
||||||
_btn_protect[(disable || !this.mode.isEdit)?'hide':'show']();
|
options && options.history && _btn_history.setDisabled(disable);
|
||||||
_btn_rename[(disable || !this.mode.canRename || this.mode.isDesktopApp) ?'hide':'show']();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
btnSaveCaption : 'Save',
|
btnSaveCaption : 'Save',
|
||||||
|
|
|
@ -83,7 +83,7 @@ define([
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.minimizedMode = true;
|
this.minimizedMode = true;
|
||||||
this._state = {};
|
this._state = {disabled: false};
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
|
|
|
@ -347,21 +347,20 @@ define([
|
||||||
if (this._state.DisabledEditing != disable) {
|
if (this._state.DisabledEditing != disable) {
|
||||||
this._state.DisabledEditing = disable;
|
this._state.DisabledEditing = disable;
|
||||||
|
|
||||||
var rightMenuController = PE.getController('RightMenu');
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
if (disable && rightMenuController.rightmenu.GetActivePane() !== 'id-signature-settings')
|
viewMode: disable,
|
||||||
rightMenuController.rightmenu.clearSelection();
|
allowSignature: true,
|
||||||
rightMenuController.SetDisabled(disable, true);
|
rightMenu: {clear: disable && (PE.getController('RightMenu').rightmenu.GetActivePane() !== 'id-signature-settings'), disable: true},
|
||||||
PE.getController('Toolbar').DisableToolbar(disable, disable);
|
statusBar: true,
|
||||||
PE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
leftMenu: {disable: false, previewMode: true},
|
||||||
PE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
fileMenu: false,
|
||||||
PE.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
|
comments: {disable: false, previewMode: true},
|
||||||
|
chat: false,
|
||||||
// var leftMenu = PE.getController('LeftMenu').leftMenu;
|
review: true,
|
||||||
// leftMenu.btnComments.setDisabled(disable);
|
viewport: false,
|
||||||
PE.getController('LeftMenu').setPreviewMode(disable);
|
documentHolder: true,
|
||||||
var comments = PE.getController('Common.Controllers.Comments');
|
toolbar: true
|
||||||
if (comments)
|
}, 'signature');
|
||||||
comments.setPreviewMode(disable);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,6 @@ define([
|
||||||
SetDisabled: function(disable) {
|
SetDisabled: function(disable) {
|
||||||
var langs = this.langMenu.items.length>0;
|
var langs = this.langMenu.items.length>0;
|
||||||
this.btnLanguage.setDisabled(disable || !langs || this._state.no_paragraph);
|
this.btnLanguage.setDisabled(disable || !langs || this._state.no_paragraph);
|
||||||
this.mode.isEdit = !disable;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiFocusObject: function(selectedObjects) {
|
onApiFocusObject: function(selectedObjects) {
|
||||||
|
|
|
@ -323,16 +323,16 @@ define([
|
||||||
this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
|
this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disabled) {
|
SetDisabled: function(disabled) {
|
||||||
this.editor.$btnfunc[!disabled?'removeClass':'addClass']('disabled');
|
this.editor.$btnfunc[!disabled && this.mode.isEdit ?'removeClass':'addClass']('disabled');
|
||||||
this.editor.btnNamedRanges.setVisible(!disabled);
|
this.editor.btnNamedRanges.setVisible(!disabled && this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge);
|
||||||
},
|
},
|
||||||
|
|
||||||
setPreviewMode: function(mode) {
|
setPreviewMode: function(mode) {
|
||||||
if (this.viewmode === mode) return;
|
if (this.viewmode === mode) return;
|
||||||
this.viewmode = mode;
|
this.viewmode = mode;
|
||||||
this.editor.$btnfunc[!mode?'removeClass':'addClass']('disabled');
|
this.editor.$btnfunc[!mode && this.mode.isEdit?'removeClass':'addClass']('disabled');
|
||||||
this.editor.cellNameDisabled(mode);
|
this.editor.cellNameDisabled(mode && !(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -188,13 +188,28 @@ define([
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disabled) {
|
SetDisabled: function(disable, options) {
|
||||||
this.leftMenu.btnComments.setDisabled(disabled);
|
if (this.leftMenu._state.disabled !== disable) {
|
||||||
this.leftMenu.btnChat.setDisabled(disabled);
|
this.leftMenu._state.disabled = disable;
|
||||||
this.leftMenu.btnPlugins.setDisabled(disabled);
|
if (disable) {
|
||||||
this.leftMenu.btnSpellcheck.setDisabled(disabled);
|
this.previsEdit = this.mode.isEdit;
|
||||||
|
this.prevcanEdit = this.mode.canEdit;
|
||||||
|
this.mode.isEdit = this.mode.canEdit = !disable;
|
||||||
|
} else {
|
||||||
|
this.mode.isEdit = this.previsEdit;
|
||||||
|
this.mode.canEdit = this.prevcanEdit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.leftMenu.getMenu('file').disableEditing(disabled);
|
if (disable) this.leftMenu.close();
|
||||||
|
|
||||||
|
if (!options || options.comments && options.comments.disable)
|
||||||
|
this.leftMenu.btnComments.setDisabled(disable);
|
||||||
|
if (!options || options.chat)
|
||||||
|
this.leftMenu.btnChat.setDisabled(disable);
|
||||||
|
|
||||||
|
this.leftMenu.btnPlugins.setDisabled(disable);
|
||||||
|
this.leftMenu.btnSpellcheck.setDisabled(disable);
|
||||||
},
|
},
|
||||||
|
|
||||||
createDelayedElements: function() {
|
createDelayedElements: function() {
|
||||||
|
|
|
@ -209,7 +209,8 @@ define([
|
||||||
Common.NotificationCenter.on('download:cancel', _.bind(this.onDownloadCancel, this));
|
Common.NotificationCenter.on('download:cancel', _.bind(this.onDownloadCancel, this));
|
||||||
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
||||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||||
Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
|
Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
|
||||||
|
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
|
||||||
|
|
||||||
this.stackLongActions = new Common.IrregularStack({
|
this.stackLongActions = new Common.IrregularStack({
|
||||||
strongCompare : this._compareActionStrong,
|
strongCompare : this._compareActionStrong,
|
||||||
|
@ -218,6 +219,11 @@ define([
|
||||||
|
|
||||||
this.stackLongActions.push({id: InitApplication, type: Asc.c_oAscAsyncActionType.BlockInteraction});
|
this.stackLongActions.push({id: InitApplication, type: Asc.c_oAscAsyncActionType.BlockInteraction});
|
||||||
|
|
||||||
|
this.stackDisableActions = new Common.IrregularStack({
|
||||||
|
strongCompare : this._compareActionWeak,
|
||||||
|
weakCompare : this._compareActionWeak
|
||||||
|
});
|
||||||
|
|
||||||
this.isShowOpenDialog = false;
|
this.isShowOpenDialog = false;
|
||||||
|
|
||||||
// Initialize api gateway
|
// Initialize api gateway
|
||||||
|
@ -670,6 +676,9 @@ define([
|
||||||
if (type == Asc.c_oAscAsyncActionType.BlockInteraction && !( (id == Asc.c_oAscAsyncAction['LoadDocumentFonts'] || id == Asc.c_oAscAsyncAction['ApplyChanges']) && (this.dontCloseDummyComment || this.inTextareaControl || Common.Utils.ModalWindow.isVisible() || this.inFormControl) ))
|
if (type == Asc.c_oAscAsyncActionType.BlockInteraction && !( (id == Asc.c_oAscAsyncAction['LoadDocumentFonts'] || id == Asc.c_oAscAsyncAction['ApplyChanges']) && (this.dontCloseDummyComment || this.inTextareaControl || Common.Utils.ModalWindow.isVisible() || this.inFormControl) ))
|
||||||
this.onEditComplete(this.loadMask, {restorefocus:true});
|
this.onEditComplete(this.loadMask, {restorefocus:true});
|
||||||
}
|
}
|
||||||
|
if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
|
||||||
|
this.disableEditing(false, true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setLongActionView: function(action) {
|
setLongActionView: function(action) {
|
||||||
|
@ -741,6 +750,12 @@ define([
|
||||||
case LoadingDocument:
|
case LoadingDocument:
|
||||||
title = this.loadingDocumentTitleText + ' ';
|
title = this.loadingDocumentTitleText + ' ';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['Disconnect']:
|
||||||
|
title = this.textDisconnect;
|
||||||
|
this.disableEditing(true, true);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (typeof action.id == 'string'){
|
if (typeof action.id == 'string'){
|
||||||
title = action.id;
|
title = action.id;
|
||||||
|
@ -1032,11 +1047,75 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disable) {
|
disableEditing: function(disable, temp) {
|
||||||
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
|
viewMode: disable,
|
||||||
|
allowSignature: false,
|
||||||
|
allowProtect: false,
|
||||||
|
rightMenu: {clear: true, disable: true},
|
||||||
|
statusBar: true,
|
||||||
|
leftMenu: {disable: true, previewMode: true},
|
||||||
|
fileMenu: {protect: true, history: temp},
|
||||||
|
comments: {disable: !temp, previewMode: true},
|
||||||
|
chat: true,
|
||||||
|
review: true,
|
||||||
|
viewport: true,
|
||||||
|
documentHolder: true,
|
||||||
|
toolbar: true,
|
||||||
|
celleditor: {previewMode: true}
|
||||||
|
}, temp ? 'reconnect' : 'disconnect');
|
||||||
|
},
|
||||||
|
|
||||||
|
onEditingDisable: function(disable, options, type) {
|
||||||
var app = this.getApplication();
|
var app = this.getApplication();
|
||||||
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
|
|
||||||
app.getController('RightMenu').getView('RightMenu').clearSelection();
|
var action = {type: type, disable: disable, options: options};
|
||||||
app.getController('Toolbar').DisableToolbar(disable);
|
if (disable && !this.stackDisableActions.get({type: type}))
|
||||||
|
this.stackDisableActions.push(action);
|
||||||
|
!disable && this.stackDisableActions.pop({type: type});
|
||||||
|
var prev_options = !disable && (this.stackDisableActions.length()>0) ? this.stackDisableActions.get(this.stackDisableActions.length()-1) : null;
|
||||||
|
|
||||||
|
if (options.rightMenu && app.getController('RightMenu')) {
|
||||||
|
options.rightMenu.clear && app.getController('RightMenu').getView('RightMenu').clearSelection();
|
||||||
|
options.rightMenu.disable && app.getController('RightMenu').SetDisabled(disable, options.allowSignature);
|
||||||
|
}
|
||||||
|
if (options.statusBar) {
|
||||||
|
app.getController('Statusbar').SetDisabled(disable);
|
||||||
|
}
|
||||||
|
if (options.review) {
|
||||||
|
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||||
|
}
|
||||||
|
if (options.viewport) {
|
||||||
|
app.getController('Viewport').SetDisabled(disable);
|
||||||
|
}
|
||||||
|
if (options.toolbar) {
|
||||||
|
app.getController('Toolbar').DisableToolbar(disable, options.viewMode);
|
||||||
|
}
|
||||||
|
if (options.documentHolder) {
|
||||||
|
app.getController('DocumentHolder').SetDisabled(disable, options.allowProtect);
|
||||||
|
}
|
||||||
|
if (options.leftMenu) {
|
||||||
|
if (options.leftMenu.disable)
|
||||||
|
app.getController('LeftMenu').SetDisabled(disable, options);
|
||||||
|
if (options.leftMenu.previewMode)
|
||||||
|
app.getController('LeftMenu').setPreviewMode(disable);
|
||||||
|
}
|
||||||
|
if (options.fileMenu) {
|
||||||
|
app.getController('LeftMenu').leftMenu.getMenu('file').SetDisabled(disable, options.fileMenu);
|
||||||
|
if (options.leftMenu.disable)
|
||||||
|
app.getController('LeftMenu').leftMenu.getMenu('file').applyMode();
|
||||||
|
}
|
||||||
|
if (options.comments) {
|
||||||
|
var comments = this.getApplication().getController('Common.Controllers.Comments');
|
||||||
|
if (comments && options.comments.previewMode)
|
||||||
|
comments.setPreviewMode(disable);
|
||||||
|
}
|
||||||
|
if (options.celleditor && options.celleditor.previewMode) {
|
||||||
|
app.getController('CellEditor').setPreviewMode(disable);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prev_options) {
|
||||||
|
this.onEditingDisable(prev_options.disable, prev_options.options, prev_options.type);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2437,20 +2516,7 @@ define([
|
||||||
var me = this;
|
var me = this;
|
||||||
Common.Utils.warningDocumentIsLocked({
|
Common.Utils.warningDocumentIsLocked({
|
||||||
disablefunc: function (disable) {
|
disablefunc: function (disable) {
|
||||||
me.disableEditing(disable);
|
me.disableEditing(disable, true);
|
||||||
var app = me.getApplication();
|
|
||||||
app.getController('Toolbar').DisableToolbar(disable,disable);
|
|
||||||
app.getController('RightMenu').SetDisabled(disable, true);
|
|
||||||
app.getController('Statusbar').SetDisabled(disable);
|
|
||||||
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
|
||||||
app.getController('DocumentHolder').SetDisabled(disable);
|
|
||||||
var leftMenu = app.getController('LeftMenu');
|
|
||||||
leftMenu.setPreviewMode(disable);
|
|
||||||
leftMenu.disableEditing(disable);
|
|
||||||
app.getController('CellEditor').disableEditing(disable);
|
|
||||||
app.getController('Viewport').disableEditing(disable);
|
|
||||||
var comments = app.getController('Common.Controllers.Comments');
|
|
||||||
if (comments) comments.setPreviewMode(disable);
|
|
||||||
}});
|
}});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2952,7 +3018,8 @@ define([
|
||||||
errorPivotWithoutUnderlying: 'The Pivot Table report was saved without the underlying data.<br>Use the \'Refresh\' button to update the report.',
|
errorPivotWithoutUnderlying: 'The Pivot Table report was saved without the underlying data.<br>Use the \'Refresh\' button to update the report.',
|
||||||
txtQuarter: 'Qtr',
|
txtQuarter: 'Qtr',
|
||||||
txtOr: '%1 or %2',
|
txtOr: '%1 or %2',
|
||||||
confirmReplaceFormulaInTable: 'Formulas in the header row will be removed and converted to static text.<br>Do you want to continue?'
|
confirmReplaceFormulaInTable: 'Formulas in the header row will be removed and converted to static text.<br>Do you want to continue?',
|
||||||
|
textDisconnect: 'Connection is lost'
|
||||||
}
|
}
|
||||||
})(), SSE.Controllers.Main || {}))
|
})(), SSE.Controllers.Main || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -505,7 +505,7 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function (disabled) {
|
SetDisabled: function (disabled) {
|
||||||
this.viewmode = disabled;
|
this.viewmode = disabled;
|
||||||
this.header.mnuitemHideHeadings.setDisabled(disabled);
|
this.header.mnuitemHideHeadings.setDisabled(disabled);
|
||||||
this.header.mnuitemHideGridlines.setDisabled(disabled);
|
this.header.mnuitemHideGridlines.setDisabled(disabled);
|
||||||
|
|
|
@ -127,6 +127,10 @@ define([
|
||||||
caption : this.btnRenameCaption,
|
caption : this.btnRenameCaption,
|
||||||
canFocused: false
|
canFocused: false
|
||||||
});
|
});
|
||||||
|
if ( !!this.options.miRename ) {
|
||||||
|
this.miRename.setDisabled(this.options.miRename.isDisabled());
|
||||||
|
delete this.options.miRename;
|
||||||
|
}
|
||||||
|
|
||||||
this.miProtect = new Common.UI.MenuItem({
|
this.miProtect = new Common.UI.MenuItem({
|
||||||
el : $markup.elementById('#fm-btn-protect'),
|
el : $markup.elementById('#fm-btn-protect'),
|
||||||
|
@ -249,6 +253,8 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
applyMode: function() {
|
applyMode: function() {
|
||||||
|
if (!this.rendered) return;
|
||||||
|
|
||||||
if (!this.panels) {
|
if (!this.panels) {
|
||||||
this.panels = {
|
this.panels = {
|
||||||
'opts' : (new SSE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')),
|
'opts' : (new SSE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')),
|
||||||
|
@ -324,8 +330,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this.mode.disableEditing != undefined ) {
|
if ( this.mode.disableEditing != undefined ) {
|
||||||
this.panels['opts'].disableEditing(this.mode.disableEditing);
|
this.panels['opts'].SetDisabled(this.mode.disableEditing);
|
||||||
this.miProtect.setDisabled(this.mode.disableEditing);
|
|
||||||
delete this.mode.disableEditing;
|
delete this.mode.disableEditing;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -343,8 +348,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!delay) {
|
if (!delay) {
|
||||||
if ( this.rendered )
|
this.applyMode();
|
||||||
this.applyMode();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -402,6 +406,8 @@ define([
|
||||||
if ( !this.rendered ) {
|
if ( !this.rendered ) {
|
||||||
if (type == 'save') {
|
if (type == 'save') {
|
||||||
return this.options.miSave ? this.options.miSave : (this.options.miSave = new Common.UI.MenuItem({}));
|
return this.options.miSave ? this.options.miSave : (this.options.miSave = new Common.UI.MenuItem({}));
|
||||||
|
} else if (type == 'rename') {
|
||||||
|
return this.options.miRename ? this.options.miRename : (this.options.miRename = new Common.UI.MenuItem({}));
|
||||||
} else
|
} else
|
||||||
if (type == 'protect') {
|
if (type == 'protect') {
|
||||||
return this.options.miProtect ? this.options.miProtect : (this.options.miProtect = new Common.UI.MenuItem({}));
|
return this.options.miProtect ? this.options.miProtect : (this.options.miProtect = new Common.UI.MenuItem({}));
|
||||||
|
@ -410,19 +416,25 @@ define([
|
||||||
if (type == 'save') {
|
if (type == 'save') {
|
||||||
return this.miSave;
|
return this.miSave;
|
||||||
} else
|
} else
|
||||||
|
if (type == 'rename') {
|
||||||
|
return this.miRename;
|
||||||
|
}else
|
||||||
if (type == 'protect') {
|
if (type == 'protect') {
|
||||||
return this.miProtect;
|
return this.miProtect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disabled) {
|
SetDisabled: function(disable, options) {
|
||||||
if ( !this.panels ) {
|
if ( !this.panels ) {
|
||||||
this.mode.disableEditing = disabled;
|
this.mode.disableEditing = disable;
|
||||||
} else {
|
} else {
|
||||||
this.panels['opts'].disableEditing(disabled);
|
this.panels['opts'].SetDisabled(disable);
|
||||||
this.miProtect.setDisabled(disabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _btn_protect = this.getButton('protect');
|
||||||
|
|
||||||
|
options && options.protect && _btn_protect.setDisabled(disable || !this.mode.isEdit);
|
||||||
},
|
},
|
||||||
|
|
||||||
btnSaveCaption : 'Save',
|
btnSaveCaption : 'Save',
|
||||||
|
|
|
@ -261,10 +261,11 @@ define([
|
||||||
this.spellcheckSettings && this.spellcheckSettings.setApi(api);
|
this.spellcheckSettings && this.spellcheckSettings.setApi(api);
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing: function(disabled) {
|
SetDisabled: function(disabled) {
|
||||||
if ( disabled ) {
|
if ( disabled ) {
|
||||||
$(this.viewSettingsPicker.dataViewItems[1].el).hide();
|
$(this.viewSettingsPicker.dataViewItems[1].el).hide();
|
||||||
$(this.viewSettingsPicker.dataViewItems[2].el).hide();
|
$(this.viewSettingsPicker.dataViewItems[2].el).hide();
|
||||||
|
this.viewSettingsPicker.selectByIndex(0, true);
|
||||||
} else {
|
} else {
|
||||||
if ( this.mode.canPrint )
|
if ( this.mode.canPrint )
|
||||||
$(this.viewSettingsPicker.dataViewItems[1].el).show();
|
$(this.viewSettingsPicker.dataViewItems[1].el).show();
|
||||||
|
|
|
@ -75,7 +75,7 @@ define([
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.minimizedMode = true;
|
this.minimizedMode = true;
|
||||||
this._state = {};
|
this._state = {disabled: false};
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
|
|
|
@ -393,23 +393,22 @@ define([
|
||||||
if (this._state.DisabledEditing != disable) {
|
if (this._state.DisabledEditing != disable) {
|
||||||
this._state.DisabledEditing = disable;
|
this._state.DisabledEditing = disable;
|
||||||
|
|
||||||
var rightMenuController = SSE.getController('RightMenu');
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
if (disable && rightMenuController.rightmenu.GetActivePane() !== 'id-signature-settings')
|
viewMode: disable,
|
||||||
rightMenuController.rightmenu.clearSelection();
|
allowSignature: true,
|
||||||
rightMenuController.SetDisabled(disable, true);
|
allowProtect: true,
|
||||||
SSE.getController('Toolbar').DisableToolbar(disable, disable);
|
rightMenu: {clear: disable && (SSE.getController('RightMenu').rightmenu.GetActivePane() !== 'id-signature-settings'), disable: true},
|
||||||
SSE.getController('Statusbar').SetDisabled(disable);
|
statusBar: true,
|
||||||
SSE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
leftMenu: {disable: false, previewMode: true},
|
||||||
SSE.getController('DocumentHolder').SetDisabled(disable, true);
|
fileMenu: false,
|
||||||
SSE.getController('CellEditor').setPreviewMode(disable);
|
comments: {disable: false, previewMode: true},
|
||||||
SSE.getController('Viewport').disableEditing(disable);
|
chat: false,
|
||||||
|
review: true,
|
||||||
// var leftMenu = SSE.getController('LeftMenu').leftMenu;
|
viewport: true,
|
||||||
// leftMenu.btnComments.setDisabled(disable);
|
documentHolder: true,
|
||||||
SSE.getController('LeftMenu').setPreviewMode(disable);
|
toolbar: true,
|
||||||
var comments = SSE.getController('Common.Controllers.Comments');
|
celleditor: {previewMode: true}
|
||||||
if (comments)
|
}, 'signature');
|
||||||
comments.setPreviewMode(disable);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -507,7 +507,7 @@ define([
|
||||||
this.mode = _.extend({}, this.mode, mode);
|
this.mode = _.extend({}, this.mode, mode);
|
||||||
// this.$el.find('.el-edit')[mode.isEdit?'show':'hide']();
|
// this.$el.find('.el-edit')[mode.isEdit?'show':'hide']();
|
||||||
this.btnAddWorksheet.setVisible(this.mode.isEdit);
|
this.btnAddWorksheet.setVisible(this.mode.isEdit);
|
||||||
this.btnAddWorksheet.setDisabled(this.mode.isDisconnected);
|
this.btnAddWorksheet.setDisabled(this.mode.isDisconnected || this.api && (this.api.asc_isWorkbookLocked() || this.api.isCellEdited) || this.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None);
|
||||||
this.updateTabbarBorders();
|
this.updateTabbarBorders();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue