<%-- The contents of this file are subject to the license and copyright detailed in the LICENSE and NOTICE files at the root of the source tree and available online at http://www.dspace.org/license/ --%> <%-- - Show form allowing edit of collection metadata - - Attributes: - item - item to edit - collections - collections the item is in, if any - handle - item's Handle, if any (String) - dc.types - MetadataField[] - all metadata fields in the registry --%> <%@ page contentType="text/html;charset=UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %> <%@ page import="javax.servlet.jsp.PageContext" %> <%@ page import="org.dspace.app.webui.servlet.admin.AuthorizeAdminServlet" %> <%@ page import="org.dspace.app.webui.servlet.admin.EditItemServlet" %> <%@ page import="org.dspace.core.ConfigurationManager" %> <%@ page import="org.dspace.eperson.EPerson" %> <%@ page import="org.dspace.core.Utils" %> <%@ page import="org.dspace.content.authority.service.MetadataAuthorityService" %> <%@ page import="org.dspace.content.authority.service.ChoiceAuthorityService" %> <%@ page import="org.dspace.content.authority.Choices" %> <%@ page import="org.apache.commons.lang.StringUtils" %> <%@ page import="java.util.*" %> <%@ page import="org.dspace.content.authority.service.MetadataAuthorityService" %> <%@ page import="org.dspace.content.*" %> <%@ page import="org.dspace.content.Collection" %> <%@ page import="org.dspace.content.authority.factory.ContentAuthorityServiceFactory" %> <%@ page import="org.dspace.content.factory.ContentServiceFactory" %> <%@ page import="org.dspace.app.webui.util.UIUtil" %> <% Item item = (Item) request.getAttribute("item"); String handle = (String) request.getAttribute("handle"); List collections = (List) request.getAttribute("collections"); List dcTypes = (List) request.getAttribute("dc.types"); HashMap metadataFields = (HashMap) request.getAttribute("metadataFields"); request.setAttribute("LanguageSwitch", "hide"); // Is anyone logged in? EPerson user = (EPerson) request.getAttribute("dspace.current.user"); // Is the logged in user an admin of the item Boolean itemAdmin = (Boolean)request.getAttribute("admin_button"); boolean isItemAdmin = (itemAdmin == null ? false : itemAdmin.booleanValue()); // Is the logged in user an admin or community admin or collection admin Boolean admin = (Boolean)request.getAttribute("is.admin"); boolean isAdmin = (admin == null ? false : admin.booleanValue()); Boolean communityAdmin = (Boolean)request.getAttribute("is.communityAdmin"); boolean isCommunityAdmin = (communityAdmin == null ? false : communityAdmin.booleanValue()); Boolean collectionAdmin = (Boolean)request.getAttribute("is.collectionAdmin"); boolean isCollectionAdmin = (collectionAdmin == null ? false : collectionAdmin.booleanValue()); String naviAdmin = "admin"; String link = "/dspace-admin"; if(!isAdmin && (isCommunityAdmin || isCollectionAdmin)) { naviAdmin = "community-or-collection-admin"; link = "/tools"; } Boolean policy = (Boolean)request.getAttribute("policy_button"); boolean bPolicy = (policy == null ? false : policy.booleanValue()); Boolean delete = (Boolean)request.getAttribute("delete_button"); boolean bDelete = (delete == null ? false : delete.booleanValue()); Boolean createBits = (Boolean)request.getAttribute("create_bitstream_button"); boolean bCreateBits = (createBits == null ? false : createBits.booleanValue()); Boolean removeBits = (Boolean)request.getAttribute("remove_bitstream_button"); boolean bRemoveBits = (removeBits == null ? false : removeBits.booleanValue()); Boolean ccLicense = (Boolean)request.getAttribute("cclicense_button"); boolean bccLicense = (ccLicense == null ? false : ccLicense.booleanValue()); Boolean withdraw = (Boolean)request.getAttribute("withdraw_button"); boolean bWithdraw = (withdraw == null ? false : withdraw.booleanValue()); Boolean reinstate = (Boolean)request.getAttribute("reinstate_button"); boolean bReinstate = (reinstate == null ? false : reinstate.booleanValue()); Boolean privating = (Boolean)request.getAttribute("privating_button"); boolean bPrivating = (privating == null ? false : privating.booleanValue()); Boolean publicize = (Boolean)request.getAttribute("publicize_button"); boolean bPublicize = (publicize == null ? false : publicize.booleanValue()); Boolean reOrderBitstreams = (Boolean)request.getAttribute("reorder_bitstreams_button"); boolean breOrderBitstreams = (reOrderBitstreams != null && reOrderBitstreams); // owning Collection ID for choice authority calls Collection collection = null; if (collections.size() > 0) collection = collections.get(0); %> <%! StringBuffer doAuthority(MetadataAuthorityService mam, ChoiceAuthorityService cam, PageContext pageContext, String contextPath, String fieldName, String idx, MetadataValue dcv, Collection collection) { StringBuffer sb = new StringBuffer(); if (cam.isChoicesConfigured(fieldName)) { boolean authority = mam.isAuthorityControlled(fieldName); boolean required = authority && mam.isAuthorityRequired(fieldName); String fieldNameIdx = "value_" + fieldName + "_" + idx; String authorityName = "choice_" + fieldName + "_authority_" + idx; String confidenceName = "choice_" + fieldName + "_confidence_" + idx; // put up a SELECT element containing all choices if ("select".equals(cam.getPresentation(fieldName))) { sb.append("\n"); } // use lookup for any other presentation style (i.e "select") else { String confidenceIndicator = "indicator_"+confidenceName; sb.append("\n
\n"); if (authority) { String confidenceSymbol = Choices.getConfidenceText(dcv.getConfidence()).toLowerCase(); sb.append("") .append("") .append(""); sb.append("") .append("") .append("") .append("") .append(""); } sb.append("") .append(""); } } return sb; } %> <%--

Edit Item

--%>

">

<%--

PLEASE NOTE: These changes are not validated in any way. You are responsible for entering the data in the correct format. If you are not sure what the format is, please do NOT make changes.

--%>

<%-- --%> <%-- --%>
<%= item.getID() %>
<%= (handle == null ? "None" : handle) %>
In Collections:
<% for (int i = 0; i < collections.size(); i++) { %> <%= collections.get(i).getName() %>
<% } %>
Item page: <% if (handle == null) { %> <% } else { String url = ConfigurationManager.getProperty("dspace.url") + "/handle/" + handle; %> <%= url %> <% } %>
<% if (!item.isWithdrawn() && bWithdraw) { %>
<%-- --%> "/>
<% } else if (item.isWithdrawn() && bReinstate) { %>
<%-- --%> "/>
<% } %> <% if (bDelete) { %>
<%-- --%> "/>
<% } %> <% if (isItemAdmin) { %>
"/>
<% } %> <% if (item.isDiscoverable() && bPrivating) { %>
"/>
<% } else if (!item.isDiscoverable() && bPublicize) { %>
"/>
<% } %> <% if (bPolicy) { %> <%-- =========================================================== Edit item's policies =========================================================== --%>
" /> <%-- --%> " />
<% } %> <% if (isItemAdmin) { %> <%-- =========================================================== Curate Item =========================================================== --%>
" />
<% } %>
<% if (item.isWithdrawn()) { %> <%--

This item was withdrawn from DSpace

--%>

<% } %>
<%-- --%> <% MetadataAuthorityService mam = ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService(); ChoiceAuthorityService cam = ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService(); List dcv = ContentServiceFactory.getInstance().getItemService().getMetadata(item, Item.ANY, Item.ANY, Item.ANY, Item.ANY); String row = "even"; // Keep a count of the number of values of each element+qualifier // key is "element" or "element_qualifier" (String) // values are Integers - number of values that element/qualifier so far Map dcCounter = new HashMap(); for (int i = 0; i < dcv.size(); i++) { // Find out how many values with this element/qualifier we've found String key = dcv.get(i).getMetadataField().toString(); Integer count = dcCounter.get(key); if (count == null) { count = new Integer(0); } // Increment counter in map dcCounter.put(key, new Integer(count.intValue() + 1)); // We will use two digits to represent the counter number in the parameter names. // This means a string sort can be used to put things in the correct order even // if there are >= 10 values for a particular element/qualifier. Increase this to // 3 digits if there are ever >= 100 for a single element/qualifer! :) String sequenceNumber = count.toString(); while (sequenceNumber.length() < 2) { sequenceNumber = "0" + sequenceNumber; } %> <% row = (row.equals("odd") ? "even" : "odd"); } %>
Element Qualifier Value Language  
<%=dcv.get(i).getMetadataField().getMetadataSchema().getName() %> <%= dcv.get(i).getMetadataField().getElement() %>   <%= (dcv.get(i).getMetadataField().getQualifier() == null ? "" : dcv.get(i).getMetadataField().getQualifier()) %> <% if (cam.isChoicesConfigured(key)) { %> <%= doAuthority(mam, cam, pageContext, request.getContextPath(), key, sequenceNumber, dcv.get(i), collection).toString() %> <% } else { %> <% } %> " size="5"/> <%-- --%>
<%-- --%>

<%--

Bitstreams

--%>

<%--

Note that if the "user format description" field isn't empty, the format will always be set to "Unknown", so clear the user format description before changing the format field.

--%>

<%-- --%> <% List bundles = item.getBundles(); row = "even"; for (int i = 0; i < bundles.size(); i++) { List bitstreams = bundles.get(i).getBitstreams(); for (int j = 0; j < bitstreams.size(); j++) { ArrayList bitstreamIdOrder = new ArrayList(); for (Bitstream bitstream : bitstreams) { bitstreamIdOrder.add(bitstream.getID()); } // Parameter names will include the bundle and bitstream ID // e.g. "bitstream_14_18_desc" is the description of bitstream 18 in bundle 14 Bitstream bitstream = bitstreams.get(j); String key = bundles.get(i).getID() + "_" + (bitstream).getID(); BitstreamFormat bf = (bitstream).getFormat(UIUtil.obtainContext(request)); %> "> <% if (bundles.get(i).getName().equals("ORIGINAL")) { %> <% } else { %> <% } %> <% if (bundles.get(i).getName().equals("ORIGINAL") && breOrderBitstreams) { //This strings are only used in case the user has javascript disabled String upButtonValue = null; String downButtonValue = null; if(0 != j){ ArrayList temp = (ArrayList) bitstreamIdOrder.clone(); //We don't have the first button, so create a value where the current bitstreamId moves one up UUID tempInt = temp.get(j); temp.set(j, temp.get(j - 1)); temp.set(j - 1, tempInt); upButtonValue = StringUtils.join(temp.toArray(new UUID[temp.size()]), ","); } if(j < (bitstreams.size() -1)){ //We don't have the first button, so create a value where the current bitstreamId moves one up ArrayList temp = (ArrayList) bitstreamIdOrder.clone(); UUID tempInt = temp.get(j); temp.set(j, temp.get(j + 1)); temp.set(j + 1, tempInt); downButtonValue = StringUtils.join(temp.toArray(new UUID[temp.size()]), ","); } %> <% }else{ %> <% } %> <% row = (row.equals("odd") ? "even" : "odd"); } } %>
Primary
Bitstream
Name Source Description Format User Format Description   
<%-- View  --%>   checked="<%="checked" %>" <% } %> /> "/> "/> "/> (<%= Utils.addEntities(bf.getShortDescription()) %>) "/>
<%=j+1%> <% if (bRemoveBits) { %> <% } %>
<%--

--%>
<% if (bCreateBits) { %> "/> <% } if(breOrderBitstreams){ %> " name="submit_update_order" style="visibility: hidden;"> <% } if (ConfigurationManager.getBooleanProperty("webui.submit.enable-cc") && bccLicense) { String s; List ccBundle = ContentServiceFactory.getInstance().getItemService().getBundles(item, "CC-LICENSE"); s = ccBundle.size() > 0 ? LocaleSupport.getLocalizedMessage(pageContext, "jsp.tools.edit-item-form.replacecc.button") : LocaleSupport.getLocalizedMessage(pageContext, "jsp.tools.edit-item-form.addcc.button"); %> "/> <% } %> <%-- --%> " /> <%-- --%> " />