[SSE mobile] Bug 48623 (Moved code from main controller, removed unused code)

This commit is contained in:
JuliaSvinareva 2021-05-13 18:37:00 +03:00
parent c36ed41d35
commit 41105c00ef
3 changed files with 41 additions and 149 deletions

View file

@ -59,26 +59,7 @@
"errorProcessSaveResult": "Saving is failed.", "errorProcessSaveResult": "Saving is failed.",
"criticalErrorTitle": "Error", "criticalErrorTitle": "Error",
"warnProcessRightsChange": "You have been denied the right to edit the file.", "warnProcessRightsChange": "You have been denied the right to edit the file.",
"errorAccessDeny": "You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.", "errorAccessDeny": "You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator."
"confirmMoveCellRange": "The destination cell`s range can contain data. Continue the operation?",
"textOk": "Ok",
"confirmPutMergeRange": "The source data contains merged cells.<br>They will be unmerged before they are pasted into the table.",
"openTitleText": "Opening Document",
"saveTitleText": "Saving Document",
"loadFontsTitleText": "Loading Data",
"loadImagesTitleText": "Loading Images",
"loadFontTitleText": "Loading Data",
"loadImageTitleText": "Loading Image",
"downloadTitleText": "Downloading Document",
"printTitleText": "Printing Document",
"uploadImageTitleText": "Uploading Image",
"titleRecalcFormulas": "Calculating formulas...",
"textPleaseWait": "It`s working hard. Please wait...",
"savePreparingText": "Preparing to save",
"waitText": "Please, wait...",
"txtEditingMode": "Set editing mode...",
"loadingDocumentTitleText": "Loading spreadsheet"
} }
}, },
"LongActions": { "LongActions": {
@ -108,7 +89,13 @@
"txtEditingMode": "Set editing mode...", "txtEditingMode": "Set editing mode...",
"loadingDocumentTitleText": "Loading document", "loadingDocumentTitleText": "Loading document",
"loadingDocumentTextText": "Loading document...", "loadingDocumentTextText": "Loading document...",
"textLoadingDocument": "Loading document" "textLoadingDocument": "Loading document",
"notcriticalErrorTitle": "Warning",
"textOk": "Ok",
"textNo": "No",
"confirmMoveCellRange": "The destination cell`s range can contain data. Continue the operation?",
"confirmPutMergeRange": "The source data contains merged cells.<br>They will be unmerged before they are pasted into the table."
}, },
"Error": { "Error": {
"criticalErrorTitle": "Error", "criticalErrorTitle": "Error",

View file

@ -28,6 +28,7 @@ const LongActionsController = () => {
api.asc_registerCallback('asc_onStartAction', onLongActionBegin); api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
api.asc_registerCallback('asc_onEndAction', onLongActionEnd); api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);
api.asc_registerCallback('asc_onConfirmAction', onConfirmAction);
}); });
Common.Notifications.on('preloader:endAction', onLongActionEnd); Common.Notifications.on('preloader:endAction', onLongActionEnd);
Common.Notifications.on('preloader:beginAction', onLongActionBegin); Common.Notifications.on('preloader:beginAction', onLongActionBegin);
@ -38,6 +39,7 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin); api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin);
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
api.asc_unregisterCallback('asc_onConfirmAction', onConfirmAction);
Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:endAction', onLongActionEnd);
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);
@ -178,6 +180,36 @@ const LongActionsController = () => {
}; };
const onConfirmAction = (id, apiCallback) => {
if (id === Asc.c_oAscConfirm.ConfirmReplaceRange) {
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.confirmMoveCellRange,
buttons: [
{text: _t.textYes,
onClick: () => {
if (apiCallback) apiCallback(true);
}},
{text: _t.textNo,
onClick: () => {
if (apiCallback) apiCallback(false);
}}
],
}).open();
} else if (id === Asc.c_oAscConfirm.ConfirmPutMergeRange) {
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.confirmPutMergeRange,
buttons: [
{text: _t.textOk,
onClick: () => {
if (apiCallback) apiCallback();
}},
],
}).open();
}
};
const onOpenDocument = (progress) => { const onOpenDocument = (progress) => {
if (loadMask && loadMask.el) { if (loadMask && loadMask.el) {
const $title = loadMask.el.getElementsByClassName('dialog-title')[0]; const $title = loadMask.el.getElementsByClassName('dialog-title')[0];
@ -185,7 +217,7 @@ const LongActionsController = () => {
$title.innerHTML = `${_t.textLoadingDocument}: ${Math.min(Math.round(proc * 100), 100)}%`; $title.innerHTML = `${_t.textLoadingDocument}: ${Math.min(Math.round(proc * 100), 100)}%`;
} }
} };
return null; return null;
}; };

View file

@ -298,8 +298,6 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onPrint', this.onPrint.bind(this)); this.api.asc_registerCallback('asc_onPrint', this.onPrint.bind(this));
this.api.asc_registerCallback('asc_onDocumentName', this.onDocumentName.bind(this)); this.api.asc_registerCallback('asc_onDocumentName', this.onDocumentName.bind(this));
this.api.asc_registerCallback('asc_onEndAction', this._onLongActionEnd.bind(this)); this.api.asc_registerCallback('asc_onEndAction', this._onLongActionEnd.bind(this));
// this.api.asc_registerCallback('asc_onStartAction', this.onLongActionBegin.bind(this));
this.api.asc_registerCallback('asc_onConfirmAction', this.onConfirmAction.bind(this));
EditorUIController.initCellInfo && EditorUIController.initCellInfo(this.props); EditorUIController.initCellInfo && EditorUIController.initCellInfo(this.props);
@ -326,131 +324,6 @@ class MainController extends Component {
} }
// onLongActionBegin(type, id) {
// let action = {id: id, type: type};
// this.setLongActionView(action);
// }
// setLongActionView(action) {
// const _t = this._t;
// let title = '';
// switch (action.id) {
// case Asc.c_oAscAsyncAction.Open:
// title = _t.openTitleText;
// break;
// case Asc.c_oAscAsyncAction.Save:
// title = _t.saveTitleText;
// break;
// case Asc.c_oAscAsyncAction.ForceSaveTimeout:
// break;
// case Asc.c_oAscAsyncAction.ForceSaveButton:
// break;
// case Asc.c_oAscAsyncAction.LoadDocumentFonts:
// title = _t.loadFontsTitleText;
// break;
// case Asc.c_oAscAsyncAction.LoadDocumentImages:
// title = _t.loadImagesTitleText;
// break;
// case Asc.c_oAscAsyncAction.LoadFont:
// title = _t.loadFontTitleText;
// break;
// case Asc.c_oAscAsyncAction.LoadImage:
// title = _t.loadImageTitleText;
// break;
// case Asc.c_oAscAsyncAction.DownloadAs:
// title = _t.downloadTitleText;
// break;
// case Asc.c_oAscAsyncAction.Print:
// title = _t.printTitleText;
// break;
// case Asc.c_oAscAsyncAction.UploadImage:
// title = _t.uploadImageTitleText;
// break;
// case Asc.c_oAscAsyncAction.Recalc:
// title = _t.titleRecalcFormulas;
// break;
// case Asc.c_oAscAsyncAction.SlowOperation:
// title = _t.textPleaseWait;
// break;
// case Asc.c_oAscAsyncAction['PrepareToSave']:
// title = _t.savePreparingText;
// break;
// case Asc.c_oAscAsyncAction['Waiting']:
// title = _t.waitText;
// break;
// case this.ApplyEditRights:
// title = _t.txtEditingMode;
// break;
// case this.LoadingDocument:
// title = _t.loadingDocumentTitleText;
// break;
// default:
// if (typeof action.id == 'string'){
// title = action.id;
// }
// break;
// }
// if (action.type == Asc.c_oAscAsyncActionType.BlockInteraction) {
// // !this.loadMask && (this.loadMask = new Common.UI.LoadMask({owner: $$('#viewport')}));
// // this.loadMask.setTitle(title);
// if (!this.isShowOpenDialog) {
// this.api.asc_enableKeyEvents(false);
// // this.loadMask.show();
// }
// }
// }
onConfirmAction(id, apiCallback) {
const _t = this._t;
if (id == Asc.c_oAscConfirm.ConfirmReplaceRange) {
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.confirmMoveCellRange,
buttons: [
{text: _t.textYes,
onClick: () => {
if (apiCallback) apiCallback(true);
}},
{text: _t.textNo,
onClick: () => {
if (apiCallback) apiCallback(false);
}}
],
}).open();
} else if (id == Asc.c_oAscConfirm.ConfirmPutMergeRange) {
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.confirmPutMergeRange,
buttons: [
{text: _t.textOk,
onClick: () => {
if (apiCallback) apiCallback();
}},
],
}).open();
}
}
_onLongActionEnd(type, id) { _onLongActionEnd(type, id) {
if ( type === Asc.c_oAscAsyncActionType.BlockInteraction && id == Asc.c_oAscAsyncAction.Open ) { if ( type === Asc.c_oAscAsyncActionType.BlockInteraction && id == Asc.c_oAscAsyncAction.Open ) {
Common.Gateway.internalMessage('documentReady', {}); Common.Gateway.internalMessage('documentReady', {});