[SSE] Made changing of status items in statusbar

This commit is contained in:
JuliaSvinareva 2021-07-28 19:49:34 +03:00
parent eda6510de0
commit 3f0cc17039
6 changed files with 100 additions and 15 deletions

View file

@ -259,7 +259,7 @@ define([
case 'print': Common.NotificationCenter.trigger('print', this.leftMenu); break; case 'print': Common.NotificationCenter.trigger('print', this.leftMenu); break;
case 'exit': Common.NotificationCenter.trigger('goback'); break; case 'exit': Common.NotificationCenter.trigger('goback'); break;
case 'edit': case 'edit':
// this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText); this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText);
Common.Gateway.requestEditRights(); Common.Gateway.requestEditRights();
break; break;
case 'new': case 'new':

View file

@ -661,10 +661,23 @@ define([
} }
action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}); action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information});
action && this.setLongActionView(action); if (action) {
this.setLongActionView(action);
} else {
var me = this;
if ((id == Asc.c_oAscAsyncAction['Save'] || id == Asc.c_oAscAsyncAction['ForceSaveButton']) && !this.appOptions.isOffline) {
if (this._state.fastCoauth && this._state.usersCount > 1) {
me._state.timerSave = setTimeout(function () {
me.getApplication().getController('Statusbar').setStatusCaption(me.textChangesSaved, false, 3000);
}, 500);
} else
me.getApplication().getController('Statusbar').setStatusCaption(me.textChangesSaved, false, 3000);
} else
this.getApplication().getController('Statusbar').setStatusCaption('');
}
if (id == Asc.c_oAscAsyncAction.Save) { if (id == Asc.c_oAscAsyncAction.Save) {
this.toolbarView && this.toolbarView.synchronizeChanges(); this.synchronizeChanges();
} }
action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
@ -686,83 +699,97 @@ define([
}, },
setLongActionView: function(action) { setLongActionView: function(action) {
var title = ''; var title = '', text = '', force = false;
switch (action.id) { switch (action.id) {
case Asc.c_oAscAsyncAction.Open: case Asc.c_oAscAsyncAction.Open:
title = this.openTitleText; title = this.openTitleText;
text = this.openTextText;
break; break;
case Asc.c_oAscAsyncAction.Save: case Asc.c_oAscAsyncAction['Save']:
title = this.saveTitleText; case Asc.c_oAscAsyncAction['ForceSaveButton']:
break;
case Asc.c_oAscAsyncAction.ForceSaveTimeout: case Asc.c_oAscAsyncAction.ForceSaveTimeout:
break; clearTimeout(this._state.timerSave);
force = true;
case Asc.c_oAscAsyncAction.ForceSaveButton: text = (!this.appOptions.isOffline) ? this.saveTextText : '';
break; break;
case Asc.c_oAscAsyncAction.LoadDocumentFonts: case Asc.c_oAscAsyncAction.LoadDocumentFonts:
title = this.loadFontsTitleText; title = this.loadFontsTitleText;
text = this.loadFontsTextText;
break; break;
case Asc.c_oAscAsyncAction.LoadDocumentImages: case Asc.c_oAscAsyncAction.LoadDocumentImages:
title = this.loadImagesTitleText; title = this.loadImagesTitleText;
text = this.loadImagesTextText;
break; break;
case Asc.c_oAscAsyncAction.LoadFont: case Asc.c_oAscAsyncAction.LoadFont:
title = this.loadFontTitleText; title = this.loadFontTitleText;
text = this.loadFontTextText;
break; break;
case Asc.c_oAscAsyncAction.LoadImage: case Asc.c_oAscAsyncAction.LoadImage:
title = this.loadImageTitleText; title = this.loadImageTitleText;
text = this.loadImageTextText;
break; break;
case Asc.c_oAscAsyncAction.DownloadAs: case Asc.c_oAscAsyncAction.DownloadAs:
title = this.downloadTitleText; title = this.downloadTitleText;
text = this.downloadTextText;
break; break;
case Asc.c_oAscAsyncAction.Print: case Asc.c_oAscAsyncAction.Print:
title = this.printTitleText; title = this.printTitleText;
text = this.printTextText;
break; break;
case Asc.c_oAscAsyncAction.UploadImage: case Asc.c_oAscAsyncAction.UploadImage:
title = this.uploadImageTitleText; title = this.uploadImageTitleText;
text = this.uploadImageTextText;
break; break;
case Asc.c_oAscAsyncAction.Recalc: case Asc.c_oAscAsyncAction.Recalc:
title = this.titleRecalcFormulas; title = this.titleRecalcFormulas;
text = this.textRecalcFormulas;
break; break;
case Asc.c_oAscAsyncAction.SlowOperation: case Asc.c_oAscAsyncAction.SlowOperation:
title = this.textPleaseWait; title = this.textPleaseWait;
text = this.textPleaseWait;
break; break;
case Asc.c_oAscAsyncAction['PrepareToSave']: case Asc.c_oAscAsyncAction['PrepareToSave']:
title = this.savePreparingText; title = this.savePreparingText;
text = this.savePreparingTitle;
break; break;
case Asc.c_oAscAsyncAction['Waiting']: case Asc.c_oAscAsyncAction['Waiting']:
title = this.waitText; title = this.waitText;
text = this.waitText;
break; break;
case ApplyEditRights: case ApplyEditRights:
title = this.txtEditingMode; title = this.txtEditingMode;
text = this.waitText;
break; break;
case LoadingDocument: case LoadingDocument:
title = this.loadingDocumentTitleText + ' '; title = this.loadingDocumentTitleText + ' ';
text = this.loadingDocumentTitleText;
break; break;
case Asc.c_oAscAsyncAction['Disconnect']: case Asc.c_oAscAsyncAction['Disconnect']:
title = this.textDisconnect; title = this.textDisconnect;
text = this.textDisconnect;
this.disableEditing(true, true); this.disableEditing(true, true);
break; break;
default: default:
if (typeof action.id == 'string'){ if (typeof action.id == 'string'){
title = action.id; title = action.id;
text = action.id;
} }
break; break;
} }
@ -775,10 +802,14 @@ define([
this.api.asc_enableKeyEvents(false); this.api.asc_enableKeyEvents(false);
this.loadMask.show(); this.loadMask.show();
} }
} else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
} }
}, },
onApplyEditRights: function(data) { onApplyEditRights: function(data) {
this.getApplication().getController('Statusbar').setStatusCaption('');
if (data && !data.allowed) { if (data && !data.allowed) {
Common.UI.info({ Common.UI.info({
title: this.requestEditFailedTitleText, title: this.requestEditFailedTitleText,
@ -1383,6 +1414,7 @@ define([
rightmenuController.getView('RightMenu').hide(); rightmenuController.getView('RightMenu').hide();
/** coauthoring begin **/ /** coauthoring begin **/
me.api.asc_registerCallback('asc_onCollaborativeChanges', _.bind(me.onCollaborativeChanges, me));
me.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me)); me.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me));
me.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me)); me.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me));
me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onUserConnection, me)); me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onUserConnection, me));
@ -1894,6 +1926,8 @@ define([
} }
this._isDocReady && (this._state.isDocModified !== change) && Common.Gateway.setDocumentModified(change); this._isDocReady && (this._state.isDocModified !== change) && Common.Gateway.setDocumentModified(change);
if (change && (!this._state.fastCoauth || this._state.usersCount<2))
this.getApplication().getController('Statusbar').setStatusCaption('', true);
this._state.isDocModified = change; this._state.isDocModified = change;
} }
@ -2449,7 +2483,7 @@ define([
oldval = this._state.fastCoauth; oldval = this._state.fastCoauth;
this._state.fastCoauth = (value===null || parseInt(value) == 1); this._state.fastCoauth = (value===null || parseInt(value) == 1);
if (this._state.fastCoauth && !oldval) if (this._state.fastCoauth && !oldval)
this.toolbarView.synchronizeChanges(); this.synchronizeChanges();
} }
if (this.appOptions.canForcesave) { if (this.appOptions.canForcesave) {
this.appOptions.forcesave = Common.localStorage.getBool("sse-settings-forcesave", this.appOptions.canForcesave); this.appOptions.forcesave = Common.localStorage.getBool("sse-settings-forcesave", this.appOptions.canForcesave);
@ -2634,6 +2668,18 @@ define([
return true; return true;
}, },
onCollaborativeChanges: function() {
if (this._state.hasCollaborativeChanges) return;
this._state.hasCollaborativeChanges = true;
if (this.appOptions.isEdit)
this.getApplication().getController('Statusbar').setStatusCaption(this.textNeedSynchronize, true);
},
synchronizeChanges: function() {
this.toolbarView && this.toolbarView.synchronizeChanges();
this._state.hasCollaborativeChanges = false;
},
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.', leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
criticalErrorTitle: 'Error', criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning', notcriticalErrorTitle: 'Warning',
@ -3036,7 +3082,9 @@ define([
txtOr: '%1 or %2', txtOr: '%1 or %2',
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.', errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.',
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' textDisconnect: 'Connection is lost',
textNeedSynchronize: 'You have an updates',
textChangesSaved: 'All changes saved'
} }
})(), SSE.Controllers.Main || {})) })(), SSE.Controllers.Main || {}))
}); });

View file

@ -764,6 +764,19 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.statusbar); Common.NotificationCenter.trigger('edit:complete', this.statusbar);
}, },
setStatusCaption: function(text, force, delay) {
if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force )
return;
this.timerCaption = undefined;
if (text.length) {
this.statusbar.showStatusMessage(text);
if (delay>0)
this.timerCaption = (new Date()).getTime() + delay;
} else
this.statusbar.clearStatusMessage();
},
zoomText : 'Zoom {0}%', zoomText : 'Zoom {0}%',
errorLastSheet : 'Workbook must have at least one visible worksheet.', errorLastSheet : 'Workbook must have at least one visible worksheet.',
errorRemoveSheet: 'Can\'t delete the worksheet.', errorRemoveSheet: 'Can\'t delete the worksheet.',

View file

@ -39,9 +39,9 @@
</div> </div>
</div> </div>
<div id="status-number-of-sheet"> <div id="status-number-of-sheet">
<label id="label-sheets" class="status-label">Sheet 1 of 9</label> <label id="label-sheets" class="status-label"></label>
</div> </div>
<div id="status-action"> <div id="status-action">
<label id="label-action" class="status-label">All changes saved</label> <label id="label-action" class="status-label"></label>
</div> </div>
</div> </div>

View file

@ -480,9 +480,11 @@ define([
this.boxNumberSheets = $('#status-number-of-sheet', this.el); this.boxNumberSheets = $('#status-number-of-sheet', this.el);
this.isCompact && this.boxNumberSheets.hide(); this.isCompact && this.boxNumberSheets.hide();
this.labelNumberSheets = $('#label-sheets', this.boxNumberSheets);
this.boxAction = $('#status-action', this.el); this.boxAction = $('#status-action', this.el);
this.isCompact && this.boxAction.hide(); this.isCompact && this.boxAction.hide();
this.labelAction = $('#label-action', this.boxAction);
this.$el.append('<div id="statusbar-menu" style="width:0; height:0;"></div>'); this.$el.append('<div id="statusbar-menu" style="width:0; height:0;"></div>');
this.$customizeStatusBarMenu = this.$el.find('#statusbar-menu'); this.$customizeStatusBarMenu = this.$el.find('#statusbar-menu');
@ -608,6 +610,8 @@ define([
this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || me.api.isCellEdited); this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || me.api.isCellEdited);
$('#status-label-zoom').text(Common.Utils.String.format(this.zoomText, Math.floor((this.api.asc_getZoom() +.005)*100))); $('#status-label-zoom').text(Common.Utils.String.format(this.zoomText, Math.floor((this.api.asc_getZoom() +.005)*100)));
this.updateNumberOfSheet(sindex, wc);
me.fireEvent('sheet:changed', [me, sindex]); me.fireEvent('sheet:changed', [me, sindex]);
me.fireEvent('sheet:updateColors', [true]); me.fireEvent('sheet:updateColors', [true]);
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + me.api.asc_getActiveWorksheetId()], false); Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + me.api.asc_getActiveWorksheetId()], false);
@ -679,6 +683,8 @@ define([
onSheetChanged: function(o, index, tab) { onSheetChanged: function(o, index, tab) {
this.api.asc_showWorksheet(tab.sheetindex); this.api.asc_showWorksheet(tab.sheetindex);
this.updateNumberOfSheet(tab.sheetindex, this.api.asc_getWorksheetsCount());
if (this.hasTabInvisible && !this.tabbar.isTabVisible(index)) { if (this.hasTabInvisible && !this.tabbar.isTabVisible(index)) {
this.tabbar.setTabVisible(index); this.tabbar.setTabVisible(index);
} }
@ -919,6 +925,21 @@ define([
this.onTabInvisible(undefined, this.tabbar.checkInvisible(true)); this.onTabInvisible(undefined, this.tabbar.checkInvisible(true));
}, },
updateNumberOfSheet: function (active, count) {
this.labelNumberSheets.text(
Common.Utils.String.format(this.sheetIndexText, active + 1, count)
);
},
showStatusMessage: function(message) {
this.labelAction.text(message);
},
clearStatusMessage: function() {
this.labelAction.text('');
},
sheetIndexText : 'Sheet {0} of {1}',
tipZoomIn : 'Zoom In', tipZoomIn : 'Zoom In',
tipZoomOut : 'Zoom Out', tipZoomOut : 'Zoom Out',
tipZoomFactor : 'Magnification', tipZoomFactor : 'Magnification',

View file

@ -1009,6 +1009,8 @@
"SSE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"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.textNeedSynchronize": "You have an updates",
"SSE.Controllers.Main.textChangesSaved": "All changes saved",
"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",
@ -3012,6 +3014,7 @@
"SSE.Views.Statusbar.tipZoomOut": "Zoom out", "SSE.Views.Statusbar.tipZoomOut": "Zoom out",
"SSE.Views.Statusbar.ungroupSheets": "Ungroup Sheets", "SSE.Views.Statusbar.ungroupSheets": "Ungroup Sheets",
"SSE.Views.Statusbar.zoomText": "Zoom {0}%", "SSE.Views.Statusbar.zoomText": "Zoom {0}%",
"SSE.Views.Statusbar.sheetIndexText": "Sheet {0} of {1}",
"SSE.Views.TableOptionsDialog.errorAutoFilterDataRange": "The operation could not be done for the selected range of cells.<br>Select a uniform data range different from the existing one and try again.", "SSE.Views.TableOptionsDialog.errorAutoFilterDataRange": "The operation could not be done for the selected range of cells.<br>Select a uniform data range different from the existing one and try again.",
"SSE.Views.TableOptionsDialog.errorFTChangeTableRangeError": "Operation could not be completed for the selected cell range.<br>Select a range so that the first table row was on the same row<br>and the resulting table overlapped the current one.", "SSE.Views.TableOptionsDialog.errorFTChangeTableRangeError": "Operation could not be completed for the selected cell range.<br>Select a range so that the first table row was on the same row<br>and the resulting table overlapped the current one.",
"SSE.Views.TableOptionsDialog.errorFTRangeIncludedOtherTables": "Operation could not be completed for the selected cell range.<br>Select a range which does not include other tables.", "SSE.Views.TableOptionsDialog.errorFTRangeIncludedOtherTables": "Operation could not be completed for the selected cell range.<br>Select a range which does not include other tables.",