RollerContext rollerCtx = RollerContext.getRollerContext( );
WebsiteData weblog = null;
WeblogEntryData entry = null;
WeblogCategoryData category = null;
Template page = null;
FolderData folder = null; // don't even know how this is involved :/
Date date = null;
boolean isDay = false;
boolean isMonth = false;
String locale = null;
// get data from page request
locale = pageRequest.getLocale();
weblog = pageRequest.getWeblog();
entry = pageRequest.getWeblogEntry();
category = pageRequest.getWeblogCategory();
page = pageRequest.getWeblogPage();
if(page == null) {
page = weblog.getDefaultPage();
}
// setup date, isDay, and isMonth
if(pageRequest.getWeblogDate() != null) {
Date now = new Date();
if(pageRequest.getWeblogDate().length() == 8) {
isDay = true;
try {
date = DateUtil.get8charDateFormat().parse(pageRequest.getWeblogDate());
if(date.after(now)) {
date = now;
}
} catch(Exception e) {
// bleh
}
} else if(pageRequest.getWeblogDate().length() == 6) {
isMonth = true;
try {
date = DateUtil.get6charDateFormat().parse(pageRequest.getWeblogDate());
if(date.after(now)) {
date = now;
}
} catch(Exception e) {
// bleh
}
} else {
isMonth = true;
}
}
try {
// Add old page model object to context
OldWeblogPageModel pageModel = new OldWeblogPageModel();
pageModel.init(request,
weblog,
entry,
category,
date,
isDay,
isMonth,
locale);
ctx.put("pageModel", pageModel);
// along with old pages list :/
ctx.put("pages", pageModel.getPages());
} catch (Exception e) {
throw new RollerException("ERROR creating Page Model",e);
}
// Add page helper to context
OldPageHelper pageHelper = new OldPageHelper(request,
response,
ctx,
weblog,
(date == null) ? new Date() : date,
folder,
page.getName(),
pageContext,
pageRequest);
ctx.put("pageHelper", pageHelper);
// Load standard Roller objects and values into the context