This recipe has been tested in 1.5.1 and will probably work with later versions. It is safe to use since it doesn't change any existing functions.
This recipe explains how to add extra alphabet letters in "browse" pages (like "Browsing by Title" , "Browsing by Author")
The english alphabet list is created by a for loop in ConfigurableBrowse.java with this piece of code:
Code Block |
---|
// Create a clickable list of the alphabet List jumpList = jump.addList("jump-list", List.TYPE_SIMPLE, "alphabet"); Map<String, String> zeroQuery = new HashMap<String, String>(queryParams); zeroQuery.put(BrowseParams.STARTS_WITH, "0"); jumpList.addItemXref(super.generateURL(BROWSE_URL_BASE, zeroQuery), "0-9"); for (char c = 'A'; c <= 'Z'; c++) { Map<String, String> cQuery = new HashMap<String, String>(queryParams); cQuery.put(BrowseParams.STARTS_WITH, Character.toString(c)); jumpList.addItemXref(super.generateURL(BROWSE_URL_BASE, cQuery), Character .toString(c)); } |
In order to add an extra alphabet list (in this case, Greek alphabet) you need to create another list with the letters you want to browse.
You need one for loop and one List jumpList per alphabet, in this example I had to use two for Greek because of an extra letter (now defunct) in the middle of the Greek alphabet.
Code Block |
---|
List jumpList2 = jump.addList("jump-list2", List.TYPE_SIMPLE, "alphabet"); for (char vv = 'Α'; vv <= 'Ρ'; vv++) { Map<String, String> vvQuery = new HashMap<String, String>(queryParams); vvQuery.put(BrowseParams.STARTS_WITH, Character.toString(vv)); jumpList2.addItemXref(super.generateURL(BROWSE_URL_BASE, vvQuery), Character.toString(vv)); } for (char qq = 'Σ'; qq <= 'Ω'; qq++) { Map<String, String> qqQuery = new HashMap<String, String>(queryParams); qqQuery.put(BrowseParams.STARTS_WITH, Character.toString(qq)); jumpList2.addItemXref(super.generateURL(BROWSE_URL_BASE, qqQuery), Character.toString(qq)); } |
To add specific letters in an existing list (like the "0-9"), you need to add
Code Block |
---|
jumpList.addItemXref(... |
after or before the for loop that creates the list.
After rebuilding, the new list may not display properly (depending on the chosen theme).
A css selector must be used to place and style the extra list.