From 8ccc09447b79c422f72e9e857a700e45ae5cbeb8 Mon Sep 17 00:00:00 2001 From: Maxim Valyanskiy Date: Tue, 15 Oct 2024 20:01:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81=20?= =?UTF-8?q?=D1=82=D0=BE=D0=BF=D0=B8=D0=BA=D0=B0=20=D0=BC=D0=B5=D0=B6=D0=B4?= =?UTF-8?q?=D1=83=20=D0=BD=D0=BE=D0=B2=D0=BE=D1=81=D1=82=D1=8F=D0=BC=D0=B8?= =?UTF-8?q?/=D0=B3=D0=B0=D0=BB=D0=B5=D1=80=D0=B5=D0=B5=D0=B9/=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../topic/TopicModificationController.scala | 21 ++++++--- src/main/webapp/WEB-INF/jsp/mtn.jsp | 47 +++++++++++-------- 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/src/main/scala/ru/org/linux/topic/TopicModificationController.scala b/src/main/scala/ru/org/linux/topic/TopicModificationController.scala index 7191cd8a44..f27e6e199e 100644 --- a/src/main/scala/ru/org/linux/topic/TopicModificationController.scala +++ b/src/main/scala/ru/org/linux/topic/TopicModificationController.scala @@ -1,5 +1,5 @@ /* - * Copyright 1998-2023 Linux.org.ru + * Copyright 1998-2024 Linux.org.ru * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -128,26 +128,35 @@ class TopicModificationController(prepareService: TopicPrepareService, messageDa } @RequestMapping(value = Array("/mt.jsp"), method = Array(RequestMethod.GET)) - def moveTopicFormForum(@RequestParam msgid: Int): ModelAndView = ModeratorOnly { _ => + def moveToForumForm(@RequestParam msgid: Int): ModelAndView = ModeratorOnly { _ => val topic = messageDao.getById(msgid) val section = sectionService.getSection(Section.SECTION_FORUM) new ModelAndView("mtn", Map ( "message" -> topic, - "groups" -> groupDao.getGroups(section), + "groups" -> groupDao.getGroups(section).asScala.map(g => g.id -> g.title).asJava, "author" -> userService.getUserCached(topic.authorUserId) ).asJava) } @RequestMapping(value = Array("/mtn.jsp"), method = Array(RequestMethod.GET)) @throws[Exception] - def moveTopicForm(@RequestParam msgid: Int): ModelAndView = ModeratorOnly { _ => + def movePremoderatedForm(@RequestParam msgid: Int): ModelAndView = ModeratorOnly { _ => val topic = messageDao.getById(msgid) - val section = sectionService.getSection(topic.sectionId) + + val currentSection = sectionService.getSection(topic.sectionId) + + val sections = if (currentSection.isPremoderated && !currentSection.isPollPostAllowed) { + sectionService.sections.filter(s => s.isPremoderated && !s.isPollPostAllowed) + } else { + Seq(currentSection) + } + + val groups = sections.flatMap(g => groupDao.getGroups(g).asScala) new ModelAndView("mtn", Map( "message" -> topic, - "groups" -> groupDao.getGroups(section), + "groups" -> groups.map(g => g.id -> s"${sectionService.getSection(g.sectionId).getTitle}: ${g.title}").asJava, "author" -> userService.getUserCached(topic.authorUserId) ).asJava) } diff --git a/src/main/webapp/WEB-INF/jsp/mtn.jsp b/src/main/webapp/WEB-INF/jsp/mtn.jsp index 08a987ac5a..097f098d8c 100644 --- a/src/main/webapp/WEB-INF/jsp/mtn.jsp +++ b/src/main/webapp/WEB-INF/jsp/mtn.jsp @@ -1,6 +1,6 @@ <%@ page contentType="text/html; charset=utf-8"%> <%-- - ~ Copyright 1998-2015 Linux.org.ru + ~ Copyright 1998-2024 Linux.org.ru ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at @@ -20,28 +20,37 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -Перенос +Перенос топика -перенос ${message.id} в группу: -
+ +

Перенос топика

+ + - - +
+ +
+ +
+ +
-сообщение написано -, score=${author.score} +

+ Сообщение написано , score=${author.score} +