Merge pull request #412 from EKT/DS-1322

[DS-1322] Item without Title inaccessible via the UI unless for the admin via ID or Handle
This commit is contained in:
Andrea Bollini
2013-12-04 05:07:43 -08:00
3 changed files with 38 additions and 19 deletions

View File

@@ -78,6 +78,8 @@ itemlist.dc.type.degree = Degree
itemlist.et-al = et al
itemlist.thumbnail = Preview
itemlist.title.undefined = Undefined
jsp.adminhelp = <span class="glyphicon glyphicon-question-sign"></span>
jsp.administer = Administer
jsp.admintools = Admin Tools

View File

@@ -483,7 +483,7 @@ public class BrowseListTag extends TagSupport
metadata = UIUtil.displayDate(dd, false, false, hrq);
}
// format the title field correctly for withdrawn and private items (ie. don't link)
else if (field.equals(titleField) && (items[i].isWithdrawn() || !isDiscoverable(hrq, items[i])))
else if (field.equals(titleField) && items[i].isWithdrawn())
{
metadata = Utils.addEntities(metadataArray[0].value);
}
@@ -570,7 +570,24 @@ public class BrowseListTag extends TagSupport
metadata = "<em>" + sb.toString() + "</em>";
}
}
//In case title has no value, replace it with "undefined" so as the user has something to
//click in order to access the item page
else if (field.equals(titleField)){
String undefined = LocaleSupport.getLocalizedMessage(pageContext, "itemlist.title.undefined");
if (items[i].isWithdrawn())
{
metadata = "<span style=\"font-style:italic\">("+undefined+")</span>";
}
// format the title field correctly (as long as the item isn't withdrawn, link to it)
else
{
metadata = "<a href=\"" + hrq.getContextPath() + "/handle/"
+ items[i].getHandle() + "\">"
+ "<span style=\"font-style:italic\">("+undefined+")</span>"
+ "</a>";
}
}
// prepare extra special layout requirements for dates
String extras = "";
if (isDate[colIdx])
@@ -887,21 +904,4 @@ public class BrowseListTag extends TagSupport
throw new JspException("Server does not support DSpace's default encoding. ", e);
}
}
/* whether the embedded item of the bitem is discoverable or not? */
private boolean isDiscoverable(HttpServletRequest hrq, BrowseItem bitem)
throws JspException
{
try
{
Context c = UIUtil.obtainContext(hrq);
Item item = Item.find(c, bitem.getID());
return item.isDiscoverable();
}
catch (SQLException sqle)
{
throw new JspException(sqle.getMessage(), sqle);
}
}
}

View File

@@ -535,6 +535,23 @@ public class ItemListTag extends TagSupport
metadata = "<em>" + sb.toString() + "</em>";
}
}
//In case title has no value, replace it with "undefined" so as the user has something to
//click in order to access the item page
else if (field.equals(titleField)){
String undefined = LocaleSupport.getLocalizedMessage(pageContext, "itemlist.title.undefined");
if (items[i].isWithdrawn())
{
metadata = "<span style=\"font-style:italic\">("+undefined+")</span>";
}
// format the title field correctly (as long as the item isn't withdrawn, link to it)
else
{
metadata = "<a href=\"" + hrq.getContextPath() + "/handle/"
+ items[i].getHandle() + "\">"
+ "<span style=\"font-style:italic\">("+undefined+")</span>"
+ "</a>";
}
}
// prepare extra special layout requirements for dates
String extras = "";