From 3b460c49a7cbca72f367bc44ca111b2a508d0cac Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 28 Feb 2017 14:29:05 +0300 Subject: readonly mode --- .../main/java/com/juick/www/controllers/Home.java | 22 ++++++---- .../java/com/juick/www/controllers/NewMessage.java | 38 ++++++++-------- .../main/java/com/juick/www/controllers/PM.java | 5 +++ .../com/juick/www/controllers/PageTemplates.java | 50 ++++++++++++---------- .../java/com/juick/www/controllers/UserThread.java | 10 ++--- 5 files changed, 71 insertions(+), 54 deletions(-) (limited to 'juick-www/src/main/java') diff --git a/juick-www/src/main/java/com/juick/www/controllers/Home.java b/juick-www/src/main/java/com/juick/www/controllers/Home.java index 2f9dc903..405a4bd6 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Home.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Home.java @@ -176,15 +176,19 @@ public class Home { if (visitor.getUid() > 0) { out.println("
"); out.println("
"); - out.println(" "); - out.println("
"); - out.println(" " + - "или загрузить
"); - out.println("
"); - out.println(" "); - out.println("
"); + if (messagesService.isReadonly()) { + out.println("

Комментирование временно недоступно

"); + } else { + out.println(" "); + out.println("
"); + out.println(" " + + "или загрузить
"); + out.println("
"); + out.println(" "); + out.println("
"); + } out.println("
"); out.println("
"); } diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index b340546f..938cd338 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -98,26 +98,30 @@ public class NewMessage { templates.pageNavigation(out, visitor, null); out.println("
"); - out.println("
"); - out.println("

Место: Отменить

"); - out.println("

Фото: (JPG, PNG, до 10Мб)

"); - - String body = request.getParameter("body"); - if (body == null) { - body = StringUtils.EMPTY; + if (messagesService.isReadonly()) { + out.println("

Временно недоступно

"); } else { - if (body.length() > 4096) { - body = body.substring(0, 4096); + out.println(""); + out.println("

Место: Отменить

"); + out.println("

Фото: (JPG, PNG, до 10Мб)

"); + + String body = request.getParameter("body"); + if (body == null) { + body = StringUtils.EMPTY; + } else { + if (body.length() > 4096) { + body = body.substring(0, 4096); + } + body = StringEscapeUtils.escapeHtml4(body); } - body = StringEscapeUtils.escapeHtml4(body); - } - out.println("


"); + out.println("


"); - out.println("" + "" + "

"); - out.println("
"); - out.println("
"); - out.println("

Теги:

"); - printUserTags(out, visitor); + out.println("" + "" + "

"); + out.println(""); + out.println("
"); + out.println("

Теги:

"); + printUserTags(out, visitor); + } out.println("
"); templates.pageFooter(request, out, visitor, false); diff --git a/juick-www/src/main/java/com/juick/www/controllers/PM.java b/juick-www/src/main/java/com/juick/www/controllers/PM.java index 56b688cf..028feabc 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/PM.java +++ b/juick-www/src/main/java/com/juick/www/controllers/PM.java @@ -17,6 +17,7 @@ */ package com.juick.www.controllers; +import com.juick.service.MessagesService; import com.juick.service.PMQueriesService; import com.juick.service.TagService; import com.juick.service.UserService; @@ -55,6 +56,8 @@ public class PM { @Inject UserService userService; @Inject + MessagesService messagesService; + @Inject WebApp webApp; @RequestMapping(value = "/pm/inbox", method = RequestMethod.GET) @@ -70,6 +73,7 @@ public class PM { model.addAttribute("visitor", visitor); model.addAttribute("msgs", msgs); model.addAttribute("tags", tagService.getPopularTags()); + model.addAttribute("readonly", messagesService.isReadonly()); return "views/pm_inbox"; } @@ -92,6 +96,7 @@ public class PM { model.addAttribute("msgs", msgs); model.addAttribute("tags", tagService.getPopularTags()); model.addAttribute("uname", uname); + model.addAttribute("readonly", messagesService.isReadonly()); return "views/pm_sent"; } diff --git a/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java b/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java index eb241f7d..6ee18732 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java +++ b/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java @@ -81,9 +81,9 @@ public class PageTemplates { out.println(""); out.flush(); if (visitor.getUid() > 0) { - out.println(""); + out.println(""); } else { - out.println(""); + out.println(""); } } @@ -109,7 +109,9 @@ public class PageTemplates { out.print("
  • Рекомендации
  • "); out.println(""); out.print(" "); @@ -345,27 +347,29 @@ public class PageTemplates { if (msg.getAttachmentType() != null) { out.println("
    "); } - out.print(" "); out.print("