Communuty and subcommunity sort

30 views
Skip to first unread message

Fillemon Silvanus

unread,
Nov 18, 2018, 5:45:07 PM11/18/18
to DSpace Technical Support
Hello 

I am trying to change how my subcommunities and communities are arranged on the community-list page.
By default they are sorted in alphabetical order but i want them arranged that the first community created is first, then the next created so on.
I have been looking at the java files but did not managed to get the code that arranges the communities.

Anyone who knows please help me

Thank You in advance. 

Tim Donohue

unread,
Nov 19, 2018, 10:11:32 AM11/19/18
to Fillemon Silvanus, DSpace Technical Support
Hello,

Unfortunately, this is not easy to change *only for* the community-list page. However, assuming you are using DSpace 6.x, the community-list page (along with any other pages that list communities) uses the CommunityServiceImpl's "findAllTop()" method (which finds all the top level communities).  That method has a hardcoded sortField of "dc.title", see this code:
https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace-api/src/main/java/org/dspace/content/CommunityServiceImpl.java#L163

That method then calls a separate CommunityDAOImpl class to actually run the query.  Here's the method it calls:
https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace-api/src/main/java/org/dspace/content/dao/impl/CommunityDAOImpl.java#L85

If you wanted to change the ordering of Communities *everywhere* in the system, you could customize either that sortField (which must be a valid metadata field *for all Communities*) or change the query itself (in CommunityDAOImpl).   However, I'll admit, I'm not sure if this will affect other areas of the system.  Because this sort order is currently hardcoded, it's possible that either the XMLUI or JSPUI may make assumptions regarding how Communities are returned.  So, please be aware that changing code at this level will need to be well tested on your end -- it's not something I've ever tried myself.

Good luck,

Tim


--
All messages to this mailing list should adhere to the DuraSpace Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.
--
Tim Donohue
Technical Lead for DSpace & DSpaceDirect
DuraSpace.org | DSpace.org | DSpaceDirect.org
Reply all
Reply to author
Forward
0 new messages