[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 'exit': Common.NotificationCenter.trigger('goback'); break;
case 'edit':
// this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText);
this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText);
Common.Gateway.requestEditRights();
break;
case 'new':

View file

@ -661,10 +661,23 @@ define([
}
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) {
this.toolbarView && this.toolbarView.synchronizeChanges();
this.synchronizeChanges();
}
action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
@ -686,83 +699,97 @@ define([
},
setLongActionView: function(action) {
var title = '';
var title = '', text = '', force = false;
switch (action.id) {
case Asc.c_oAscAsyncAction.Open:
title = this.openTitleText;
text = this.openTextText;
break;
case Asc.c_oAscAsyncAction.Save:
title = this.saveTitleText;
break;
case Asc.c_oAscAsyncAction['Save']:
case Asc.c_oAscAsyncAction['ForceSaveButton']:
case Asc.c_oAscAsyncAction.ForceSaveTimeout:
break;
case Asc.c_oAscAsyncAction.ForceSaveButton:
clearTimeout(this._state.timerSave);
force = true;
text = (!this.appOptions.isOffline) ? this.saveTextText : '';
break;
case Asc.c_oAscAsyncAction.LoadDocumentFonts:
title = this.loadFontsTitleText;
text = this.loadFontsTextText;
break;
case Asc.c_oAscAsyncAction.LoadDocumentImages:
title = this.loadImagesTitleText;
text = this.loadImagesTextText;
break;
case Asc.c_oAscAsyncAction.LoadFont:
title = this.loadFontTitleText;
text = this.loadFontTextText;
break;
case Asc.c_oAscAsyncAction.LoadImage:
title = this.loadImageTitleText;
text = this.loadImageTextText;
break;
case Asc.c_oAscAsyncAction.DownloadAs:
title = this.downloadTitleText;
text = this.downloadTextText;
break;
case Asc.c_oAscAsyncAction.Print:
title = this.printTitleText;
text = this.printTextText;
break;
case Asc.c_oAscAsyncAction.UploadImage:
title = this.uploadImageTitleText;
text = this.uploadImageTextText;
break;
case Asc.c_oAscAsyncAction.Recalc:
title = this.titleRecalcFormulas;
text = this.textRecalcFormulas;
break;
case Asc.c_oAscAsyncAction.SlowOperation:
title = this.textPleaseWait;
text = this.textPleaseWait;
break;
case Asc.c_oAscAsyncAction['PrepareToSave']:
title = this.savePreparingText;
text = this.savePreparingTitle;
break;
case Asc.c_oAscAsyncAction['Waiting']:
title = this.waitText;
text = this.waitText;
break;
case ApplyEditRights:
title = this.txtEditingMode;
text = this.waitText;
break;
case LoadingDocument:
title = this.loadingDocumentTitleText + ' ';
text = this.loadingDocumentTitleText;
break;
case Asc.c_oAscAsyncAction['Disconnect']:
title = this.textDisconnect;
text = this.textDisconnect;
this.disableEditing(true, true);
break;
default:
if (typeof action.id == 'string'){
title = action.id;
text = action.id;
}
break;
}
@ -775,10 +802,14 @@ define([
this.api.asc_enableKeyEvents(false);
this.loadMask.show();
}
} else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
}
},
onApplyEditRights: function(data) {
this.getApplication().getController('Statusbar').setStatusCaption('');
if (data && !data.allowed) {
Common.UI.info({
title: this.requestEditFailedTitleText,
@ -1383,6 +1414,7 @@ define([
rightmenuController.getView('RightMenu').hide();
/** 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_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, 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);
if (change && (!this._state.fastCoauth || this._state.usersCount<2))
this.getApplication().getController('Statusbar').setStatusCaption('', true);
this._state.isDocModified = change;
}
@ -2449,7 +2483,7 @@ define([
oldval = this._state.fastCoauth;
this._state.fastCoauth = (value===null || parseInt(value) == 1);
if (this._state.fastCoauth && !oldval)
this.toolbarView.synchronizeChanges();
this.synchronizeChanges();
}
if (this.appOptions.canForcesave) {
this.appOptions.forcesave = Common.localStorage.getBool("sse-settings-forcesave", this.appOptions.canForcesave);
@ -2634,6 +2668,18 @@ define([
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.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',
@ -3036,7 +3082,9 @@ define([
txtOr: '%1 or %2',
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?',
textDisconnect: 'Connection is lost'
textDisconnect: 'Connection is lost',
textNeedSynchronize: 'You have an updates',
textChangesSaved: 'All changes saved'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -764,6 +764,19 @@ define([
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}%',
errorLastSheet : 'Workbook must have at least one visible worksheet.',
errorRemoveSheet: 'Can\'t delete the worksheet.',

View file

@ -39,9 +39,9 @@
</div>
</div>
<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 id="status-action">
<label id="label-action" class="status-label">All changes saved</label>
<label id="label-action" class="status-label"></label>
</div>
</div>

View file

@ -480,9 +480,11 @@ define([
this.boxNumberSheets = $('#status-number-of-sheet', this.el);
this.isCompact && this.boxNumberSheets.hide();
this.labelNumberSheets = $('#label-sheets', this.boxNumberSheets);
this.boxAction = $('#status-action', this.el);
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.$customizeStatusBarMenu = this.$el.find('#statusbar-menu');
@ -608,6 +610,8 @@ define([
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)));
this.updateNumberOfSheet(sindex, wc);
me.fireEvent('sheet:changed', [me, sindex]);
me.fireEvent('sheet:updateColors', [true]);
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + me.api.asc_getActiveWorksheetId()], false);
@ -679,6 +683,8 @@ define([
onSheetChanged: function(o, index, tab) {
this.api.asc_showWorksheet(tab.sheetindex);
this.updateNumberOfSheet(tab.sheetindex, this.api.asc_getWorksheetsCount());
if (this.hasTabInvisible && !this.tabbar.isTabVisible(index)) {
this.tabbar.setTabVisible(index);
}
@ -919,6 +925,21 @@ define([
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',
tipZoomOut : 'Zoom Out',
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.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.textNeedSynchronize": "You have an updates",
"SSE.Controllers.Main.textChangesSaved": "All changes saved",
"SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textFirstCol": "First column",
"SSE.Controllers.Print.textFirstRow": "First row",
@ -3012,6 +3014,7 @@
"SSE.Views.Statusbar.tipZoomOut": "Zoom out",
"SSE.Views.Statusbar.ungroupSheets": "Ungroup Sheets",
"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.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.",