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