// we are dealing with a shared theme scenario
} else if("shared".equals(getThemeType())) {
// make sure theme is valid and enabled
Theme newTheme = null;
if(getThemeId() == null) {
// TODO: i18n
addError("No theme specified");
} else {
try {
ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
newTheme = themeMgr.getTheme(getThemeId());
if(!newTheme.isEnabled()) {
// TODO: i18n
addError("Theme not enabled");
}
} catch(Exception ex) {
log.warn(ex);
// TODO: i18n
addError("Theme not found");
}
}
if(!hasActionErrors()) try {
weblog.setEditorTheme(getThemeId());
log.debug("Saving theme "+getThemeId()+" for weblog "+weblog.getHandle());
// save updated weblog and flush
UserManager userMgr = WebloggerFactory.getWeblogger().getUserManager();
userMgr.saveWebsite(weblog);
WebloggerFactory.getWeblogger().flush();
// make sure to flush the page cache so ppl can see the change
CacheManager.invalidate(weblog);
// TODO: i18n
addMessage("Successfully set theme to - "+newTheme.getName());
} catch(WebloggerException re) {
log.error("Error saving weblog - "+getActionWeblog().getHandle(), re);
addError("Error setting theme");
}