Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

The list in SelectCollectionStep.java does not specify in which community each collection belongs to. So for collections named "Thesis" that exist in multiple departments (Communities) the user can't choose which is the correct one.

One solution to this problem is to change the way the list is built in SelectCollectionStep.java
(package org.dspace.app.xmlui.aspect.submission.submit) by adding a loop inside the loop that gets the names / handles for each collection in order to get the names of the parent communities

so the original loop:

Code Block
for (Collection collection : collections) 
{
   	String name = collection.getMetadata("name");
   	if (name.length() > 50)
   		name = name.substring(0, 47) + "...";
	select.addOption(collection.getHandle(),name);
}

can be changed to:

Code Block
for (Collection collection : collections)
{
	String name = "";
	String temp = "";
	String temp2 = "";
	Community[] community = collection.getCommunities();	//get the names of the communities for this collection
	for (Community com : community)
	{
		temp = com.getMetadata("name");
		if (temp.length() > 15)
			temp = temp.substring(0, 12) + "...";	//Trimming the name of the community
		name = temp +" / "+ name;			//Adding the strings of the community names
	}
	temp2 = collection.getMetadata("name");
	if (temp2.length() > 18)
		temp2 = temp2.substring(0, 15) + "...";		//Trimming the name of the collection
	name = name + temp2;
	select.addOption(collection.getHandle(),name);
	}

The variables ("temp","temp2") can be changed, string variable "temp" can be used instead "temp2", and the substring methods can be removed if the names of the communities are not very big. Some steps in the loop can be skipped/merged together.
This change has been tested in 1.5.2

The same can be applied in Profile page (EditProfile.java / package org.dspace.app.xmlui.aspect.eperson) with the addition of

Code Block
import org.dspace.content.Community

In this way the users can choose the collection they want to subscribe to for mail alerts