protected void buildSearchControls(Division div) throws WingException { Table controlsTable = div.addTable("search-controls", 1, 3); Row controlsRow = controlsTable.addRow(Row.ROLE_DATA); // Create a control for the number of records to display Cell rppCell = controlsRow.addCell(); rppCell.addContent(T_rpp); Select rppSelect = rppCell.addSelect("rpp"); for (int i : RESULTS_PER_PAGE_PROGRESSION) { rppSelect.addOption((i == getParameterRpp()), i, Integer.toString(i)); } Cell sortCell = controlsRow.addCell(); try { // Create a drop down of the different sort columns available sortCell.addContent(T_sort_by); Select sortSelect = sortCell.addSelect("sort_by"); sortSelect.addOption(false, 0, T_sort_by_relevance); for (SortOption so : SortOption.getSortOptions()) { if (so.isVisible()) { sortSelect.addOption( (so.getNumber() == getParameterSortBy()), so.getNumber(), message("xmlui.ArtifactBrowser.AbstractSearch.sort_by." + so.getName())); } } } catch (SortException se) { throw new WingException("Unable to get sort options", se); } // Create a control to changing ascending / descending order Cell orderCell = controlsRow.addCell(); orderCell.addContent(T_order); Select orderSelect = orderCell.addSelect("order"); orderSelect.addOption( SortOption.ASCENDING.equals(getParameterOrder()), SortOption.ASCENDING, T_order_asc); orderSelect.addOption( SortOption.DESCENDING.equals(getParameterOrder()), SortOption.DESCENDING, T_order_desc); // Create a control for the number of authors per item to display // FIXME This is currently disabled, as the supporting functionality // is not currently present in xmlui // if (isItemBrowse(info)) // { // controlsForm.addContent(T_etal); // Select etalSelect = controlsForm.addSelect(BrowseParams.ETAL); // // etalSelect.addOption((info.getEtAl() < 0), 0, T_etal_all); // etalSelect.addOption(1 == info.getEtAl(), 1, Integer.toString(1)); // // for (int i = 5; i <= 50; i += 5) // { // etalSelect.addOption(i == info.getEtAl(), i, Integer.toString(i)); // } // } }
public void addBody(Body body) throws WingException, SQLException, AuthorizeException { // Get all our parameters MetadataSchema[] schemas = MetadataSchema.findAll(context); String idsString = parameters.getParameter("fieldIDs", null); ArrayList<MetadataField> fields = new ArrayList<MetadataField>(); for (String id : idsString.split(",")) { MetadataField field = MetadataField.find(context, Integer.valueOf(id)); fields.add(field); } // DIVISION: metadata-field-move Division moved = body.addInteractiveDivision( "metadata-field-move", contextPath + "/admin/metadata-registry", Division.METHOD_POST, "primary administrative metadata-registry"); moved.setHead(T_head1); moved.addPara(T_para1); Table table = moved.addTable("metadata-field-move", fields.size() + 1, 3); Row header = table.addRow(Row.ROLE_HEADER); header.addCell().addContent(T_column1); header.addCell().addContent(T_column2); header.addCell().addContent(T_column3); for (MetadataField field : fields) { String fieldID = String.valueOf(field.getID()); String fieldEelement = field.getElement(); String fieldQualifier = field.getQualifier(); MetadataSchema schema = MetadataSchema.find(context, field.getSchemaID()); String schemaName = schema.getName(); String fieldName = schemaName + "." + fieldEelement; if (fieldQualifier != null && fieldQualifier.length() > 0) fieldName += "." + fieldQualifier; String fieldScopeNote = field.getScopeNote(); Row row = table.addRow(); row.addCell().addContent(fieldID); row.addCell().addContent(fieldName); row.addCell().addContent(fieldScopeNote); } Row row = table.addRow(); Cell cell = row.addCell(1, 3); cell.addContent(T_para2); Select toSchema = cell.addSelect("to_schema"); for (MetadataSchema schema : schemas) { toSchema.addOption(schema.getID(), schema.getNamespace()); } Para buttons = moved.addPara(); buttons.addButton("submit_move").setValue(T_submit_move); buttons.addButton("submit_cancel").setValue(T_submit_cancel); moved.addHidden("administrative-continue").setValue(knot.getId()); }
private void renderMainPage(Division div) throws WingException { Table table = div.addTable("workflow-actions", 1, 1); table.setHead(T_info1); // Approve task Row row = table.addRow(); row.addCellContent(T_approve_help); row.addCell().addButton("submit_approve").setValue(T_approve_submit); // Reject item row = table.addRow(); row.addCellContent(T_reject_help); row.addCell().addButton("submit_reject").setValue(T_reject_submit); // Edit metadata row = table.addRow(); row.addCellContent(T_edit_help); row.addCell().addButton("submit_edit").setValue(T_edit_submit); // Everyone can just cancel row = table.addRow(); row.addCell(0, 2).addButton("submit_leave").setValue(T_cancel_submit); div.addHidden("page").setValue(ReviewAction.MAIN_PAGE); }
private void createTable(Division main) throws WingException { // Get all our parameters String id = parameters.getParameter("versionID", null); Table table = main.addTable("version", 1, 1); Row header = table.addRow(Row.ROLE_HEADER); header.addCellContent(T_column1); header.addCellContent(T_column2); header.addCellContent(T_column3); header.addCellContent(T_column4); VersioningService versioningService = new DSpace().getSingletonService(VersioningService.class); Version version = versioningService.getVersion(context, Integer.parseInt(id)); Row row = table.addRow(); row.addCell().addContent(version.getVersionNumber()); row.addCell().addContent(version.getEperson().getEmail()); row.addCell().addContent(new DCDate(version.getVersionDate()).toString()); row.addCell().addContent(version.getSummary()); List fields = main.addList("fields", List.TYPE_FORM); Composite addComposite = fields.addItem().addComposite("summary"); addComposite.setLabel(T_column4); addComposite.addTextArea("summary"); }
public void addBody(Body body) throws WingException, SQLException, AuthorizeException { // Get all our parameters String idsString = parameters.getParameter("formatIDs", null); ArrayList<BitstreamFormat> formats = new ArrayList<BitstreamFormat>(); for (String id : idsString.split(",")) { BitstreamFormat format = BitstreamFormat.find(context, Integer.valueOf(id)); formats.add(format); } // DIVISION: bitstream-format-confirm-delete Division deleted = body.addInteractiveDivision( "bitstream-format-confirm-delete", contextPath + "/admin/format-registry", Division.METHOD_POST, "primary administrative format-registry"); deleted.setHead(T_head); deleted.addPara(T_para1); Table table = deleted.addTable("format-confirm-delete", formats.size() + 1, 3); Row header = table.addRow(Row.ROLE_HEADER); header.addCell().addContent(T_column1); header.addCell().addContent(T_column2); header.addCell().addContent(T_column3); for (BitstreamFormat format : formats) { if (format == null) { continue; } String formatID = String.valueOf(format.getID()); String mimetype = format.getMIMEType(); String name = format.getShortDescription(); Row row = table.addRow(); row.addCell().addContent(formatID); row.addCell().addContent(mimetype); row.addCell().addContent(name); } Para buttons = deleted.addPara(); buttons.addButton("submit_confirm").setValue(T_submit_delete); buttons.addButton("submit_cancel").setValue(T_submit_cancel); deleted.addHidden("administrative-continue").setValue(knot.getId()); }
public void addBody(Body body) throws WingException, SQLException, AuthorizeException { // Get all our parameters String idsString = parameters.getParameter("schemaIDs", null); ArrayList<MetadataSchema> schemas = new ArrayList<MetadataSchema>(); for (String id : idsString.split(",")) { MetadataSchema schema = MetadataSchema.find(context, Integer.valueOf(id)); schemas.add(schema); } // DIVISION: metadata-schema-confirm-delete Division deleted = body.addInteractiveDivision( "metadata-schema-confirm-delete", contextPath + "/admin/metadata-registry", Division.METHOD_POST, "primary administrative metadata-registry"); deleted.setHead(T_head); deleted.addPara(T_para1); Para warning = deleted.addPara(); warning.addHighlight("bold").addContent(T_warning); warning.addContent(T_para2); Table table = deleted.addTable("schema-confirm-delete", schemas.size() + 1, 3); Row header = table.addRow(Row.ROLE_HEADER); header.addCell().addContent(T_column1); header.addCell().addContent(T_column2); header.addCell().addContent(T_column3); for (MetadataSchema schema : schemas) { Row row = table.addRow(); row.addCell().addContent(schema.getSchemaID()); row.addCell().addContent(schema.getNamespace()); row.addCell().addContent(schema.getName()); } Para buttons = deleted.addPara(); buttons.addButton("submit_confirm").setValue(T_submit_delete); buttons.addButton("submit_cancel").setValue(T_submit_cancel); deleted.addHidden("administrative-continue").setValue(knot.getId()); }
public void addBody(Body body) throws WingException, SQLException { // Get all our parameters String baseURL = contextPath + "/admin/groups?administrative-continue=" + knot.getId(); String query = parameters.getParameter("query", ""); int page = parameters.getParameterAsInteger("page", 0); int highlightID = parameters.getParameterAsInteger("highlightID", -1); // FIXME: Bad! // int resultCount = Group.searchResultCount(context, query); int resultCount = Group.search(context, query).length; Group[] groups = Group.search(context, query, page * PAGE_SIZE, PAGE_SIZE); // DIVISION: groups-main Division main = body.addInteractiveDivision( "groups-main", contextPath + "/admin/groups", Division.METHOD_POST, "primary administrative groups"); main.setHead(T_main_head); // DIVISION: group-actions Division actions = main.addDivision("group-actions"); actions.setHead(T_actions_head); // Browse Epeople List actionsList = actions.addList("actions"); actionsList.addLabel(T_actions_create); actionsList.addItemXref(baseURL + "&submit_add", T_actions_create_link); actionsList.addLabel(T_actions_browse); actionsList.addItemXref(baseURL + "&query&submit_search", T_actions_browse_link); actionsList.addLabel(T_actions_search); org.dspace.app.xmlui.wing.element.Item actionItem = actionsList.addItem(); Text queryField = actionItem.addText("query"); if (query != null) queryField.setValue(query); queryField.setHelp(T_search_help); actionItem.addButton("submit_search").setValue(T_go); // DIVISION: group-search Division search = main.addDivision("group-search"); search.setHead(T_search_head); if (resultCount > PAGE_SIZE) { // If there are enough results then paginate the results int firstIndex = page * PAGE_SIZE + 1; int lastIndex = page * PAGE_SIZE + groups.length; String nextURL = null, prevURL = null; if (page < (resultCount / PAGE_SIZE)) nextURL = baseURL + "&page=" + (page + 1); if (page > 0) prevURL = baseURL + "&page=" + (page - 1); search.setSimplePagination(resultCount, firstIndex, lastIndex, prevURL, nextURL); } Table table = search.addTable("groups-search-table", groups.length + 1, 1); Row header = table.addRow(Row.ROLE_HEADER); header.addCell().addContent(T_search_column1); header.addCell().addContent(T_search_column2); header.addCell().addContent(T_search_column3); header.addCell().addContent(T_search_column4); header.addCell().addContent(T_search_column5); for (Group group : groups) { Row row; if (group.getID() == highlightID) row = table.addRow(null, null, "highlight"); else row = table.addRow(); if (group.getID() > 1) { CheckBox select = row.addCell().addCheckBox("select_group"); select.setLabel(new Integer(group.getID()).toString()); select.addOption(new Integer(group.getID()).toString()); } else { // Don't allow the user to remove the administrative (id:1) or // anonymous group (id:0) row.addCell(); } row.addCell().addContent(group.getID()); row.addCell().addXref(baseURL + "&submit_edit&groupID=" + group.getID(), group.getName()); int memberCount = group.getMembers().length + group.getMemberGroups().length; row.addCell().addContent(memberCount == 0 ? "-" : String.valueOf(memberCount)); Cell cell = row.addCell(); if (FlowGroupUtils.getCollectionId(group.getName()) > -1) { Collection collection = Collection.find(context, FlowGroupUtils.getCollectionId(group.getName())); if (collection != null) { String collectionName = collection.getMetadata("name"); if (collectionName == null) collectionName = ""; else if (collectionName.length() > MAX_COLLECTION_NAME) collectionName = collectionName.substring(0, MAX_COLLECTION_NAME - 3) + "..."; cell.addContent(collectionName + " "); Highlight highlight = cell.addHighlight("fade"); highlight.addContent("["); highlight.addXref( contextPath + "/handle/" + collection.getExternalIdentifier().getCanonicalForm(), T_collection_link); highlight.addContent("]"); } } } if (groups.length <= 0) { Cell cell = table.addRow().addCell(1, 5); cell.addHighlight("italic").addContent(T_no_results); } else { search.addPara().addButton("submit_delete").setValue(T_submit_delete); } search.addHidden("administrative-continue").setValue(knot.getId()); }
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(); Group admins = thisCommunity.getAdministrators(); // DIVISION: main Division main = body.addInteractiveDivision( "community-assign-roles", contextPath + "/admin/community", Division.METHOD_POST, "primary administrative community"); main.setHead(T_main_head.parameterize(thisCommunity.getName())); List options = main.addList("options", List.TYPE_SIMPLE, "horizontal"); options.addItem().addXref(baseURL + "&submit_metadata", T_options_metadata); options.addItem().addHighlight("bold").addXref(baseURL + "&submit_roles", T_options_roles); options.addItem().addXref(baseURL + "&submit_curate", T_options_curate); // The table of admin roles Table rolesTable = main.addTable("roles-table", 6, 5); Row tableRow; // The header row Row tableHeader = rolesTable.addRow(Row.ROLE_HEADER); tableHeader.addCell().addContent(T_role_name); tableHeader.addCell().addContent(T_role_group); tableHeader.addCell().addContent(T_role_buttons); rolesTable.addRow(); /* * The community admins */ // data row tableRow = rolesTable.addRow(Row.ROLE_DATA); tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_admins); if (admins != null) { try { AuthorizeUtil.authorizeManageAdminGroup(context, thisCommunity); tableRow.addCell().addXref(baseURL + "&submit_edit_admin", admins.getName()); } catch (AuthorizeException authex) { // add a notice, the user is not authorized to create/edit community's admin group tableRow.addCell().addContent(T_sysadmins_only); } try { AuthorizeUtil.authorizeRemoveAdminGroup(context, thisCommunity); tableRow.addCell().addButton("submit_delete_admin").setValue(T_delete); } catch (AuthorizeException authex) { // nothing to add, the user is not allowed to delete the group } } else { tableRow.addCell().addContent(T_no_role); Cell commAdminCell = tableRow.addCell(); try { AuthorizeUtil.authorizeManageAdminGroup(context, thisCommunity); commAdminCell.addButton("submit_create_admin").setValue(T_create); } catch (AuthorizeException authex) { // add a notice, the user is not authorized to create/edit community's admin group addAdministratorOnlyButton(commAdminCell, "submit_create_admin", T_create); } } // help and directions row tableRow = rolesTable.addRow(Row.ROLE_DATA); tableRow.addCell(); tableRow.addCell(1, 2).addHighlight("fade offset").addContent(T_help_admins); try { AuthorizeUtil.authorizeManageCommunityPolicy(context, thisCommunity); // add one last link to edit the raw authorizations Cell authCell = rolesTable.addRow().addCell(1, 3); authCell.addXref(baseURL + "&submit_authorizations", T_edit_authorizations); } catch (AuthorizeException authex) { // nothing to add, the user is not authorized to manage community's policies } Para buttonList = main.addPara(); buttonList.addButton("submit_return").setValue(T_submit_return); main.addHidden("administrative-continue").setValue(knot.getId()); }
public void addBody(Body body) throws SAXException, WingException, SQLException { // Get our parameters and state; UUID collectionID = UUID.fromString(parameters.getParameter("collectionID", null)); Collection collection = collectionService.find(context, collectionID); List<Item> items = getMappedItems(collection); // DIVISION: browse-items Division div = body.addInteractiveDivision( "browse-items", contextPath + "/admin/mapper", Division.METHOD_GET, "primary administrative mapper"); div.setHead(T_head1); if (authorizeService.authorizeActionBoolean(context, collection, Constants.REMOVE)) { Para actions = div.addPara(); actions.addButton("submit_unmap").setValue(T_submit_unmap); actions.addButton("submit_return").setValue(T_submit_return); } else { Para actions = div.addPara(); Button button = actions.addButton("submit_unmap"); button.setValue(T_submit_unmap); button.setDisabled(); actions.addButton("submit_return").setValue(T_submit_return); div.addPara().addHighlight("fade").addContent(T_no_remove); } Table table = div.addTable("browse-items-table", 1, 1); Row header = table.addRow(Row.ROLE_HEADER); header.addCellContent(T_column1); header.addCellContent(T_column2); header.addCellContent(T_column3); header.addCellContent(T_column4); for (Item item : items) { String itemID = String.valueOf(item.getID()); Collection owningCollection = item.getOwningCollection(); String owning = owningCollection.getName(); String author = "unknown"; List<MetadataValue> dcAuthors = itemService.getMetadata( item, MetadataSchema.DC_SCHEMA, "contributor", Item.ANY, Item.ANY); if (dcAuthors != null && dcAuthors.size() >= 1) { author = dcAuthors.get(0).getValue(); } String title = "untitled"; List<MetadataValue> dcTitles = itemService.getMetadata(item, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY); if (dcTitles != null && dcTitles.size() >= 1) { title = dcTitles.get(0).getValue(); } String url = contextPath + "/handle/" + item.getHandle(); Row row = table.addRow(); CheckBox select = row.addCell().addCheckBox("itemID"); select.setLabel("Select"); select.addOption(itemID); row.addCellContent(owning); row.addCell().addXref(url, author); row.addCell().addXref(url, title); } if (authorizeService.authorizeActionBoolean(context, collection, Constants.REMOVE)) { Para actions = div.addPara(); actions.addButton("submit_unmap").setValue(T_submit_unmap); actions.addButton("submit_return").setValue(T_submit_return); } else { Para actions = div.addPara(); Button button = actions.addButton("submit_unmap"); button.setValue(T_submit_unmap); button.setDisabled(); actions.addButton("submit_return").setValue(T_submit_return); div.addPara().addHighlight("fade").addContent(T_no_remove); } div.addHidden("administrative-continue").setValue(knot.getId()); }
public void addBody(Body body) throws SQLException, WingException { // Get our parameters and state int itemID = parameters.getParameterAsInteger("itemID", -1); Item item = Item.find(context, itemID); String baseURL = contextPath + "/admin/item?administrative-continue=" + knot.getId(); // DIVISION: main div Division main = body.addInteractiveDivision( "edit-item-status", contextPath + "/admin/item", Division.METHOD_POST, "primary administrative item"); main.setHead(T_option_head); // LIST: options List options = main.addList("options", List.TYPE_SIMPLE, "horizontal"); options.addItem().addXref(baseURL + "&submit_status", T_option_status); options .addItem() .addHighlight("bold") .addXref(baseURL + "&submit_bitstreams", T_option_bitstreams); options.addItem().addXref(baseURL + "&submit_metadata", T_option_metadata); options.addItem().addXref(baseURL + "&view_item", T_option_view); // 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); Bundle[] bundles = item.getBundles(); for (Bundle bundle : bundles) { Cell bundleCell = files.addRow().addCell(1, 5); bundleCell.addContent(T_bundle_label.parameterize(bundle.getName())); Bitstream[] bitstreams = bundle.getBitstreams(); for (Bitstream bitstream : bitstreams) { 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(); 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, 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); } // PARA: actions Para actions = main.addPara("editItemActionsP", "editItemActionsP"); if (AuthorizeManager.authorizeActionBoolean(context, item, Constants.REMOVE)) actions.addButton("submit_delete").setValue(T_submit_delete); else { Button button = actions.addButton("submit_delete"); button.setValue(T_submit_delete); button.setDisabled(); main.addPara().addHighlight("fade").addContent(T_no_remove); } actions.addButton("submit_return").setValue(T_submit_return); main.addHidden("administrative-continue").setValue(knot.getId()); }
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException { // If we are actually editing information of an uploaded file, // then display that body instead! if (this.editFile != null) { editFile.addBody(body); return; } // Get a list of all files in the original bundle Item item = submission.getItem(); Collection collection = submission.getCollection(); String actionURL = contextPath + "/handle/" + collection.getHandle() + "/submit/" + knot.getId() + ".continue"; boolean disableFileEditing = (submissionInfo.isInWorkflow()) && !ConfigurationManager.getBooleanProperty("workflow", "reviewer.file-edit"); Bundle[] bundles = item.getBundles("ORIGINAL"); Bitstream[] bitstreams = new Bitstream[0]; if (bundles.length > 0) { bitstreams = bundles[0].getBitstreams(); } // Part A: // First ask the user if they would like to upload a new file (may be the first one) Division div = body.addInteractiveDivision( "submit-upload", actionURL, Division.METHOD_MULTIPART, "primary submission"); div.setHead(T_submission_head); addSubmissionProgressList(div); List upload = null; if (!disableFileEditing) { // Only add the upload capabilities for new item submissions upload = div.addList("submit-upload-new", List.TYPE_FORM); upload.setHead(T_head); addRioxxVersionSection(upload, item); File file = upload.addItem().addFile("file"); file.setLabel(T_file); file.setHelp(T_file_help); file.setRequired(); // if no files found error was thrown by processing class, display it! if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_NO_FILES_ERROR) { file.addError(T_file_error); } // if an upload error was thrown by processing class, display it! if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_UPLOAD_ERROR) { file.addError(T_upload_error); } // if virus checking was attempted and failed in error then let the user know if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_VIRUS_CHECKER_UNAVAILABLE) { file.addError(T_virus_checker_error); } // if virus checking was attempted and a virus found then let the user know if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_CONTAINS_VIRUS) { file.addError(T_virus_error); } Text description = upload.addItem().addText("description"); description.setLabel(T_description); description.setHelp(T_description_help); Button uploadSubmit = upload.addItem().addButton("submit_upload"); uploadSubmit.setValue(T_submit_upload); } make_sherpaRomeo_submission(item, div); // Part B: // If the user has already uploaded files provide a list for the user. if (bitstreams.length > 0 || disableFileEditing) { Table summary = div.addTable("submit-upload-summary", (bitstreams.length * 2) + 2, 7); summary.setHead(T_head2); Row header = summary.addRow(Row.ROLE_HEADER); header.addCellContent(T_column0); // primary bitstream header.addCellContent(T_column1); // select checkbox header.addCellContent(T_column2); // file name header.addCellContent(T_column3); // size header.addCellContent(T_column4); // description header.addCellContent(T_column5); // format header.addCellContent(T_column6); // edit button for (Bitstream bitstream : bitstreams) { int id = bitstream.getID(); String name = bitstream.getName(); String url = makeBitstreamLink(item, bitstream); long bytes = bitstream.getSize(); String desc = bitstream.getDescription(); String algorithm = bitstream.getChecksumAlgorithm(); String checksum = bitstream.getChecksum(); Row row = summary.addRow(); // Add radio-button to select this as the primary bitstream Radio primary = row.addCell().addRadio("primary_bitstream_id"); primary.addOption(String.valueOf(id)); // If this bitstream is already marked as the primary bitstream // mark it as such. if (bundles[0].getPrimaryBitstreamID() == id) { primary.setOptionSelected(String.valueOf(id)); } if (!disableFileEditing) { // Workflow users can not remove files. CheckBox remove = row.addCell().addCheckBox("remove"); remove.setLabel("remove"); remove.addOption(id); } else { row.addCell(); } row.addCell().addXref(url, name); row.addCellContent(bytes + " bytes"); if (desc == null || desc.length() == 0) { row.addCellContent(T_unknown_name); } else { row.addCellContent(desc); } BitstreamFormat format = bitstream.getFormat(); if (format == null) { row.addCellContent(T_unknown_format); } else { int support = format.getSupportLevel(); Cell cell = row.addCell(); cell.addContent(format.getMIMEType()); cell.addContent(" "); switch (support) { case 1: cell.addContent(T_supported); break; case 2: cell.addContent(T_known); break; case 3: cell.addContent(T_unsupported); break; } } Button edit = row.addCell().addButton("submit_edit_" + id); edit.setValue(T_submit_edit); Row checksumRow = summary.addRow(); checksumRow.addCell(); Cell checksumCell = checksumRow.addCell(null, null, 0, 6, null); checksumCell.addHighlight("bold").addContent(T_checksum); checksumCell.addContent(" "); checksumCell.addContent(algorithm + ":" + checksum); } if (!disableFileEditing) { // Workflow users can not remove files. Row actionRow = summary.addRow(); actionRow.addCell(); Button removeSeleceted = actionRow.addCell(null, null, 0, 6, null).addButton("submit_remove_selected"); removeSeleceted.setValue(T_submit_remove); } upload = div.addList("submit-upload-new-part2", List.TYPE_FORM); } // Part C: // add standard control/paging buttons addControlButtons(upload); }
public void addTablePolicies(Division parent, DSpaceObject dso, Collection owningCollection) throws WingException, SQLException { if (!isAdvancedFormEnabled) { return; } Division div = parent.addDivision("access-existing-policies"); div.setHead(T_head_policies_table); div.addPara(T_policies_help.parameterize(owningCollection)); java.util.List<ResourcePolicy> resourcePolicies = authorizeService.findPoliciesByDSOAndType(context, dso, ResourcePolicy.TYPE_CUSTOM); if (resourcePolicies.isEmpty()) { div.addPara(T_no_policies); return; } int cols = resourcePolicies.size(); if (cols == 0) cols = 1; Table policies = div.addTable("policies", 6, cols); Row header = policies.addRow(Row.ROLE_HEADER); header.addCellContent(T_column0); // name header.addCellContent(T_column1); // action header.addCellContent(T_column2); // group header.addCellContent(T_column3); // start_date header.addCellContent(T_column4); // end_date for (ResourcePolicy rp : resourcePolicies) { int id = rp.getID(); String name = ""; if (rp.getRpName() != null) name = rp.getRpName(); String action = resourcePolicyService.getActionText(rp); // if it is the default policy for the Submitter don't show it. if (dso instanceof org.dspace.content.Item) { org.dspace.content.Item item = (org.dspace.content.Item) dso; if (rp.getEPerson() != null) { if (item.getSubmitter().equals(rp.getEPerson())) continue; } } String group = ""; if (rp.getGroup() != null) group = rp.getGroup().getName(); Row row = policies.addRow(); row.addCellContent(name); row.addCellContent(action); row.addCellContent(group); // start String startDate = ""; if (rp.getStartDate() != null) { startDate = DateFormatUtils.format(rp.getStartDate(), "yyyy-MM-dd"); } row.addCellContent(startDate); // endDate String endDate = ""; if (rp.getEndDate() != null) { endDate = DateFormatUtils.format(rp.getEndDate(), "yyyy-MM-dd"); } row.addCellContent(endDate); Button edit = row.addCell().addButton("submit_edit_edit_policies_" + id); edit.setValue(T_table_submit_edit); Button delete = row.addCell().addButton("submit_delete_edit_policies_" + id); delete.setValue(T_table_submit_delete); } }