Refactoring
This commit is contained in:
parent
6f4de5a73f
commit
68fc002dc3
|
@ -738,7 +738,7 @@ define([
|
||||||
rightMenu: {clear: true, disable: true},
|
rightMenu: {clear: true, disable: true},
|
||||||
statusBar: true,
|
statusBar: true,
|
||||||
leftMenu: {disable: false, previewMode: true},
|
leftMenu: {disable: false, previewMode: true},
|
||||||
fileMenu: {protect: true, save: false, rename: false},
|
fileMenu: {protect: true},
|
||||||
navigation: {disable: false, previewMode: true},
|
navigation: {disable: false, previewMode: true},
|
||||||
comments: {disable: false, previewMode: true},
|
comments: {disable: false, previewMode: true},
|
||||||
chat: false,
|
chat: false,
|
||||||
|
@ -749,27 +749,6 @@ define([
|
||||||
plugins: true
|
plugins: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// var app = this.getApplication();
|
|
||||||
// app.getController('Toolbar').DisableToolbar(disable, false, true);
|
|
||||||
// app.getController('DocumentHolder').getView().SetDisabled(disable);
|
|
||||||
|
|
||||||
// if (this.appConfig.canReview) {
|
|
||||||
// app.getController('RightMenu').getView('RightMenu').clearSelection();
|
|
||||||
// app.getController('RightMenu').SetDisabled(disable, false);
|
|
||||||
// app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
|
||||||
// app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
|
|
||||||
// app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var comments = app.getController('Common.Controllers.Comments');
|
|
||||||
// if (comments)
|
|
||||||
// comments.setPreviewMode(disable);
|
|
||||||
|
|
||||||
// var leftMenu = app.getController('LeftMenu');
|
|
||||||
// leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
|
|
||||||
// leftMenu.setPreviewMode(disable);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
|
@ -273,20 +273,6 @@ define([
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
plugins: false
|
plugins: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// var app = this.getApplication();
|
|
||||||
// var rightMenuController = app.getController('RightMenu');
|
|
||||||
// rightMenuController.getView('RightMenu').clearSelection();
|
|
||||||
// rightMenuController.SetDisabled(disable);
|
|
||||||
// app.getController('Toolbar').DisableToolbar(disable, false, false, true);
|
|
||||||
// app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
|
||||||
// app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
|
||||||
// app.getController('DocumentHolder').getView().SetDisabled(disable);
|
|
||||||
// app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
|
|
||||||
// app.getController('LeftMenu').setPreviewMode(disable);
|
|
||||||
// var comments = app.getController('Common.Controllers.Comments');
|
|
||||||
// if (comments)
|
|
||||||
// comments.setPreviewMode(disable);
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -667,13 +667,19 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disable, options) {
|
SetDisabled: function(disable, options) {
|
||||||
this.mode.isEdit = !disable;
|
if (this.leftMenu._state.disabled !== disable) {
|
||||||
if (disable) this.leftMenu.close();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// var comments = this.getApplication().getController('Common.Controllers.Comments');
|
if (disable) this.leftMenu.close();
|
||||||
// if (comments)
|
|
||||||
// comments.setPreviewMode(disable);
|
|
||||||
// this.setPreviewMode(disable);
|
|
||||||
|
|
||||||
if (!options || options.comments && options.comments.disable)
|
if (!options || options.comments && options.comments.disable)
|
||||||
this.leftMenu.btnComments.setDisabled(disable);
|
this.leftMenu.btnComments.setDisabled(disable);
|
||||||
|
@ -683,8 +689,6 @@ define([
|
||||||
this.leftMenu.btnNavigation.setDisabled(disable);
|
this.leftMenu.btnNavigation.setDisabled(disable);
|
||||||
|
|
||||||
this.leftMenu.btnPlugins.setDisabled(disable);
|
this.leftMenu.btnPlugins.setDisabled(disable);
|
||||||
|
|
||||||
// if (disableFileMenu) this.leftMenu.getMenu('file').SetDisabled(disable);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
|
|
|
@ -213,8 +213,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.disableEditing2, this));
|
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
|
||||||
|
|
||||||
|
|
||||||
this.isShowOpenDialog = false;
|
this.isShowOpenDialog = false;
|
||||||
|
|
||||||
|
@ -707,17 +706,6 @@ define([
|
||||||
|
|
||||||
disableEditing: function(disable, temp) {
|
disableEditing: function(disable, temp) {
|
||||||
var app = this.getApplication();
|
var app = this.getApplication();
|
||||||
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
|
|
||||||
// app.getController('RightMenu').getView('RightMenu').clearSelection();
|
|
||||||
// app.getController('RightMenu').SetDisabled(disable, false);
|
|
||||||
// app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
|
||||||
}
|
|
||||||
// app.getController('LeftMenu').SetDisabled(disable, true, viewmode);
|
|
||||||
// app.getController('Toolbar').DisableToolbar(disable, disable);
|
|
||||||
// app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
|
||||||
// app.getController('Viewport').SetDisabled(disable);
|
|
||||||
// app.getController('DocumentHolder').getView().SetDisabled(disable);
|
|
||||||
|
|
||||||
Common.NotificationCenter.trigger('editing:disable', disable, {
|
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||||
viewMode: disable,
|
viewMode: disable,
|
||||||
reviewMode: false,
|
reviewMode: false,
|
||||||
|
@ -728,7 +716,7 @@ define([
|
||||||
rightMenu: {clear: true, disable: true},
|
rightMenu: {clear: true, disable: true},
|
||||||
statusBar: true,
|
statusBar: true,
|
||||||
leftMenu: {disable: true, previewMode: true},
|
leftMenu: {disable: true, previewMode: true},
|
||||||
fileMenu: {protect: true, save: true, rename: true},
|
fileMenu: {protect: true, history: temp},
|
||||||
navigation: {disable: !temp, previewMode: true},
|
navigation: {disable: !temp, previewMode: true},
|
||||||
comments: {disable: !temp, previewMode: true},
|
comments: {disable: !temp, previewMode: true},
|
||||||
chat: true,
|
chat: true,
|
||||||
|
@ -738,28 +726,9 @@ define([
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
plugins: false
|
plugins: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// this.disableEditing2(disable, {
|
|
||||||
// viewMode: disable,
|
|
||||||
// reviewMode: false,
|
|
||||||
// fillFormwMode: false,
|
|
||||||
// allowMerge: false,
|
|
||||||
// allowSignature: false,
|
|
||||||
// allowProtect: false,
|
|
||||||
// rightMenu: {clear: true, disable: true},
|
|
||||||
// statusBar: true,
|
|
||||||
// leftMenu: {disable: true, previewMode: true},
|
|
||||||
// fileMenu: true,
|
|
||||||
// comments: {previewMode: true},
|
|
||||||
// review: true,
|
|
||||||
// viewport: true,
|
|
||||||
// documentHolder: true,
|
|
||||||
// toolbar: true // check!!!
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
|
|
||||||
disableEditing2: function(disable, options) {
|
onEditingDisable: function(disable, options) {
|
||||||
var app = this.getApplication();
|
var app = this.getApplication();
|
||||||
|
|
||||||
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
|
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
|
||||||
|
@ -934,6 +903,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()) &&
|
||||||
|
@ -1034,6 +1007,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;
|
||||||
|
@ -2515,16 +2494,6 @@ define([
|
||||||
var me = this;
|
var me = this;
|
||||||
var _disable_ui = function (disable) {
|
var _disable_ui = function (disable) {
|
||||||
me.disableEditing(disable, true);
|
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});
|
||||||
|
@ -3011,7 +2980,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'),
|
||||||
|
@ -272,7 +276,7 @@ define([
|
||||||
|
|
||||||
applyMode: function() {
|
applyMode: function() {
|
||||||
if (!this.rendered) return;
|
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')),
|
||||||
|
@ -413,13 +417,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(disable, options) {
|
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');
|
|
||||||
|
|
||||||
options && options.save && _btn_save.setDisabled(disable || !this.mode.isEdit);
|
options && options.protect && _btn_protect.setDisabled(disable);
|
||||||
options && options.protect && _btn_protect.setDisabled(disable || !this.mode.isEdit);
|
options && options.history && _btn_history.setDisabled(disable);
|
||||||
options && options.rename && _btn_rename.setDisabled(disable || !this.mode.canRename || this.mode.isDesktopApp);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isVisible: function () {
|
isVisible: function () {
|
||||||
|
@ -436,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') {
|
||||||
|
@ -446,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 () {
|
||||||
|
|
|
@ -820,19 +820,6 @@ define([
|
||||||
plugins: false
|
plugins: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// DE.getController('Toolbar').DisableToolbar(disable, disable);
|
|
||||||
// DE.getController('RightMenu').SetDisabled(disable, true);
|
|
||||||
// DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
|
||||||
// DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
|
||||||
// DE.getController('DocumentHolder').getView().SetDisabled(disable);
|
|
||||||
// DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable);
|
|
||||||
|
|
||||||
// var comments = DE.getController('Common.Controllers.Comments');
|
|
||||||
// if (comments)
|
|
||||||
// comments.setPreviewMode(disable);
|
|
||||||
|
|
||||||
// DE.getController('LeftMenu').setPreviewMode(disable);
|
|
||||||
|
|
||||||
this.lockControls(DE.enumLockMM.preview, disable, {array: [this.btnInsField, this.btnEditData]});
|
this.lockControls(DE.enumLockMM.preview, disable, {array: [this.btnInsField, this.btnEditData]});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -413,23 +413,6 @@ define([
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
plugins: false
|
plugins: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// var rightMenuController = DE.getController('RightMenu');
|
|
||||||
// if (disable && rightMenuController.rightmenu.GetActivePane() !== 'id-signature-settings')
|
|
||||||
// rightMenuController.rightmenu.clearSelection();
|
|
||||||
// rightMenuController.SetDisabled(disable, false, true);
|
|
||||||
// DE.getController('Toolbar').DisableToolbar(disable, disable);
|
|
||||||
// DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
|
||||||
// DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
|
||||||
// DE.getController('DocumentHolder').getView().SetDisabled(disable, true);
|
|
||||||
// DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable);
|
|
||||||
|
|
||||||
// var leftMenu = DE.getController('LeftMenu').leftMenu;
|
|
||||||
// leftMenu.btnComments.setDisabled(disable);
|
|
||||||
// DE.getController('LeftMenu').setPreviewMode(disable);
|
|
||||||
// var comments = DE.getController('Common.Controllers.Comments');
|
|
||||||
// if (comments)
|
|
||||||
// comments.setPreviewMode(disable);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue