WebsiteData website = rreq.getWebsite();
if ( rses.isUserAuthorizedToAdmin(website)) {
// get users current theme
Roller roller = RollerFactory.getRoller();
ThemeManager themeMgr = roller.getThemeManager();
BasePageModel pageModel = new BasePageModel(
"themeEditor.title", request, response, mapping);
request.setAttribute("model",pageModel);
String username = rses.getAuthenticatedUser().getUserName();
String currentTheme = website.getEditorTheme();
List themes = themeMgr.getEnabledThemesList();
// this checks if the website has a default page template
// if not then we don't allow for a custom theme
boolean allowCustomTheme = true;
if(website.getDefaultPageId() == null
|| website.getDefaultPageId().equals("dummy")
|| website.getDefaultPageId().trim().equals(""))
allowCustomTheme = false;
// if we allow custom themes then add it to the end of the list
if(RollerRuntimeConfig.getBooleanProperty("themes.customtheme.allowed")
&& allowCustomTheme)
themes.add(Theme.CUSTOM);
// set the current theme in the request
request.setAttribute("currentTheme", currentTheme);
request.setAttribute("themesList", themes);
String theme = request.getParameter("theme");
try {
Theme previewTheme = themeMgr.getTheme(theme);
if(previewTheme.isEnabled()) {
// make sure the view knows what theme to preview
request.setAttribute("previewTheme", previewTheme.getName());