Package org.apache.roller.pojos

Examples of org.apache.roller.pojos.Template


        if(this.weblogRequest == null) {
            throw new RollerException("expected weblogRequest from init data");
        }
       
        if (weblogRequest instanceof WeblogPageRequest) {
            Template weblogPage = ((WeblogPageRequest)weblogRequest).getWeblogPage();
            pageLink = (weblogPage != null) ? weblogPage.getLink() : null;
            pageNum = ((WeblogPageRequest)weblogRequest).getPageNum();
       
       
        // extract weblog object
        weblog = weblogRequest.getWeblog();
View Full Code Here


        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
View Full Code Here

        // add language of the session (using locale specified by request)
        ctx.put("viewLocale", locale);
        mLogger.debug("context viewLocale = "+ctx.get( "viewLocale"));
       
        // alternative display pages - customization
        Template entryPage = weblog.getPageByName("_entry");
        if (entryPage != null) {
            ctx.put("entryPage", TemplateWrapper.wrap(entryPage));
        }
        // TODO: ATLAS: no templates use this, should be safe to remove
        // Template descPage = weblog.getPageByName("_desc");
View Full Code Here

               
                // Get the pages, put into context & load map
                List pages = mWebsite.getPages();
                Iterator pageIter = pages.iterator();
                while (pageIter.hasNext()) {
                    Template page = (Template) pageIter.next();
                    mPageMap.put(page.getName(), TemplateWrapper.wrap(page));
                }
            }
           
        } catch (RollerException e) {
            mLogger.error("PageModel Roller get*Manager Exception", e);
View Full Code Here

        mLogger.debug("looking up page ["+pageName+"]");
       
        String template_id = null;
       
        try {
            Template pd = mWebsite.getPageByName(pageName);
            if(pd != null) {
                template_id = pd.getId();
            }
        } catch(Exception e) {
            mLogger.error(e);
        }
       
View Full Code Here

       
        // lookup Renderer we are going to use
        Renderer renderer = null;
        try {
            log.debug("Looking up renderer");
            Template template = new StaticTemplate("templates/planet/planetrss.vm", null, "velocity");
            renderer = RendererManager.getRenderer(template);
        } catch(Exception e) {
            // nobody wants to render my content :(
            log.error("Couldn't find renderer for planet rss", e);
           
View Full Code Here

            // make sure that we can locate the template
            // if we can't then this will throw an exception
            velocityTemplate = RollerVelocity.getTemplate(template.getId(), "UTF-8");
           
            // if there is a decorator then look that up too
            Template decorator = renderTemplate.getDecorator();
            if(decorator != null) {
                velocityDecorator = RollerVelocity.getTemplate(decorator.getId());
            }
           
        } catch(ResourceNotFoundException ex) {
            // velocity couldn't find the resource so lets log a warning
            log.warn("Error creating renderer for "+template.getId()+
View Full Code Here

       
        // lookup Renderer we are going to use
        Renderer renderer = null;
        try {
            log.debug("Looking up renderer");
            Template template = new StaticTemplate("templates/weblog/rsd.vm", null, "velocity");
            renderer = RendererManager.getRenderer(template);
        } catch(Exception e) {
            // nobody wants to render my content :(
            log.error("Couldn't find renderer for rsd template", e);
           
View Full Code Here

                //ModelLoader.loadCustomModels(weblog, model, initData);
               
               
                // lookup Renderer we are going to use
                Renderer renderer = null;
                Template template = new StaticTemplate("templates/feeds/weblog-"+type+"-"+format+".vm", null, "velocity");
                renderer = RendererManager.getRenderer(template);
               
               
                // render content.  use default size of about 24K for a standard page
                CachedContent rendererOutput = new CachedContent(24567);
View Full Code Here

            response.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }
       
        // get their default page template to use for rendering
        Template page = null;
        try {
            page = weblog.getDefaultPage();
            if(page == null) {
                throw new RollerException("Could not lookup default page "+
                        "for weblog "+weblog.getHandle());
View Full Code Here

TOP

Related Classes of org.apache.roller.pojos.Template

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.