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 c6d483dcb..620d83329 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,9 +6,9 @@ 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 name {0} as already been attached. +cms.contentassets.file_attachment.already_attached=A file with the name {0} has already been attached. cms.contentassets.file_attachment.cancelled=Cancelled -cms.contentassets.file_attachment.caption=caption +cms.contentassets.file_attachment.caption=caption: cms.contentassets.file_attachment.file=file cms.contentassets.file_attachment.table.edit_attached_file=\u270d #Beschreibung/Zwischentitel: @@ -21,3 +21,5 @@ cms.contentassets.file_attachment.table_delete=delete cms.contentassets.file_attachment.description.too_long=The description execceds the limit of {0} characters. cms.contentassets.file_attachment.caption.too_long=The caption execceds the limit of {0} characters. cms.contentassets.file_attachment.title=Title: +cms.contentassets.file_attachment.input_mandatory=Error: At least one of the fields must be filled out +cms.contentassets.file_attachment.desc=Description: 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 94a389d5a..89ed9729d 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 @@ -8,7 +8,7 @@ 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 {0} wurde bereits hinzugef\u00fcgt. cms.contentassets.file_attachment.cancelled=Abgebrochen -cms.contentassets.file_attachment.caption=Zwischentitel +cms.contentassets.file_attachment.caption=Zwischentitel: cms.contentassets.file_attachment.file=Datei cms.contentassets.file_attachment.table.edit_attached_file=\u270d cms.contentassets.file_attachment.caption_or_description=Beschreibung/Zwischentitel: @@ -20,3 +20,5 @@ cms.contentassets.file_attachment.table_delete=l\u00f6schen cms.contentassets.file_attachment.description.too_long=Die Beschreibung ist l\u00e4nger als {0} Zeichen. cms.contentassets.file_attachment.caption.too_long=Die Zwischen\u00fcberschrift ist l\u00e4nger als {0} Zeichen. cms.contentassets.file_attachment.title=Titel: +cms.contentassets.file_attachment.input_mandatory=Fehler: Es muss mindestens eins der Felder ausgef\u00fcllt werden. +cms.contentassets.file_attachment.desc=Beschreibung: diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentCaptionForm.java b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentCaptionForm.java index 6fee4c962..9a547e33b 100644 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentCaptionForm.java +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentCaptionForm.java @@ -137,9 +137,6 @@ public class FileAttachmentCaptionForm extends Form add(m_title); m_captionText = new DHTMLEditor("caption"); -// m_captionText.setCols(10); -// m_captionText.setRows(1); - m_captionText.addValidationListener(new NotNullValidationListener()); m_captionText.addValidationListener(new StringInRangeValidationListener( 0, s_config.getFileAttachmentDescriptionMaxLength(), @@ -162,7 +159,15 @@ public class FileAttachmentCaptionForm extends Form @Override public void validate(final FormSectionEvent event) throws FormProcessException { - // do nothing + // test if the user made an input + PageState state = event.getPageState(); + String title = (String) m_title.getValue(state); + String desc = (String) m_captionText.getValue(state); + if ((title.length() + desc.length()) <= 0) { + throw new FormProcessException(FileAttachmentGlobalizationUtil + .globalize( + "cms.contentassets.file_attachment.input_mandatory")); + } } // process: update the mime type and content @@ -182,7 +187,7 @@ public class FileAttachmentCaptionForm extends Form attachment.setDescription((String) m_captionText.getValue(state)); String title = (String) m_title.getValue(state); if (title.isEmpty()) { - attachment.setName( "iscaption"); + attachment.setName("iscaption"); } else { attachment.setName((String) m_title.getValue(state)); } diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsTable.java b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsTable.java index cc46c533b..407e6b23b 100755 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsTable.java +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsTable.java @@ -66,7 +66,7 @@ public class FileAttachmentsTable extends Table { m_fileModel = fileModel; setRowSelectionModel(m_fileModel); getColumn(0).setCellRenderer(new FileLinkCellRenderer()); - //column 1 is description/caption + getColumn(1).setCellRenderer(new DescriptionCellRenderer()); getColumn(2).setCellRenderer(new EditLinkCellRenderer()); getColumn(3).setCellRenderer(new DeleteLinkCellRenderer()); getColumn(4).setCellRenderer(new MoveUpLinkCellRenderer()); @@ -273,10 +273,13 @@ public class FileAttachmentsTable extends Table { String cap = attachment.getAdditionalInfo(); if (cap != null) { if (attachment.getAdditionalInfo().equals("caption")) { - if (attachment.getDisplayName()!=null && attachment.getDisplayName().equals("iscaption")) { + + if (attachment.getDisplayName() != null && attachment.getDisplayName().equals("iscaption")) { return new Label(" "); } - return new Label(attachment.getDisplayName()); + Label label = new Label(attachment.getDisplayName()); + label.setOutputEscaping(false); + return label; } } @@ -284,4 +287,23 @@ public class FileAttachmentsTable extends Table { Utilities.getAssetURL(attachment)); } } + + private class DescriptionCellRenderer implements TableCellRenderer { + + public Component getComponent(final Table table, + PageState state, + Object value, + boolean isSelected, + Object key, + int row, + int column) { + final String downloadKey = (String) key; + FileAttachment attachment = new FileAttachment(new BigDecimal(downloadKey)); + + Label label = new Label(attachment.getDescription()); + label.setOutputEscaping(false); + return label; + } + } + } diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileDescriptionForm.java b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileDescriptionForm.java index dd45cc25a..a7bfb0485 100755 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileDescriptionForm.java +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/ui/FileDescriptionForm.java @@ -50,10 +50,12 @@ public class FileDescriptionForm extends FormSection implements .instanceOf(); private TextArea m_title; + private TextArea m_descriptionDHTML; private TextArea m_description; private FileAttachmentSelectionModel m_fileModel; private Submit m_cancel; private Label titleLabel; + private Label descLabel; /** * Creates a new form to edit the FileAttachment description by the item @@ -88,9 +90,9 @@ public class FileDescriptionForm extends FormSection implements add(titleLabel); add(m_title); - m_description = new DHTMLEditor("description"); - m_description.addValidationListener(new NotNullValidationListener()); - m_description.addValidationListener(new StringInRangeValidationListener( + m_descriptionDHTML = new DHTMLEditor("description"); +// m_descriptionDHTML.addValidationListener(new NotNullValidationListener()); + m_descriptionDHTML.addValidationListener(new StringInRangeValidationListener( 0, s_config.getFileAttachmentDescriptionMaxLength(), FileAttachmentGlobalize.DescriptionTooLong(s_config.getFileAttachmentDescriptionMaxLength()))); @@ -98,7 +100,14 @@ public class FileDescriptionForm extends FormSection implements add(new Label(FileAttachmentGlobalizationUtil .globalize("cms.contentassets.file_attachment.caption_or_description"))); + add(m_descriptionDHTML); + + m_description = new TextArea("desc"); + descLabel = new Label(FileAttachmentGlobalizationUtil + .globalize("cms.contentassets.file_attachment.desc")); + add(descLabel); add(m_description); + } /** @@ -126,10 +135,24 @@ public class FileDescriptionForm extends FormSection implements @Override public void validate(FormSectionEvent event) throws FormProcessException { PageState state = event.getPageState(); - FormData data = event.getFormData(); + FileAttachment file = m_fileModel.getSelectedFileAttachment(state); + // test if the user made an input - String description = (String) m_description.getValue(state); - // not performing any check + int inputlength = 0; + if (file.getAdditionalInfo() != null && file.getAdditionalInfo().equals("caption")) { + String title = (String) m_title.getValue(state); + String desc = (String) m_descriptionDHTML.getValue(state); + + inputlength = title.length() + desc.length(); + } else { + inputlength = ((String) m_description.getValue(state)).length(); + } + + if (inputlength <= 0) { + throw new FormProcessException(FileAttachmentGlobalizationUtil + .globalize( + "cms.contentassets.file_attachment.input_mandatory")); + } } /** @@ -144,18 +167,27 @@ public class FileDescriptionForm extends FormSection implements if (m_fileModel.isSelected(state)) { setVisible(state, true); FileAttachment file = m_fileModel.getSelectedFileAttachment(state); - m_description.setValue(state, file.getDescription()); + if (file.getAdditionalInfo() != null && file.getAdditionalInfo().equals("caption")) { + m_description.setVisible(state, false); + descLabel.setVisible(state, false); + m_descriptionDHTML.setValue(state, file.getDescription()); + m_descriptionDHTML.setVisible(state, true); String name = file.getName(); + m_title.setVisible(state, true); if (name != null && name.equals("iscaption")) { m_title.setValue(state, null); - m_title.setVisible(state, true); } else { m_title.setValue(state, name); } } else { m_title.setVisible(state, false); titleLabel.setVisible(state, false); + m_descriptionDHTML.setVisible(state, false); + m_description.setVisible(state, true); + descLabel.setVisible(state, true); + m_description.setValue(state, file.getDescription()); + } } else { setVisible(state, false); @@ -180,15 +212,16 @@ public class FileDescriptionForm extends FormSection implements if (m_fileModel.isSelected(state)) { FileAttachment file = m_fileModel .getSelectedFileAttachment(state); - file.setDescription((String) m_description.getValue(state)); - if (file.getAdditionalInfo().equals("caption")) { + if (file.getAdditionalInfo() != null && file.getAdditionalInfo().equals("caption")) { + file.setDescription((String) m_descriptionDHTML.getValue(state)); if (m_title.getValue(state) != null) { file.setName((String) m_title.getValue(state)); } else { file.setName("iscaption"); } - + } else { + file.setDescription((String) m_description.getValue(state)); } } m_fileModel.clearSelection(state); diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkResources.properties b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkResources.properties index f555e5a7a..d74a83dc2 100755 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkResources.properties +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkResources.properties @@ -9,3 +9,4 @@ cms.contentassets.ui.related_link.caption=Caption: cms.contentassets.ui.related_link.Description=Description/Caption: cms.contentassets.ui.related_link.title=Title: cms.contentassets.ui.related_link.description=Description: +cms.contentassets.ui.related_link.input_mandatory=Error: At least one of the fields must be filled out diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkResources_de.properties b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkResources_de.properties index 3f2e7d0ab..f0004b80b 100644 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkResources_de.properties +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkResources_de.properties @@ -9,3 +9,4 @@ cms.contentassets.ui.related_link.caption=Zwischentitel: cms.contentassets.ui.related_link.Description=Beschreibung/Zwischentitel: cms.contentassets.ui.related_link.title=Titel: cms.contentassets.ui.related_link.description=Beschreibung: +cms.contentassets.ui.related_link.input_mandatory=Fehler: Es muss mindestens eins der Felder ausgef\u00fcllt werden. diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkCaptionForm.java b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkCaptionForm.java index 40de4ee3e..47fadb6ee 100644 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkCaptionForm.java +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkCaptionForm.java @@ -138,7 +138,7 @@ public class RelatedLinkCaptionForm extends FormSection /* Add the standard description field */ m_description = new DHTMLEditor("description"); - m_description.addValidationListener(new NotNullValidationListener()); +// m_description.addValidationListener(new NotNullValidationListener()); m_description.addValidationListener(new StringLengthValidationListener(CMSConfig .getInstanceOf().getLinkDescMaxLength())); add(new Label(RelatedLinkGlobalizationUtil.globalize("cms.contentassets.ui.related_link.Description"))); @@ -237,8 +237,15 @@ public class RelatedLinkCaptionForm extends FormSection public void validate(FormSectionEvent event) throws FormProcessException { - - + // test if the user has made an input + PageState state = event.getPageState(); + String title = (String) m_title.getValue(state); + String desc = (String) m_description.getValue(state); + if ((title.length() + desc.length()) <= 0) { + throw new FormProcessException(RelatedLinkGlobalizationUtil + .globalize( + "cms.contentassets.ui.related_link.input_mandatory")); + } } /** diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkTable.java index a0eac1f2b..5b7147d15 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkTable.java @@ -204,9 +204,10 @@ public class LinkTable extends Table { boolean isLast = (row == ((Long) m_size.get(state)).intValue() - 1); if (column == m_titleCol.getModelIndex()) { - - if (link.getTargetURI()!=null && link.getTargetURI().equals("caption")) { + + if (link.getTargetURI() != null && link.getTargetURI().equals("caption")) { Label label = new Label(link.getTitle()); + label.setOutputEscaping(false); return label; } String url = link.getInternalOrExternalURI(state); @@ -215,11 +216,15 @@ public class LinkTable extends Table { return extLink; } else if (column == m_descCol.getModelIndex()) { - if (isSelected) { - return new Label(link.getDescription(), Label.BOLD); - } else { - return new Label(link.getDescription()); - } +// if (isSelected) { +// Label label = new Label(link.getDescription(), Label.BOLD); +// label.setOutputEscaping(false); +// return label; +// } else { + Label label = new Label(link.getDescription()); + label.setOutputEscaping(false); + return label; +// } } else if (column == m_editCol.getModelIndex()) { if (Boolean.TRUE.equals(m_editor.get(state))) { if (isSelected) {