You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/10/11 19:18:56 UTC
svn commit: r462866 - in /incubator/roller/trunk:
src/org/apache/roller/ui/authoring/struts/actions/
src/org/apache/roller/ui/rendering/model/
src/org/apache/roller/ui/rendering/pagers/
src/org/apache/roller/ui/rendering/servlets/ src/org/apache/roller...
Author: agilliland
Date: Wed Oct 11 10:18:55 2006
New Revision: 462866
URL: http://svn.apache.org/viewvc?view=rev&rev=462866
Log:
Adding new runtime property 'site.pages.maxEntries' to control max entries allowed per weblog page, as well as doing a little cleanup on some runtime properties.
- added new property 'site.page.maxEntries' to runtime config
- re-organized some of the properties in runtime config for nicer grouping
- udpated and re-organized matching properties in resource bundle as well
- removed use of old 'site.newsfeeds.maxEntries' which was no longer being used, instead we only use 'site.newsfeeds.defaultEntries' which affects the size of all feeds.
- updated Weblog Settings form to display an error if user enters an entryDisplayCount value larger than the max allowed entries per page.
Modified:
incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WebsiteFormAction.java
incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/ConfigModel.java
incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java
incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/PlanetFeedServlet.java
incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/ContextLoader.java
incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties
incubator/roller/trunk/web/WEB-INF/classes/rollerRuntimeConfigDefs.xml
Modified: incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WebsiteFormAction.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WebsiteFormAction.java?view=diff&rev=462866&r1=462865&r2=462866
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WebsiteFormAction.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WebsiteFormAction.java Wed Oct 11 10:18:55 2006
@@ -161,6 +161,15 @@
RollerSession rollerSession = RollerSession.getRollerSession(request);
if ( rollerSession.isUserAuthorizedToAdmin(wd)) {
checkBlacklist(errors, messages, form.getBlacklist());
+
+ // make sure user didn't enter an invalid entry display count
+ if(errors.isEmpty()) {
+ int maxEntries = RollerRuntimeConfig.getIntProperty("site.pages.maxEntries");
+ if(form.getEntryDisplayCount() > maxEntries) {
+ errors.add(null, new ActionMessage("websiteSettings.error.entryDisplayCount"));
+ }
+ }
+
if (errors.isEmpty()) {
// ensure getEnabled can't be changed
form.setEnabled(wd.getEnabled());
Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/ConfigModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/ConfigModel.java?view=diff&rev=462866&r1=462865&r2=462866
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/ConfigModel.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/ConfigModel.java Wed Oct 11 10:18:55 2006
@@ -84,7 +84,7 @@
}
public int getFeedMaxSize() {
- return getIntProperty("site.newsfeeds.maxEntries");
+ return getIntProperty("site.newsfeeds.defaultEntries");
}
public boolean getFeedStyle() {
Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java?view=diff&rev=462866&r1=462865&r2=462866
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java Wed Oct 11 10:18:55 2006
@@ -23,29 +23,23 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import org.apache.commons.collections.comparators.ReverseComparator;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.model.Roller;
-import org.apache.roller.model.RollerFactory;
-import org.apache.roller.model.WeblogManager;
-import org.apache.roller.pojos.WeblogCategoryData;
-import org.apache.roller.pojos.WeblogEntryData;
-import org.apache.roller.pojos.WeblogTemplate;
+import org.apache.roller.config.RollerRuntimeConfig;
import org.apache.roller.pojos.WebsiteData;
-import org.apache.roller.pojos.wrapper.WeblogEntryDataWrapper;
import org.apache.roller.util.DateUtil;
import org.apache.roller.util.MessageUtilities;
import org.apache.roller.util.URLUtilities;
/**
+ * An abstract implementation of a WeblogEntriesPager.
*
+ * This implementation lays out the basic functionality of an entries pager so
+ * that subclasses can easily tweak only the few things necessary to handle
+ * paging their own way.
*/
public abstract class AbstractWeblogEntriesPager implements WeblogEntriesPager {
@@ -84,7 +78,12 @@
this.tags = tags;
// make sure offset, length, and page are valid
+ int maxLength = RollerRuntimeConfig.getIntProperty("site.pages.maxEntries");
length = weblog.getEntryDisplayCount();
+ if(length > maxLength) {
+ length = maxLength;
+ }
+
if(page > 0) {
this.page = page;
}
Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/PlanetFeedServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/PlanetFeedServlet.java?view=diff&rev=462866&r1=462865&r2=462866
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/PlanetFeedServlet.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/servlets/PlanetFeedServlet.java Wed Oct 11 10:18:55 2006
@@ -145,10 +145,9 @@
model.put("absoluteSite", RollerRuntimeConfig.getAbsoluteContextURL());
model.put("feedStyle", new Boolean(RollerRuntimeConfig.getBooleanProperty("site.newsfeeds.styledFeeds")));
- int entryCount =
+ int numEntries =
RollerRuntimeConfig.getIntProperty("site.newsfeeds.defaultEntries");
- int maxEntries =
- RollerRuntimeConfig.getIntProperty("site.newsfeeds.maxEntries");
+ int entryCount = numEntries;
String sCount = request.getParameter("count");
if (sCount!=null) {
try {
@@ -156,7 +155,7 @@
} catch (NumberFormatException e) {
log.warn("Improperly formatted count parameter");
}
- if ( entryCount > maxEntries ) entryCount = maxEntries;
+ if ( entryCount > numEntries ) entryCount = numEntries;
if ( entryCount < 0 ) entryCount = 0;
}
model.put("entryCount", new Integer(entryCount));
Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/ContextLoader.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/ContextLoader.java?view=diff&rev=462866&r1=462865&r2=462866
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/ContextLoader.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/ContextLoader.java Wed Oct 11 10:18:55 2006
@@ -343,12 +343,10 @@
int entryCount = website.getEntryDisplayCount();
// But don't exceed installation-wide maxEntries settings
- int maxEntries =
- RollerRuntimeConfig.getIntProperty("site.newsfeeds.maxEntries");
int defaultEntries =
RollerRuntimeConfig.getIntProperty("site.newsfeeds.defaultEntries");
if (entryCount < 1) entryCount = defaultEntries;
- if (entryCount > maxEntries) entryCount = maxEntries;
+ if (entryCount > defaultEntries) entryCount = defaultEntries;
ctx.put("entryCount", new Integer(entryCount));
String catname = null;
Modified: incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties?view=diff&rev=462866&r1=462865&r2=462866
==============================================================================
--- incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties Wed Oct 11 10:18:55 2006
@@ -289,42 +289,37 @@
these are <i>runtime</i> properties only. Please refer to the Roller documentation \
for information on overriding Roller's <i>startup</i> properties (in the \
roller.properties file).
-configForm.frontpageWeblogHandle=Handle of weblog to serve as frontpage blog
-configForm.frontpageWeblogAggregated=Enable aggregated frontpage feeds
+
configForm.siteSettings=Site Settings
configForm.siteName=Site Name (for main page and RSS feed)
configForm.shortName=Short name (shown in site banner)
configForm.siteDescription=Site Description (for main page and RSS feed)
+configForm.frontpageWeblogHandle=Handle of weblog to serve as frontpage blog
+configForm.frontpageWeblogAggregated=Enable aggregated frontpage feeds
configForm.siteAdminEmail=Site Administrator's email address
configForm.absoluteUrl=Absolute URL to site (if required)
-configForm.searchIndexDir=Search Index Directory<br />(use ${user.home} for \
-system property)
configForm.suspendPingProcessing=Suspend all ping processing?
configForm.debugMode=Enable debug mode?
-configForm.emailNotification=Email notification?
configForm.userSettings=User Settings
configForm.allowNewUsers=Allow New Users?
configForm.registrationUrl=External registration url
-configForm.adminUsers=Admin Users
-configForm.encryptPasswords=Encrypt Passwords?
-configForm.algorithm=Encryption Algorithm
configForm.editorPages=Editor Pages
-configForm.autoformatComments=Autoformat Comments?
-configForm.escapeCommentHtml=Escape Comment HTML?
-configForm.emailComments=Email notification of comments?
+
+configForm.weblogSettings=Weblog Rendering Settings
+configForm.pageMaxEntries=Max number of entries to allow per page
+configForm.newsfeedMaxEntries=Number of entries to provide in newsfeeds
+configForm.styledFeeds=Display styled newsfeeds for browsers
configForm.commentSettings=Comment and Trackback Settings
configForm.enableComments=Allow weblog comments?
configForm.enableTrackbacks=Allow weblog trackbacks?
+configForm.autoformatComments=Autoformat Comments?
+configForm.escapeCommentHtml=Escape Comment HTML?
+configForm.emailComments=Email notification of comments?
+configForm.moderationRequired=Require comment moderation for all weblogs
configForm.enableTrackbackValidation=Enable verification of trackback links?
configForm.enableLinkback=Enable referrer linkback extraction?
-configForm.moderationRequired=Require comment moderation for all weblogs
-
-configForm.newsfeedSettings=Newsfeed settings
-configForm.defaultEntries=Default number of entries
-configForm.newsfeedMaxEntries=Max number of entries
-configForm.styledFeeds=Display styled newsfeeds for browsers
configForm.fileUploadSettings=File Upload Settings
configForm.enableFileUploads=Enable File Uploads?
@@ -332,21 +327,11 @@
configForm.forbiddenExtensions=Forbidden Extensions
configForm.maxFileSize=Max File Size (MB)
configForm.maxDirSize=Max Directory Size (MB)
-configForm.uploadDir=Upload Directory
-configForm.uploadPath=Upload Path
configForm.themeSettings=Theme Settings
configForm.newUserThemes=Themes Directory
configForm.allowCustomTheme=Allow Custom Themes?
-configForm.rssAggregatorSettings=RSS Aggregator Settings
-configForm.enableRssAggregator=Enable RSS Aggregator?
-configForm.cacheIncomingRss=Cache Incoming RSS Newsfeeds?
-configForm.rssNewsfeedCacheTime=RSS Newsfeed Cache Time (seconds)
-
-configForm.debuggingSettings=Debugging Settings
-configForm.enableMemoryDebugging=Enable Memory Debugging?
-
configForm.save=Save
configForm.rebuildIndex=Rebuild Search Index (All Users)
@@ -1633,6 +1618,7 @@
websiteSettings.entryDisplayCount=Number of entries to display on weblog
websiteSettings.active=Weblog is active (and should be included in community listings)
websiteSettings.editorSettings=Editor
+websiteSettings.error.entryDisplayCount=You have chosen a value too high for 'number of entries to display'
# --- i18n settings
Modified: incubator/roller/trunk/web/WEB-INF/classes/rollerRuntimeConfigDefs.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/WEB-INF/classes/rollerRuntimeConfigDefs.xml?view=diff&rev=462866&r1=462865&r2=462866
==============================================================================
--- incubator/roller/trunk/web/WEB-INF/classes/rollerRuntimeConfigDefs.xml (original)
+++ incubator/roller/trunk/web/WEB-INF/classes/rollerRuntimeConfigDefs.xml Wed Oct 11 10:18:55 2006
@@ -86,6 +86,7 @@
</property-def>
</display-group >
+
<!-- User Settings Group -->
<display-group name="userSettings" key="configForm.userSettings" >
@@ -106,7 +107,27 @@
</display-group >
- <!-- Comment Settings Group -->
+
+ <!-- Weblog Rendering Settings Group -->
+ <display-group name="weblogSettings" key="configForm.weblogSettings" >
+
+ <property-def name="site.pages.maxEntries" key="configForm.pageMaxEntries">
+ <type>string</type>
+ <default-value>30</default-value>
+ </property-def>
+ <property-def name="site.newsfeeds.defaultEntries" key="configForm.newsfeedMaxEntries">
+ <type>string</type>
+ <default-value>30</default-value>
+ </property-def>
+ <property-def name="site.newsfeeds.styledFeeds" key="configForm.styledFeeds">
+ <type>boolean</type>
+ <default-value>true</default-value>
+ </property-def>
+
+ </display-group>
+
+
+ <!-- Comment & Trackback Settings Group -->
<display-group name="commentSettings" key="configForm.commentSettings" >
<property-def name="users.comments.enabled" key="configForm.enableComments">
@@ -145,22 +166,6 @@
</display-group >
- <!-- Newsfeed Settings Group -->
- <display-group name="newsfeedSettings" key="configForm.newsfeedSettings" >
- <property-def name="site.newsfeeds.defaultEntries" key="configForm.defaultEntries">
- <type>string</type>
- <default-value>50</default-value>
- </property-def>
- <property-def name="site.newsfeeds.maxEntries" key="configForm.newsfeedMaxEntries">
- <type>string</type>
- <default-value>50</default-value>
- </property-def>
- <property-def name="site.newsfeeds.styledFeeds" key="configForm.styledFeeds">
- <type>boolean</type>
- <default-value>true</default-value>
- </property-def>
- </display-group>
-
<!-- File Upload Settings Group -->
<display-group name="uploadSettings" key="configForm.fileUploadSettings" >
@@ -187,6 +192,8 @@
</display-group >
+
+ <!-- Theme Settings Group -->
<display-group name="themeSettings" key="configForm.themeSettings">
<property-def name="users.themes.path" key="configForm.newUserThemes">
@@ -199,7 +206,8 @@
</property-def>
</display-group>
-
+
+
<!-- Spam Prevention Settings Group -->
<display-group name="spamSettings" key="websiteSettings.spamPrevention" >