[DE embedded] Fix submit action

This commit is contained in:
Julia Radzhabova 2021-05-20 17:44:21 +03:00
parent 01ce207277
commit 34fafd5c1a
3 changed files with 60 additions and 7 deletions

View file

@ -67,6 +67,7 @@
@btnColored: #446995; @btnColored: #446995;
@btnActiveColored: #293F59; @btnActiveColored: #293F59;
@btnHoverColored: #375478; @btnHoverColored: #375478;
@notificationColor: #fcfed7;
@iconSpriteCommonPath: "../../../../common/embed/resources/img/glyphicons.png"; @iconSpriteCommonPath: "../../../../common/embed/resources/img/glyphicons.png";
@icon-socnet-size: 40px; @icon-socnet-size: 40px;
@ -300,6 +301,10 @@
border: 1px solid @btnActiveColor; border: 1px solid @btnActiveColor;
background-color: @btnActiveColor; background-color: @btnActiveColor;
} }
&[disabled] {
opacity: 0.4;
}
} }
// Overlay control // Overlay control
@ -694,3 +699,17 @@
box-shadow: none; box-shadow: none;
} }
} }
.submit-tooltip {
position: absolute;
z-index: 1000;
top: 58px;
right: 15px;
padding: 7px 15px;
border-radius: 5px;
background-color: @notificationColor;
-webkit-box-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.5);
box-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.5);
font-size: 11px;
}

View file

@ -41,7 +41,9 @@ DE.ApplicationController = new(function(){
created = false, created = false,
ttOffset = [0, -10], ttOffset = [0, -10],
labelDocName, labelDocName,
appOptions = {}; appOptions = {},
btnSubmit,
_submitFail, $submitedTooltip;
// Initialize analytics // Initialize analytics
// ------------------------- // -------------------------
@ -144,6 +146,11 @@ DE.ApplicationController = new(function(){
case Asc.c_oAscAsyncAction['Print']: case Asc.c_oAscAsyncAction['Print']:
text = me.downloadTextText; text = me.downloadTextText;
break; break;
case Asc.c_oAscAsyncAction['Submit']:
_submitFail = false;
$submitedTooltip && $submitedTooltip.hide();
btnSubmit.attr({disabled: true});
break;
default: default:
text = me.waitText; text = me.waitText;
break; break;
@ -155,7 +162,16 @@ DE.ApplicationController = new(function(){
} }
} }
function onLongActionEnd(){ function onLongActionEnd(type, id){
if (id==Asc.c_oAscAsyncAction['Submit']) {
btnSubmit.removeAttr('disabled');
if (!$submitedTooltip) {
$submitedTooltip = $('<div class="submit-tooltip" style="display:none;">' + me.textSubmited + '</div>');
$(document.body).append($submitedTooltip);
$submitedTooltip.on('click', function() {$submitedTooltip.hide();});
}
!_submitFail && $submitedTooltip.show();
}
hideMask(); hideMask();
} }
@ -419,11 +435,13 @@ DE.ApplicationController = new(function(){
api.asc_setViewMode(!appOptions.canFillForms); api.asc_setViewMode(!appOptions.canFillForms);
btnSubmit = $('#id-btn-submit');
if (!appOptions.canFillForms) { if (!appOptions.canFillForms) {
$('#id-btn-prev-field').hide(); $('#id-btn-prev-field').hide();
$('#id-btn-next-field').hide(); $('#id-btn-next-field').hide();
$('#id-btn-clear-fields').hide(); $('#id-btn-clear-fields').hide();
$('#id-btn-submit').hide(); btnSubmit.hide();
} else { } else {
$('#id-pages').hide(); $('#id-pages').hide();
$('#id-btn-next-field .caption').text(me.textNext); $('#id-btn-next-field .caption').text(me.textNext);
@ -440,12 +458,12 @@ DE.ApplicationController = new(function(){
}); });
if (appOptions.canSubmitForms) { if (appOptions.canSubmitForms) {
$('#id-btn-submit .caption').text(me.textSubmit); btnSubmit.find('.caption').text(me.textSubmit);
$('#id-btn-submit').on('click', function(){ btnSubmit.on('click', function(){
api.asc_SendForm(); api.asc_SendForm();
}); });
} else } else
$('#id-btn-submit').hide(); btnSubmit.hide();
api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
api.asc_SetFastCollaborative(true); api.asc_SetFastCollaborative(true);
@ -534,6 +552,16 @@ DE.ApplicationController = new(function(){
message = me.errorAccessDeny; message = me.errorAccessDeny;
break; break;
case Asc.c_oAscError.ID.Submit:
message = me.errorSubmit;
_submitFail = true;
$submitedTooltip && $submitedTooltip.hide();
break;
case Asc.c_oAscError.ID.EditingError:
message = me.errorEditingDownloadas;
break;
default: default:
message = me.errorDefaultMessage.replace('%1', id); message = me.errorDefaultMessage.replace('%1', id);
break; break;
@ -704,6 +732,9 @@ DE.ApplicationController = new(function(){
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
textNext: 'Next Field', textNext: 'Next Field',
textClear: 'Clear All Fields', textClear: 'Clear All Fields',
textSubmit: 'Submit' textSubmit: 'Submit',
textSubmited: '<b>Form submitted successfully</b><br>Click to close the tip.',
errorSubmit: 'Submit failed.',
errorEditingDownloadas: 'An error occurred during the work with the document.<br>Use the \'Download as...\' option to save the file backup copy to your computer hard drive.'
} }
})(); })();

View file

@ -26,6 +26,9 @@
"DE.ApplicationController.textNext": "Next Field", "DE.ApplicationController.textNext": "Next Field",
"DE.ApplicationController.textClear": "Clear All Fields", "DE.ApplicationController.textClear": "Clear All Fields",
"DE.ApplicationController.textSubmit": "Submit", "DE.ApplicationController.textSubmit": "Submit",
"DE.ApplicationController.textSubmited": "<b>Form submitted successfully</b><br>Click to close the tip",
"DE.ApplicationController.errorSubmit": "Submit failed.",
"DE.ApplicationController.errorEditingDownloadas": "An error occurred during the work with the document.<br>Use the 'Download as...' option to save the file backup copy to your computer hard drive.",
"DE.ApplicationView.txtDownload": "Download", "DE.ApplicationView.txtDownload": "Download",
"DE.ApplicationView.txtEmbed": "Embed", "DE.ApplicationView.txtEmbed": "Embed",
"DE.ApplicationView.txtFullScreen": "Full Screen", "DE.ApplicationView.txtFullScreen": "Full Screen",