}
public void addBody(Body body) throws WingException, SQLException, AuthorizeException
{
int communityID = parameters.getParameterAsInteger("communityID", -1);
Community thisCommunity = Community.find(context, communityID);
String baseURL = contextPath + "/admin/community?administrative-continue=" + knot.getId();
String short_description_error = FlowContainerUtils.checkXMLFragment(thisCommunity.getMetadata("short_description"));
String introductory_text_error = FlowContainerUtils.checkXMLFragment(thisCommunity.getMetadata("introductory_text"));
String copyright_text_error = FlowContainerUtils.checkXMLFragment(thisCommunity.getMetadata("copyright_text"));
String side_bar_text_error = FlowContainerUtils.checkXMLFragment(thisCommunity.getMetadata("side_bar_text"));
// DIVISION: main
Division main = body.addInteractiveDivision("community-metadata-edit",contextPath+"/admin/community",Division.METHOD_MULTIPART,"primary administrative community");
main.setHead(T_main_head.parameterize(thisCommunity.getName()));
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);
// The grand list of metadata options
List metadataList = main.addList("metadataList", "form");
// community name
metadataList.addLabel(T_label_name);
Text name = metadataList.addItem().addText("name");
name.setSize(40);
name.setValue(thisCommunity.getMetadata("name"));
// short description
metadataList.addLabel(T_label_short_description);
Text short_description = metadataList.addItem().addText("short_description");
short_description.setValue(thisCommunity.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(thisCommunity.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(thisCommunity.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(thisCommunity.getMetadata("side_bar_text"));
side_bar_text.setSize(6, 40);
if (side_bar_text_error != null)
side_bar_text.addError(side_bar_text_error);
// 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 (thisCommunity.getLogo() != null) {
metadataList.addLabel(T_label_existing_logo);
item = metadataList.addItem();
item.addFigure(contextPath + "/bitstream/id/" + thisCommunity.getLogo().getID() + "/bob.jpg", null, null);
item.addButton("submit_delete_logo").setValue(T_submit_delete_logo);
}
Para buttonList = main.addPara();
buttonList.addButton("submit_save").setValue(T_submit_update);