From 722892e91246566fa2bb1e36a2504259b8ec89f9 Mon Sep 17 00:00:00 2001 From: jensp Date: Tue, 8 Oct 2013 14:09:26 +0000 Subject: [PATCH] Weiteres Feintuning des CategoryFilter git-svn-id: https://svn.libreccm.org/ccm/trunk@2341 8810af33-2d31-482b-a856-94f89814c4df --- .../navigation/ui/object/CategoryFilter.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ccm-navigation/src/com/arsdigita/navigation/ui/object/CategoryFilter.java b/ccm-navigation/src/com/arsdigita/navigation/ui/object/CategoryFilter.java index 081fec8fb..678a92d35 100644 --- a/ccm-navigation/src/com/arsdigita/navigation/ui/object/CategoryFilter.java +++ b/ccm-navigation/src/com/arsdigita/navigation/ui/object/CategoryFilter.java @@ -74,7 +74,7 @@ public class CategoryFilter { } else { //Otherwise, we assume that we get the ID of a single category final com.arsdigita.persistence.Filter filter = filterFactory.in( - "parent.id", "com.arsdigita.categorization.objectIDsInSubtree"); + "parent.id", "com.arsdigita.categorization.objectIDsInSubtree"); filter.set("categoryID", value); compoundFilter.addFilter(filter); } @@ -118,10 +118,12 @@ public class CategoryFilter { multipleElem.setText("false"); } - for (String value : values) { - if (!catNameToCatId.containsKey(value)) { - invalid.newChildElement("value").setText(value); - invalidFound = true; + if (!multiple) { + for (String value : values) { + if (!catNameToCatId.containsKey(value)) { + invalid.newChildElement("value").setText(value); + invalidFound = true; + } } } @@ -138,7 +140,7 @@ public class CategoryFilter { final StringBuffer searchString) { final Element elem = new Element("category"); elem.addAttribute("id", category.getID().toString()); - //if ((values != null) && !values.isEmpty() && values.contains(category.getID().toString())) { + if (multiple) { if ((values != null) && !values.isEmpty() && values.contains(category.getName())) { elem.addAttribute("selected", "selected"); if (searchString.length() > 0) { @@ -146,6 +148,11 @@ public class CategoryFilter { } searchString.append(category.getName()); } + } else { + if ((values != null) && !values.isEmpty() && values.contains(category.getID().toString())) { + elem.addAttribute("selected", "selected"); + } + } elem.setText(category.getName()); parent.addContent(elem); }