public void addBody(Body body) throws WingException, SQLException, AuthorizeException
{
int collectionID = parameters.getParameterAsInteger("collectionID", -1);
Collection thisCollection = Collection.find(context, collectionID);
String baseURL = contextPath + "/admin/collection?administrative-continue=" + knot.getId();
//Check that all HTML input fields contain valid XHTML
String short_description_error = FlowContainerUtils.checkXMLFragment(thisCollection.getMetadata("short_description"));
String introductory_text_error = FlowContainerUtils.checkXMLFragment(thisCollection.getMetadata("introductory_text"));
String copyright_text_error = FlowContainerUtils.checkXMLFragment(thisCollection.getMetadata("copyright_text"));
String side_bar_text_error = FlowContainerUtils.checkXMLFragment(thisCollection.getMetadata("side_bar_text"));
// DIVISION: main
Division main = body.addInteractiveDivision("collection-metadata-edit",contextPath+"/admin/collection",Division.METHOD_MULTIPART,"primary administrative collection");
main.setHead(T_main_head.parameterize(thisCollection.getMetadata("name")));
List options = main.addList("options",List.TYPE_SIMPLE,"horizontal");
options.addItem().addHighlight("bold").addXref(baseURL+"&submit_metadata",T_options_metadata);
options.addItem().addXref(baseURL+"&submit_roles",T_options_roles);
options.addItem().addXref(baseURL+"&submit_harvesting",T_options_harvest);
// The grand list of metadata options
List metadataList = main.addList("metadataList", "form");
// collection name
metadataList.addLabel(T_label_name);
Text name = metadataList.addItem().addText("name");
name.setSize(40);
name.setValue(thisCollection.getMetadata("name"));
// short description
metadataList.addLabel(T_label_short_description);
Text short_description = metadataList.addItem().addText("short_description");
short_description.setValue(thisCollection.getMetadata("short_description"));
short_description.setSize(40);
if (short_description_error != null)
short_description.addError(short_description_error);
// introductory text
metadataList.addLabel(T_label_introductory_text);
TextArea introductory_text = metadataList.addItem().addTextArea("introductory_text");
introductory_text.setValue(thisCollection.getMetadata("introductory_text"));
introductory_text.setSize(6, 40);
if (introductory_text_error != null)
introductory_text.addError(introductory_text_error);
// copyright text
metadataList.addLabel(T_label_copyright_text);
TextArea copyright_text = metadataList.addItem().addTextArea("copyright_text");
copyright_text.setValue(thisCollection.getMetadata("copyright_text"));
copyright_text.setSize(6, 40);
if (copyright_text_error != null)
copyright_text.addError(copyright_text_error);
// legacy sidebar text; may or may not be used for news
metadataList.addLabel(T_label_side_bar_text);
TextArea side_bar_text = metadataList.addItem().addTextArea("side_bar_text");
side_bar_text.setValue(thisCollection.getMetadata("side_bar_text"));
side_bar_text.setSize(6, 40);
if (side_bar_text_error != null)
side_bar_text.addError(side_bar_text_error);
// license text
metadataList.addLabel(T_label_license);
TextArea license = metadataList.addItem().addTextArea("license");
license.setValue(thisCollection.getMetadata("license"));
license.setSize(6, 40);
// provenance description
metadataList.addLabel(T_label_provenance_description);
TextArea provenance_description = metadataList.addItem().addTextArea("provenance_description");
provenance_description.setValue(thisCollection.getMetadata("provenance_description"));
provenance_description.setSize(6, 40);
// the row to upload a new logo
metadataList.addLabel(T_label_logo);
metadataList.addItem().addFile("logo");
// the row displaying an existing logo
Item item;
if (thisCollection.getLogo() != null) {
metadataList.addLabel(T_label_existing_logo);
item = metadataList.addItem();
item.addFigure(contextPath + "/bitstream/id/" + thisCollection.getLogo().getID() + "/bob.jpg", null, null);
item.addButton("submit_delete_logo").setValue(T_submit_delete_logo);
}
// item template creation and removal
metadataList.addLabel(T_label_item_template);
item = metadataList.addItem();
if (thisCollection.getTemplateItem() == null)
item.addButton("submit_create_template").setValue(T_submit_create_template);
else
{
item.addButton("submit_edit_template").setValue(T_submit_edit_template);
item.addButton("submit_delete_template").setValue(T_submit_delete_template);