[DE] Refactoring disable editing
This commit is contained in:
parent
85271a0e0a
commit
8e5979570b
|
@ -728,25 +728,47 @@ define([
|
|||
},
|
||||
|
||||
disableEditing: function(disable) {
|
||||
var app = this.getApplication();
|
||||
app.getController('Toolbar').DisableToolbar(disable, false, true);
|
||||
app.getController('DocumentHolder').getView().SetDisabled(disable);
|
||||
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||
viewMode: false,
|
||||
reviewMode: true,
|
||||
fillFormwMode: false,
|
||||
allowMerge: false,
|
||||
allowSignature: false,
|
||||
allowProtect: false,
|
||||
rightMenu: {clear: true, disable: true},
|
||||
statusBar: true,
|
||||
leftMenu: {disable: false, previewMode: true},
|
||||
fileMenu: {protect: true, save: false, rename: false},
|
||||
navigation: {disable: false, previewMode: true},
|
||||
comments: {disable: false, previewMode: true},
|
||||
chat: false,
|
||||
review: false,
|
||||
viewport: false,
|
||||
documentHolder: true,
|
||||
toolbar: true,
|
||||
plugins: true
|
||||
});
|
||||
|
||||
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 app = this.getApplication();
|
||||
// app.getController('Toolbar').DisableToolbar(disable, false, true);
|
||||
// app.getController('DocumentHolder').getView().SetDisabled(disable);
|
||||
|
||||
var leftMenu = app.getController('LeftMenu');
|
||||
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
|
||||
leftMenu.setPreviewMode(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) {
|
||||
this.view.$el.find('.no-group-mask.review').css('opacity', 1);
|
||||
|
|
|
@ -253,19 +253,40 @@ define([
|
|||
if (this._state.DisabledEditing != disable) {
|
||||
this._state.DisabledEditing = disable;
|
||||
|
||||
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);
|
||||
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||
viewMode: false,
|
||||
reviewMode: false,
|
||||
fillFormwMode: true,
|
||||
allowMerge: false,
|
||||
allowSignature: false,
|
||||
allowProtect: false,
|
||||
rightMenu: {clear: true, disable: true},
|
||||
statusBar: true,
|
||||
leftMenu: {disable: false, previewMode: true},
|
||||
fileMenu: false,
|
||||
navigation: {disable: false, previewMode: true},
|
||||
comments: {disable: false, previewMode: true},
|
||||
chat: false,
|
||||
review: true,
|
||||
viewport: false,
|
||||
documentHolder: true,
|
||||
toolbar: true,
|
||||
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)
|
||||
this.view.$el.find('.no-group-mask.form-view').css('opacity', 1);
|
||||
}
|
||||
|
|
|
@ -666,21 +666,25 @@ define([
|
|||
this.dlgSearch && this.dlgSearch.setMode(this.viewmode ? 'no-replace' : 'search');
|
||||
},
|
||||
|
||||
SetDisabled: function(disable, disableFileMenu) {
|
||||
this.mode.isEdit = !disable;
|
||||
SetDisabled: function(disable, options) {
|
||||
// if (viewMode) this.mode.isEdit = !disable;
|
||||
if (disable) this.leftMenu.close();
|
||||
|
||||
/** coauthoring begin **/
|
||||
this.leftMenu.btnComments.setDisabled(disable);
|
||||
var comments = this.getApplication().getController('Common.Controllers.Comments');
|
||||
if (comments)
|
||||
comments.setPreviewMode(disable);
|
||||
this.setPreviewMode(disable);
|
||||
this.leftMenu.btnChat.setDisabled(disable);
|
||||
/** coauthoring end **/
|
||||
// var comments = this.getApplication().getController('Common.Controllers.Comments');
|
||||
// if (comments)
|
||||
// comments.setPreviewMode(disable);
|
||||
// this.setPreviewMode(disable);
|
||||
|
||||
if (!options || options.comments && options.comments.disable)
|
||||
this.leftMenu.btnComments.setDisabled(disable);
|
||||
if (!options || options.chat)
|
||||
this.leftMenu.btnChat.setDisabled(disable);
|
||||
if (!options || options.navigation && options.navigation.disable)
|
||||
this.leftMenu.btnNavigation.setDisabled(disable);
|
||||
|
||||
this.leftMenu.btnPlugins.setDisabled(disable);
|
||||
this.leftMenu.btnNavigation.setDisabled(disable);
|
||||
if (disableFileMenu) this.leftMenu.getMenu('file').SetDisabled(disable);
|
||||
|
||||
// if (disableFileMenu) this.leftMenu.getMenu('file').SetDisabled(disable);
|
||||
},
|
||||
|
||||
/** coauthoring begin **/
|
||||
|
|
|
@ -213,6 +213,7 @@ define([
|
|||
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||
Common.NotificationCenter.on('editing:disable', _.bind(this.disableEditing2, this));
|
||||
|
||||
|
||||
this.isShowOpenDialog = false;
|
||||
|
@ -704,18 +705,107 @@ define([
|
|||
return"#"+("000000"+color.toString(16)).substr(-6);
|
||||
},
|
||||
|
||||
|
||||
disableEditing: function(disable) {
|
||||
disableEditing: function(disable, temp) {
|
||||
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('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, {
|
||||
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: {protect: true, save: true, rename: true},
|
||||
navigation: {disable: !temp, previewMode: true},
|
||||
comments: {disable: !temp, previewMode: true},
|
||||
chat: true,
|
||||
review: true,
|
||||
viewport: true,
|
||||
documentHolder: true,
|
||||
toolbar: true,
|
||||
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) {
|
||||
var app = this.getApplication();
|
||||
|
||||
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
|
||||
if (options.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);
|
||||
}
|
||||
}
|
||||
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, 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.viewMode!==undefined)
|
||||
this.appOptions.isEdit = !options.viewMode;
|
||||
}
|
||||
if (options.leftMenu.previewMode)
|
||||
app.getController('LeftMenu').setPreviewMode(disable);
|
||||
}
|
||||
if (options.fileMenu) {
|
||||
app.getController('LeftMenu').leftMenu.getMenu('file').SetDisabled(disable, options.fileMenu);
|
||||
}
|
||||
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);
|
||||
}
|
||||
app.getController('LeftMenu').SetDisabled(disable, true);
|
||||
app.getController('Toolbar').DisableToolbar(disable, disable);
|
||||
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||
app.getController('Viewport').SetDisabled(disable);
|
||||
},
|
||||
|
||||
onRequestClose: function() {
|
||||
|
@ -2425,17 +2515,17 @@ define([
|
|||
warningDocumentIsLocked: function() {
|
||||
var me = this;
|
||||
var _disable_ui = function (disable) {
|
||||
me.disableEditing(disable);
|
||||
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);
|
||||
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});
|
||||
|
|
|
@ -411,14 +411,14 @@ define([
|
|||
});
|
||||
},
|
||||
|
||||
SetDisabled: function(disable) {
|
||||
SetDisabled: function(disable, options) {
|
||||
var _btn_save = this.getButton('save'),
|
||||
_btn_rename = this.getButton('rename'),
|
||||
_btn_protect = this.getButton('protect');
|
||||
|
||||
_btn_save.setDisabled(disable || !this.mode.isEdit);
|
||||
_btn_protect.setDisabled(disable || !this.mode.isEdit);
|
||||
_btn_rename.setDisabled(disable || !this.mode.canRename || this.mode.isDesktopApp);
|
||||
options && options.save && _btn_save.setDisabled(disable || !this.mode.isEdit);
|
||||
options && options.protect && _btn_protect.setDisabled(disable || !this.mode.isEdit);
|
||||
options && options.rename && _btn_rename.setDisabled(disable || !this.mode.canRename || this.mode.isDesktopApp);
|
||||
},
|
||||
|
||||
isVisible: function () {
|
||||
|
|
|
@ -799,18 +799,39 @@ define([
|
|||
},
|
||||
|
||||
disableEditing: function(disable) {
|
||||
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);
|
||||
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||
viewMode: disable,
|
||||
reviewMode: false,
|
||||
fillFormwMode: false,
|
||||
allowMerge: true,
|
||||
allowSignature: false,
|
||||
allowProtect: false,
|
||||
rightMenu: {clear: false, disable: true},
|
||||
statusBar: true,
|
||||
leftMenu: {disable: false, previewMode: true},
|
||||
fileMenu: false,
|
||||
navigation: {disable: false, previewMode: true},
|
||||
comments: {disable: false, previewMode: true},
|
||||
chat: false,
|
||||
review: true,
|
||||
viewport: false,
|
||||
documentHolder: true,
|
||||
toolbar: true,
|
||||
plugins: false
|
||||
});
|
||||
|
||||
var comments = DE.getController('Common.Controllers.Comments');
|
||||
if (comments)
|
||||
comments.setPreviewMode(disable);
|
||||
// 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);
|
||||
|
||||
DE.getController('LeftMenu').setPreviewMode(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]});
|
||||
},
|
||||
|
|
|
@ -393,22 +393,43 @@ define([
|
|||
if (this._state.DisabledEditing != disable) {
|
||||
this._state.DisabledEditing = disable;
|
||||
|
||||
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);
|
||||
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||
viewMode: disable,
|
||||
reviewMode: false,
|
||||
fillFormwMode: false,
|
||||
allowMerge: false,
|
||||
allowSignature: true,
|
||||
allowProtect: true,
|
||||
rightMenu: {clear: disable && (DE.getController('RightMenu').rightmenu.GetActivePane() !== 'id-signature-settings'), disable: true},
|
||||
statusBar: true,
|
||||
leftMenu: {disable: false, previewMode: true},
|
||||
fileMenu: false,
|
||||
navigation: {disable: false, previewMode: true},
|
||||
comments: {disable: false, previewMode: true},
|
||||
chat: false,
|
||||
review: true,
|
||||
viewport: false,
|
||||
documentHolder: true,
|
||||
toolbar: true,
|
||||
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);
|
||||
// DE.getController('LeftMenu').setPreviewMode(disable);
|
||||
// var comments = DE.getController('Common.Controllers.Comments');
|
||||
// if (comments)
|
||||
// comments.setPreviewMode(disable);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue