Allow user to sort the items
It would be a nice feature to allow the user to sort the elements in the manager. The default style of showing the most recent addition is nice, but what if the user is looking for something older? Or what if they know the name of it, and would like the nodes sorted in alphabetical order?
Our Base View: taxonomy_term
Go to Administer->Site Building->Views. Locate the 'taxonomy_term' view, and if it isn't already enabled, click the 'enable' link on the right. This will be the default view for the taxonomy terms. By default, it will sort the terms by posted date, with the most recent first. If you wanted to change the default sort method, or if you wanted to filter it so only certain nodes were displayed, you could edit this view to do so. However, for our purposes, the default settings are fine.
Sort by Newest
The first thing we will do is to create the view to sort with the newest entries first. Since this is the default behavior, it is a simple task. However, as we need to be able to change the sort order, we should have a way to set it back to the default, so let's go.
Go to the views list (Administer->Site Building->Views) and click the 'clone' link next to 'taxonomy_term'. This will make a new view, which is initially the same as 'taxonomy_term'. You will be prompted to specify some information about the new view. I recommend changing the name to 'taxonomy_term_newest' and changing the view tag to 'newest'. You may want to change the description as well. Click the 'next' button to create the view and begin editing it. At this point, the view will work as we'd like, but we need to add a tab so that users may set the sort order to 'newest'. Click on the 'Page' tab, then under 'Page settings', change the path to taxonomy/term/%/newest. The menu will currently be set to 'No menu', so click that to modify it. Select 'Menu tab' for the type, enter 'Newest' for the title, and give it a description if you like (i.e. Sort the items from newest to oldest). The weight isn't too critical, unless you want to have the sort tabs in a specific order. The lower the weight, the further to the left the tab will be. For example, I will use the order of Newest | Oldest | Alphabetical (ascending) | Alphabetical (descending), and assign weights of 0, 1, 2, and 3, respectively. Feel free to use whatever weights you'd like. Finally, click 'Update' then 'Save' to save the view.
Sort by Oldest
Sorting from the oldest to the newest will require another view, similar to the one we just created, but with a different sort order. We could clone either the base view (taxonomy_terms) or the one we just created (taxonomy_terms_newest). Let's clone the one we just made.
If we are still on the screen to edit the 'taxonomy_terms_newest' view, click the 'List' link at the top. Otherwise, go to Administer->Site Building->Views to get the list of views. Locate 'taxonomy_terms_newest' and click the 'Clone' link. Change the name to 'taxonomy_terms_oldest', and change the tag to oldest. Click 'Next' to begin editing the new view.
On the 'Default' tab, change the sort criteria of 'Node: Post Date' from descending to ascending (remember to 'Update' then 'Save'.) Then click the 'Page' tab. Change the path to 'taxonomy/term/%/oldest' and change the menu so the tab title is 'Oldest' and give it an appropriate description and weight. Remember that we are modifying a clone of 'taxonomy_terms_newest'. If we cloned the base view (taxonomy_terms), the menu would need to be created by setting the type to 'Menu tab', as described above. Update and save the view.
Sort by Title
It is also a good idea to be able to sort the items by their title, both ascending and descending. Create a clone of 'taxonomy_terms_oldest', changing the name to 'taxonomy_terms_alpha_ascending' and the tag to 'alphabetical ascending'. Click 'Next' and remove the 'Post date' from the sort criteria (you can do this by clicking it to edit, then click the 'Remove' button.) Click the '+' by the sort criteria, and add 'Node: Title', leaving the order in ascending. Update and save the view.
Click the 'Page' tab, and as described above, change the path to 'taxonomy/term/%/alpha-ascend', and set the menu tab title to 'Alphabetical (ascending)' (updating the description and weight if desired.) Update and save.
Finally, clone 'taxonomy_terms_alpha_ascending' to 'taxonomy_terms_alpha_descending'. Change the sort order of 'Node: Title' to descending, change the path to 'taxonomy/term/%/alpha-descend', and change the menu tab title to 'Alphabetical (descending)'. Change the description and weight of the menu tab, if desired, then update and save the view.
Try it out
Go to your download manager. The terms are listed alphabetically (this is done by the Taxonomy_List module.) Find a term that has more than one entry, and click on that. This will show all downloads in that category, sorted from newest to oldest. You should now see tabs at the top to change the sort order (Newest, Oldest, Alphabetical (ascending), Alphabetical (descending)). Try clicking on the tabs and see if the sort order changes.
