[BUGFIX] Fix broken ImageManipulation wizard
[Packages/TYPO3.CMS.git] / typo3 / sysext / filelist / Resources / Public / JavaScript / FileDelete.js
1 /*
2 * This file is part of the TYPO3 CMS project.
3 *
4 * It is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License, either version 2
6 * of the License, or any later version.
7 *
8 * For the full copyright and license information, please read the
9 * LICENSE.txt file that was distributed with this source code.
10 *
11 * The TYPO3 project - inspiring people to share!
12 */
13
14 /**
15 * Module: TYPO3/CMS/Filelist/FileDelete
16 * JavaScript for file delete
17 */
18 define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], function ($, Modal, Severity) {
19
20 $(document).on('click', '.t3js-filelist-delete', function(e) {
21 e.preventDefault();
22 var $anchorElement = $(this);
23 var redirectUrl = $anchorElement.data('redirectUrl');
24 if (redirectUrl) {
25 redirectUrl = top.rawurlencode(redirectUrl);
26 } else {
27 redirectUrl = top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);
28 }
29 var identifier = $anchorElement.data('identifier');
30 var veriCode = $anchorElement.data('veriCode');
31 var deleteUrl = $anchorElement.data('deleteUrl') + '&file[delete][0][data]=' + encodeURIComponent(identifier) + '&vC=' + encodeURIComponent(veriCode);
32 if ($anchorElement.data('check')) {
33 var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('content'), Severity.warning, [
34 {
35 text: TYPO3.lang['buttons.confirm.delete_file.no'] || 'Cancel',
36 active: true,
37 btnClass: 'btn-default',
38 name: 'no'
39 },
40 {
41 text: TYPO3.lang['buttons.confirm.delete_file.yes'] || 'Yes, delete this file',
42 btnClass: 'btn-warning',
43 name: 'yes'
44 }
45 ]);
46 $modal.on('button.clicked', function(e) {
47 if (e.target.name === 'no') {
48 Modal.dismiss();
49 } else if (e.target.name === 'yes') {
50 Modal.dismiss();
51 top.content.list_frame.location.href = deleteUrl + '&redirect=' + redirectUrl;
52 }
53 });
54 } else {
55 top.content.list_frame.location.href = deleteUrl + '&redirect=' + redirectUrl;
56 }
57 });
58
59 });