Community Server 2007: Correct sorting of Files TreeView

Something that has annoyed me since I started using Community Server was that the Files treeview didn't sort by name, but by internal Ids (so the actual sort order is "by creation date").

So, now that I'm deeping in how CS works internally, I decided to fix it by sorting alphabetically both the folder groups and folders for the Downloads section.

It requires modification of a core component (CommunityServerFiles20 project, CommunityServer.Files assembly), but the change is just changing two lines of code!

  1. Open the Folders class
  2. Find the GetFoldersByGroupID method
  3. Find this comment:
    // Sort the galleries
  4. Change the line following the comment to:
    folders.Sort(newSectionSorter(SectionSortBy.Name));
  5. Find the GetFolderGroups() method
  6. Find this comment:
    // Sort the forum groups
  7. Change the line following the comment to:
    folderGroups.Sort(newGroupSorter(GroupSortBy.Name));

Rebuild in release mode, replace the assembly in \bin folder, and we're done!

As an added bonus, on the Control Panel's file management the folder groups & files will be sorted too!

Posted by Kartones on 2009-01-28

Comments?

Share via: Twitter Linkedin Google+ Facebook