コード例 #1
0
  @RequestMapping(
      value = {HELP_EDIT_FI, HELP_EDIT_SV},
      method = GET)
  public String helpEdit(
      @PathVariable("helpPage") String localizedPageName, Model model, Locale locale) {

    Urls urls = Urls.get(locale);

    model.addAttribute(ALT_URI_ATTR, urls.alt().help(""));
    model.addAttribute("helpPage", localizedPageName);
    model.addAttribute("categoryLinksMap", infoTextService.getOmSubjectList(locale));
    model.addAttribute("content", infoTextService.getDraft(localizedPageName));
    model.addAttribute("urls", urls);

    return HELP_EDIT_VIEW;
  }
コード例 #2
0
  @RequestMapping(
      value = {NEWS_FI, NEWS_SV},
      method = GET)
  public String news(Model model, Locale locale) {
    Urls urls = Urls.get(locale);

    String pageUri = HelpPage.NEWS.getUri(locale.toLanguageTag());

    model.addAttribute(ALT_URI_ATTR, urls.alt().news());
    model.addAttribute("content", infoTextService.getPublished(pageUri));
    model.addAttribute("pageUri", pageUri);
    model.addAttribute("omUser", userService.getCurrentUser().isOm());

    addPiwicIdIfNotAuthenticated(model);

    return NEWS_VIEW;
  }
コード例 #3
0
  @RequestMapping(
      value = {HELP_FI, HELP_SV},
      method = GET)
  public String help(
      @PathVariable("helpPage") String localizedPageName, Model model, Locale locale) {
    Urls urls = Urls.get(locale);

    model.addAttribute(ALT_URI_ATTR, urls.alt().help(""));
    model.addAttribute("helpPage", localizedPageName);
    model.addAttribute("categoryLinksMap", infoTextService.getPublicSubjectList(locale));
    model.addAttribute("content", infoTextService.getPublished(localizedPageName));
    model.addAttribute("urls", urls);
    model.addAttribute("omUser", userService.getCurrentUser().isOm());

    addPiwicIdIfNotAuthenticated(model);

    return HELP_VIEW;
  }
コード例 #4
0
  @RequestMapping(
      value = {HELP_EDIT_FI, HELP_EDIT_SV},
      method = POST,
      params = ACTION_EDITOR_PUBLISH_DRAFT)
  public String publishDraft(
      @PathVariable("helpPage") String localizedPageName,
      Locale locale,
      HttpServletRequest request) {

    infoTextService.publishDraft(localizedPageName);

    return redirectWithMessage(
        Urls.get(locale).helpEdit(localizedPageName), RequestMessage.EDITOR_PUBLISH_DRAFT, request);
  }
コード例 #5
0
  @RequestMapping(
      value = {HELP_EDIT_FI, HELP_EDIT_SV},
      method = POST,
      params = ACTION_EDITOR_SAVE_DRAFT)
  public String helpEdit(
      @PathVariable("helpPage") String localizedPageName,
      @RequestParam(value = "content", required = true) String content,
      @RequestParam(value = "subject", required = true) String subject,
      Model model,
      Locale locale,
      HttpServletRequest request) {

    infoTextService.updateDraft(localizedPageName, content, subject);

    return redirectWithMessage(
        Urls.get(locale).helpEdit(localizedPageName), RequestMessage.EDITOR_SAVE_DRAFT, request);
  }