From ee0664929512c8f9f5fda920782c71491fed7d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20S=C4=85gol?= <marcin@soee.pl> Date: Wed, 6 May 2020 19:42:45 +0200 Subject: [PATCH] [TASK] Improve file rename duplicate warning message Improve the warning message presented to the user when a file is renamed through the Filelist module and a file with the new name already exists. Resolves: #91299 Releases: master Change-Id: If1ff921396f782c1f560fdb092755e306344d0f3 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64427 Reviewed-by: Markus Klein <markus.klein@typo3.org> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de> Reviewed-by: Benjamin Franzke <bfr@qbus.de> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Daniel Goerz <daniel.goerz@posteo.de> Tested-by: Benjamin Franzke <bfr@qbus.de> --- .../filelist/Resources/Public/TypeScript/RenameFile.ts | 2 +- .../sysext/filelist/Resources/Private/Language/locallang.xlf | 4 +--- .../sysext/filelist/Resources/Public/JavaScript/RenameFile.js | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/RenameFile.ts b/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/RenameFile.ts index 66bbf5b62423..845f39f9dc94 100644 --- a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/RenameFile.ts +++ b/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/RenameFile.ts @@ -51,7 +51,7 @@ class RenameFile { if (fileExists && originalFileName !== newFileName) { const description: string = TYPO3.lang['file_rename.exists.description'] - .replace('{0}', originalFileName).replace('{1}', newFileName); + .replace('{0}', originalFileName).replace(/\{1\}/g, newFileName); const modal: JQuery = Modal.confirm( TYPO3.lang['file_rename.exists.title'], diff --git a/typo3/sysext/filelist/Resources/Private/Language/locallang.xlf b/typo3/sysext/filelist/Resources/Private/Language/locallang.xlf index 55ab6a85482c..66040f58d585 100644 --- a/typo3/sysext/filelist/Resources/Private/Language/locallang.xlf +++ b/typo3/sysext/filelist/Resources/Private/Language/locallang.xlf @@ -22,9 +22,7 @@ <source>File exists already</source> </trans-unit> <trans-unit id="file_rename.exists.description" resname="file_rename.exists.description"> - <source>You want to rename the file "{0}" to "{1}", but such a file already exists. How do you want to - proceed? - </source> + <source>You want to rename the file "{0}" to "{1}", but the file "{1}" already exists. How do you want to proceed?</source> </trans-unit> <trans-unit id="file_rename.actions.cancel" resname="file_rename.actions.cancel"> <source>Cancel</source> diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/RenameFile.js b/typo3/sysext/filelist/Resources/Public/JavaScript/RenameFile.js index 76bf0a0492a9..9714584ca435 100644 --- a/typo3/sysext/filelist/Resources/Public/JavaScript/RenameFile.js +++ b/typo3/sysext/filelist/Resources/Public/JavaScript/RenameFile.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -define(["require","exports","TYPO3/CMS/Backend/Enum/Severity","jquery","TYPO3/CMS/Backend/Modal"],(function(e,a,t,n,i){"use strict";return new class{constructor(){this.initialize()}initialize(){n(".t3js-submit-file-rename").on("click",this.checkForDuplicate)}checkForDuplicate(e){e.preventDefault();const a=n("#"+n(e.currentTarget).attr("form")),r=a.find('input[name="data[rename][0][target]"]'),l=a.find('input[name="data[rename][0][conflictMode]"]'),c=TYPO3.settings.ajaxUrls.file_exists;n.ajax({cache:!1,data:{fileName:r.val(),fileTarget:a.find('input[name="data[rename][0][destination]"]').val()},success:e=>{const n=void 0!==e.uid,c=r.data("original"),s=r.val();if(n&&c!==s){const e=TYPO3.lang["file_rename.exists.description"].replace("{0}",c).replace("{1}",s);i.confirm(TYPO3.lang["file_rename.exists.title"],e,t.SeverityEnum.warning,[{active:!0,btnClass:"btn-default",name:"cancel",text:TYPO3.lang["file_rename.actions.cancel"]},{btnClass:"btn-primary",name:"rename",text:TYPO3.lang["file_rename.actions.rename"]},{btnClass:"btn-default",name:"replace",text:TYPO3.lang["file_rename.actions.override"]}]).on("button.clicked",e=>{"cancel"!==e.target.name&&(l.val(e.target.name),a.submit()),i.dismiss()})}else a.submit()},url:c})}}})); \ No newline at end of file +define(["require","exports","TYPO3/CMS/Backend/Enum/Severity","jquery","TYPO3/CMS/Backend/Modal"],(function(e,a,t,n,i){"use strict";return new class{constructor(){this.initialize()}initialize(){n(".t3js-submit-file-rename").on("click",this.checkForDuplicate)}checkForDuplicate(e){e.preventDefault();const a=n("#"+n(e.currentTarget).attr("form")),r=a.find('input[name="data[rename][0][target]"]'),l=a.find('input[name="data[rename][0][conflictMode]"]'),c=TYPO3.settings.ajaxUrls.file_exists;n.ajax({cache:!1,data:{fileName:r.val(),fileTarget:a.find('input[name="data[rename][0][destination]"]').val()},success:e=>{const n=void 0!==e.uid,c=r.data("original"),s=r.val();if(n&&c!==s){const e=TYPO3.lang["file_rename.exists.description"].replace("{0}",c).replace(/\{1\}/g,s);i.confirm(TYPO3.lang["file_rename.exists.title"],e,t.SeverityEnum.warning,[{active:!0,btnClass:"btn-default",name:"cancel",text:TYPO3.lang["file_rename.actions.cancel"]},{btnClass:"btn-primary",name:"rename",text:TYPO3.lang["file_rename.actions.rename"]},{btnClass:"btn-default",name:"replace",text:TYPO3.lang["file_rename.actions.override"]}]).on("button.clicked",e=>{"cancel"!==e.target.name&&(l.val(e.target.name),a.submit()),i.dismiss()})}else a.submit()},url:c})}}})); \ No newline at end of file -- GitLab