throws RollerException {
Roller mRoller = RollerFactory.getRoller();
Map props = mRoller.getPropertiesManager().getProperties();
WebsiteData weblog = rreq.getWebsite();
if (weblog == null && rreq.getRequest().getParameter("entry") != null) {
String handle = rreq.getRequest().getParameter("entry");
weblog = RollerFactory.getRoller().getUserManager().getWebsiteByHandle(handle);
}
if (weblog == null && rreq.getRequest().getAttribute(RollerRequest.OWNING_WEBSITE) != null) {
weblog = (WebsiteData)rreq.getRequest().getAttribute(RollerRequest.OWNING_WEBSITE);
}
if (weblog != null) {
ctx.put("userName", weblog.getHandle());
ctx.put("fullName", weblog.getName() );
ctx.put("emailAddress", weblog.getEmailAddress() );
ctx.put("encodedEmail", RegexUtil.encode(weblog.getEmailAddress()));
ctx.put("obfuscatedEmail", RegexUtil.obfuscateEmail(weblog.getEmailAddress()));
// setup Locale for future rendering
ctx.put("locale", weblog.getLocaleInstance());
// setup Timezone for future rendering
ctx.put("timezone", weblog.getTimeZoneInstance());
ctx.put("timeZone", weblog.getTimeZoneInstance());
} else {
// create dummy website for use in site-wide feeds
weblog = new WebsiteData();
weblog.setAllowComments(Boolean.FALSE);
weblog.setHandle("zzz_none_zzz");
weblog.setName(
((RollerPropertyData)props.get("site.name")).getValue());
weblog.setDescription(
((RollerPropertyData)props.get("site.description")).getValue());
weblog.setEntryDisplayCount(
RollerRuntimeConfig.getIntProperty("site.newsfeeds.defaultEntries"));
ctx.put("handle", weblog.getHandle() );
ctx.put("userName", weblog.getHandle() );
ctx.put("fullName", weblog.getHandle());
ctx.put("locale", Locale.getDefault());
ctx.put("timezone", TimeZone.getDefault());
ctx.put("timeZone", TimeZone.getDefault());
ctx.put("emailAddress",
((RollerPropertyData)props.get("site.adminemail")).getValue());
}
ctx.put("website", WebsiteDataWrapper.wrap(weblog) );
String siteName = ((RollerPropertyData)props.get("site.name")).getValue();
if ("Roller-based Site".equals(siteName)) siteName = "Main";
ctx.put("siteName", siteName);
String siteShortName = ((RollerPropertyData)props.get("site.shortName")).getValue();
ctx.put("siteShortName", siteShortName);
// add language of the session (using locale of viewer set by Struts)
ctx.put("viewLocale",
LanguageUtil.getViewLocale(rreq.getRequest()));
mLogger.debug("context viewLocale = "+ctx.get( "viewLocale"));
// if there is an "_entry" page, only load it once
// but don't do it for dummy website
if (weblog != null && !"zzz_none_zzz".equals(weblog.getHandle())) {
// alternative display pages - customization
Template entryPage = weblog.getPageByName("_entry");
if (entryPage != null) {
ctx.put("entryPage", TemplateWrapper.wrap(entryPage));
}
Template descPage = weblog.getPageByName("_desc");
if (descPage != null) {
ctx.put("descPage", TemplateWrapper.wrap(descPage));
}
}