Package ru.org.linux.group

Examples of ru.org.linux.group.Group


    ModelAndView mv = new ModelAndView("view-news-archive");

    Section section = sectionService.getSection(sectionid);
    mv.getModel().put("section", section);

    Group group = null;
    if (groupName!=null) {
      group = groupDao.getGroup(section, groupName);
    }

    mv.getModel().put("group", group);
View Full Code Here


            request.isSecure(),
            tmpl.getCurrentUser(),
            messageText
    );

    Group group = preparedMessage.getGroup();

    if (!group.getUrlName().equals(groupName) || group.getSectionId() != section.getId()) {
      return new ModelAndView(new RedirectView(topic.getLink()));
    }

    boolean showDeleted = request.getParameter("deleted") != null;
    if (showDeleted) {
View Full Code Here

            request.isSecure(),
            tmpl.getCurrentUser(),
            messageText
    );

    Group group = preparedMessage.getGroup();

    if (!group.getUrlName().equals(groupName) || group.getSectionId() != section.getId()) {
      return new ModelAndView(new RedirectView(topic.getLink()+"?output=rss"));
    }

    if (topic.isExpired()) {
      throw new MessageNotFoundException(topic.getId(), "no more comments");
View Full Code Here

            bonus = deleteInfo.getBonus();
          }
        }
      }

      Group group = groupDao.getGroup(event.getGroupId());

      prepared.add(new PreparedUserEvent(event, text, commentAuthor, bonus, group));
    }

    return prepared;
View Full Code Here

   */
  public String formatJump(TopicDao messageDao, boolean secure) throws MessageNotFoundException, URIException {
    if(_topic_id != -1) {
      Topic message = messageDao.getById(_topic_id);

      Group group = messageDao.getGroup(message);

      String scheme;
      if(secure) {
        scheme = "https";
      } else {
        scheme = "http";
      }
      String host = getHost();
      int port = getPort();
      String path = group.getUrl() + _topic_id;
      String query = "";
      if(_comment_id != -1) {
        query = "cid=" + _comment_id;
      }
      URI jumpUri = new URI(scheme, null , host, port, path, query);
View Full Code Here

    if (topic.isExpired()) {
      errors.reject(null, "Сообщение уже устарело");
      return;
    }

    Group group = groupDao.getGroup(topic.getGroupId());

    if (!isCommentsAllowed(group, topic, user)) {
      errors.reject(null, "Вы не можете добавлять комментарии в эту тему");
    }
  }
View Full Code Here

    return effective;
  }

  public int getPostscore(Topic topic) {
    Group group = groupDao.getGroup(topic.getGroupId());

    return getPostscore(group, topic);
  }
View Full Code Here

    final Topic message = preparedTopic.getMessage();

    params.put("message", message);
    params.put("preparedMessage", preparedTopic);

    Group group = preparedTopic.getGroup();
    params.put("group", group);

    params.put("groups", groupDao.getGroups(preparedTopic.getSection()));

    params.put("newMsg", message);

    TopicMenu topicMenu = prepareService.getTopicMenu(
            preparedTopic,
            currentUser,
            secure,
            profile,
            true
    );

    params.put("topicMenu", topicMenu);

    List<EditHistoryDto> editInfoList = editHistoryService.getEditInfo(message.getId(), EditHistoryObjectTypeEnum.TOPIC);
    if (!editInfoList.isEmpty()) {
      params.put("editInfo", editInfoList.get(0));

      ImmutableSet<User> editors = editHistoryService.getEditorUsers(message, editInfoList);

      ImmutableMap.Builder<Integer,Integer> editorBonus = ImmutableMap.builder();
      for (User editor : editors) {
        if (currentUser.getId() == editor.getId()) {
          editorBonus.put(editor.getId(), 0);
        } else {
          editorBonus.put(editor.getId(), 1);
        }
      }

      form.setEditorBonus(editorBonus.build());
     
      params.put("editors", editors);
    }

    params.put("commit", false);

    if (group.isLinksAllowed()) {
      form.setLinktext(message.getLinktext());
      form.setUrl(message.getUrl());
    }

    form.setTitle(StringEscapeUtils.unescapeHtml(message.getTitle()));
View Full Code Here

    Map<String, Object> params = new HashMap<>();

    final Topic message = messageDao.getById(msgid);
    PreparedTopic preparedTopic = prepareService.prepareTopic(message, request.isSecure(), tmpl.getCurrentUser());
    Group group = preparedTopic.getGroup();

    User user = tmpl.getCurrentUser();

    IPBlockDao.checkBlockIP(ipBlockInfo, errors, user);

    boolean tagsEditable = permissionService.isTagsEditable(preparedTopic, user);
    boolean editable = permissionService.isEditable(preparedTopic, user);

    if (!editable && !tagsEditable) {
      throw new AccessViolationException("это сообщение нельзя править");
    }

    params.put("message", message);
    params.put("preparedMessage", preparedTopic);
    params.put("group", group);
    params.put("topicMenu", prepareService.getTopicMenu(
            preparedTopic,
            tmpl.getCurrentUser(),
            request.isSecure(),
            tmpl.getProf(),
            true
    ));

    params.put("groups", groupDao.getGroups(preparedTopic.getSection()));

    if (editable) {
      String title = request.getParameter("title");
      if (title == null || title.trim().isEmpty()) {
        throw new BadInputException("заголовок сообщения не может быть пустым");
      }
    }

    boolean preview = request.getParameter("preview") != null;
    if (preview) {
      params.put("info", "Предпросмотр");
    }

    boolean publish = request.getParameter("publish") != null;

    List<EditHistoryDto> editInfoList = editHistoryService.getEditInfo(message.getId(), EditHistoryObjectTypeEnum.TOPIC);

    if (!editInfoList.isEmpty()) {
      EditHistoryDto editHistoryDto = editInfoList.get(0);
      params.put("editInfo", editHistoryDto);

      if (lastEdit == null || editHistoryDto.getEditdate().getTime()!=lastEdit) {
        errors.reject(null, "Сообщение было отредактировано независимо");
      }
    }

    boolean commit = request.getParameter("commit") != null;

    if (commit) {
      user.checkCommit();
      if (message.isCommited()) {
        throw new BadInputException("сообщение уже подтверждено");
      }
    }

    params.put("commit", !message.isCommited() && preparedTopic.getSection().isPremoderated() && user.isModerator());

    Topic newMsg = new Topic(group, message, form, publish);

    boolean modified = false;

    if (!message.getTitle().equals(newMsg.getTitle())) {
      modified = true;
    }
   
    if (form.getMsg()!=null) {
      String oldText = msgbaseDao.getMessageText(message.getId()).getText();
 
      if (!oldText.equals(form.getMsg())) {
        modified = true;
      }
    }
   
    if (message.getLinktext() == null) {
      if (newMsg.getLinktext() != null) {
        modified = true;
      }
    } else if (!message.getLinktext().equals(newMsg.getLinktext())) {
      modified = true;
    }

    if (group.isLinksAllowed()) {
      if (message.getUrl() == null) {
        if (newMsg.getUrl() != null) {
          modified = true;
        }
      } else if (!message.getUrl().equals(newMsg.getUrl())) {
        modified = true;
      }
    }

    if (!editable && modified) {
      throw new AccessViolationException("нельзя править это сообщение, только теги");
    }

    if (form.getMinor()!=null && !tmpl.isModeratorSession()) {
      throw new AccessViolationException("вы не можете менять статус новости");
    }

    List<String> newTags = null;

    if (form.getTags()!=null) {
      newTags = TagName.parseAndSanitizeTags(form.getTags());
    }

    if (changeGroupId != null) {
      if (message.getGroupId() != changeGroupId) {
        Group changeGroup = groupDao.getGroup(changeGroupId);

        int section = message.getSectionId();

        if (changeGroup.getSectionId() != section) {
          throw new AccessViolationException("Can't move topics between sections");
        }
      }
    }
View Full Code Here

    HttpServletRequest request,
    @PathVariable("id") int msgid
  ) throws Exception {
    Topic message = messageDao.getById(msgid);
    Template tmpl = Template.getTemplate(request);
    Group group = groupDao.getGroup(message.getGroupId());

    topicPermissionService.checkView(group, message, tmpl.getCurrentUser(), false);

    List<PreparedEditHistory> editHistories = editHistoryService.prepareEditInfo(message, request.isSecure());
View Full Code Here

TOP

Related Classes of ru.org.linux.group.Group

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.