Examples of CmsSite


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

  }

  @RequestMapping(value = "/vote.jspx", method = RequestMethod.GET)
  public String input(Integer voteId, HttpServletRequest request,
      HttpServletResponse response, ModelMap model) {
    CmsSite site = CmsUtils.getSite(request);
    CmsVoteTopic vote = cmsVoteTopicMng.findById(voteId);
    model.addAttribute("vote", vote);
    FrontUtils.frontData(request, model, site);
    return FrontUtils.getTplPath(request, site.getSolutionPath(),
        TPLDIR_SPECIAL, VOTE_INPUT);
  }
View Full Code Here

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

  @RequestMapping(value = "/vote.jspx", method = RequestMethod.POST)
  public String submit(Integer voteId, Integer[] itemIds,
      HttpServletRequest request, HttpServletResponse response,
      ModelMap model) {
    CmsSite site = CmsUtils.getSite(request);
    CmsUser user = CmsUtils.getUser(request);
    String ip = RequestUtils.getIpAddr(request);
    String cookieName = VOTE_COOKIE_PREFIX + voteId;
    Cookie cookie = CookieUtils.getCookie(request, cookieName);
    String cookieValue;
    if (cookie != null && !StringUtils.isBlank(cookie.getValue())) {
      cookieValue = cookie.getValue();
    } else {
      cookieValue = null;
    }
    if (!validateSubmit(voteId, itemIds, user, ip, cookieValue, model)) {
      if (cookieValue == null) {
        // 随机cookie
        cookieValue = StringUtils.remove(UUID.randomUUID().toString(),
            "-");
        // 写cookie
        CookieUtils.addCookie(request, response, cookieName,
            cookieValue, Integer.MAX_VALUE, null);
      }
      CmsVoteTopic vote = cmsVoteTopicMng.vote(voteId, itemIds, user, ip,
          cookieValue);
      model.addAttribute("status", 0);
      model.addAttribute("vote", vote);

      log.info("vote CmsVote id={}, name={}", vote.getId(), vote
          .getTitle());
    }
    FrontUtils.frontData(request, model, site);
    return FrontUtils.getTplPath(request, site.getSolutionPath(),
        TPLDIR_SPECIAL, VOTE_RESULT);
  }
View Full Code Here

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

  @RequestMapping(value = "/topic*.jspx", method = RequestMethod.GET)
  public String index(Integer channelId, Integer topicId,
      HttpServletRequest request, HttpServletResponse response,
      ModelMap model) {
    // 全部?按站点?按栏目?要不同模板?
    CmsSite site = CmsUtils.getSite(request);
    FrontUtils.frontData(request, model, site);
    FrontUtils.frontPageData(request, model);
    if (topicId != null) {
      CmsTopic topic = cmsTopicMng.findById(topicId);
      if (topic == null) {
        return FrontUtils.pageNotFound(request, response, model);
      }
      model.addAttribute("topic", topic);
      String tpl = topic.getTplContent();
      if (StringUtils.isBlank(tpl)) {
        tpl = FrontUtils.getTplPath(request, site.getSolutionPath(),
            TPLDIR_TOPIC, TOPIC_DEFAULT);
      }
      return tpl;
    } else if (channelId != null) {
      Channel channel = channelMng.findById(channelId);
      if (channel != null) {
        model.addAttribute("channel", channel);
      } else {
        return FrontUtils.pageNotFound(request, response, model);
      }
      return FrontUtils.getTplPath(request, site.getSolutionPath(),
          TPLDIR_TOPIC, TOPIC_CHANNEL);
    } else {
      return FrontUtils.getTplPath(request, site.getSolutionPath(),
          TPLDIR_TOPIC, TOPIC_INDEX);
    }
  }
View Full Code Here

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

  }

  @RequestMapping(value = "/topic/{id}.jspx", method = RequestMethod.GET)
  public String topic(@PathVariable Integer id, HttpServletRequest request,
      HttpServletResponse response, ModelMap model) {
    CmsSite site = CmsUtils.getSite(request);
    if (id == null) {
      return FrontUtils.pageNotFound(request, response, model);
    }
    CmsTopic topic = cmsTopicMng.findById(id);
    if (topic == null) {
      return FrontUtils.pageNotFound(request, response, model);
    }
    model.addAttribute("topic", topic);
    String tpl = topic.getTplContent();
    if (StringUtils.isBlank(tpl)) {
      tpl = FrontUtils.getTplPath(request, site.getSolutionPath(),
          TPLDIR_TOPIC, TOPIC_DEFAULT);
    }
    FrontUtils.frontData(request, model, site);
    FrontUtils.frontPageData(request, model);
    return tpl;
View Full Code Here

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

  @RequestMapping(value = "/search*.jspx", method = RequestMethod.GET)
  public String index(HttpServletRequest request,
      HttpServletResponse response, ModelMap model) {

    CmsSite site = CmsUtils.getSite(request);
    // 将request中所有参数保存至model中。
    model.putAll(RequestUtils.getQueryParams(request));
    FrontUtils.frontData(request, model, site);
    FrontUtils.frontPageData(request, model);
    String q = RequestUtils.getQueryParam(request, "q")==null?"":RequestUtils.getQueryParam(request, "q");

    if(q.equals("?")||q.equals("*")){
      return FrontUtils.getTplPath(request, site.getSolutionPath(),
          TPLDIR_SPECIAL, SEARCH_ERROR);
    }
    if(q.startsWith("?")||q.startsWith("*")){
      model.addAttribute("oldq",q);
      q=q.substring(1);
      //替换关键词
      model.addAttribute("q",q);
    }
    String channelId = RequestUtils.getQueryParam(request, "channelId");
    if (StringUtils.isBlank(q) && StringUtils.isBlank(channelId)) {
      model.remove("q");
      model.remove("channelId");
      return FrontUtils.getTplPath(request, site.getSolutionPath(),
          TPLDIR_SPECIAL, SEARCH_INPUT);
    } else {
      return FrontUtils.getTplPath(request, site.getSolutionPath(),
          TPLDIR_SPECIAL, SEARCH_RESULT);
    }
  }
View Full Code Here

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

  @RequestMapping(value = "/comment*.jspx", method = RequestMethod.GET)
  public String page(Integer contentId, Integer pageNo,
      HttpServletRequest request, HttpServletResponse response,
      ModelMap model) {
    CmsSite site = CmsUtils.getSite(request);
    Content content = contentMng.findById(contentId);
    if (content == null) {
      return FrontUtils.showMessage(request, model,
          "comment.contentNotFound");
    }
    if (content.getChannel().getCommentControl() == ChannelExt.COMMENT_OFF) {
      return FrontUtils.showMessage(request, model, "comment.closed");
    }
    // 将request中所有参数保存至model中。
    model.putAll(RequestUtils.getQueryParams(request));
    FrontUtils.frontData(request, model, site);
    FrontUtils.frontPageData(request, model);
    model.addAttribute("content", content);
    return FrontUtils.getTplPath(request, site.getSolutionPath(),
        TPLDIR_SPECIAL, COMMENT_PAGE);
  }
View Full Code Here

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

    List<CmsComment> list = cmsCommentMng.getListForTag(siteId, contentId,
        greatTo, chk, rec, desc, count);
    // 将request中所有参数
    model.putAll(RequestUtils.getQueryParams(request));
    model.addAttribute("list", list);
    CmsSite site = CmsUtils.getSite(request);
    FrontUtils.frontData(request, model, site);
    return FrontUtils.getTplPath(request, site.getSolutionPath(),
        TPLDIR_CSI, COMMENT_LIST);
  }
View Full Code Here

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

  @RequestMapping(value = "/comment.jspx", method = RequestMethod.POST)
  public void submit(Integer contentId, String text, String captcha,
      HttpServletRequest request, HttpServletResponse response,
      ModelMap model) throws JSONException {
    CmsSite site = CmsUtils.getSite(request);
    CmsUser user = CmsUtils.getUser(request);
    JSONObject json = new JSONObject();
    if (contentId == null) {
      json.put("success", false);
      json.put("status", 100);
      ResponseUtils.renderJson(response, json.toString());
      return;
    }
    if (StringUtils.isBlank(text)) {
      json.put("success", false);
      json.put("status", 101);
      ResponseUtils.renderJson(response, json.toString());
      return;
    }
    if (user == null || user.getGroup().getNeedCaptcha()) {
      // 验证码错误
      try {
        if (!imageCaptchaService.validateResponseForID(session
            .getSessionId(request, response), captcha)) {
          json.put("success", false);
          json.put("status", 1);
          ResponseUtils.renderJson(response, json.toString());
          return;
        }
      } catch (CaptchaServiceException e) {
        json.put("success", false);
        json.put("status", 1);
        log.warn("", e);
        ResponseUtils.renderJson(response, json.toString());
        return;
      }
    }
    Content content = contentMng.findById(contentId);
    if (content == null) {
      // 内容不存在
      json.put("success", false);
      json.put("status", 2);
    } else if (content.getChannel().getCommentControl() == ChannelExt.COMMENT_OFF) {
      // 评论关闭
      json.put("success", false);
      json.put("status", 3);
    } else if (content.getChannel().getCommentControl() == ChannelExt.COMMENT_LOGIN
        && user == null) {
      // 需要登录才能评论
      json.put("success", false);
      json.put("status", 4);
    } else {
      boolean checked = false;
      Integer userId = null;
      if (user != null) {
        checked = !user.getGroup().getNeedCheck();
        userId = user.getId();
      }
      cmsCommentMng.comment(text, RequestUtils.getIpAddr(request),
          contentId, site.getId(), userId, checked, false);
      json.put("success", true);
      json.put("status", 0);
    }
    ResponseUtils.renderJson(response, json.toString());
  }
View Full Code Here

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

  @Override
  public boolean preHandle(HttpServletRequest request,
      HttpServletResponse response, Object handler) throws Exception {
    // 获得站点
    CmsSite site = getSite(request, response);
    CmsUtils.setSite(request, site);
    // Site加入线程变量
    CmsThreadVariable.setSite(site);

    // 获得用户
View Full Code Here

Examples of org.jabusuite.cms.CmsSite

    }

    protected void createTestPages() {
        try {
            CmsSitesRemote sites = (CmsSitesRemote) ClientTools.getRemoteBean(CmsSitesRemote.class);
            CmsSite site = sites.findDataset(1);
            /*
            if (site == null) {
            site = new CmsSite(ClientGlobals.getUser(), ClientGlobals.getCompany());
            site.setId(1);
            site.setTitle("GS-Networks");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.