Package com.jeecms.cms.entity.main

Examples of com.jeecms.cms.entity.main.Content


        tagStr, channelId, site, user, captcha, request, response);
    if (errors.hasErrors()) {
      return FrontUtils.showError(request, response, model, errors);
    }

    Content c = new Content();
    c.setSite(site);
    ContentExt ext = new ContentExt();
    ext.setTitle(title);
    ext.setAuthor(author);
    ext.setDescription(description);
    ContentTxt t = new ContentTxt();
    t.setTxt(txt);
    ContentType type = contentTypeMng.getDef();
    if (type == null) {
      throw new RuntimeException("Default ContentType not found.");
    }
    Integer typeId = type.getId();
    String[] tagArr = StrUtils.splitAndTrim(tagStr, ",", null);
    c = contentMng.save(c, ext, t, null, null, null, tagArr, null, null,
        null, null, null, channelId, typeId, null, user, true);
    log.info("member contribute save Content success. id={}", c.getId());
    return FrontUtils.showSuccess(request, model, nextUrl);
  }
View Full Code Here


    }
    WebErrors errors = validateEdit(id, site, user, request);
    if (errors.hasErrors()) {
      return FrontUtils.showError(request, response, model, errors);
    }
    Content content = contentMng.findById(id);
    // 获得本站栏目列表
    Set<Channel> rights = user.getGroup().getContriChannels();
    List<Channel> topList = channelMng.getTopList(site.getId(), true);
    List<Channel> channelList = Channel.getListForSelect(topList, rights,
        true);
View Full Code Here

    }
    WebErrors errors = validateUpdate(id, channelId, site, user, request);
    if (errors.hasErrors()) {
      return FrontUtils.showError(request, response, model, errors);
    }
    Content c = new Content();
    c.setId(id);
    c.setSite(site);
    ContentExt ext = new ContentExt();
    ext.setId(id);
    ext.setTitle(title);
    ext.setAuthor(author);
    ext.setDescription(description);
View Full Code Here

      Integer[] ids) {
    for (Integer id : ids) {
      if (errors.ifNull(id, "id")) {
        return true;
      }
      Content c = contentMng.findById(id);
      // 数据不存在
      if (errors.ifNotExist(c, Content.class, id)) {
        return true;
      }
      // 非本用户数据
      if (!c.getUser().getId().equals(user.getId())) {
        errors.noPermission(Content.class, id);
        return true;
      }
      // 非本站点数据
      if (!c.getSite().getId().equals(site.getId())) {
        errors.notInSite(Content.class, id);
        return true;
      }
      // 文章级别大于0,不允许修改
      if (c.getCheckStep() > 0) {
        errors.addErrorCode("member.contentChecked");
        return true;
      }
    }
    return false;
View Full Code Here

        CacheMode.IGNORE).scroll(ScrollMode.FORWARD_ONLY);
    int count = 0;
    int totalPage;
    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));
          file = new File(real);
          parent = file.getParentFile();
          if (!parent.exists()) {
            parent.mkdirs();
          }
        } else {
          real = realPathResolver.get(c.getStaticFilename(pageNo));
          file = new File(real);
        }
        try {
          // FileWriter不能指定编码确实是个问题,只能用这个代替了。
          out = new OutputStreamWriter(new FileOutputStream(file),
              UTF8);
          tpl.process(data, out);
          log.info("create static file: {}", file.getAbsolutePath());
        } finally {
          if (out != null) {
            out.close();
          }
        }
      }
      c.setNeedRegenerate(false);
      if (++count % 20 == 0) {
        session.clear();
      }
    }
    return count;
View Full Code Here

  public Content saveContent(String title, String txt, Integer acquId,
      AcquisitionResultType resultType, CmsAcquisitionTemp temp,
      CmsAcquisitionHistory history) {
    CmsAcquisition acqu = findById(acquId);
    Content c = new Content();
    c.setSite(acqu.getSite());
    ContentExt cext = new ContentExt();
    ContentTxt ctxt = new ContentTxt();
    cext.setTitle(title);
    ctxt.setTxt(txt);
    Content content = contentMng.save(c, cext, ctxt, null, null, null,
        null, null, null, null, null, null, acqu.getChannel().getId(),
        acqu.getType().getId(), false, acqu.getUser(), false);
    history.setTitle(title);
    history.setContent(content);
    history.setDescription(resultType.name());
View Full Code Here

      return errors.showErrorPage(model);
    }
    CmsSite site = CmsUtils.getSite(request);
    CmsUser user = CmsUtils.getUser(request);
    byte currStep = user.getCheckStep(site.getId());
    Content content = manager.findById(id);

    model.addAttribute("content", content);
    model.addAttribute("currStep", currStep);

    if (cid != null) {
View Full Code Here

    }
    CmsSite site = CmsUtils.getSite(request);
    Integer siteId = site.getId();
    CmsUser user = CmsUtils.getUser(request);
    // 内容
    Content content = manager.findById(id);
    // 栏目
    Channel channel = content.getChannel();
    // 模型
    CmsModel m = channel.getModel();
    // 模型项列表
    List<CmsModelItem> itemList = cmsModelItemMng.getList(m.getId(), false,
        false);
    // 栏目列表
    Set<Channel> rights;
    if (user.getUserSite(siteId).getAllChannel()) {
      // 拥有所有栏目权限
      rights = null;
    } else {
      rights = user.getChannels(siteId);
    }

    List<Channel> topList = channelMng.getTopList(site.getId(), true);
    List<Channel> channelList = Channel.getListForSelect(topList, rights,
        true);

    // 专题列表
    List<CmsTopic> topicList = cmsTopicMng
        .getListByChannel(channel.getId());
    Set<CmsTopic> topics = content.getTopics();
    for (CmsTopic t : topics) {
      if (!topicList.contains(t)) {
        topicList.add(t);
      }
    }
    Integer[] topicIds = CmsTopic.fetchIds(content.getTopics());
    // 内容模板列表
    List<String> tplList = getTplContent(site, m, content.getTplContent());
    // 会员组列表
    List<CmsGroup> groupList = cmsGroupMng.getList();
    Integer[] groupIds = CmsGroup.fetchIds(content.getViewGroups());
    // 内容类型
    List<ContentType> typeList = contentTypeMng.getList(false);
    // 当前模板,去除基本路径
    int tplPathLength = site.getTplPath().length();
    String tplContent = content.getTplContent();
    if (!StringUtils.isBlank(tplContent)) {
      tplContent = tplContent.substring(tplPathLength);
    }

    model.addAttribute("content", content);
View Full Code Here

      for (Content bean : beans) {
        log.info("delete to cycle, Content id={}", bean.getId());
      }
    } else {
      for(Integer id:ids){
        Content c=manager.findById(id);
        //处理附件
        manager.updateFileByContent(c, false);
      }
      beans = manager.deleteByIds(ids);
      for (Content bean : beans) {
View Full Code Here

    WebErrors errors = validateDelete(ids, request);
    if (errors.hasErrors()) {
      return errors.showErrorPage(model);
    }
    for(Integer id:ids){
      Content c=manager.findById(id);
      //处理附件
      manager.updateFileByContent(c, false);
    }
    Content[] beans = manager.deleteByIds(ids);
    for (Content bean : beans) {
View Full Code Here

TOP

Related Classes of com.jeecms.cms.entity.main.Content

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.