[SSE] Refactoring
This commit is contained in:
parent
82156d4986
commit
83bfedde47
|
@ -69,7 +69,6 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onWorksheetLocked, this));
|
this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onWorksheetLocked, this));
|
||||||
this.api.asc_registerCallback('asc_onSheetsChanged', this.onApiSheetChanged.bind(this));
|
this.api.asc_registerCallback('asc_onSheetsChanged', this.onApiSheetChanged.bind(this));
|
||||||
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', this.onApiSheetChanged.bind(this));
|
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', this.onApiSheetChanged.bind(this));
|
||||||
this.api.asc_registerCallback('asc_onLockNamedSheetViewManager', this.onLockNamedSheetViewManager.bind(this));
|
|
||||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||||
}
|
}
|
||||||
|
@ -99,7 +98,6 @@ define([
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this));
|
Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this));
|
||||||
Common.NotificationCenter.on('sheetview:locked', _.bind(this.onSheetViewLocked, this));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
SetDisabled: function(state) {
|
SetDisabled: function(state) {
|
||||||
|
@ -168,10 +166,6 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onCreateView: function(item) {
|
onCreateView: function(item) {
|
||||||
if (this._state.viewlocked) {
|
|
||||||
Common.NotificationCenter.trigger('sheetview:locked');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.api && this.api.asc_addNamedSheetView(null, true);
|
this.api && this.api.asc_addNamedSheetView(null, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -179,7 +173,6 @@ define([
|
||||||
var me = this;
|
var me = this;
|
||||||
(new SSE.Views.ViewManagerDlg({
|
(new SSE.Views.ViewManagerDlg({
|
||||||
api: this.api,
|
api: this.api,
|
||||||
locked: this._state.viewlocked,
|
|
||||||
handler: function(result, value) {
|
handler: function(result, value) {
|
||||||
if (result == 'ok' && value) {
|
if (result == 'ok' && value) {
|
||||||
if (me.api) {
|
if (me.api) {
|
||||||
|
@ -220,26 +213,6 @@ define([
|
||||||
onApiZoomChange: function(zf, type){
|
onApiZoomChange: function(zf, type){
|
||||||
var value = Math.floor((zf + .005) * 100);
|
var value = Math.floor((zf + .005) * 100);
|
||||||
this.view.cmbZoom.setValue(value, value + '%');
|
this.view.cmbZoom.setValue(value, value + '%');
|
||||||
},
|
|
||||||
|
|
||||||
onSheetViewLocked: function() {
|
|
||||||
var me = this;
|
|
||||||
if ($('.asc-window.modal.alert:visible').length < 1) {
|
|
||||||
Common.UI.warning({
|
|
||||||
msg: this.errorEditView,
|
|
||||||
maxwidth: 500,
|
|
||||||
callback: _.bind(function(btn){
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.view);
|
|
||||||
}, this)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
onLockNamedSheetViewManager: function(index, state) {
|
|
||||||
// this._state.viewlocked = state;
|
|
||||||
},
|
|
||||||
|
|
||||||
errorEditView: 'The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.'
|
|
||||||
|
|
||||||
}, SSE.Controllers.ViewTab || {}));
|
}, SSE.Controllers.ViewTab || {}));
|
||||||
});
|
});
|
|
@ -97,13 +97,11 @@ define([
|
||||||
|
|
||||||
this.api = options.api;
|
this.api = options.api;
|
||||||
this.views = options.views || [];
|
this.views = options.views || [];
|
||||||
this.locked = options.locked || false;
|
|
||||||
this.userTooltip = true;
|
this.userTooltip = true;
|
||||||
this.currentView = undefined;
|
this.currentView = undefined;
|
||||||
|
|
||||||
this.wrapEvents = {
|
this.wrapEvents = {
|
||||||
onRefreshNamedSheetViewList: _.bind(this.onRefreshNamedSheetViewList, this),
|
onRefreshNamedSheetViewList: _.bind(this.onRefreshNamedSheetViewList, this)
|
||||||
onLockNamedSheetViewManager: _.bind(this.onLockNamedSheetViewManager, this)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
|
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
|
||||||
|
@ -162,17 +160,12 @@ define([
|
||||||
_setDefaults: function (props) {
|
_setDefaults: function (props) {
|
||||||
this.refreshList(this.views, 0);
|
this.refreshList(this.views, 0);
|
||||||
this.api.asc_registerCallback('asc_onRefreshNamedSheetViewList', this.wrapEvents.onRefreshNamedSheetViewList);
|
this.api.asc_registerCallback('asc_onRefreshNamedSheetViewList', this.wrapEvents.onRefreshNamedSheetViewList);
|
||||||
this.api.asc_registerCallback('asc_onLockNamedSheetViewManager', this.wrapEvents.onLockNamedSheetViewManager);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onRefreshNamedSheetViewList: function() {
|
onRefreshNamedSheetViewList: function() {
|
||||||
this.refreshList(this.api.asc_getNamedSheetViews(), this.currentView);
|
this.refreshList(this.api.asc_getNamedSheetViews(), this.currentView);
|
||||||
},
|
},
|
||||||
|
|
||||||
onLockNamedSheetViewManager: function(index, state) {
|
|
||||||
// this.locked = state;
|
|
||||||
},
|
|
||||||
|
|
||||||
refreshList: function(views, selectedItem) {
|
refreshList: function(views, selectedItem) {
|
||||||
if (views) {
|
if (views) {
|
||||||
this.views = views;
|
this.views = views;
|
||||||
|
@ -242,10 +235,6 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onNew: function (duplicate) {
|
onNew: function (duplicate) {
|
||||||
if (this.locked) {
|
|
||||||
Common.NotificationCenter.trigger('sheetview:locked');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var rec = duplicate ? this.viewList.getSelectedRec().get('view') : undefined;
|
var rec = duplicate ? this.viewList.getSelectedRec().get('view') : undefined;
|
||||||
this.currentView = this.viewList.store.length;
|
this.currentView = this.viewList.store.length;
|
||||||
this.api.asc_addNamedSheetView(rec);
|
this.api.asc_addNamedSheetView(rec);
|
||||||
|
@ -263,27 +252,17 @@ define([
|
||||||
primary: 'yes',
|
primary: 'yes',
|
||||||
callback: function(btn) {
|
callback: function(btn) {
|
||||||
if (btn == 'yes') {
|
if (btn == 'yes') {
|
||||||
res = me.api.asc_deleteNamedSheetViews([rec.get('view')]);
|
me.api.asc_deleteNamedSheetViews([rec.get('view')]);
|
||||||
if (res) {// error when deleting
|
|
||||||
Common.UI.warning({msg: me.errorDeleteView.replace('%1', rec.get('name')), maxwidth: 500});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res = this.api.asc_deleteNamedSheetViews([rec.get('view')]);
|
this.api.asc_deleteNamedSheetViews([rec.get('view')]);
|
||||||
if (res) {// error when deleting
|
|
||||||
Common.UI.warning({msg: this.errorDeleteView.replace('%1', rec.get('name')), maxwidth: 500});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onRename: function () {
|
onRename: function () {
|
||||||
if (this.locked) {
|
|
||||||
Common.NotificationCenter.trigger('sheetview:locked');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var rec = this.viewList.getSelectedRec();
|
var rec = this.viewList.getSelectedRec();
|
||||||
if (rec) {
|
if (rec) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
@ -310,7 +289,7 @@ define([
|
||||||
if (usersStore){
|
if (usersStore){
|
||||||
var rec = usersStore.findUser(id);
|
var rec = usersStore.findUser(id);
|
||||||
if (rec)
|
if (rec)
|
||||||
return rec.get('username');
|
return Common.Utils.UserInfoParser.getParsedName(rec.get('username'));
|
||||||
}
|
}
|
||||||
return this.guestText;
|
return this.guestText;
|
||||||
},
|
},
|
||||||
|
@ -335,7 +314,6 @@ define([
|
||||||
close: function () {
|
close: function () {
|
||||||
this.userTipHide();
|
this.userTipHide();
|
||||||
this.api.asc_unregisterCallback('asc_onRefreshNamedSheetViewList', this.wrapEvents.onRefreshNamedSheetViewList);
|
this.api.asc_unregisterCallback('asc_onRefreshNamedSheetViewList', this.wrapEvents.onRefreshNamedSheetViewList);
|
||||||
this.api.asc_unregisterCallback('asc_onLockNamedSheetViewManager', this.wrapEvents.onLockNamedSheetViewManager);
|
|
||||||
|
|
||||||
Common.Views.AdvancedSettingsWindow.prototype.close.call(this);
|
Common.Views.AdvancedSettingsWindow.prototype.close.call(this);
|
||||||
},
|
},
|
||||||
|
@ -362,8 +340,7 @@ define([
|
||||||
tipIsLocked: 'This element is being edited by another user.',
|
tipIsLocked: 'This element is being edited by another user.',
|
||||||
textRenameLabel: 'Rename view',
|
textRenameLabel: 'Rename view',
|
||||||
textRenameError: 'View name must not be empty.',
|
textRenameError: 'View name must not be empty.',
|
||||||
warnDeleteView: "You are trying to delete the currently enabled view '%1'.<br>Close this view and delete it?",
|
warnDeleteView: "You are trying to delete the currently enabled view '%1'.<br>Close this view and delete it?"
|
||||||
errorDeleteView: "You cannot delete view '%1' because it is currently being used by other users."
|
|
||||||
|
|
||||||
}, SSE.Views.ViewManagerDlg || {}));
|
}, SSE.Views.ViewManagerDlg || {}));
|
||||||
});
|
});
|
|
@ -850,6 +850,7 @@
|
||||||
"SSE.Controllers.Main.warnLicenseExceeded": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact your administrator to learn more.",
|
"SSE.Controllers.Main.warnLicenseExceeded": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact your administrator to learn more.",
|
||||||
"SSE.Controllers.Main.warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.",
|
"SSE.Controllers.Main.warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.",
|
||||||
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
|
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
|
||||||
|
"SSE.Controllers.Main.errorEditView": "The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.",
|
||||||
"SSE.Controllers.Print.strAllSheets": "All Sheets",
|
"SSE.Controllers.Print.strAllSheets": "All Sheets",
|
||||||
"SSE.Controllers.Print.textFirstCol": "First column",
|
"SSE.Controllers.Print.textFirstCol": "First column",
|
||||||
"SSE.Controllers.Print.textFirstRow": "First row",
|
"SSE.Controllers.Print.textFirstRow": "First row",
|
||||||
|
@ -1215,7 +1216,6 @@
|
||||||
"SSE.Controllers.Toolbar.txtTable_TableStyleMedium": "Table Style Medium",
|
"SSE.Controllers.Toolbar.txtTable_TableStyleMedium": "Table Style Medium",
|
||||||
"SSE.Controllers.Toolbar.warnLongOperation": "The operation you are about to perform might take rather much time to complete.<br>Are you sure you want to continue?",
|
"SSE.Controllers.Toolbar.warnLongOperation": "The operation you are about to perform might take rather much time to complete.<br>Are you sure you want to continue?",
|
||||||
"SSE.Controllers.Toolbar.warnMergeLostData": "Only the data from the upper-left cell will remain in the merged cell. <br>Are you sure you want to continue?",
|
"SSE.Controllers.Toolbar.warnMergeLostData": "Only the data from the upper-left cell will remain in the merged cell. <br>Are you sure you want to continue?",
|
||||||
"SSE.Controllers.ViewTab.errorEditView": "The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.",
|
|
||||||
"SSE.Controllers.Viewport.textFreezePanes": "Freeze Panes",
|
"SSE.Controllers.Viewport.textFreezePanes": "Freeze Panes",
|
||||||
"SSE.Controllers.Viewport.textFreezePanesShadow:": "Show Freezed Panes Shadow",
|
"SSE.Controllers.Viewport.textFreezePanesShadow:": "Show Freezed Panes Shadow",
|
||||||
"SSE.Controllers.Viewport.textHideFBar": "Hide Formula Bar",
|
"SSE.Controllers.Viewport.textHideFBar": "Hide Formula Bar",
|
||||||
|
@ -2941,7 +2941,6 @@
|
||||||
"SSE.Views.ViewManagerDlg.textRenameLabel": "Rename view",
|
"SSE.Views.ViewManagerDlg.textRenameLabel": "Rename view",
|
||||||
"SSE.Views.ViewManagerDlg.textRenameError": "View name must not be empty.",
|
"SSE.Views.ViewManagerDlg.textRenameError": "View name must not be empty.",
|
||||||
"SSE.Views.ViewManagerDlg.warnDeleteView": "You are trying to delete the currently enabled view '%1'.<br>Close this view and delete it?",
|
"SSE.Views.ViewManagerDlg.warnDeleteView": "You are trying to delete the currently enabled view '%1'.<br>Close this view and delete it?",
|
||||||
"SSE.Views.ViewManagerDlg.errorDeleteView": "You cannot delete view '%1' because it is currently being used by other users.",
|
|
||||||
"SSE.Views.ViewTab.capBtnSheetView": "Sheet View",
|
"SSE.Views.ViewTab.capBtnSheetView": "Sheet View",
|
||||||
"SSE.Views.ViewTab.capBtnFreeze": "Freeze Panes",
|
"SSE.Views.ViewTab.capBtnFreeze": "Freeze Panes",
|
||||||
"SSE.Views.ViewTab.textZoom": "Zoom",
|
"SSE.Views.ViewTab.textZoom": "Zoom",
|
||||||
|
|
Loading…
Reference in a new issue