forked from DSpace/DSpace
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DS-1272] Setting discovery to be the default search/browse engine
- Loading branch information
Showing
15 changed files
with
421 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/browseArtifacts/CollectionBrowse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* 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/ | ||
*/ | ||
package org.dspace.app.xmlui.aspect.browseArtifacts; | ||
|
||
import org.apache.cocoon.ProcessingException; | ||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer; | ||
import org.dspace.app.xmlui.utils.HandleUtil; | ||
import org.dspace.app.xmlui.wing.Message; | ||
import org.dspace.app.xmlui.wing.WingException; | ||
import org.dspace.app.xmlui.wing.element.Body; | ||
import org.dspace.app.xmlui.wing.element.Division; | ||
import org.dspace.app.xmlui.wing.element.List; | ||
import org.dspace.authorize.AuthorizeException; | ||
import org.dspace.browse.BrowseException; | ||
import org.dspace.browse.BrowseIndex; | ||
import org.dspace.content.Collection; | ||
import org.dspace.content.DSpaceObject; | ||
import org.xml.sax.SAXException; | ||
|
||
import java.io.IOException; | ||
import java.sql.SQLException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Renders the browse links for a collection | ||
* | ||
* @author Kevin Van de Velde (kevin at atmire dot com) | ||
* @author Mark Diggory (markd at atmire dot com) | ||
* @author Ben Bosman (ben at atmire dot com) | ||
*/ | ||
public class CollectionBrowse extends AbstractDSpaceTransformer { | ||
|
||
private static final Message T_head_browse = | ||
message("xmlui.ArtifactBrowser.CollectionViewer.head_browse"); | ||
|
||
private static final Message T_browse_titles = | ||
message("xmlui.ArtifactBrowser.CollectionViewer.browse_titles"); | ||
|
||
private static final Message T_browse_authors = | ||
message("xmlui.ArtifactBrowser.CollectionViewer.browse_authors"); | ||
|
||
private static final Message T_browse_dates = | ||
message("xmlui.ArtifactBrowser.CollectionViewer.browse_dates"); | ||
|
||
@Override | ||
public void addBody(Body body) throws SAXException, WingException, SQLException, IOException, AuthorizeException, ProcessingException { | ||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel); | ||
if (!(dso instanceof Collection)) | ||
{ | ||
return; | ||
} | ||
|
||
// Set up the major variables | ||
Collection collection = (Collection) dso; | ||
|
||
Division home = body.addDivision("collection-home", "primary repository collection"); | ||
|
||
Division search = home.addDivision("collection-search-browse", | ||
"secondary search-browse"); | ||
|
||
// Browse by list | ||
Division browseDiv = search.addDivision("collection-browse", "secondary browse"); | ||
List browse = browseDiv.addList("collection-browse", List.TYPE_SIMPLE, | ||
"collection-browse"); | ||
browse.setHead(T_head_browse); | ||
String url = contextPath + "/handle/" + collection.getHandle(); | ||
|
||
try { | ||
// Get a Map of all the browse tables | ||
BrowseIndex[] bis = BrowseIndex.getBrowseIndices(); | ||
for (BrowseIndex bix : bis) { | ||
// Create a Map of the query parameters for this link | ||
Map<String, String> queryParams = new HashMap<String, String>(); | ||
|
||
queryParams.put("type", bix.getName()); | ||
|
||
// Add a link to this browse | ||
browse.addItemXref(generateURL(url + "/browse", queryParams), | ||
message("xmlui.ArtifactBrowser.Navigation.browse_" + bix.getName())); | ||
} | ||
} catch (BrowseException bex) { | ||
browse.addItemXref(url + "/browse?type=title", T_browse_titles); | ||
browse.addItemXref(url + "/browse?type=author", T_browse_authors); | ||
browse.addItemXref(url + "/browse?type=dateissued", T_browse_dates); | ||
} | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/browseArtifacts/CommunityBrowse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* 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/ | ||
*/ | ||
package org.dspace.app.xmlui.aspect.browseArtifacts; | ||
|
||
import org.apache.cocoon.ProcessingException; | ||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer; | ||
import org.dspace.app.xmlui.utils.HandleUtil; | ||
import org.dspace.app.xmlui.wing.Message; | ||
import org.dspace.app.xmlui.wing.WingException; | ||
import org.dspace.app.xmlui.wing.element.Body; | ||
import org.dspace.app.xmlui.wing.element.Division; | ||
import org.dspace.app.xmlui.wing.element.List; | ||
import org.dspace.authorize.AuthorizeException; | ||
import org.dspace.browse.BrowseException; | ||
import org.dspace.browse.BrowseIndex; | ||
import org.dspace.content.Community; | ||
import org.dspace.content.DSpaceObject; | ||
import org.xml.sax.SAXException; | ||
|
||
import java.io.IOException; | ||
import java.sql.SQLException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Renders the browse links for a community | ||
* | ||
* @author Kevin Van de Velde (kevin at atmire dot com) | ||
* @author Mark Diggory (markd at atmire dot com) | ||
* @author Ben Bosman (ben at atmire dot com) | ||
*/ | ||
public class CommunityBrowse extends AbstractDSpaceTransformer { | ||
|
||
private static final Message T_head_browse = | ||
message("xmlui.ArtifactBrowser.CommunityViewer.head_browse"); | ||
|
||
private static final Message T_browse_titles = | ||
message("xmlui.ArtifactBrowser.CommunityViewer.browse_titles"); | ||
|
||
private static final Message T_browse_authors = | ||
message("xmlui.ArtifactBrowser.CommunityViewer.browse_authors"); | ||
|
||
private static final Message T_browse_dates = | ||
message("xmlui.ArtifactBrowser.CommunityViewer.browse_dates"); | ||
|
||
@Override | ||
public void addBody(Body body) throws SAXException, WingException, SQLException, IOException, AuthorizeException, ProcessingException { | ||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel); | ||
if (!(dso instanceof Community)) | ||
{ | ||
return; | ||
} | ||
|
||
// Set up the major variables | ||
Community community = (Community) dso; | ||
|
||
Division home = body.addDivision("community-home", "primary repository community"); | ||
|
||
Division search = home.addDivision("community-search-browse", | ||
"secondary search-browse"); | ||
|
||
// Browse by list | ||
Division browseDiv = search.addDivision("community-browse", "secondary browse"); | ||
List browse = browseDiv.addList("community-browse", List.TYPE_SIMPLE, | ||
"community-browse"); | ||
browse.setHead(T_head_browse); | ||
String url = contextPath + "/handle/" + community.getHandle(); | ||
|
||
try { | ||
// Get a Map of all the browse tables | ||
BrowseIndex[] bis = BrowseIndex.getBrowseIndices(); | ||
for (BrowseIndex bix : bis) { | ||
// Create a Map of the query parameters for this link | ||
Map<String, String> queryParams = new HashMap<String, String>(); | ||
|
||
queryParams.put("type", bix.getName()); | ||
|
||
// Add a link to this browse | ||
browse.addItemXref(generateURL(url + "/browse", queryParams), | ||
message("xmlui.ArtifactBrowser.Navigation.browse_" + bix.getName())); | ||
} | ||
} catch (BrowseException bex) { | ||
browse.addItemXref(url + "/browse?type=title", T_browse_titles); | ||
browse.addItemXref(url + "/browse?type=author", T_browse_authors); | ||
browse.addItemXref(url + "/browse?type=dateissued", T_browse_dates); | ||
} | ||
} | ||
} |
Oops, something went wrong.