From 8076b80249cfd1a630557644f39d44da7ca3410c Mon Sep 17 00:00:00 2001 From: Greg McClellan? Date: Thu, 3 Oct 2002 22:36:46 +0000 Subject: [PATCH] Finally fixed problem of author names showing up lower-case. git-svn-id: http://scm.dspace.org/svn/repo/trunk@437 9c30dcfa-912a-0410-8fc2-9e0234be79fd --- dspace/src/org/dspace/browse/Browse.java | 41 +++++++++++++++--------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/dspace/src/org/dspace/browse/Browse.java b/dspace/src/org/dspace/browse/Browse.java index a289995c3f..63fca46310 100644 --- a/dspace/src/org/dspace/browse/Browse.java +++ b/dspace/src/org/dspace/browse/Browse.java @@ -782,7 +782,7 @@ public class Browse { TableRow row = (TableRow) iterator.next(); Object theValue = (isAuthorsBrowse) ? - (Object) row.getStringColumn("sort_author") : + (Object) row.getStringColumn("author") : (Object) new Integer(row.getIntColumn("item_id")); // Should not happen @@ -852,14 +852,26 @@ public class Browse { String tablename = BrowseTables.getTable(scope); String column = BrowseTables.getValueColumn(scope); - - StringBuffer sqlb = new StringBuffer() - .append("select ") - .append(isCount ? "count(" : "") - .append(getTargetColumns(scope)) - .append(isCount ? ")" : "") - .append(" from ") - .append(tablename); + + int browseType = scope.getBrowseType(); + + StringBuffer sqlb = new StringBuffer(); + sqlb.append("select "); + sqlb.append(isCount ? "count(" : ""); + sqlb.append(getTargetColumns(scope)); + sqlb.append(isCount ? ")" : ""); + + /** + * This next bit adds another column to the query, so + * authors don't show up lower-case + **/ + if (browseType == AUTHORS_BROWSE && !isCount) + { + sqlb.append(",author"); + } + + sqlb.append(" from "); + sqlb.append(tablename); // If the browse uses items (or item ids) instead of String values // make a subquery. @@ -906,12 +918,11 @@ public class Browse return sqlb.toString(); // Add an order by clause -- a parameter - sqlb.append(" order by ").append(column).append("{2}") - // If an item, make sure it's ordered by item_id as well - .append((scope.focusIsString() || - (scope.getBrowseType() == AUTHORS_BROWSE)) - ? "" : ", item_id"); - + sqlb.append(" order by ").append(column).append("{2}") + // If an item, make sure it's ordered by item_id as well + .append((scope.focusIsString() || + (scope.getBrowseType() == AUTHORS_BROWSE)) + ? "" : ", item_id"); // A limit on the total returned (Postgres extension) if (! scope.hasNoLimit()) sqlb.append(" LIMIT {3} ");