Package ru.org.linux.poll

Examples of ru.org.linux.poll.Poll


    if (!preparedTopic.getTags().isEmpty()) {
      form.setTags(TagRef.names(preparedTopic.getTags()));
    }

    if (preparedTopic.getSection().isPollPostAllowed()) {
      Poll poll = pollDao.getPollByTopicId(message.getId());

      form.setPoll(PollVariant.toMap(poll.getVariants()));

      form.setMultiselect(poll.isMultiSelect());
    }

    return new ModelAndView("edit", params);
  }
View Full Code Here


          throw new AccessViolationException("Can't move topics between sections");
        }
      }
    }

    Poll newPoll = null;

    if (preparedTopic.getSection().isPollPostAllowed() && form.getPoll() != null && tmpl.isModeratorSession()) {
      newPoll = buildNewPoll(message, form);
    }

    String newText;

    if (form.getMsg() != null) {
      newText = form.getMsg();
    } else {
      newText = msgbaseDao.getMessageText(message.getId()).getText();
    }

    if (form.getEditorBonus() != null) {
      ImmutableSet<Integer> editors = editHistoryService.getEditors(message, editInfoList);

      for (int userid : form.getEditorBonus().keySet()) {
        if (!editors.contains(userid)) {
          errors.reject("editorBonus", "некорректный корректор?!");
        }
      }
    }

    if (!preview && !errors.hasErrors() && ipBlockInfo.isCaptchaRequired()) {
      captcha.checkCaptcha(request, errors);
    }

    if (!preview && !errors.hasErrors()) {
      boolean changed = topicService.updateAndCommit(
              newMsg,
              message,
              user,
              newTags,
              newText,
              commit,
              changeGroupId,
              form.getBonus(),
              newPoll!=null?newPoll.getVariants():null,
              form.isMultiselect(),
              form.getEditorBonus()
      );

      if (changed || commit || publish) {
View Full Code Here

    return new ModelAndView("edit", params);
  }

  private Poll buildNewPoll(Topic message, EditTopicRequest form) throws PollNotFoundException {
    Poll poll = pollDao.getPollByTopicId(message.getId());

    List<PollVariant> newVariants = new ArrayList<>();

    for (PollVariant v : poll.getVariants()) {
      String label = form.getPoll().get(v.getId());

      if (!Strings.isNullOrEmpty(label)) {
        newVariants.add(new PollVariant(v.getId(), label));
      }
    }

    for (String label : form.getNewPoll()) {
      if (!Strings.isNullOrEmpty(label)) {
        newVariants.add(new PollVariant(0, label));
      }
    }

    return poll.createNew(newVariants);
  }
View Full Code Here

      if (section.isImagepost() && scrn == null && !errors.hasErrors()) {
        errors.reject(null, "Изображение отсутствует");
      }
    }

    Poll poll = null;
   
    if (section!=null && section.isPollPostAllowed()) {
      poll = preparePollPreview(form);
    }
View Full Code Here

      if (!Strings.isNullOrEmpty(item)) {
        variants.add(new PollVariant(0, item));
      }
    }

    return new Poll(0, 0, form.isMultiSelect(), false, variants);
  }
View Full Code Here

TOP

Related Classes of ru.org.linux.poll.Poll

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.