Fix for SF bug [1606439] Exception handling for deleting a metadata field

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3373 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Stuart Lewis
2009-01-18 21:22:41 +00:00
parent 1058c7485a
commit 0654064bd8
4 changed files with 45 additions and 20 deletions

View File

@@ -215,6 +215,7 @@ jsp.dspace-admin.confirm-delete-format.returntoedit = Return to the
jsp.dspace-admin.confirm-delete-format.title = Delete Bitstream Format
jsp.dspace-admin.confirm-delete-format.warning = Any existing bitstreams of this format will be reverted to the <em>unknown</em> bitstream format.
jsp.dspace-admin.confirm-delete-mdfield.confirm = Are you sure the field <strong>{0}</strong> should be deleted?
jsp.dspace-admin.confirm-delete-mdfield.failed = Unable to delete this metadata field. This is most likely to be because it is referenced by at least one item.
jsp.dspace-admin.confirm-delete-mdfield.heading = Delete Metadata Field: <code>{0}</code>
jsp.dspace-admin.confirm-delete-mdfield.title = Delete Metadata Field
jsp.dspace-admin.confirm-delete-mdfield.warning = This will result in an error if any items have values for this metadata field.

View File

@@ -195,8 +195,18 @@ public class MetadataFieldRegistryServlet extends DSpaceServlet
// User confirms deletion of type
MetadataField dc = MetadataField.find(context, UIUtil
.getIntParameter(request, "dc_type_id"));
try
{
dc.delete(context);
request.setAttribute("failed", new Boolean(false));
showTypes(context, request, response, schemaID);
} catch (Exception e)
{
request.setAttribute("type", dc);
request.setAttribute("failed", true);
JSPManager.showJSP(request, response,
"/dspace-admin/confirm-delete-mdfield.jsp");
}
context.complete();
}
else if (button.equals("submit_move"))

View File

@@ -59,9 +59,15 @@
String typeName = type.getElement() +
(type.getQualifier() == null ? "" : "." + type.getQualifier());
boolean failed = false;
if (request.getAttribute("failed") != null)
{
failed = ((Boolean)request.getAttribute("failed")).booleanValue();
}
%>
<dspace:layout titlekey="jsp.dspace-admin.list-metadata-elements.title"
<dspace:layout titlekey="jsp.dspace-admin.confirm-delete-mdfield.title"
navbar="admin"
locbar="link"
parenttitlekey="jsp.administer"
@@ -78,9 +84,10 @@
<fmt:param><%= typeName %></fmt:param>
</fmt:message></p>
<%
if (!failed) { %>
<%-- <P>This will result in an error if any items have values for this metadata field.</P> --%>
<p><fmt:message key="jsp.dspace-admin.confirm-delete-mdfield.warning"/></p>
<form method="post" action="">
<input type="hidden" name="dc_type_id" value="<%= type.getFieldID() %>">
<center>
@@ -95,5 +102,11 @@
</tr>
</table>
</center>
</form>
</form><%
} else {%>
<%-- <P>Unable to delete this metadata field. This is most likely to be because it is referenced by at least one item.</P> --%>
<p><strong><fmt:message key="jsp.dspace-admin.confirm-delete-mdfield.failed"/></strong></p><%
}
%>
</dspace:layout>

View File

@@ -9,6 +9,7 @@
- Patch for SF feature request [1587270] Implicit group for all registered users
- Fix for SF bug [2495728] 'My Account' disappears following exports
- Update XMLUI Google Analytics code to match latest tracking code
- Fix for SF bug [1606439] Exception handling for deleting a metadata field
(Stuart Lewis / Chris Yates / Flavio Botelho / Alex Barbieri / Reuben Pasquini)
- [2057378] Hierarchical LDAP support