Package com.jeecms.core.web.front.URLHelper

Examples of com.jeecms.core.web.front.URLHelper.PageInfo


    // 尽量不要携带太多参数,多使用标签获取数据。
    // 目前已知的需要携带翻页信息。
    // 获得页号和翻页信息吧。
    int pageNo = URLHelper.getPageNo(request);
    String[] params = URLHelper.getParams(request);
    PageInfo info = URLHelper.getPageInfo(request);
    String[] paths = URLHelper.getPaths(request);
    int len = paths.length;
    if (len == 1) {
      // 单页
      return channel(paths[0], pageNo, params, info, request, response,
View Full Code Here


   * @param map
   */
  public static void frontPageData(HttpServletRequest request,
      Map<String, Object> map) {
    int pageNo = URLHelper.getPageNo(request);
    PageInfo info = URLHelper.getPageInfo(request);
    String href = info.getHref();
    String hrefFormer = info.getHrefFormer();
    String hrefLatter = info.getHrefLatter();
    frontPageData(pageNo, href, hrefFormer, hrefLatter, map);
  }
View Full Code Here

        totalPage = (quantity - 1) / c.getPageSize() + 1;
      }
    }
    String real, filename;
    File f, parent;
    PageInfo info;
    Writer out = null;
    Template tpl;
    CmsSite site = c.getSite();
    FrontUtils.frontData(data, site, null, null, null);
    for (int i = 1; i <= totalPage; i++) {
      filename = c.getStaticFilename(i);
      real = realPathResolver.get(filename.toString());
      f = new File(real);
      parent = f.getParentFile();
      if (!parent.exists()) {
        parent.mkdirs();
      }
      tpl = conf.getTemplate(c.getTplChannelOrDef());
      String urlStatic = c.getUrlStatic(i);
      info = URLHelper.getPageInfo(filename.substring(filename
          .lastIndexOf("/")), null);
      FrontUtils.frontPageData(i, info.getHref(), info.getHrefFormer(),
          info.getHrefLatter(), data);
      FrontUtils.putLocation(data, urlStatic);
      data.put("channel", c);
      try {
        // FileWriter不能指定编码确实是个问题,只能用这个代替了。
        out = new OutputStreamWriter(new FileOutputStream(f), UTF8);
View Full Code Here

    String url, real;
    File file, parent;
    Content c;
    Channel chnl;
    CmsSite site;
    PageInfo info;
    Template tpl;
    Writer out = null;
    if (data == null) {
      data = new HashMap<String, Object>();
    }
    while (contents.next()) {
      c = (Content) contents.get(0);
      chnl = c.getChannel();
      // 如果是外部链接或者不生成静态页面,则不生成
      if (!StringUtils.isBlank(c.getLink()) || !chnl.getStaticContent()) {
        continue;
      }
      // 如果不需要生成静态页面,则不生成
      if(!c.getNeedRegenerate()){
        continue;
      }
      site = c.getSite();
      tpl = conf.getTemplate(c.getTplContentOrDef());
      FrontUtils.frontData(data, site, null, null, null);
      data.put("content", c);
      data.put("channel", c.getChannel());
      totalPage = c.getPageCount();
      for (int pageNo = 1; pageNo <= totalPage; pageNo++) {
        String txt = c.getTxtByNo(pageNo);
        // 内容加上关键字
        txt = cmsKeywordMng.attachKeyword(site.getId(), txt);
        Paginable pagination = new SimplePage(pageNo, 1, c
            .getPageCount());
        data.put("pagination", pagination);
        url = c.getUrlStatic(pageNo);
        info = URLHelper.getPageInfo(url
            .substring(url.lastIndexOf("/")), null);
        FrontUtils.putLocation(data, url);
        FrontUtils.frontPageData(pageNo, info.getHref(), info
            .getHrefFormer(), info.getHrefLatter(), data);
        data.put("title", c.getTitleByNo(pageNo));
        data.put("txt", txt);
        data.put("pic", c.getPictureByNo(pageNo));
        if (pageNo == 1) {
          real = realPathResolver.get(c.getStaticFilename(pageNo));
View Full Code Here

    }
    int totalPage;
    String url, real;
    File file, parent;
    CmsSite site;
    PageInfo info;
    Template tpl;
    Writer out = null;
    site = c.getSite();
    tpl = conf.getTemplate(c.getTplContentOrDef());
    FrontUtils.frontData(data, site, null, null, null);
    data.put("content", c);
    data.put("channel", chnl);
    totalPage = c.getPageCount();
    for (int pageNo = 1; pageNo <= totalPage; pageNo++) {
      String txt = c.getTxtByNo(pageNo);
      // 内容加上关键字
      txt = cmsKeywordMng.attachKeyword(site.getId(), txt);
      Paginable pagination = new SimplePage(pageNo, 1, c.getPageCount());
      data.put("pagination", pagination);
      url = c.getUrlStatic(pageNo);
      info = URLHelper.getPageInfo(url.substring(url.lastIndexOf("/")),
          null);
      FrontUtils.putLocation(data, url);
      FrontUtils.frontPageData(pageNo, info.getHref(), info
          .getHrefFormer(), info.getHrefLatter(), data);
      data.put("title", c.getTitleByNo(pageNo));
      data.put("txt", txt);
      data.put("pic", c.getPictureByNo(pageNo));
      real = realPathResolver.get(c.getStaticFilename(pageNo));
      file = new File(real);
View Full Code Here

    ScrollableResults channels = finder.createQuery(session).setCacheMode(
        CacheMode.IGNORE).scroll(ScrollMode.FORWARD_ONLY);
    int count = 0;
    CmsSite site;
    Channel c;
    PageInfo info;
    Writer out = null;
    Template tpl;
    String real, filename;
    File f, parent;
    int quantity, totalPage;
    if (data == null) {
      data = new HashMap<String, Object>();
    }
    while (channels.next()) {
      c = (Channel) channels.get(0);
      site = c.getSite();
      FrontUtils.frontData(data, site, null, null, null);
      // 如果是外部链接或者不需要生产静态页,则不生成
      if (!StringUtils.isBlank(c.getLink()) || !c.getStaticChannel()) {
        continue;
      }
      // 没有内容或者有子栏目,则只生成一页
      int childs = childsOfChannel(c.getId());
      if (!c.getModel().getHasContent()) {
        totalPage = 1;
      } else {
        if (c.getListChild()) {
          quantity = childs;
        } else {
          if(!c.getListChild() && childs > 0){
            quantity=contentsOfParentChannel(c.getId());
          }else{
            quantity = contentsOfChannel(c.getId());
          }
        }
        if (quantity <= 0) {
          totalPage = 1;
        } else {
          totalPage = (quantity - 1) / c.getPageSize() + 1;
        }
      }
      for (int i = 1; i <= totalPage; i++) {
        filename = c.getStaticFilename(i);
        real = realPathResolver.get(filename.toString());
        f = new File(real);
        parent = f.getParentFile();
        if (!parent.exists()) {
          parent.mkdirs();
        }
        tpl = conf.getTemplate(c.getTplChannelOrDef());
        String urlStatic = c.getUrlStatic(i);
        info = URLHelper.getPageInfo(filename.substring(filename
            .lastIndexOf("/")), null);
        FrontUtils.frontPageData(i, info.getHref(), info
            .getHrefFormer(), info.getHrefLatter(), data);
        FrontUtils.putLocation(data, urlStatic);
        data.put("channel", c);
        try {
          // FileWriter不能指定编码确实是个问题,只能用这个代替了。
          out = new OutputStreamWriter(new FileOutputStream(f), UTF8);
View Full Code Here

TOP

Related Classes of com.jeecms.core.web.front.URLHelper.PageInfo

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.