From 08ebde26fe38f997fdd23cd8cdfeaa8e68badb0b Mon Sep 17 00:00:00 2001 From: pb Date: Sun, 21 Dec 2008 11:38:09 +0000 Subject: [PATCH] incorporate several APLAWS patches for ccm-ldn-navigation: r1727: Fixed NPE when Content Item List portlet had no category selected. r1748: Added DataCollectionDefinition.setBlackListTypes() to filter for for content types which are blacklisted in the AtoZ module r1749: Bumped version number from 6.5.1 to 6.5.2 git-svn-id: https://svn.libreccm.org/ccm/trunk@64 8810af33-2d31-482b-a856-94f89814c4df --- ccm-ldn-navigation/application.xml | 2 +- .../london/navigation/ContentTypes.pdl | 13 +++++++ .../navigation/DataCollectionDefinition.java | 39 ++++++++++++++----- 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/ccm-ldn-navigation/application.xml b/ccm-ldn-navigation/application.xml index cdbdbde77..5beb7ad84 100755 --- a/ccm-ldn-navigation/application.xml +++ b/ccm-ldn-navigation/application.xml @@ -2,7 +2,7 @@ diff --git a/ccm-ldn-navigation/pdl/com/arsdigita/london/navigation/ContentTypes.pdl b/ccm-ldn-navigation/pdl/com/arsdigita/london/navigation/ContentTypes.pdl index 94bc9e6f8..416c2c567 100755 --- a/ccm-ldn-navigation/pdl/com/arsdigita/london/navigation/ContentTypes.pdl +++ b/ccm-ldn-navigation/pdl/com/arsdigita/london/navigation/ContentTypes.pdl @@ -16,3 +16,16 @@ query TypesInSection { typeID = type_id; } } + +query blackListTypes { + String objectType; + + do { + select ct.classname + from atoz_cat_ct_blacklist_map bm, + content_types ct + where ct.type_id = bm.type_id + } map { + objectType = classname; + } +} diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java index 80db78d6b..eff8e2c4a 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java @@ -58,6 +58,7 @@ public class DataCollectionDefinition extends LockableImpl { private boolean m_descendCategories = false; private boolean m_excludeIndexObjects = true; private boolean m_checkPermissions = false; + private boolean m_blackListTypes = false; private ArrayList m_ordering = new ArrayList(); private ArrayList m_excludedTypes = new ArrayList(); @@ -149,6 +150,15 @@ public class DataCollectionDefinition extends LockableImpl { m_checkPermissions = checkPermissions; } + /** + * Activates a filter for content types which are blacklisted + * in the AtoZ module. + */ + public void setBlackListTypes(boolean blackListTypes) { + Assert.unlocked(this); + m_blackListTypes = blackListTypes; + } + public final void addOrder(String order) { Assert.unlocked(this); m_ordering.add(order); @@ -174,15 +184,19 @@ public class DataCollectionDefinition extends LockableImpl { property.addProperty( objects ); } - // for date ordered categories, if pagination occurs, we need to ensure - // that primary ordering is the date attribute included in the renderer - // if there is one - s_log.debug("Category is " + model.getCategory().getID() + ": " + model.getCategory().getName()); - s_log.debug("getting data collection. Is category date ordered? " - + Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) - + " date attribute has been set to " + m_dateAttribute); - if (Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) && m_dateAttribute != null) { - objects.addOrder(m_dateAttribute + " desc"); + if (model.getCategory() != null) { + // for date ordered categories, if pagination occurs, we need to ensure + // that primary ordering is the date attribute included in the renderer + // if there is one + if (s_log.isDebugEnabled()) { + s_log.debug("Category is " + model.getCategory().getID() + ": " + model.getCategory().getName()); + s_log.debug("getting data collection. Is category date ordered? " + + Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) + + " date attribute has been set to " + m_dateAttribute); + } + if (Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) && m_dateAttribute != null) { + objects.addOrder(m_dateAttribute + " desc"); + } } if (m_ordering.size() > 0) { @@ -214,6 +228,11 @@ public class DataCollectionDefinition extends LockableImpl { objects.addFilter(ACSObject.OBJECT_TYPE + " != '" + excludedType + "'" ); } + + if (m_blackListTypes) { + objects.addNotInSubqueryFilter(ACSObject.OBJECT_TYPE, + "com.arsdigita.london.navigation.blackListTypes"); + } Category cat = getCategory(model); if (m_filterCategory && cat != null) { @@ -247,7 +266,7 @@ public class DataCollectionDefinition extends LockableImpl { // allow subclasses to override the permission check checkPermissions(objects); } - } + } protected void checkPermissions(DataCollection objects) { Party party = Kernel.getContext().getParty();