aboutsummaryrefslogtreecommitdiff
path: root/src/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java')
-rw-r--r--src/java/com/juick/http/www/UserThread.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index 3357f65c..095612d7 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse;
*/
public class UserThread {
- protected void doGetThread(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User user, int MID) throws ServletException, IOException {
+ protected void doGetThread(Connection sql, HttpServletRequest request, HttpServletResponse response, int MID) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
if (!MessagesQueries.canViewThread(sql, MID, visitor != null ? visitor.UID : 0)) {
@@ -41,6 +41,8 @@ public class UserThread {
return;
}
+ com.juick.Message msg = MessagesQueries.getMessage(sql, MID);
+
boolean listview = false;
String paramView = request.getParameter("view");
if (paramView != null) {
@@ -56,16 +58,16 @@ public class UserThread {
listview = true;
}
- String title = "@" + user.UName + " - #" + MID;
+ String title = msg.User.UName + ": " + msg.getTagsString();
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
try {
- PageTemplates.pageHead(out, title, "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + user.UName + "\" href=\"//rss.juick.com/" + user.UName + "/blog\"/>");
+ PageTemplates.pageHead(out, title, "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + msg.User.UName + "\" href=\"//rss.juick.com/" + msg.User.UName + "/blog\"/>");
PageTemplates.pageNavigation(out, visitor, null);
out.println("<section id=\"content\" style=\"margin-left: 0; width: 100%\">");
- com.juick.Message msg = printMessage(out, sql, user, MID, visitor);
+ printMessage(out, sql, msg, visitor);
printReplies(out, sql, msg, visitor, listview);
out.println("</section>");
@@ -77,9 +79,7 @@ public class UserThread {
}
}
- public static com.juick.Message printMessage(PrintWriter out, Connection sql, com.juick.User user, int mid, com.juick.User visitor) {
- com.juick.Message msg = MessagesQueries.getMessage(sql, mid);
-
+ public static com.juick.Message printMessage(PrintWriter out, Connection sql, com.juick.Message msg, com.juick.User visitor) {
msg.VisitorCanComment = visitor != null;
String tags = (msg.Tags.isEmpty()) ? "" : PageTemplates.formatTags(msg.Tags, msg.User);
@@ -114,7 +114,7 @@ public class UserThread {
}
out.println("<ul>");
- out.println(" <li id=\"msg-" + mid + "\" class=\"msg msgthread\">");
+ out.println(" <li id=\"msg-" + msg.MID + "\" class=\"msg msgthread\">");
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>");
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\"></a></div>");
@@ -123,7 +123,7 @@ public class UserThread {
out.println(" <div class=\"msg-txt\">" + txt + "</div>");
if (msg.AttachmentType != null) {
- out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + mid + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + mid + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
+ out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.MID + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.MID + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
}
boolean visitorInBL = false;
@@ -139,12 +139,12 @@ public class UserThread {
}
if (msg.VisitorCanComment) {
- out.println(" <form action=\"/post\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + mid + "\"/>");
+ out.println(" <form action=\"/post\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + msg.MID + "\"/>");
out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Написать комментарий\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>");
out.println(" </form>");
}
- ArrayList<String> recomm = MessagesQueries.getMessageRecommendations(sql, mid);
+ ArrayList<String> recomm = MessagesQueries.getMessageRecommendations(sql, msg.MID);
if (!recomm.isEmpty()) {
out.print(" <div class=\"" + (msg.VisitorCanComment ? "msg-recomms" : "msg-comments") + "\">Рекомендовали (" + recomm.size() + "): ");
for (int i = 0; i < recomm.size(); i++) {
@@ -159,19 +159,19 @@ public class UserThread {
out.println(" </li>");
out.println(" <li id=\"mtoolbar\"><ul>");
- out.println(" <li><a href=\"/" + mid + "\"><div style=\"background-position: -64px 0\"></div>" + mid + "</a></li>");
+ out.println(" <li><a href=\"/" + msg.MID + "\"><div style=\"background-position: -64px 0\"></div>" + msg.MID + "</a></li>");
if (visitor != null) {
if (visitor.UID != msg.User.UID) {
- if (MessagesQueries.isSubscribed(sql, visitor.UID, mid)) {
- out.println(" <li><a href=\"/post?body=U+%23" + mid + "\"><div style=\"background-position: -48px 0\"></div>Подписан</a></li>");
+ if (MessagesQueries.isSubscribed(sql, visitor.UID, msg.MID)) {
+ out.println(" <li><a href=\"/post?body=U+%23" + msg.MID + "\"><div style=\"background-position: -48px 0\"></div>Подписан</a></li>");
} else {
- out.println(" <li><a href=\"/post?body=S+%23" + mid + "\"><div style=\"background-position: -16px 0\"></div>Подписаться</a></li>");
+ out.println(" <li><a href=\"/post?body=S+%23" + msg.MID + "\"><div style=\"background-position: -16px 0\"></div>Подписаться</a></li>");
}
if (!visitorInBL) {
- out.println(" <li><a href=\"/post?body=%21+%23" + mid + "\"><div style=\"background-position: -32px 0\"></div>Рекомендовать</a></li>");
+ out.println(" <li><a href=\"/post?body=%21+%23" + msg.MID + "\"><div style=\"background-position: -32px 0\"></div>Рекомендовать</a></li>");
}
} else {
- out.println(" <li><a href=\"/post?body=D+%23" + mid + "\"><div style=\"background-position: 0\"></div>Удалить</a></li>");
+ out.println(" <li><a href=\"/post?body=D+%23" + msg.MID + "\"><div style=\"background-position: 0\"></div>Удалить</a></li>");
}
}
out.println(" </ul></li>");