From fa275828cd88bd33e7af6e3cefb75ec177ba5295 Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 4 Feb 2015 08:40:06 +0000 Subject: [PATCH] Improvment of the error message for an already attached file git-svn-id: https://svn.libreccm.org/ccm/trunk@3116 8810af33-2d31-482b-a856-94f89814c4df --- .../FileAttachmentGlobalize.java | 2 +- .../FileAttachmentResources.properties | 2 +- .../FileAttachmentResources_de.properties | 2 +- .../ui/FileAttachmentUpload.java | 3 ++- .../util/FileAttachmentGlobalizationUtil.java | 21 +++++++++++++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/util/FileAttachmentGlobalizationUtil.java diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentGlobalize.java b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentGlobalize.java index 22fa12f0a..48d081b16 100644 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentGlobalize.java +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentGlobalize.java @@ -71,7 +71,7 @@ public class FileAttachmentGlobalize { "cms.contentassets.file_attachment.upload_new_file_label", "com.arsdigita.cms.contentassets.FileAttachmentResources"); } - + } diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentResources.properties b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentResources.properties index 313bd7a68..df7d36671 100755 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentResources.properties +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentResources.properties @@ -6,4 +6,4 @@ cms.contentassets.file_attachment.upload_new_file_label=Upload a new file cms.contentassets.file_attachment.tableheader_file=File cms.contentassets.file_attachment.tableheader_description=Description cms.contentassets.file_attachment.list_label=File attachments -cms.contentassets.file_attachment.already_attached=A file with the same name as the selected file has already been attached. +cms.contentassets.file_attachment.already_attached=A file with the name {0} as already been attached. diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentResources_de.properties b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentResources_de.properties index 2cf63e959..411bcfef7 100644 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentResources_de.properties +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentResources_de.properties @@ -6,4 +6,4 @@ cms.contentassets.file_attachment.upload_new_file_label=Neue Datei hochladen cms.contentassets.file_attachment.tableheader_file=Datei cms.contentassets.file_attachment.tableheader_description=Beschreibung cms.contentassets.file_attachment.list_label=Dateianh\u00e4nge -cms.contentassets.file_attachment.already_attached=Eine Datei mit dem Namen der ausgew\u00e4hlten Datei wurde bereits hinzugef\u00fcgt. +cms.contentassets.file_attachment.already_attached=Eine Datei mit dem Namen {0} wurde bereits hinzugef\u00fcgt. diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentUpload.java b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentUpload.java index ba18129bd..2a4956b1b 100755 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentUpload.java +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentUpload.java @@ -30,6 +30,7 @@ import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contentassets.FileAttachment; import com.arsdigita.cms.contentassets.FileAttachmentGlobalize; +import com.arsdigita.cms.contentassets.util.FileAttachmentGlobalizationUtil; import com.arsdigita.cms.ui.FileUploadSection; import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.dispatcher.DispatcherHelper; @@ -159,7 +160,7 @@ public class FileAttachmentUpload extends Form final DataObject attachment = attachments.getDataObject(); if (attachment.get(FileAttachment.NAME).equals(fileName)) { attachments.close(); - throw new FormProcessException(GlobalizationUtil.globalize( + throw new FormProcessException(FileAttachmentGlobalizationUtil.globalize( "cms.contentassets.file_attachment.already_attached", new String[]{fileName})); } } diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/util/FileAttachmentGlobalizationUtil.java b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/util/FileAttachmentGlobalizationUtil.java new file mode 100644 index 000000000..0d1667ac3 --- /dev/null +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/util/FileAttachmentGlobalizationUtil.java @@ -0,0 +1,21 @@ +package com.arsdigita.cms.contentassets.util; + +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * + * @author Jens Pelzetter + */ +public class FileAttachmentGlobalizationUtil { + + public static final String BUNDLE_NAME = "com.arsdigita.cms.contentassets.FileAttachmentResources"; + + public static GlobalizedMessage globalize(final String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + public static GlobalizedMessage globalize(final String key, final Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } + +}