More Entries in the Edit Sidebar

Roller shows a list of recent entries and recent drafts on the left sidebar of the weblog editor page. This is a really handy little feature and lets you access entries and drafts really quickly. The problem is that only 20 entries are shown as standard, and there's no setting to change this. Back to the code!

So the sidebar template is in weblog/WeblogEditSidebar.jsp, surprisingly. A quick scan of the code reveals that the list of recent entries is predefined by the model:

<c:forEach var="post" items="${model.recentPublishedEntries}">

Looking at the top of that page, we see that the model is org.roller.presentation.<br />
weblog.actions.WeblogEntryPageModel
. That's kind of a deep package structure, but OK. So inside that class, we hack up the getRecentPublishedEntries method.
It's actually just a parameter change:

    public List getRecentPublishedEntries() throws RollerException
    {
        return rollerRequest.getRoller().getWeblogManager()
            .getWeblogEntries(
                rollerRequest.getWebsite(), // userName
                null,              // startDate
                null,              // endDate
                null,              // catName
                WeblogManager.PUB_ONLY, // status
                new Integer(20));  // maxEntries
    }

Change the maxEntries parameter to however many you want and away you go.

Now to deploy. Just run the wonderful build.sh all command from the Roller source root folder and it does most of the work. Copy across the new rollerweb.jar file and restart tomcat. And you're done.

And yes, before you point it out, I am aware that the Roller source does not meet my exacting standards of indentation. The fallback strategy is to stick with whatever dumbass indentation standard the codebase you have to work on uses. That's just the way it is.




This entry was posted in Java. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *