aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/UserThread.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2014-03-18 06:11:00 +0700
committerGravatar Ugnich Anton2014-03-18 06:11:00 +0700
commitc137f9c5acdb896a04569c5276cc53eaa68a5b2b (patch)
tree32df4ebe3dd76a9eee03dc1ee7baddc31d1a68bb /src/java/com/juick/http/www/UserThread.java
parent9fae780d462eee90dc1c3891308f436699342e7d (diff)
Login dialog in javascript
Diffstat (limited to 'src/java/com/juick/http/www/UserThread.java')
-rw-r--r--src/java/com/juick/http/www/UserThread.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index 8496fbe4..6b42d4a1 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -260,9 +260,9 @@ public class UserThread {
out.println("<ul id=\"replies\">");
if (listview) {
- printList(out, replies);
+ printList(out, replies, visitor);
} else {
- printTree(out, replies, 0, 0, false);
+ printTree(out, replies, visitor, 0, 0, false);
}
out.println("</ul>");
@@ -273,7 +273,7 @@ public class UserThread {
}
}
- public static void printTree(PrintWriter out, ArrayList<com.juick.Message> replies, int ReplyTo, int margin, boolean hidden) {
+ public static void printTree(PrintWriter out, ArrayList<com.juick.Message> replies, com.juick.User visitor, int ReplyTo, int margin, boolean hidden) {
if (margin > 240) {
margin = 240;
}
@@ -302,6 +302,8 @@ public class UserThread {
if (msg.VisitorCanComment) {
out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
+ } else if (visitor == null) {
+ out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return openDialogLogin()\">Ответить</a></div>");
}
int childs = msg.getChildsCount();
@@ -313,15 +315,15 @@ public class UserThread {
out.println(" </li>");
if (ReplyTo == 0 && childs > 1 && replies.size() > 10) {
- printTree(out, msg.childs, msg.RID, margin + 20, true);
+ printTree(out, msg.childs, visitor, msg.RID, margin + 20, true);
} else if (childs > 0) {
- printTree(out, msg.childs, msg.RID, margin + 20, hidden);
+ printTree(out, msg.childs, visitor, msg.RID, margin + 20, hidden);
}
}
}
}
- public static void printList(PrintWriter out, ArrayList<com.juick.Message> replies) {
+ public static void printList(PrintWriter out, ArrayList<com.juick.Message> replies, com.juick.User visitor) {
for (int i = 0; i < replies.size(); i++) {
com.juick.Message msg = replies.get(i);
@@ -342,6 +344,8 @@ public class UserThread {
if (msg.VisitorCanComment) {
out.println(" &#183; <a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
+ } else if (visitor == null) {
+ out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return openDialogLogin()\">Ответить</a></div>");
}
out.println(" </div>");
out.println(" </li>");