fix phpstan/phpcs

This commit is contained in:
Dennis Eichhorn 2021-06-26 14:38:08 +02:00
parent 83798b7545
commit e96311893f
3 changed files with 17 additions and 13 deletions

View File

@ -309,7 +309,9 @@ export class Form
{
action = typeof action !== 'undefined' ? action : null;
if (!form.isValid()) {
const data = form.getData();
if (!form.isValid(data)) {
this.app.notifyManager.send(
new NotificationMessage(
NotificationLevel.INFO,
@ -334,7 +336,7 @@ export class Form
const request = new Request(),
self = this;
request.setData(form.getData());
request.setData(data);
request.setType(RequestType.FORM_DATA);
request.setUri(action ? action : form.getAction());
request.setMethod(form.getMethod());
@ -344,17 +346,19 @@ export class Form
if (xhr.getResponseHeader('content-type') === 'application/octet-stream') {
const blob = new Blob([xhr.response], { type: 'application/octet-stream' });
const doc = document.createElement('a');
doc.style = 'display: none';
const doc = document.createElement('a');
doc.style = 'display: none';
document.body.appendChild(doc);
const url = window.URL.createObjectURL(blob);
doc.href = url;
doc.href = url;
const disposition = xhr.getResponseHeader('content-disposition');
let filename = '';
let filename = '';
if (disposition && disposition.indexOf('attachment') !== -1) {
const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
const matches = filenameRegex.exec(disposition);
const matches = filenameRegex.exec(disposition);
if (matches !== null && matches[1]) {
filename = matches[1].replace(/['"]/g, '');
}

View File

@ -373,10 +373,10 @@ export class Table
{
checkbox.addEventListener('click', function (event)
{
const columnId = checkbox.closest('td').cellIndex;
const rows = checkbox.closest('table').querySelectorAll('tbody tr');
const columnId = checkbox.closest('td').cellIndex;
const rows = checkbox.closest('table').querySelectorAll('tbody tr');
const rowLength = rows.length;
const status = checkbox.checked;
const status = checkbox.checked;
for (let i = 0; i < rowLength; ++i) {
const box = rows[i].cells[columnId].querySelector('input[type=checkbox]');

View File

@ -482,10 +482,10 @@ export class FormView
*
* @since 1.0.0
*/
isValid ()
isValid (data)
{
const elements = this.getFormElements(),
length = elements.length;
const elements = typeof data === 'undefined' ? this.getFormElements() : data;
const length = elements.length;
try {
for (let i = 0; i < length; ++i) {