Package org.apache.roller.weblogger.pojos

Examples of org.apache.roller.weblogger.pojos.Theme


        }
       
        // now go through each theme and load it into a Theme object
        for(int i=0; i < themenames.length; i++) {
            try {
                Theme theme = new SharedThemeFromDir(this.themeDir + File.separator + themenames[i]);
                if(theme != null) {
                    themes.put(theme.getId(), theme);
                }
            } catch (Throwable unexpected) {
                // shouldn't happen, so let's learn why it did
                log.error("Problem reading theme " + themenames[i], unexpected);
            }
View Full Code Here


        long resourceLastMod = 0;
        InputStream resourceStream = null;
       
        // first, see if we have a preview theme to operate from
        if(!StringUtils.isEmpty(resourceRequest.getThemeName())) {
            Theme theme = resourceRequest.getTheme();
            ThemeResource resource = theme.getResource(resourceRequest.getResourcePath());
            if(resource != null) {
                resourceLastMod = resource.getLastModified();
                resourceStream = resource.getInputStream();
            }
        }
View Full Code Here

           
        // 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");
            }
View Full Code Here

           
            WeblogTemplate stylesheet = getTemplate();
           
            // lookup the theme used by this weblog
            ThemeManager tmgr = WebloggerFactory.getWeblogger().getThemeManager();
            Theme theme = tmgr.getTheme(getActionWeblog().getEditorTheme());
           
            // lookup
            stylesheet.setLastModified(new Date());
            stylesheet.setContents(theme.getStylesheet().getContents());
           
            // save template and flush
            UserManager mgr = WebloggerFactory.getWeblogger().getUserManager();
            mgr.savePage(stylesheet);
            WebloggerFactory.getWeblogger().flush();
View Full Code Here

        long resourceLastMod = 0;
        InputStream resourceStream = null;
       
        // first, see if we have a preview theme to operate from
        if(!StringUtils.isEmpty(resourceRequest.getThemeName())) {
            Theme theme = resourceRequest.getTheme();
            ThemeResource resource = theme.getResource(resourceRequest.getResourcePath());
            if(resource != null) {
                resourceLastMod = resource.getLastModified();
                resourceStream = resource.getInputStream();
            }
        }
View Full Code Here

            // only create temporary weblog object if theme name was specified
            // in request, which indicates we're doing a theme preview

            // try getting the preview theme
            log.debug("preview theme = "+previewRequest.getThemeName());
            Theme previewTheme = previewRequest.getTheme();

            // construct a temporary Website object for this request
            // and set the EditorTheme to our previewTheme
            tmpWebsite = new Weblog();
            tmpWebsite.setData(weblog);
            if(previewTheme != null && previewTheme.isEnabled()) {
                tmpWebsite.setEditorTheme(previewTheme.getId());
            } else if(WeblogTheme.CUSTOM.equals(previewRequest.getThemeName())) {
                tmpWebsite.setEditorTheme(WeblogTheme.CUSTOM);
            }

            // we've got to set the weblog in our previewRequest because that's
View Full Code Here

            if(split.length < 2)
                throw new ResourceNotFoundException("Invalid ThemeRL key "+name);
           
            // lookup the template from the proper theme
            ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
            Theme theme = themeMgr.getTheme(split[0]);
            ThemeTemplate template = theme.getTemplateByName(split[1]);
           
            if(template == null)
                throw new ResourceNotFoundException("Template ["+split[1]+
                        "] doesn't seem to be part of theme ["+split[0]+"]");
           
View Full Code Here

            if(split.length < 2)
                return last_mod;
           
            // lookup the template from the proper theme
            ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
            Theme theme = themeMgr.getTheme(split[0]);
            ThemeTemplate template = theme.getTemplateByName(split[1]);
           
            if(template == null)
                return last_mod;
           
            last_mod = template.getLastModified().getTime();
View Full Code Here

           
        // 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
                WebloggerFactory.getWeblogger().getWeblogManager().saveWeblog(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");
            }
View Full Code Here

           
            WeblogTemplate stylesheet = getTemplate();
           
            // lookup the theme used by this weblog
            ThemeManager tmgr = WebloggerFactory.getWeblogger().getThemeManager();
            Theme theme = tmgr.getTheme(getActionWeblog().getEditorTheme());
           
            // lookup
            stylesheet.setLastModified(new Date());
            stylesheet.setContents(theme.getStylesheet().getContents());
           
            // save template and flush
            WebloggerFactory.getWeblogger().getWeblogManager().savePage(stylesheet);
            WebloggerFactory.getWeblogger().flush();
           
View Full Code Here

TOP

Related Classes of org.apache.roller.weblogger.pojos.Theme

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.