Skip to content

Commit

Permalink
[BUGFIX] Add missing DOM ready checks in filelist
Browse files Browse the repository at this point in the history
Some modules in the filelist are missing DOM ready checks.
This patch adds the missing checks to prevent loading issues.

Resolves: #78976
Releases: master, 8.7
Change-Id: Iee328808a89cf92f4fde1afd59167ae9fa7280be
Reviewed-on: https://review.typo3.org/55390
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
  • Loading branch information
NeoBlack authored and opi99 committed Feb 5, 2018
1 parent fa01dca commit 308242e
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 82 deletions.
76 changes: 39 additions & 37 deletions typo3/sysext/filelist/Resources/Public/JavaScript/FileDelete.js
Expand Up @@ -17,43 +17,45 @@
*/
define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], function($, Modal, Severity) {

$(document).on('click', '.t3js-filelist-delete', function(e) {
e.preventDefault();
var $anchorElement = $(this);
var redirectUrl = $anchorElement.data('redirectUrl');
if (redirectUrl) {
redirectUrl = top.rawurlencode(redirectUrl);
} else {
redirectUrl = top.rawurlencode(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
}
var identifier = $anchorElement.data('identifier');
var deleteType = $anchorElement.data('deleteType');
var deleteUrl = $anchorElement.data('deleteUrl') + '&data[delete][0][data]=' + encodeURIComponent(identifier);
if ($anchorElement.data('check')) {
var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('content'), Severity.warning, [
{
text: TYPO3.lang['buttons.confirm.delete_file.no'] || 'Cancel',
active: true,
btnClass: 'btn-default',
name: 'no'
},
{
text: TYPO3.lang['buttons.confirm.' + deleteType + '.yes'] || 'Yes, delete this file or folder',
btnClass: 'btn-warning',
name: 'yes'
}
]);
$modal.on('button.clicked', function(e) {
if (e.target.name === 'no') {
Modal.dismiss();
} else if (e.target.name === 'yes') {
Modal.dismiss();
top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
}
});
} else {
top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
}
$(function() {
$(document).on('click', '.t3js-filelist-delete', function(e) {
e.preventDefault();
var $anchorElement = $(this);
var redirectUrl = $anchorElement.data('redirectUrl');
if (redirectUrl) {
redirectUrl = top.rawurlencode(redirectUrl);
} else {
redirectUrl = top.rawurlencode(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
}
var identifier = $anchorElement.data('identifier');
var deleteType = $anchorElement.data('deleteType');
var deleteUrl = $anchorElement.data('deleteUrl') + '&data[delete][0][data]=' + encodeURIComponent(identifier);
if ($anchorElement.data('check')) {
var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('content'), Severity.warning, [
{
text: TYPO3.lang['buttons.confirm.delete_file.no'] || 'Cancel',
active: true,
btnClass: 'btn-default',
name: 'no'
},
{
text: TYPO3.lang['buttons.confirm.' + deleteType + '.yes'] || 'Yes, delete this file or folder',
btnClass: 'btn-warning',
name: 'yes'
}
]);
$modal.on('button.clicked', function(e) {
if (e.target.name === 'no') {
Modal.dismiss();
} else if (e.target.name === 'yes') {
Modal.dismiss();
top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
}
});
} else {
top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
}
});
});

});
71 changes: 37 additions & 34 deletions typo3/sysext/filelist/Resources/Public/JavaScript/FileList.js
Expand Up @@ -17,53 +17,56 @@
*/
define(['jquery'], function($) {

$('a.filelist-file-title').click(function(event) {
event.preventDefault();
$(function() {
$('a.filelist-file-title').click(function(event) {
event.preventDefault();

var url = $(this).attr('data-url');
window.location.href = url;
});
var url = $(this).attr('data-url');
window.location.href = url;
});

$('a.btn.filelist-file-edit').click(function(event) {
event.preventDefault();
$('a.btn.filelist-file-edit').click(function(event) {
event.preventDefault();

var url = $(this).attr('data-url');
top.list_frame.location.href = url;
});
var url = $(this).attr('data-url');
top.list_frame.location.href = url;
});

$('a.btn.filelist-file-view').click(function(event) {
event.preventDefault();
$('a.btn.filelist-file-view').click(function(event) {
event.preventDefault();

var url = $(this).attr('data-url');
top.openUrlInWindow(url, 'WebFile')
});
var url = $(this).attr('data-url');
top.openUrlInWindow(url, 'WebFile')
});

$('a.btn.filelist-file-replace').click(function(event) {
event.preventDefault();
$('a.btn.filelist-file-replace').click(function(event) {
event.preventDefault();

var url = $(this).attr('data-url');
top.list_frame.location.href = url;
});
var url = $(this).attr('data-url');
top.list_frame.location.href = url;
});

$('a.btn.filelist-file-rename').click(function(event) {
event.preventDefault();
$('a.btn.filelist-file-rename').click(function(event) {
event.preventDefault();

var url = $(this).attr('data-url');
top.list_frame.location.href = url;
});
var url = $(this).attr('data-url');
top.list_frame.location.href = url;
});

$('a.btn.filelist-file-info').click(function(event) {
event.preventDefault();
$('a.btn.filelist-file-info').click(function(event) {
event.preventDefault();

var identifier = $(this).attr('data-identifier');
openFileInfoPopup(identifier);
});
var identifier = $(this).attr('data-identifier');
openFileInfoPopup(identifier);
});

$('a.filelist-file-references').click(function(event) {
event.preventDefault();

$('a.filelist-file-references').click(function(event) {
event.preventDefault();
var identifier = $(this).attr('data-identifier');
openFileInfoPopup(identifier);
});

var identifier = $(this).attr('data-identifier');
openFileInfoPopup(identifier);
});

/**
Expand Down
Expand Up @@ -17,9 +17,11 @@
*/
define(['jquery'], function($) {

$('a.filelist-translationToggler').click(function(event) {
var id = $(this).attr('data-fileid');
$('div[data-fileid="' + id + '"]').toggle();
$(function() {
$('a.filelist-translationToggler').click(function(event) {
var id = $(this).attr('data-fileid');
$('div[data-fileid="' + id + '"]').toggle();
});
});

return null;
Expand Down
18 changes: 10 additions & 8 deletions typo3/sysext/filelist/Resources/Public/JavaScript/FileSearch.js
Expand Up @@ -18,16 +18,18 @@
*/
define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {

var $searchFields = $('input[name="tx_filelist_file_filelistlist[searchWord]"]');
var searchResultShown = ('' !== $searchFields.first().val());
$(function() {
var $searchFields = $('input[name="tx_filelist_file_filelistlist[searchWord]"]');
var searchResultShown = ('' !== $searchFields.first().val());

// make search field clearable
$searchFields.clearable({
onClear: function() {
if (searchResultShown) {
$(this).closest('form').submit();
// make search field clearable
$searchFields.clearable({
onClear: function() {
if (searchResultShown) {
$(this).closest('form').submit();
}
}
}
});
});

});

0 comments on commit 308242e

Please sign in to comment.