- Sortierbare Publikationsliste (derzeit nach Titel und Erscheinungsjahr)

- Formatierungen


git-svn-id: https://svn.libreccm.org/ccm/trunk@773 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-03-02 14:10:22 +00:00
parent b28a6cf8b5
commit 1ef984825e
4 changed files with 209 additions and 138 deletions

View File

@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.london.navigation; package com.arsdigita.london.navigation;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
@ -50,20 +49,19 @@ import org.apache.log4j.Logger;
* later use for a DataCollection of ACSObjects. * later use for a DataCollection of ACSObjects.
*/ */
public class DataCollectionDefinition extends LockableImpl { public class DataCollectionDefinition extends LockableImpl {
private static Logger s_log = Logger.getLogger(
DataCollectionDefinition.class);
private String m_objectType = ACSObject.BASE_DATA_OBJECT_TYPE; private String m_objectType = ACSObject.BASE_DATA_OBJECT_TYPE;
private String m_specificObjectType = null; private String m_specificObjectType = null;
private boolean m_filterCategory = true; private boolean m_filterCategory = true;
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 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();
private ArrayList m_properties = new ArrayList(); private ArrayList m_properties = new ArrayList();
private String m_dateAttribute = null; private String m_dateAttribute = null;
public final void setObjectType(String objectType) { public final void setObjectType(String objectType) {
@ -75,40 +73,43 @@ public class DataCollectionDefinition extends LockableImpl {
public final void setSpecificObjectType(String specificObjectType) { public final void setSpecificObjectType(String specificObjectType) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
if (specificObjectType != null) { if (specificObjectType != null) {
validateObjectType(specificObjectType); validateObjectType(specificObjectType);
} }
m_specificObjectType = specificObjectType; m_specificObjectType = specificObjectType;
} }
public final void excludeSpecificObjectType( String specificObjectType ) { public final void excludeSpecificObjectType(String specificObjectType) {
Assert.isUnlocked( this ); Assert.isUnlocked(this);
m_excludedTypes.add( specificObjectType ); m_excludedTypes.add(specificObjectType);
} }
private static Logger s_log = Logger.getLogger(DataCollectionDefinition.class); public void setDateAttribute(DataCollectionRenderer renderer) {
ObjectType type = SessionManager.getMetadataRoot().getObjectType(
public void setDateAttribute (DataCollectionRenderer renderer) { m_objectType);
ObjectType type = SessionManager.getMetadataRoot().getObjectType(m_objectType); s_log.debug("set date attribute for collection of " + type.
s_log.debug("set date attribute for collection of " + type.getQualifiedName()); getQualifiedName());
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
Iterator properties = type.getProperties(); Iterator properties = type.getProperties();
while (properties.hasNext()) { while (properties.hasNext()) {
Property prop = (Property)properties.next(); Property prop = (Property) properties.next();
s_log.debug("object has property " + prop.getName() + " of class " + prop.getJavaClass().getName()); s_log.debug("object has property " + prop.getName()
+ " of class " + prop.getJavaClass().getName());
} }
} }
Iterator it = (renderer.getAttributes().iterator()); Iterator it = (renderer.getAttributes().iterator());
while (it.hasNext()) { while (it.hasNext()) {
String attribute = (String)it.next(); String attribute = (String) it.next();
s_log.debug("renderer is rendering attribute: " + attribute); s_log.debug("renderer is rendering attribute: " + attribute);
Property property = type.getProperty(attribute); Property property = type.getProperty(attribute);
s_log.debug("property of object: " + property); s_log.debug("property of object: " + property);
if (property != null) { if (property != null) {
s_log.debug("Property class is " + property.getJavaClass().getName()); s_log.debug("Property class is " + property.getJavaClass().
getName());
} }
if (property != null && property.getJavaClass().getName().equals(Date.class.getName())) { if (property != null && property.getJavaClass().getName().equals(Date.class.
getName())) {
m_dateAttribute = attribute; m_dateAttribute = attribute;
// if more than one date attribute is specified for the type included in this // if more than one date attribute is specified for the type included in this
// definition, then we cannot determine in the code which is to be used as the // definition, then we cannot determine in the code which is to be used as the
@ -121,30 +122,31 @@ public class DataCollectionDefinition extends LockableImpl {
} }
private final void validateObjectType(String objectType) { private final void validateObjectType(String objectType) {
ObjectType type = SessionManager.getMetadataRoot().getObjectType(objectType); ObjectType type = SessionManager.getMetadataRoot().getObjectType(
objectType);
Assert.exists(type, ObjectType.class); Assert.exists(type, ObjectType.class);
validateObjectType(type); validateObjectType(type);
} }
protected void validateObjectType(ObjectType type) { protected void validateObjectType(ObjectType type) {
// Nada // Nada
} }
public final void setFilterCategory(boolean filterCategory) { public final void setFilterCategory(boolean filterCategory) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
m_filterCategory = filterCategory; m_filterCategory = filterCategory;
} }
public final void setDescendCategories(boolean descendCategories) { public final void setDescendCategories(boolean descendCategories) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
m_descendCategories = descendCategories; m_descendCategories = descendCategories;
} }
public final void setExcludeIndexObjects(boolean excludeIndexObjects) { public final void setExcludeIndexObjects(boolean excludeIndexObjects) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
m_excludeIndexObjects = excludeIndexObjects; m_excludeIndexObjects = excludeIndexObjects;
} }
public final void setCheckPermissions(boolean checkPermissions) { public final void setCheckPermissions(boolean checkPermissions) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
m_checkPermissions = checkPermissions; m_checkPermissions = checkPermissions;
@ -155,33 +157,40 @@ public class DataCollectionDefinition extends LockableImpl {
* in the AtoZ module. * in the AtoZ module.
*/ */
public void setBlackListTypes(boolean blackListTypes) { public void setBlackListTypes(boolean blackListTypes) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
m_blackListTypes = blackListTypes; m_blackListTypes = blackListTypes;
} }
public final void addOrder(String order) { public final void addOrder(String order) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
if(s_log.isDebugEnabled()) {
s_log.debug(String.format("Adding order '%s' to current list of "
+ "order attributes: ", order));
for(Object orderAttr : m_ordering) {
s_log.debug(String.format("\t%s", orderAttr));
}
}
m_ordering.add(order); m_ordering.add(order);
} }
public final void addProperty( DataCollectionProperty property ) { public final void addProperty(DataCollectionProperty property) {
Assert.isUnlocked( this ); Assert.isUnlocked(this);
m_properties.add( property ); m_properties.add(property);
} }
public final DataCollection getDataCollection(NavigationModel model) { public final DataCollection getDataCollection(NavigationModel model) {
Assert.isLocked(this); Assert.isLocked(this);
DataCollection objects = SessionManager.getSession() DataCollection objects = SessionManager.getSession().retrieve(
.retrieve(m_objectType); m_objectType);
applyFilters(objects, model); applyFilters(objects, model);
Iterator properties = m_properties.iterator(); Iterator properties = m_properties.iterator();
while( properties.hasNext() ) { while (properties.hasNext()) {
DataCollectionProperty property = (DataCollectionProperty) DataCollectionProperty property = (DataCollectionProperty) properties.
properties.next(); next();
property.addProperty( objects ); property.addProperty(objects);
} }
if (model.getCategory() != null) { if (model.getCategory() != null) {
@ -189,12 +198,16 @@ public class DataCollectionDefinition extends LockableImpl {
// that primary ordering is the date attribute included in the renderer // that primary ordering is the date attribute included in the renderer
// if there is one // if there is one
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Category is " + model.getCategory().getID() + ": " + model.getCategory().getName()); s_log.debug("Category is " + model.getCategory().getID() + ": " + model.
s_log.debug("getting data collection. Is category date ordered? " getCategory().getName());
+ Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) s_log.debug("getting data collection. Is category date ordered? "
+ " date attribute has been set to " + m_dateAttribute); + 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) { if (Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.
getPageState()) && m_dateAttribute != null) {
objects.addOrder(m_dateAttribute + " desc"); objects.addOrder(m_dateAttribute + " desc");
} }
} }
@ -202,7 +215,7 @@ public class DataCollectionDefinition extends LockableImpl {
if (m_ordering.size() > 0) { if (m_ordering.size() > 0) {
Iterator orders = m_ordering.iterator(); Iterator orders = m_ordering.iterator();
while (orders.hasNext()) { while (orders.hasNext()) {
objects.addOrder((String)orders.next()); objects.addOrder((String) orders.next());
} }
} else { } else {
objects.addOrder("id desc"); objects.addOrder("id desc");
@ -210,13 +223,13 @@ public class DataCollectionDefinition extends LockableImpl {
return objects; return objects;
} }
/** Can be overridden to extract differently the category to inspect. */ /** Can be overridden to extract differently the category to inspect. */
protected Category getCategory(NavigationModel model) { protected Category getCategory(NavigationModel model) {
return model.getCategory(); return model.getCategory();
} }
protected void applyFilters(DataCollection objects, protected void applyFilters(DataCollection objects,
NavigationModel model) { NavigationModel model) {
if (m_specificObjectType != null) { if (m_specificObjectType != null) {
objects.addEqualsFilter(ACSObject.OBJECT_TYPE, m_specificObjectType); objects.addEqualsFilter(ACSObject.OBJECT_TYPE, m_specificObjectType);
@ -225,48 +238,48 @@ public class DataCollectionDefinition extends LockableImpl {
Iterator excludedTypes = m_excludedTypes.iterator(); Iterator excludedTypes = m_excludedTypes.iterator();
while (excludedTypes.hasNext()) { while (excludedTypes.hasNext()) {
String excludedType = excludedTypes.next().toString(); String excludedType = excludedTypes.next().toString();
objects.addFilter(ACSObject.OBJECT_TYPE + " != '" + objects.addFilter(ACSObject.OBJECT_TYPE + " != '" + excludedType
excludedType + "'" ); + "'");
} }
if (m_blackListTypes) { if (m_blackListTypes) {
objects.addNotInSubqueryFilter(ACSObject.OBJECT_TYPE, objects.addNotInSubqueryFilter(ACSObject.OBJECT_TYPE,
"com.arsdigita.london.navigation.blackListTypes"); "com.arsdigita.london.navigation.blackListTypes");
} }
Category cat = getCategory(model); Category cat = getCategory(model);
if (m_filterCategory && cat != null) { if (m_filterCategory && cat != null) {
if (m_descendCategories) { if (m_descendCategories) {
Filter children = objects.addInSubqueryFilter( Filter children = objects.addInSubqueryFilter(
getCategorizedObjectPath("id"),
"com.arsdigita.categorization.objectIDsInSubtree");
children.set( "categoryID", cat.getID() );
if (m_excludeIndexObjects) {
Filter moreChildren = objects.addNotInSubqueryFilter(
getCategorizedObjectPath("id"), getCategorizedObjectPath("id"),
"com.arsdigita.categorization.liveIndexItemsInSubtree" "com.arsdigita.categorization.objectIDsInSubtree");
); children.set("categoryID", cat.getID());
moreChildren.set( "categoryID", cat.getID() ); if (m_excludeIndexObjects) {
Filter moreChildren =
objects.addNotInSubqueryFilter(
getCategorizedObjectPath("id"),
"com.arsdigita.categorization.liveIndexItemsInSubtree");
moreChildren.set("categoryID", cat.getID());
} }
} else { } else {
objects.addEqualsFilter( objects.addEqualsFilter(
getCategorizedObjectPath("categories.id"), getCategorizedObjectPath("categories.id"),
cat.getID()); cat.getID());
if (m_excludeIndexObjects) { if (m_excludeIndexObjects) {
Filter moreChildren = objects.addNotInSubqueryFilter( Filter moreChildren =
getCategorizedObjectPath("id"), objects.addNotInSubqueryFilter(
"com.arsdigita.categorization.liveIndexItemsInCategory" getCategorizedObjectPath("id"),
); "com.arsdigita.categorization.liveIndexItemsInCategory");
moreChildren.set( "categoryID", cat.getID() ); moreChildren.set("categoryID", cat.getID());
} }
} }
} }
if (m_checkPermissions) { if (m_checkPermissions) {
// 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();
@ -275,11 +288,11 @@ public class DataCollectionDefinition extends LockableImpl {
} }
PermissionService.filterObjects( PermissionService.filterObjects(
objects, objects,
PrivilegeDescriptor.READ, PrivilegeDescriptor.READ,
party.getOID()); party.getOID());
} }
protected String getCategorizedObjectPath(String fragment) { protected String getCategorizedObjectPath(String fragment) {
return fragment; return fragment;
} }

View File

@ -50,7 +50,7 @@ import org.apache.log4j.Logger;
public class DataCollectionRenderer extends LockableImpl { public class DataCollectionRenderer extends LockableImpl {
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(DataCollectionRenderer.class); Logger.getLogger(DataCollectionRenderer.class);
private ArrayList m_attributes = new ArrayList(); private ArrayList m_attributes = new ArrayList();
private ArrayList m_properties = new ArrayList(); private ArrayList m_properties = new ArrayList();
private int m_pageSize = 20; private int m_pageSize = 20;
@ -61,7 +61,7 @@ public class DataCollectionRenderer extends LockableImpl {
* {@link SimpleXMLGenerator.ADAPTER_CONTEXT}. * {@link SimpleXMLGenerator.ADAPTER_CONTEXT}.
*/ */
private String m_specializeObjectsContext = private String m_specializeObjectsContext =
SimpleXMLGenerator.ADAPTER_CONTEXT; SimpleXMLGenerator.ADAPTER_CONTEXT;
private boolean m_wrapAttributes = false; private boolean m_wrapAttributes = false;
private boolean m_navItems = true; private boolean m_navItems = true;
@ -123,10 +123,12 @@ public class DataCollectionRenderer extends LockableImpl {
} }
/** /**
* @pageNumber current page, starting from 1 * @param objects
* @param pageNumber current page, starting from 1
* @return
*/ */
public Element generateXML(DataCollection objects, public Element generateXML(DataCollection objects,
int pageNumber) { int pageNumber) {
Assert.isLocked(this); Assert.isLocked(this);
// Quasimodo: Begin // Quasimodo: Begin
@ -148,7 +150,8 @@ public class DataCollectionRenderer extends LockableImpl {
} }
long objectCount = objects.size(); long objectCount = objects.size();
int pageCount = (int) Math.ceil((double) objectCount / (double) m_pageSize); int pageCount = (int) Math.ceil((double) objectCount
/ (double) m_pageSize);
if (pageNumber < 1) { if (pageNumber < 1) {
pageNumber = 1; pageNumber = 1;
@ -163,7 +166,8 @@ public class DataCollectionRenderer extends LockableImpl {
long end = begin + count; long end = begin + count;
if (count != 0) { if (count != 0) {
objects.setRange(new Integer((int) begin + 1), new Integer((int) end + 1)); objects.setRange(new Integer((int) begin + 1),
new Integer((int) end + 1));
} }
Element paginator = Navigation.newElement("paginator"); Element paginator = Navigation.newElement("paginator");
@ -187,7 +191,8 @@ public class DataCollectionRenderer extends LockableImpl {
} }
paginator.addAttribute("pageParam", pageParam); paginator.addAttribute("pageParam", pageParam);
paginator.addAttribute("baseURL", URL.there(url.getPathInfo(), map).toString()); paginator.addAttribute("baseURL", URL.there(url.getPathInfo(), map).
toString());
// Quasimodo: End // Quasimodo: End
paginator.addAttribute("pageNumber", new Long(pageNumber).toString()); paginator.addAttribute("pageNumber", new Long(pageNumber).toString());
@ -218,7 +223,8 @@ public class DataCollectionRenderer extends LockableImpl {
Iterator properties = m_properties.iterator(); Iterator properties = m_properties.iterator();
while (properties.hasNext()) { while (properties.hasNext()) {
DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.next(); DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.
next();
property.render(objects, item); property.render(objects, item);
} }
@ -237,13 +243,13 @@ public class DataCollectionRenderer extends LockableImpl {
protected String getStableURL(DataObject dobj, ACSObject obj) { protected String getStableURL(DataObject dobj, ACSObject obj) {
OID oid = new OID((String) dobj.get(ACSObject.OBJECT_TYPE), OID oid = new OID((String) dobj.get(ACSObject.OBJECT_TYPE),
dobj.get(ACSObject.ID)); dobj.get(ACSObject.ID));
return Navigation.redirectURL(oid); return Navigation.redirectURL(oid);
} }
private void outputValue(final Element item, final Object value, private void outputValue(final Element item, final Object value,
final String name, final String name,
final String[] paths, final int depth) { final String[] paths, final int depth) {
if (null == value) { if (null == value) {
return; return;
} }
@ -274,18 +280,27 @@ public class DataCollectionRenderer extends LockableImpl {
Date date = (Date) value; Date date = (Date) value;
Calendar calDate = Calendar.getInstance(); Calendar calDate = Calendar.getInstance();
calDate.setTime(date); calDate.setTime(date);
attribute.addAttribute("year", Integer.toString(calDate.get(Calendar.YEAR))); attribute.addAttribute("year", Integer.toString(calDate.get(
attribute.addAttribute("month", Integer.toString(calDate.get(Calendar.MONTH) + 1)); Calendar.YEAR)));
attribute.addAttribute("day", Integer.toString(calDate.get(Calendar.DAY_OF_MONTH))); attribute.addAttribute("month", Integer.toString(calDate.get(
attribute.addAttribute("hour", Integer.toString(calDate.get(Calendar.HOUR_OF_DAY))); Calendar.MONTH) + 1));
attribute.addAttribute("minute", Integer.toString(calDate.get(Calendar.MINUTE))); attribute.addAttribute("day", Integer.toString(calDate.get(
attribute.addAttribute("second", Integer.toString(calDate.get(Calendar.SECOND))); Calendar.DAY_OF_MONTH)));
attribute.addAttribute("hour", Integer.toString(calDate.get(
Calendar.HOUR_OF_DAY)));
attribute.addAttribute("minute", Integer.toString(calDate.get(
Calendar.MINUTE)));
attribute.addAttribute("second", Integer.toString(calDate.get(
Calendar.SECOND)));
// Quasimodo: BEGIN // Quasimodo: BEGIN
// Add attributes for date and time // Add attributes for date and time
Locale negLocale = com.arsdigita.dispatcher.DispatcherHelper.getNegotiatedLocale(); Locale negLocale = com.arsdigita.dispatcher.DispatcherHelper.
DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM, negLocale); getNegotiatedLocale();
DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, negLocale); DateFormat dateFormatter = DateFormat.getDateInstance(
DateFormat.MEDIUM, negLocale);
DateFormat timeFormatter = DateFormat.getTimeInstance(
DateFormat.SHORT, negLocale);
attribute.addAttribute("date", dateFormatter.format(date)); attribute.addAttribute("date", dateFormatter.format(date));
attribute.addAttribute("time", timeFormatter.format(date)); attribute.addAttribute("time", timeFormatter.format(date));
// Quasimodo: END // Quasimodo: END
@ -298,7 +313,7 @@ public class DataCollectionRenderer extends LockableImpl {
} }
private void valuePersistenceError(PersistenceException ex, private void valuePersistenceError(PersistenceException ex,
String[] paths, int depth) { String[] paths, int depth) {
StringBuffer msg = new StringBuffer(); StringBuffer msg = new StringBuffer();
msg.append("Attribute "); msg.append("Attribute ");
for (int i = 0; i <= depth; i++) { for (int i = 0; i <= depth; i++) {
@ -317,9 +332,8 @@ public class DataCollectionRenderer extends LockableImpl {
} }
protected void generateItemXML(Element item, protected void generateItemXML(Element item,
DataObject dobj, DataObject dobj,
ACSObject obj, ACSObject obj,
int index) { int index) {
} }
} }

View File

@ -40,7 +40,9 @@ public class ComplexObjectList extends AbstractObjectList {
public static final String CUSTOM_NAME = "customName"; public static final String CUSTOM_NAME = "customName";
protected String m_customName = null; protected String m_customName = null;
protected String m_filter = null; protected String m_filter = null;
protected HashMap m_filterParameters = new HashMap(); protected Map m_filterParameters = new HashMap();
private Map<String, String> m_customAttributes = new HashMap<String, String>();
public void setCustomName(String name) { public void setCustomName(String name) {
m_customName = name; m_customName = name;
@ -66,10 +68,19 @@ public class ComplexObjectList extends AbstractObjectList {
m_filterParameters.put(parameterName, value); m_filterParameters.put(parameterName, value);
} }
public String getCustomAttribute(final String attribute) {
return m_customAttributes.get(attribute);
}
public void addCustomAttribute(final String attribute, final String value) {
m_customAttributes.put(attribute, value);
}
/* Diese Methode überschreibt die Methode aus der Eltern-Klasse, um /* Diese Methode überschreibt die Methode aus der Eltern-Klasse, um
* die SQL-Filter berücksichtigen zu können * die SQL-Filter berücksichtigen zu können
*/ */
@Override
protected DataCollection getObjects( HttpServletRequest request, HttpServletResponse response ) { protected DataCollection getObjects( HttpServletRequest request, HttpServletResponse response ) {
DataCollection objects = super.getObjects( request, response ); DataCollection objects = super.getObjects( request, response );
@ -104,6 +115,10 @@ public class ComplexObjectList extends AbstractObjectList {
if (m_customName != null) { if (m_customName != null) {
content.addAttribute(CUSTOM_NAME, m_customName); content.addAttribute(CUSTOM_NAME, m_customName);
} }
for(Map.Entry<String, String> attribute : m_customAttributes.entrySet()) {
content.addAttribute(attribute.getKey(), attribute.getValue());
}
content.addContent(generateObjectListXML(request, response)); content.addContent(generateObjectListXML(request, response));

View File

@ -1,52 +1,81 @@
<jsp:root <jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:define="/WEB-INF/bebop-define.tld" xmlns:define="/WEB-INF/bebop-define.tld"
xmlns:show="/WEB-INF/bebop-show.tld" xmlns:show="/WEB-INF/bebop-show.tld"
version="1.2"> version="1.2">
<jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/> <jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/>
<jsp:directive.page import="com.arsdigita.bebop.parameters.BigDecimalParameter"/> <jsp:directive.page import="com.arsdigita.bebop.parameters.BigDecimalParameter"/>
<jsp:directive.page import="com.arsdigita.london.navigation.Navigation"/> <jsp:directive.page import="com.arsdigita.london.navigation.Navigation"/>
<jsp:directive.page import="com.arsdigita.london.navigation.cms.CMSDataCollectionDefinition"/> <jsp:directive.page import="com.arsdigita.london.navigation.cms.CMSDataCollectionDefinition"/>
<jsp:directive.page import="com.arsdigita.london.navigation.cms.CMSDataCollectionRenderer"/> <jsp:directive.page import="com.arsdigita.london.navigation.cms.CMSDataCollectionRenderer"/>
<jsp:directive.page import="org.apache.log4j.Logger"/>
<jsp:scriptlet> <jsp:scriptlet>
long age = Navigation.getConfig().getIndexPageCacheLifetime(); long age = Navigation.getConfig().getIndexPageCacheLifetime();
if (age == 0) { if (age == 0) {
DispatcherHelper.cacheDisable(response); DispatcherHelper.cacheDisable(response);
} else { } else {
DispatcherHelper.cacheForWorld(response, (int)age); DispatcherHelper.cacheForWorld(response, (int)age);
} }
</jsp:scriptlet>
<define:page name="defaultItemPage" application="navigation"
title="Navigation" cache="true">
<define:component name="greetingItem"
classname="com.arsdigita.london.navigation.ui.GreetingItem"/>
<define:component name="categoryPath"
classname="com.arsdigita.london.navigation.ui.category.Path"/>
<define:component name="categoryMenu"
classname="com.arsdigita.london.navigation.ui.category.Menu"/>
<define:component name="itemList"
classname="com.arsdigita.london.navigation.ui.object.SimpleObjectList"/>
<jsp:scriptlet>
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).setDefinition(new CMSDataCollectionDefinition());
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).setRenderer(new CMSDataCollectionRenderer());
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getDefinition().setObjectType("com.arsdigita.cms.ContentPage");
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getDefinition().setDescendCategories(false);
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getDefinition().addOrder("parent.categories.link.sortKey");
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().setPageSize(20);
((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().setSpecializeObjects(true);
</jsp:scriptlet> </jsp:scriptlet>
<define:component name="assignedTerms" <define:page name="defaultItemPage" application="navigation"
classname="com.arsdigita.london.navigation.ui.CategoryIndexAssignedTerms"/> title="Navigation" cache="false">
</define:page> <define:component name="greetingItem"
<show:all/> classname="com.arsdigita.london.navigation.ui.GreetingItem"/>
<define:component name="categoryPath"
classname="com.arsdigita.london.navigation.ui.category.Path"/>
<define:component name="categoryMenu"
classname="com.arsdigita.london.navigation.ui.category.Menu"/>
<define:component name="itemList"
classname="com.arsdigita.london.navigation.ui.object.ComplexObjectList"/>
<jsp:scriptlet>
org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("SciPublicationListJsp");
application.log("JSP::Configuring object list...");
logger.warn("JSP::Configuring object list...");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).setDefinition(new CMSDataCollectionDefinition());
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).setRenderer(new CMSDataCollectionRenderer());
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().setObjectType("com.arsdigita.cms.contenttypes.Publication");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).setCustomName("SciPublicationsList");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().setDescendCategories(false);
logger.warn(String.format("JSP::orderBy = %s", request.getParameter("orderBy")));
if((request.getParameter("orderBy") == null)) {
logger.warn("JSP::Setting list order to 'title'...");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().addOrder("title");
} else {
if("title".equals(request.getParameter("orderBy"))) {
logger.warn("JSP::Setting list order to 'title'...");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().addOrder("title");
} else if("authors".equals(request.getParameter("orderBy"))) {
logger.warn("JSP::Setting list order to 'authors'...");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().addOrder("authors asc");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().addOrder("authors.givenname asc");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().addOrder("authors.link.editor asc");
} else if("year".equals(request.getParameter("orderBy"))) {
logger.warn("JSP::Setting list order to 'yearOfPublication'...");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().addOrder("yearOfPublication asc");
} else {
logger.warn("JSP::Unknown value for order, setting list order to 'title'...");
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getDefinition().addOrder("title");
}
}
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getRenderer().setPageSize(20);
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) itemList).getRenderer().setSpecializeObjects(true);
</jsp:scriptlet>
<define:component name="assignedTerms"
classname="com.arsdigita.london.navigation.ui.CategoryIndexAssignedTerms"/>
</define:page>
<show:all/>
</jsp:root> </jsp:root>