mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
Merge pull request #31 from KevinVdV/DS-1136
[DS-1136] Breadcrumb trail incorrect for community/collection browse and statistics
This commit is contained in:
@@ -244,7 +244,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
|
|||||||
|
|
||||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||||
if ((dso instanceof Collection) || (dso instanceof Community)) {
|
if ((dso instanceof Collection) || (dso instanceof Community)) {
|
||||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
|
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageMeta.addTrail().addContent(message("xmlui.Discovery.AbstractSearch.type_" + facetField));
|
pageMeta.addTrail().addContent(message("xmlui.Discovery.AbstractSearch.type_" + facetField));
|
||||||
|
@@ -88,7 +88,7 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
|
|||||||
|
|
||||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||||
if ((dso instanceof org.dspace.content.Collection) || (dso instanceof Community)) {
|
if ((dso instanceof org.dspace.content.Collection) || (dso instanceof Community)) {
|
||||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
|
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageMeta.addTrail().addContent(T_trail);
|
pageMeta.addTrail().addContent(T_trail);
|
||||||
|
@@ -221,7 +221,7 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
|||||||
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
||||||
if (dso != null)
|
if (dso != null)
|
||||||
{
|
{
|
||||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
|
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageMeta.addTrail().addContent(getTrailMessage(info));
|
pageMeta.addTrail().addContent(getTrailMessage(info));
|
||||||
|
@@ -114,7 +114,7 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
|||||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||||
if ((dso instanceof Collection) || (dso instanceof Community))
|
if ((dso instanceof Collection) || (dso instanceof Community))
|
||||||
{
|
{
|
||||||
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath);
|
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageMeta.addTrail().addContent(T_trail);
|
pageMeta.addTrail().addContent(T_trail);
|
||||||
|
@@ -235,7 +235,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
|||||||
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
||||||
if (dso != null)
|
if (dso != null)
|
||||||
{
|
{
|
||||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
|
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageMeta.addTrail().addContent(getTrailMessage(info));
|
pageMeta.addTrail().addContent(getTrailMessage(info));
|
||||||
|
@@ -71,7 +71,7 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
|
|||||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||||
if ((dso instanceof Collection) || (dso instanceof Community))
|
if ((dso instanceof Collection) || (dso instanceof Community))
|
||||||
{
|
{
|
||||||
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath);
|
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageMeta.addTrail().addContent(T_trail);
|
pageMeta.addTrail().addContent(T_trail);
|
||||||
|
@@ -51,7 +51,7 @@ public class StatisticsTransformer extends AbstractDSpaceTransformer {
|
|||||||
|
|
||||||
if(dso != null)
|
if(dso != null)
|
||||||
{
|
{
|
||||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
|
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
|
||||||
}
|
}
|
||||||
pageMeta.addTrailLink(contextPath + "/handle" + (dso != null && dso.getHandle() != null ? "/" + dso.getHandle() : "/statistics"), T_statistics_trail);
|
pageMeta.addTrailLink(contextPath + "/handle" + (dso != null && dso.getHandle() != null ? "/" + dso.getHandle() : "/statistics"), T_statistics_trail);
|
||||||
|
|
||||||
|
@@ -229,7 +229,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
|
|||||||
Collection collection = submission.getCollection();
|
Collection collection = submission.getCollection();
|
||||||
|
|
||||||
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
||||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
|
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
|
||||||
pageMeta.addTrail().addContent(T_submission_trail);
|
pageMeta.addTrail().addContent(T_submission_trail);
|
||||||
}
|
}
|
||||||
else if (submission instanceof WorkflowItem)
|
else if (submission instanceof WorkflowItem)
|
||||||
@@ -239,7 +239,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
|
|||||||
Collection collection = submission.getCollection();
|
Collection collection = submission.getCollection();
|
||||||
|
|
||||||
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
||||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
|
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
|
||||||
pageMeta.addTrail().addContent(T_workflow_trail);
|
pageMeta.addTrail().addContent(T_workflow_trail);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -94,7 +94,7 @@ public abstract class AbstractXMLUIAction extends AbstractDSpaceTransformer impl
|
|||||||
Collection collection = workflowItem.getCollection();
|
Collection collection = workflowItem.getCollection();
|
||||||
|
|
||||||
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
||||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
|
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
|
||||||
pageMeta.addTrail().addContent(T_workflow_trail);
|
pageMeta.addTrail().addContent(T_workflow_trail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -142,16 +142,39 @@ public class HandleUtil
|
|||||||
* or a bitstream, then the object is not included, but its collection and
|
* or a bitstream, then the object is not included, but its collection and
|
||||||
* community parents are. However, if the item is a community or collection
|
* community parents are. However, if the item is a community or collection
|
||||||
* then it is included along with all parents.
|
* then it is included along with all parents.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* If the terminal object in the trail is the passed object, do not link to
|
* If the terminal object in the trail is the passed object, do not link to
|
||||||
* it, because that is (presumably) the page at which the user has arrived.
|
* it, because that is (presumably) the page at which the user has arrived.
|
||||||
*
|
*
|
||||||
* @param dso
|
* @param dso the DSpace who's parents we wil add to the pageMeta
|
||||||
* @param pageMeta
|
* @param pageMeta the object to which we link our trial
|
||||||
|
* @param contextPath The context path
|
||||||
*/
|
*/
|
||||||
public static void buildHandleTrail(DSpaceObject dso, PageMeta pageMeta,
|
public static void buildHandleTrail(DSpaceObject dso, PageMeta pageMeta,
|
||||||
String contextPath) throws SQLException, WingException
|
String contextPath) throws SQLException, WingException
|
||||||
|
{
|
||||||
|
buildHandleTrail(dso, pageMeta, contextPath, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a list of trail metadata starting with the owning collection and
|
||||||
|
* ending with the root level parent. If the Object is an item, a bundle,
|
||||||
|
* or a bitstream, then the object is not included, but its collection and
|
||||||
|
* community parents are. However, if the item is a community or collection
|
||||||
|
* then it is included along with all parents.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* If the terminal object in the trail is the passed object, do not link to
|
||||||
|
* it, because that is (presumably) the page at which the user has arrived.
|
||||||
|
*
|
||||||
|
* @param dso the DSpace who's parents we wil add to the pageMeta
|
||||||
|
* @param pageMeta the object to which we link our trial
|
||||||
|
* @param contextPath The context path
|
||||||
|
* @param linkOriginalObject whether or not to make a link of the original object
|
||||||
|
*/
|
||||||
|
public static void buildHandleTrail(DSpaceObject dso, PageMeta pageMeta,
|
||||||
|
String contextPath, boolean linkOriginalObject) throws SQLException, WingException
|
||||||
{
|
{
|
||||||
// Add the trail back to the repository root.
|
// Add the trail back to the repository root.
|
||||||
Stack<DSpaceObject> stack = new Stack<DSpaceObject>();
|
Stack<DSpaceObject> stack = new Stack<DSpaceObject>();
|
||||||
@@ -206,7 +229,7 @@ public class HandleUtil
|
|||||||
DSpaceObject pop = stack.pop();
|
DSpaceObject pop = stack.pop();
|
||||||
|
|
||||||
String target;
|
String target;
|
||||||
if (pop == dso)
|
if (pop == dso && !linkOriginalObject)
|
||||||
target = null; // Do not link "back" to the terminal object
|
target = null; // Do not link "back" to the terminal object
|
||||||
else
|
else
|
||||||
target = contextPath + "/handle/" + pop.getHandle();
|
target = contextPath + "/handle/" + pop.getHandle();
|
||||||
|
Reference in New Issue
Block a user