Package ru.org.linux.site

Examples of ru.org.linux.site.Template


  public ModelAndView vote(
    ServletRequest request,
    @RequestParam(value="vote", required = false) int[] votes,
    @RequestParam("voteid") int voteid
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    User user = tmpl.getCurrentUser();

    Poll poll = pollDao.getCurrentPoll();
    Topic msg = messageDao.getById(poll.getTopicId());

    if (voteid != poll.getId()) {
View Full Code Here


  @RequestMapping(value="/vote-vote.jsp", method=RequestMethod.GET)
  public ModelAndView showForm(
    @RequestParam("msgid") int msgid,
    HttpServletRequest request
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    Map<String, Object> params = new HashMap<>();
View Full Code Here

          HttpServletRequest request,
          @RequestParam("msgid") int msgid
  ) throws Exception {
    Map<String, Object> params = new HashMap<>();

    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("нет авторизации");
    }

    params.put("msgid", msgid);

    Comment comment = commentService.getById(msgid);

    if (comment.isDeleted()) {
      throw new UserErrorException("комментарий уже удален");
    }

    int topicId = comment.getTopicId();

    Topic topic = messageDao.getById(topicId);

    if (topic.isDeleted()) {
      throw new AccessViolationException("тема удалена");
    }

    params.put("topic", topic);

    CommentList comments = commentService.getCommentList(topic, tmpl.isModeratorSession());

    CommentFilter cv = new CommentFilter(comments);

    List<Comment> list = cv.getCommentsSubtree(msgid);
View Full Code Here

  ) throws Exception {
    if (bonus < 0 || bonus > 20) {
      throw new BadParameterException("неправильный размер штрафа");
    }

    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("нет авторизации");
    }

    User user = tmpl.getCurrentUser();
    user.checkBlocked();
    user.checkAnonymous();

    Comment comment = commentService.getById(msgid);
View Full Code Here

      formParams.put("postscoreInfo", TopicPermissionService.getPostScoreInfo(postscore));
      topicPermissionService.checkCommentsAllowed(commentRequest.getTopic(), user, errors);
      formParams.put("comment", commentPrepareService.prepareCommentForEdit(comment, msg, request.isSecure()));
    }

    Template tmpl = Template.getTemplate(request);

    boolean editable = topicPermissionService.isCommentsEditingAllowed(
            commentRequest.getOriginal(),
            commentRequest.getTopic(),
            tmpl.getCurrentUser()
    );

    if (!editable) {
      throw new AccessViolationException("у Вас нет прав на редактирование этого сообщения");
    }
View Full Code Here

  public ModelAndView changeTagShowFormHandler(
    HttpServletRequest request,
    @RequestParam(value = "firstLetter", required = false, defaultValue = "") String firstLetter,
    @RequestParam("tagName") String oldTagName
  ) throws AccessViolationException {
    Template template = Template.getTemplate(request);
    if (!template.isModeratorSession()) {
      throw new AccessViolationException(REJECT_REASON);
    }
    TagRequest.Change tagRequestChange = new TagRequest.Change();
    tagRequestChange.setOldTagName(oldTagName);
    tagRequestChange.setTagName(oldTagName);
View Full Code Here

    HttpServletRequest request,
    @RequestParam(value = "firstLetter", required = false, defaultValue = "") String firstLetter,
    @ModelAttribute("tagRequestChange") TagRequest.Change tagRequestChange,
    Errors errors
  ) throws AccessViolationException {
    Template template = Template.getTemplate(request);
    if (!template.isModeratorSession()) {
      throw new AccessViolationException(REJECT_REASON);
    }

    tagModificationService.change(tagRequestChange.getOldTagName(), tagRequestChange.getTagName(), errors);

    if (!errors.hasErrors()) {
      logger.info(
              "Тег '{}' изменен пользователем {}",
              tagRequestChange.getOldTagName(),
              template.getNick()
      );

      return redirectToListPage(tagRequestChange.getTagName());
    }
View Full Code Here

  public ModelAndView deleteTagShowFormHandler(
    HttpServletRequest request,
    @RequestParam(value = "firstLetter", required = false, defaultValue = "") String firstLetter,
    @RequestParam("tagName") String oldTagName
  ) throws AccessViolationException {
    Template template = Template.getTemplate(request);
    if (!template.isModeratorSession()) {
      throw new AccessViolationException(REJECT_REASON);
    }
    TagRequest.Delete tagRequestDelete = new TagRequest.Delete();
    tagRequestDelete.setOldTagName(oldTagName);
    ModelAndView modelAndView = new ModelAndView("tags-delete");
View Full Code Here

    HttpServletRequest request,
    @RequestParam(value = "firstLetter", required = false, defaultValue = "") String firstLetter,
    @ModelAttribute("tagRequestDelete") TagRequest.Delete tagRequestDelete,
    Errors errors
  ) throws AccessViolationException {
    Template template = Template.getTemplate(request);
    if (!template.isModeratorSession()) {
      throw new AccessViolationException(REJECT_REASON);
    }

    tagModificationService.delete(tagRequestDelete.getOldTagName(), tagRequestDelete.getTagName(), errors);

    if (!errors.hasErrors()) {
      logger.info(
              "Тег '{}' удален пользователем {}",
              tagRequestDelete.getOldTagName(),
              template.getNick()
      );
      return redirectToListPage(firstLetter);
    }

    ModelAndView modelAndView = new ModelAndView("tags-delete");
View Full Code Here

  @RequestMapping(value="/people/{nick}/deleted-comments")
  public ModelAndView showCommentsOld(
    @PathVariable String nick,
    HttpServletRequest request
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);
    if (!tmpl.isModeratorSession()) {
      throw new AccessViolationException("Not moderator");
    }

    ModelAndView mv = new ModelAndView("deleted-comments");
View Full Code Here

TOP

Related Classes of ru.org.linux.site.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.