mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +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);
|
||||
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));
|
||||
|
@@ -88,7 +88,7 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
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);
|
||||
|
@@ -221,7 +221,7 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
||||
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
||||
if (dso != null)
|
||||
{
|
||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
|
||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
|
||||
}
|
||||
|
||||
pageMeta.addTrail().addContent(getTrailMessage(info));
|
||||
|
@@ -114,7 +114,7 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if ((dso instanceof Collection) || (dso instanceof Community))
|
||||
{
|
||||
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath);
|
||||
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath, true);
|
||||
}
|
||||
|
||||
pageMeta.addTrail().addContent(T_trail);
|
||||
|
@@ -235,7 +235,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
||||
if (dso != null)
|
||||
{
|
||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
|
||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
|
||||
}
|
||||
|
||||
pageMeta.addTrail().addContent(getTrailMessage(info));
|
||||
|
@@ -71,7 +71,7 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if ((dso instanceof Collection) || (dso instanceof Community))
|
||||
{
|
||||
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath);
|
||||
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath, true);
|
||||
}
|
||||
|
||||
pageMeta.addTrail().addContent(T_trail);
|
||||
|
@@ -51,7 +51,7 @@ public class StatisticsTransformer extends AbstractDSpaceTransformer {
|
||||
|
||||
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);
|
||||
|
||||
|
@@ -229,7 +229,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
|
||||
Collection collection = submission.getCollection();
|
||||
|
||||
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
|
||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
|
||||
pageMeta.addTrail().addContent(T_submission_trail);
|
||||
}
|
||||
else if (submission instanceof WorkflowItem)
|
||||
@@ -239,7 +239,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
|
||||
Collection collection = submission.getCollection();
|
||||
|
||||
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
|
||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
|
||||
pageMeta.addTrail().addContent(T_workflow_trail);
|
||||
}
|
||||
else
|
||||
|
@@ -94,7 +94,7 @@ public abstract class AbstractXMLUIAction extends AbstractDSpaceTransformer impl
|
||||
Collection collection = workflowItem.getCollection();
|
||||
|
||||
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
|
||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
|
||||
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
|
||||
* 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
|
||||
* @param pageMeta
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
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.
|
||||
Stack<DSpaceObject> stack = new Stack<DSpaceObject>();
|
||||
@@ -206,7 +229,7 @@ public class HandleUtil
|
||||
DSpaceObject pop = stack.pop();
|
||||
|
||||
String target;
|
||||
if (pop == dso)
|
||||
if (pop == dso && !linkOriginalObject)
|
||||
target = null; // Do not link "back" to the terminal object
|
||||
else
|
||||
target = contextPath + "/handle/" + pop.getHandle();
|
||||
|
Reference in New Issue
Block a user