options.addItem().addXref(baseURL + "&submit_curate", T_option_curate);
// TABLE: Bitstream summary
Table files = main.addTable("editItemBitstreams", 1, 1);
files.setHead(T_head1);
Row header = files.addRow(Row.ROLE_HEADER);
header.addCellContent(T_column1);
header.addCellContent(T_column2);
header.addCellContent(T_column3);
header.addCellContent(T_column4);
header.addCellContent(T_column5);
header.addCellContent(T_column6);
header.addCellContent(T_column7);
Bundle[] bundles = item.getBundles();
boolean showBitstreamUpdateOrderButton = false;
for (Bundle bundle : bundles)
{
Cell bundleCell = files.addRow("bundle_head_" + bundle.getID(), Row.ROLE_DATA, "").addCell(1, 5);
bundleCell.addContent(T_bundle_label.parameterize(bundle.getName()));
Bitstream[] bitstreams = bundle.getBitstreams();
ArrayList<Integer> bitstreamIdOrder = new ArrayList<Integer>();
for (Bitstream bitstream : bitstreams) {
bitstreamIdOrder.add(bitstream.getID());
}
for (int bitstreamIndex = 0; bitstreamIndex < bitstreams.length; bitstreamIndex++) {
Bitstream bitstream = bitstreams[bitstreamIndex];
boolean primary = (bundle.getPrimaryBitstreamID() == bitstream.getID());
String name = bitstream.getName();
if (name != null && name.length() > 50) {
// If the fiel name is too long the shorten it so that it will display nicely.
String shortName = name.substring(0, 15);
shortName += " ... ";
shortName += name.substring(name.length() - 25, name.length());
name = shortName;
}
String description = bitstream.getDescription();
String format = null;
BitstreamFormat bitstreamFormat = bitstream.getFormat();
if (bitstreamFormat != null) {
format = bitstreamFormat.getShortDescription();
}
String editURL = contextPath + "/admin/item?administrative-continue=" + knot.getId() + "&bitstreamID=" + bitstream.getID() + "&submit_edit";
String viewURL = contextPath + "/bitstream/id/" + bitstream.getID() + "/" + bitstream.getName();
Row row = files.addRow("bitstream_row_" + bitstream.getID(), Row.ROLE_DATA, "");
CheckBox remove = row.addCell().addCheckBox("remove");
remove.setLabel("remove");
remove.addOption(bundle.getID() + "/" + bitstream.getID());
if (!AuthorizeManager.authorizeActionBoolean(context, item, Constants.REMOVE)) {
remove.setDisabled();
}
if (AuthorizeManager.authorizeActionBoolean(context, bitstream, Constants.WRITE)) {
// The user can edit the bitstream give them a link.
Cell cell = row.addCell();
cell.addXref(editURL, name);
if (primary) {
cell.addXref(editURL, T_primary_label);
}
row.addCell().addXref(editURL, description);
row.addCell().addXref(editURL, format);
} else {
// The user can't edit the bitstream just show them it.
Cell cell = row.addCell();
cell.addContent(name);
if (primary) {
cell.addContent(T_primary_label);
}
row.addCell().addContent(description);
row.addCell().addContent(format);
}
Highlight highlight = row.addCell().addHighlight("fade");
highlight.addContent("[");
highlight.addXref(viewURL, T_view_link);
highlight.addContent("]");
if (AuthorizeManager.authorizeActionBoolean(context, bundle, Constants.WRITE)) {
Cell cell = row.addCell("bitstream_order_" + bitstream.getID(), Cell.ROLE_DATA, "");
//Add the +1 to make it more human readable
cell.addHidden("order_" + bitstream.getID()).setValue(String.valueOf(bitstreamIndex + 1));
showBitstreamUpdateOrderButton = true;
Button upButton = cell.addButton("submit_order_" + bundle.getID() + "_" + bitstream.getID() + "_up", ((bitstreamIndex == 0) ? "disabled" : "") + " icon-button arrowUp ");
if((bitstreamIndex == 0)){
upButton.setDisabled();
}
upButton.setValue(T_order_up);
upButton.setHelp(T_order_up);
Button downButton = cell.addButton("submit_order_" + bundle.getID() + "_" + bitstream.getID() + "_down", (bitstreamIndex == (bitstreams.length - 1) ? "disabled" : "") + " icon-button arrowDown ");
if(bitstreamIndex == (bitstreams.length - 1)){
downButton.setDisabled();
}
downButton.setValue(T_order_down);
downButton.setHelp(T_order_down);
//These values will only be used IF javascript is disabled or isn't working
cell.addHidden(bundle.getID() + "_" + bitstream.getID() + "_up_value").setValue(retrieveOrderUpButtonValue((java.util.List<Integer>) bitstreamIdOrder.clone(), bitstreamIndex));
cell.addHidden(bundle.getID() + "_" + bitstream.getID() + "_down_value").setValue(retrieveOrderDownButtonValue((java.util.List<Integer>) bitstreamIdOrder.clone(), bitstreamIndex));
}else{
row.addCell().addContent(String.valueOf(bitstreamIndex));
}
}
}
if (AuthorizeManager.authorizeActionBoolean(context, item, Constants.ADD))
{
Cell cell = files.addRow().addCell(1, 5);
cell.addXref(contextPath+"/admin/item?administrative-continue="+knot.getId()+"&submit_add",T_submit_add);
}
else
{
Cell cell = files.addRow().addCell(1, 5);
cell.addHighlight("fade").addContent(T_no_upload);
}