}
// If this is a date based browse, render the date navigation
if (isSortedByDate(info))
{
Para jumpForm = jump.addPara();
// Create a select list to choose a month
jumpForm.addContent(T_jump_select);
Select month = jumpForm.addSelect(BrowseParams.MONTH);
month.addOption(false, "-1", T_choose_month);
for (int i = 1; i <= 12; i++)
{
month.addOption(false, String.valueOf(i), DCDate.getMonthName(i, Locale
.getDefault()));
}
// Create a select list to choose a year
Select year = jumpForm.addSelect(BrowseParams.YEAR);
year.addOption(false, "-1", T_choose_year);
int currentYear = DCDate.getCurrent().getYear();
int i = currentYear;
// Calculate where to move from 1, 5 to 10 year jumps
int oneYearBreak = ((currentYear - ONE_YEAR_LIMIT) / 5) * 5;
int fiveYearBreak = ((currentYear - FIVE_YEAR_LIMIT) / 10) * 10;
int tenYearBreak = (currentYear - TEN_YEAR_LIMIT);
do
{
year.addOption(false, String.valueOf(i), String.valueOf(i));
if (i <= fiveYearBreak)
{
i -= 10;
}
else if (i <= oneYearBreak)
{
i -= 5;
}
else
{
i--;
}
}
while (i > tenYearBreak);
// Create a free text entry box for the year
jumpForm = jump.addPara();
jumpForm.addContent(T_jump_year);
jumpForm.addText(BrowseParams.STARTS_WITH).setHelp(T_jump_year_help);
jumpForm.addButton("submit").setValue(T_go);
}
else
{
// Create a clickable list of the alphabet
List jumpList = jump.addList("jump-list", List.TYPE_SIMPLE, "alphabet");
// browse params for each letter are all the query params
// WITHOUT the second-stage browse value, and add STARTS_WITH.
Map<String, String> letterQuery = new HashMap<String, String>(queryParamsGET);
for (String valueKey : BrowseParams.FILTER_VALUE)
{
letterQuery.remove(valueKey);
}
letterQuery.put(BrowseParams.STARTS_WITH, "0");
jumpList.addItemXref(super.generateURL(BROWSE_URL_BASE, letterQuery), "0-9");
for (char c = 'A'; c <= 'Z'; c++)
{
letterQuery.put(BrowseParams.STARTS_WITH, Character.toString(c));
jumpList.addItemXref(super.generateURL(BROWSE_URL_BASE, letterQuery), Character
.toString(c));
}
// Create a free text field for the initial characters
Para jumpForm = jump.addPara();
jumpForm.addContent(T_starts_with);
jumpForm.addText(BrowseParams.STARTS_WITH).setHelp(T_starts_with_help);
jumpForm.addButton("submit").setValue(T_go);
}
}