Update of
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets
In directory
james.mmbase.org:/tmp/cvs-serv5646/portlets/src/java/com/finalist/cmsc/portlets
Modified Files:
Tag: b1_5
ContentChannelPortlet.java
Log Message:
CMSC-1189(Add age constraint to contentchannel portlets)
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets
See also: http://www.mmbase.org/jira/browse/CMSC-1189
Index: ContentChannelPortlet.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets/ContentChannelPortlet.java,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -b -r1.13 -r1.13.2.1
--- ContentChannelPortlet.java 22 Aug 2008 13:32:45 -0000 1.13
+++ ContentChannelPortlet.java 18 Dec 2008 09:22:32 -0000 1.13.2.1
@@ -50,6 +50,7 @@
protected static final String DIRECTION = "direction";
protected static final String ORDERBY = "orderby";
protected static final String CONTENTCHANNEL = "contentchannel";
+ protected static final String MAX_DAYS = "maxDays";
protected static final String VIEW_TYPE = "viewtype";
protected static final String DISPLAY_TYPE = "displaytype";
@@ -79,6 +80,7 @@
setPortletParameter(portletId, VIEW_TYPE,
request.getParameter(VIEW_TYPE));
setPortletNodeParameter(portletId, ARCHIVE_PAGE,
request.getParameter(ARCHIVE_PAGE));
setPortletParameter(portletId, START_INDEX,
request.getParameter(START_INDEX));
+ setPortletParameter(portletId,MAX_DAYS,request.getParameter(MAX_DAYS));
}
@@ -186,14 +188,18 @@
useLifecycleBool = false;
}
+ int maxDays = Integer.parseInt(preferences.getValue(MAX_DAYS, "-1"));
+ if(maxDays <= 0){
+ maxDays = Integer.MAX_VALUE;
+ }
int totalItems = countContentElements(req, contenttypes, channel,
offset, orderby, direction, archive,
- elementsPerPage, year, month, day, useLifecycleBool);
+ elementsPerPage, year, month, day, useLifecycleBool, maxDays);
if (startIndex > 0) {
totalItems = totalItems - startIndex;
}
List<ContentElement> elements = getContentElements(req, contenttypes,
channel, offset, orderby, direction,
- archive, elementsPerPage, year, month, day, useLifecycleBool);
+ archive, elementsPerPage, year, month, day,
useLifecycleBool,maxDays);
setAttribute(req, ELEMENTS, elements);
if (contenttypes != null && !contenttypes.isEmpty()) {
@@ -245,12 +251,11 @@
}
}
-
protected int countContentElements(RenderRequest req, List<String>
contenttypes, String channel, int offset,
String orderby, String direction, String archive, int
elementsPerPage, int year, int month, int day,
- boolean useLifecycleBool) {
+ boolean useLifecycleBool, int maxDays) {
int totalItems = ContentRepository.countContentElements(channel,
contenttypes, orderby, direction,
- useLifecycleBool, archive, offset, elementsPerPage, year, month,
day);
+ useLifecycleBool, archive, offset, elementsPerPage, year, month,
day, maxDays);
return totalItems;
}
@@ -263,7 +268,13 @@
return elements;
}
-
+ protected List<ContentElement> getContentElements(RenderRequest req,
List<String> contenttypes, String channel,
+ int offset, String orderby, String direction, String archive, int
elementsPerPage, int year, int month,
+ int day, boolean useLifecycleBool, int maxDays) {
+ List<ContentElement> elements =
ContentRepository.getContentElements(channel, contenttypes, orderby, direction,
+ useLifecycleBool, archive, offset, elementsPerPage, year, month,
day,maxDays);
+ return elements;
+ }
public int getOffset(int currentPage, int pageSize) {
return ((currentPage - 1) * pageSize) + 1;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs