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
master
pb 2008-12-21 11:38:09 +00:00
parent 76c1523cf7
commit 08ebde26fe
3 changed files with 43 additions and 11 deletions

View File

@ -2,7 +2,7 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-ldn-navigation" name="ccm-ldn-navigation"
prettyName="Navigation" prettyName="Navigation"
version="6.5.1" version="6.5.2"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>

View File

@ -16,3 +16,16 @@ query TypesInSection {
typeID = type_id; 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;
}
}

View File

@ -58,6 +58,7 @@ public class DataCollectionDefinition extends LockableImpl {
private boolean m_descendCategories = false; private boolean m_descendCategories = false;
private boolean m_excludeIndexObjects = true; private boolean m_excludeIndexObjects = true;
private boolean m_checkPermissions = false; private boolean m_checkPermissions = false;
private boolean m_blackListTypes = false;
private ArrayList m_ordering = new ArrayList(); private ArrayList m_ordering = new ArrayList();
private ArrayList m_excludedTypes = new ArrayList(); private ArrayList m_excludedTypes = new ArrayList();
@ -149,6 +150,15 @@ public class DataCollectionDefinition extends LockableImpl {
m_checkPermissions = checkPermissions; 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) { public final void addOrder(String order) {
Assert.unlocked(this); Assert.unlocked(this);
m_ordering.add(order); m_ordering.add(order);
@ -174,15 +184,19 @@ public class DataCollectionDefinition extends LockableImpl {
property.addProperty( objects ); property.addProperty( objects );
} }
// for date ordered categories, if pagination occurs, we need to ensure if (model.getCategory() != null) {
// that primary ordering is the date attribute included in the renderer // for date ordered categories, if pagination occurs, we need to ensure
// if there is one // that primary ordering is the date attribute included in the renderer
s_log.debug("Category is " + model.getCategory().getID() + ": " + model.getCategory().getName()); // if there is one
s_log.debug("getting data collection. Is category date ordered? " if (s_log.isDebugEnabled()) {
+ Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) s_log.debug("Category is " + model.getCategory().getID() + ": " + model.getCategory().getName());
+ " date attribute has been set to " + m_dateAttribute); s_log.debug("getting data collection. Is category date ordered? "
if (Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) && m_dateAttribute != null) { + Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState())
objects.addOrder(m_dateAttribute + " desc"); + " 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) { if (m_ordering.size() > 0) {
@ -214,6 +228,11 @@ public class DataCollectionDefinition extends LockableImpl {
objects.addFilter(ACSObject.OBJECT_TYPE + " != '" + objects.addFilter(ACSObject.OBJECT_TYPE + " != '" +
excludedType + "'" ); excludedType + "'" );
} }
if (m_blackListTypes) {
objects.addNotInSubqueryFilter(ACSObject.OBJECT_TYPE,
"com.arsdigita.london.navigation.blackListTypes");
}
Category cat = getCategory(model); Category cat = getCategory(model);
if (m_filterCategory && cat != null) { if (m_filterCategory && cat != null) {
@ -247,7 +266,7 @@ public class DataCollectionDefinition extends LockableImpl {
// allow subclasses to override the permission check // allow subclasses to override the permission check
checkPermissions(objects); checkPermissions(objects);
} }
} }
protected void checkPermissions(DataCollection objects) { protected void checkPermissions(DataCollection objects) {
Party party = Kernel.getContext().getParty(); Party party = Kernel.getContext().getParty();