// Add all the query parameters as hidden fields on the form
for (String key : queryParams.keySet())
controls.addHidden(key).setValue(queryParams.get(key));
Para controlsForm = controls.addPara();
// If we are browsing a list of items
if (isItemBrowse(info)) // && info.isSecondLevel()
{
try
{
// Create a drop down of the different sort columns available
Set<SortOption> sortOptions = SortOption.getSortOptions();
// Only generate the list if we have multiple columns
if (sortOptions.size() > 1)
{
controlsForm.addContent(T_sort_by);
Select sortSelect = controlsForm.addSelect(BrowseParams.SORT_BY);
for (SortOption so : sortOptions)
{
sortSelect.addOption(so.equals(info.getSortOption()), so.getNumber(),
message("xmlui.ArtifactBrowser.ConfigurableBrowse.sort_by." + so.getName()));
}
}
}
catch (SortException se)
{
throw new WingException("Unable to get sort options", se);
}
}
// Create a control to changing ascending / descending order
controlsForm.addContent(T_order);
Select orderSelect = controlsForm.addSelect(BrowseParams.ORDER);
orderSelect.addOption("ASC".equals(params.scope.getOrder()), "ASC", T_order_asc);
orderSelect.addOption("DESC".equals(params.scope.getOrder()), "DESC", T_order_desc);
// Create a control for the number of records to display
controlsForm.addContent(T_rpp);
Select rppSelect = controlsForm.addSelect(BrowseParams.RESULTS_PER_PAGE);
for (int i = 5; i <= 100; i += 5)
{
rppSelect.addOption((i == info.getResultsPerPage()), i, Integer.toString(i));
}
// Create a control for the number of authors per item to display
// FIXME This is currently disabled, as the supporting functionality
// is not currently present in xmlui
//if (isItemBrowse(info))
//{
// controlsForm.addContent(T_etal);
// Select etalSelect = controlsForm.addSelect(BrowseParams.ETAL);
//
// etalSelect.addOption((info.getEtAl() < 0), 0, T_etal_all);
// etalSelect.addOption(1 == info.getEtAl(), 1, Integer.toString(1));
//
// for (int i = 5; i <= 50; i += 5)
// {
// etalSelect.addOption(i == info.getEtAl(), i, Integer.toString(i));
// }
//}
controlsForm.addButton("update").setValue(T_update);
}