// Build the form that describes an item.
Division div = body.addInteractiveDivision("submit-edit-file", actionURL, Division.METHOD_POST, "primary submission");
div.setHead(T_submission_head);
addSubmissionProgressList(div);
List edit = div.addList("submit-edit-file", List.TYPE_FORM);
edit.setHead(T_head);
edit.addLabel(T_file);
edit.addItem().addXref(fileUrl, fileName);
Text description = edit.addItem().addText("description");
description.setLabel(T_description);
description.setHelp(T_description_help);
description.setValue(bitstream.getDescription());
edit.addItem(T_info1);
if (guessedFormat != null)
{
edit.addLabel(T_format_detected);
edit.addItem(guessedFormat.getShortDescription());
}
// System supported formats
Select format = edit.addItem().addSelect("format");
format.setLabel(T_format_selected);
format.addOption(-1,T_format_default);
for (BitstreamFormat bitstreamFormat : bitstreamFormats)
{
String supportLevel = "Unknown";
if (bitstreamFormat.getSupportLevel() == BitstreamFormat.KNOWN)
supportLevel = "known";
else if (bitstreamFormat.getSupportLevel() == BitstreamFormat.SUPPORTED)
supportLevel = "Supported";
String name = bitstreamFormat.getShortDescription()+" ("+supportLevel+")";
int id = bitstreamFormat.getID();
format.addOption(id,name);
}
if (currentFormat != null)
{
format.setOptionSelected(currentFormat.getID());
}
else if (guessedFormat != null)
{
format.setOptionSelected(guessedFormat.getID());
}
else
{
format.setOptionSelected(-1);
}
edit.addItem(T_info2);
// User supplied format
Text userFormat = edit.addItem().addText("format_description");
userFormat.setLabel(T_format_user);
userFormat.setHelp(T_format_user_help);
userFormat.setValue(bitstream.getUserFormatDescription());
// add ID of bitstream we're editing
div.addHidden("bitstream_id").setValue(bitstream.getID());
// Note, not standard control actions, this page just goes back to the upload step.
org.dspace.app.xmlui.wing.element.Item actions = edit.addItem();
actions.addButton("submit_save").setValue(T_submit_save);
actions.addButton("submit_edit_cancel").setValue(T_submit_cancel);
}