Sort the Role Listing in the Contribute Client | arfore.com

One of the annoyances I have found with the Contribute Client is that in the Administration interface section, when adding a user, the menu of roles is not sorted for you. The list that appears when you reassign a user or when you create a new role, is sorted for you.

Each time that a new role is added, the client updates the hub file, adding the new role to the end of the list.

In investigating this I found that the hub file is just an XML file. This file is stored in the root _mm folder of the website that you are managing. Note that this file is connection specific, so if you are managing multiple websites, the location of this control file will vary. And if you are managing a large deployment by having multiple sites with a single directory structure, you will have a different _mm folder and hub file for each site, even though they are physically on the same server they are treated differently by the logic of the software.

The XML node list structure that controls this is as follows:

... ...

The name of the role shown in the Contribute client administration interface is controlled by the value assigned to the value attribute of the individual group_list_item nodes.

The last group_item_list node is the most recent role that has been added to the system.

What I ended up doing was using a pre-compiled perl program to sort the group_list_item nodes based on the content of the value attribute.

In order to use xmlsort, you will need the following Perl modules:

XML-Filter-BufferText-1.01 XML-Filter-Sort-1.01 XML-SAX-Writer-0.50

Text-Iconv-1.4

After installing those Perl modules you will be able to use the xmlsort command. This is essentially a precompiled Perl command that eliminates you from having to write a Perl script to do a simple sort. If you need to do more complex sorting or XML processing then you will need to roll your own code.

The necessary syntax for the command is:

xmlsort -i -r=group_list/group_list_item -k=@value cthubxxx.csi > out.xml

Replace the cthubxxx.csi is the command with the actually filename for your particular hub file. At this point you should backup your hub file then rename out.xml to the hub filename. This process doesn’t require a restart of CPS or the Contribute client, but it would be safer to do this at a time when there is low usage of Contribute just in case.

arfore – Mon, 2006 – 12 – 18 01:41

%d bloggers like this: