mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
address most Andrea's comments
This commit is contained in:
@@ -5,11 +5,12 @@
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.app.xmlui.utils;
|
||||
package org.dspace.app.util;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
|
||||
/**
|
||||
* Utility class for lists of collections.
|
||||
@@ -42,23 +43,32 @@ public class CollectionDropDown {
|
||||
*/
|
||||
public static String collectionPath(Collection col, int maxchars) throws SQLException
|
||||
{
|
||||
|
||||
Community[] getCom = null;
|
||||
String name = "";
|
||||
getCom = col.getCommunities(); // all communities containing given collection
|
||||
for (Community com : getCom) {
|
||||
name = com.getMetadata("name") + "/" + name;
|
||||
String separator = ConfigurationManager.getProperty("subcommunity.separator");
|
||||
if (separator == null)
|
||||
{
|
||||
separator = " > ";
|
||||
}
|
||||
|
||||
name = name + col.getMetadata("name");
|
||||
Community[] getCom = null;
|
||||
StringBuffer name = new StringBuffer("");
|
||||
getCom = col.getCommunities(); // all communities containing given collection
|
||||
for (Community com : getCom)
|
||||
{
|
||||
name.insert(0, com.getMetadata("name") + separator);
|
||||
}
|
||||
|
||||
if (maxchars != 0) {
|
||||
name.append(col.getMetadata("name"));
|
||||
|
||||
if (maxchars != 0)
|
||||
{
|
||||
int len = name.length();
|
||||
if (len > maxchars) {
|
||||
name = "…" + name.substring(len - (maxchars - 1), len);
|
||||
if (len > maxchars)
|
||||
{
|
||||
name = new StringBuffer(name.substring(len - (maxchars - 1), len));
|
||||
name.insert(0, "\u2026"); // prepend with an ellipsis (cut from left)
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
return name.toString();
|
||||
}
|
||||
}
|
@@ -21,6 +21,7 @@ import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.environment.SourceResolver;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.util.CollectionDropDown;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
@@ -41,7 +42,6 @@ import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.Subscribe;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import org.dspace.app.xmlui.utils.CollectionDropDown;
|
||||
|
||||
/**
|
||||
* Display a form that allows the user to edit their profile.
|
||||
|
Reference in New Issue
Block a user