FileAttachments: minor changes, pretty up the code
git-svn-id: https://svn.libreccm.org/ccm/trunk@3401 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a386fc9811
commit
7b8def2a67
|
|
@ -15,7 +15,6 @@
|
|||
package com.arsdigita.cms.contentassets.ui;
|
||||
|
||||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.Embedded;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
|
|
@ -32,61 +31,39 @@ import com.arsdigita.bebop.form.Option;
|
|||
import com.arsdigita.bebop.form.RadioGroup;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.FileAsset;
|
||||
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.contenttypes.Link;
|
||||
import com.arsdigita.cms.ui.FileUploadSection;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.mimetypes.ImageMimeType;
|
||||
import com.arsdigita.mimetypes.MimeType;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* A form for uploading file attachments. Displays a mime-type selection box.
|
||||
* A form for uploading captions. Based on FileAttachmentUpload
|
||||
*
|
||||
* @author Scott Seago (sseago@redhat.com)
|
||||
* @version $Revision: #2 $ $DateTime: 2004/03/30 18:21:14 $
|
||||
* @version $Id: FileAttachmentUpload.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
* @author konerman
|
||||
*/
|
||||
public class FileCaptionForm extends Form
|
||||
public class FileAttachmentCaptionForm extends Form
|
||||
implements FormInitListener, FormProcessListener, FormValidationListener {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(FileAttachmentUpload.class);
|
||||
private static final Logger s_log = Logger.getLogger(FileAttachmentCaptionForm.class);
|
||||
|
||||
private FileUploadSection m_fileUploadSection;
|
||||
private TextArea m_description;
|
||||
private ItemSelectionModel m_itemModel;
|
||||
private SaveCancelSection m_saveCancelSection;
|
||||
private Boolean isFile;
|
||||
private TextArea m_captionText;
|
||||
private RadioGroup m_dType;
|
||||
private Option m_file;
|
||||
private CheckboxGroup m_checkbox;
|
||||
private DHTMLEditor content;
|
||||
|
||||
/**
|
||||
* Construct a new FileAttachmentUpload
|
||||
* Construct a new FileCaptionForm
|
||||
*
|
||||
* @param itemModel The {@link ItemSelectionModel} which will be responsible
|
||||
* for loading the current item
|
||||
*
|
||||
*/
|
||||
public FileCaptionForm(ItemSelectionModel itemModel) {
|
||||
public FileAttachmentCaptionForm(ItemSelectionModel itemModel) {
|
||||
super("CaptionAttachmentUpload", new ColumnPanel(2));
|
||||
m_itemModel = itemModel;
|
||||
|
||||
|
|
@ -168,6 +145,7 @@ public class FileCaptionForm extends Form
|
|||
s_log.debug("Init");
|
||||
m_captionText.setValue(state, null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -51,7 +51,7 @@ public class FileAttachmentsStep extends SecurityPropertyEditor {
|
|||
private CMSContainer m_display;
|
||||
private FileAttachmentsTable m_fileList;
|
||||
private FileAttachmentUpload m_uploadForm;
|
||||
private FileCaptionForm m_captionForm;
|
||||
private FileAttachmentCaptionForm m_captionForm;
|
||||
private BigDecimalParameter m_fileParam = new BigDecimalParameter("fa");
|
||||
private FileAttachmentSelectionModel m_fileModel
|
||||
= new FileAttachmentSelectionModel(m_fileParam);
|
||||
|
|
@ -101,7 +101,7 @@ public class FileAttachmentsStep extends SecurityPropertyEditor {
|
|||
m_uploadForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
// The caption form
|
||||
m_captionForm = new FileCaptionForm(m_item);
|
||||
m_captionForm = new FileAttachmentCaptionForm(m_item);
|
||||
add("caption",
|
||||
FileAttachmentGlobalizationUtil.globalize(
|
||||
"cms.contentassets.file_attachment.upload_new_caption"),
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ public class FileAttachmentsTable extends Table {
|
|||
private static final String UP_EVENT = "up";
|
||||
private static final String DOWN_EVENT = "down";
|
||||
private static final String EDIT_EVENT = "edit";
|
||||
// private static final String EDIT_EVENT = FileAttachmentGlobalizationUtil.globalize("cms.contentassets.file_attachment.table.edit_attached_file");
|
||||
|
||||
private ItemSelectionModel m_model;
|
||||
private FileAttachmentSelectionModel m_fileModel;
|
||||
|
|
@ -68,10 +67,11 @@ public class FileAttachmentsTable extends Table {
|
|||
setRowSelectionModel(m_fileModel);
|
||||
getColumn(0).setCellRenderer(new FileLinkCellRenderer());
|
||||
//column 1 is description/caption
|
||||
getColumn(2).setCellRenderer(new MoveUpLinkCellRenderer());
|
||||
getColumn(3).setCellRenderer(new MoveDownLinkCellRenderer());
|
||||
getColumn(4).setCellRenderer(new EditLinkCellRenderer());
|
||||
getColumn(5).setCellRenderer(new DeleteLinkCellRenderer());
|
||||
getColumn(2).setCellRenderer(new EditLinkCellRenderer());
|
||||
getColumn(3).setCellRenderer(new DeleteLinkCellRenderer());
|
||||
getColumn(4).setCellRenderer(new MoveUpLinkCellRenderer());
|
||||
getColumn(5).setCellRenderer(new MoveDownLinkCellRenderer());
|
||||
|
||||
m_size = new RequestLocal();
|
||||
m_editor = new RequestLocal() {
|
||||
|
||||
|
|
@ -144,13 +144,13 @@ public class FileAttachmentsTable extends Table {
|
|||
|
||||
if (Boolean.TRUE.equals(m_editor.get(state))) {
|
||||
ControlLink delLink = new ControlLink(new Label(FileAttachmentGlobalizationUtil.globalize(
|
||||
"cms.contentassets.file_attachment.table_delete"))) {
|
||||
"cms.contentassets.file_attachment.table_delete"))) {
|
||||
|
||||
public void setControlEvent(PageState s) {
|
||||
s.setControlEvent(table, DELETE_EVENT, modKey);
|
||||
}
|
||||
public void setControlEvent(PageState s) {
|
||||
s.setControlEvent(table, DELETE_EVENT, modKey);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
sc.add(delLink);
|
||||
}
|
||||
return sc;
|
||||
|
|
@ -179,10 +179,10 @@ public class FileAttachmentsTable extends Table {
|
|||
ControlLink delLink = new ControlLink(new Label(FileAttachmentGlobalizationUtil.globalize(
|
||||
"cms.contentassets.file_attachment.table_edit"))) {
|
||||
|
||||
public void setControlEvent(PageState s) {
|
||||
s.setControlEvent(table, EDIT_EVENT, modKey);
|
||||
}
|
||||
};
|
||||
public void setControlEvent(PageState s) {
|
||||
s.setControlEvent(table, EDIT_EVENT, modKey);
|
||||
}
|
||||
};
|
||||
sc.add(delLink);
|
||||
}
|
||||
}
|
||||
|
|
@ -206,13 +206,13 @@ public class FileAttachmentsTable extends Table {
|
|||
|
||||
if (!isFirst && Boolean.TRUE.equals(m_editor.get(state))) {
|
||||
ControlLink delLink = new ControlLink(new Label(FileAttachmentGlobalizationUtil.globalize(
|
||||
"cms.contentassets.file_attachment.table_up"))) {
|
||||
"cms.contentassets.file_attachment.table_up"))) {
|
||||
|
||||
public void setControlEvent(PageState s) {
|
||||
s.setControlEvent(table, UP_EVENT, modKey);
|
||||
}
|
||||
public void setControlEvent(PageState s) {
|
||||
s.setControlEvent(table, UP_EVENT, modKey);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
sc.add(delLink);
|
||||
}
|
||||
return sc;
|
||||
|
|
@ -242,13 +242,13 @@ public class FileAttachmentsTable extends Table {
|
|||
|
||||
if (!isLast && Boolean.TRUE.equals(m_editor.get(state))) {
|
||||
ControlLink delLink = new ControlLink(new Label(FileAttachmentGlobalizationUtil.globalize(
|
||||
"cms.contentassets.file_attachment.table_down"))) {
|
||||
"cms.contentassets.file_attachment.table_down"))) {
|
||||
|
||||
public void setControlEvent(PageState s) {
|
||||
s.setControlEvent(table, DOWN_EVENT, modKey);
|
||||
}
|
||||
public void setControlEvent(PageState s) {
|
||||
s.setControlEvent(table, DOWN_EVENT, modKey);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
sc.add(delLink);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue