js: Drop iframe-upload fallback for IE

This commit is contained in:
Johannes Meyer 2019-07-11 11:14:08 +02:00
parent 97d5b39662
commit 5cf71c9bbd
2 changed files with 1 additions and 63 deletions

View File

@ -322,33 +322,6 @@
url = icinga.utils.addUrlParams(url, dataObj);
} else {
if (encoding === 'multipart/form-data') {
if (typeof window.FormData === 'undefined') {
icinga.loader.submitFormToIframe($form, url, $target);
// Disable all form controls to prevent resubmission as early as possible.
// (This relies on native form submission, so using setTimeout is the only possible solution)
setTimeout(function () {
if ($target.attr('id') == $form.closest('.container').attr('id')) {
$form.find(':input:not(:disabled)').prop('disabled', true);
}
}, 0);
if (autosubmit) {
if ($button.length) {
// We're autosubmitting the form so the button has not been clicked, however,
// to be really safe, we're disabling the button explicitly, just in case..
$button.prop('disabled', true);
}
$form[0].submit(); // This should actually not trigger the onSubmit event, let's hope that this is true for all browsers..
event.stopPropagation();
event.preventDefault();
return false;
} else {
return true;
}
}
data = new window.FormData($form[0]);
} else {
data = $form.serializeArray();
@ -370,7 +343,7 @@
// Disable all form controls to prevent resubmission except for our search input
// Note that disabled form inputs will not be enabled via JavaScript again
if ($target.attr('id') == $form.closest('.container').attr('id')) {
if ($target.attr('id') === $form.closest('.container').attr('id')) {
$form.find(':input:not(#search):not(:disabled)').prop('disabled', true);
}

View File

@ -163,41 +163,6 @@
return req;
},
/**
* Mimic XHR form submission by using an iframe
*
* @param {object} $form The form being submitted
* @param {string} action The form's action URL
* @param {object} $target The target container
*/
submitFormToIframe: function ($form, action, $target) {
var _this = this;
$form.prop('action', _this.icinga.utils.addUrlParams(action, {
'_frameUpload': true
}));
$form.prop('target', 'fileupload-frame-target');
$('#fileupload-frame-target').on('load', function (event) {
var $frame = $(event.target);
var $contents = $frame.contents();
var $redirectMeta = $contents.find('meta[name="redirectUrl"]');
if ($redirectMeta.length) {
_this.redirectToUrl($redirectMeta.attr('content'), $target);
} else {
// Fetch the frame's new content and paste it into the target
_this.renderContentToContainer(
$contents.find('body').html(),
$target,
'replace'
);
}
$frame.prop('src', 'about:blank'); // Clear the frame's dom
$frame.off('load'); // Unbind the event as it's set on demand
});
},
/**
* Create an URL relative to the Icinga base Url, still unused
*