added FormValidationListeners, html tags in Link- and FileAttachmentsTable will be interpreted now.
git-svn-id: https://svn.libreccm.org/ccm/trunk@3475 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f4c2d83332
commit
825aa26231
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue