diff options
Diffstat (limited to 'juick-www')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/UserThread.java | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java index 0aeac4c6..c3a2a24e 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java +++ b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java @@ -244,6 +244,32 @@ public class UserThread { } } + boolean foldable = false; + if (replies.size() > 10) { + for (int i = 0; i < replies.size() - 1; i++) { + if (replies.get(i).getChildsCount() > 1) { + foldable = true; + break; + } + } + } + + out.println("<div class=\"title2\">"); + out.print(" <div class=\"title2-right\">"); + if (listview) { + out.print("<a href=\"?view=tree\" rel=\"nofollow\">Показать деревом</a>"); + } else { + if (foldable) { + out.print("<span id=\"unfoldall\"><a href=\"#\">Раскрыть все</a> · </span>"); + } + out.print("<a href=\"?view=list\" rel=\"nofollow\">Показать списком</a>"); + } + out.print("</div>"); + out.println(" <h2>Ответы (" + replies.size() + ")</h2>"); + out.println("</div>"); + + out.println("<ul id=\"replies\">"); + if (!replies.isEmpty()) { if (visitor.getUid() > 0 && msg.getUser().getUid() == visitor.getUid()) { for (Message reply : replies) { @@ -260,43 +286,19 @@ public class UserThread { } } - boolean foldable = false; - if (replies.size() > 10) { - for (int i = 0; i < replies.size() - 1; i++) { - if (replies.get(i).getChildsCount() > 1) { - foldable = true; - break; - } - } - } - - out.println("<div class=\"title2\">"); - out.print(" <div class=\"title2-right\">"); - if (listview) { - out.print("<a href=\"?view=tree\" rel=\"nofollow\">Показать деревом</a>"); - } else { - if (foldable) { - out.print("<span id=\"unfoldall\"><a href=\"#\">Раскрыть все</a> · </span>"); - } - out.print("<a href=\"?view=list\" rel=\"nofollow\">Показать списком</a>"); - } - out.print("</div>"); - out.println(" <h2>Ответы (" + replies.size() + ")</h2>"); - out.println("</div>"); - - out.println("<ul id=\"replies\">"); if (listview) { printList(out, replies, visitor); } else { printTree(out, replies, visitor, 0, 0, false); } - out.println("</ul>"); for (Message reply : replies) { reply.cleanupChilds(); } replies.clear(); } + + out.println("</ul>"); } public void printTree(PrintWriter out, List<com.juick.Message> replies, com.juick.User visitor, int ReplyTo, int margin, boolean hidden) { |