diff options
author | Vitaly Takmazov | 2016-06-27 13:16:43 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-06-27 13:16:43 +0300 |
commit | 606f43f50904f7d811cf9b438e0e820e586be900 (patch) | |
tree | 55904b790d79ba15033469bd378342883322bb5d /src/main/java/com/juick/http/www/UserThread.java | |
parent | 0d93073c6988a22246db61a59b97c2fd7c9f462b (diff) |
spring-jdbc near complete
Diffstat (limited to 'src/main/java/com/juick/http/www/UserThread.java')
-rw-r--r-- | src/main/java/com/juick/http/www/UserThread.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/com/juick/http/www/UserThread.java b/src/main/java/com/juick/http/www/UserThread.java index 4ee290ab..638e3a3b 100644 --- a/src/main/java/com/juick/http/www/UserThread.java +++ b/src/main/java/com/juick/http/www/UserThread.java @@ -21,9 +21,10 @@ import com.juick.Message; import com.juick.Tag; import com.juick.server.MessagesQueries; import com.juick.server.UserQueries; +import org.springframework.jdbc.core.JdbcTemplate; + import java.io.IOException; import java.io.PrintWriter; -import java.sql.Connection; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; @@ -36,7 +37,7 @@ import javax.servlet.http.HttpServletResponse; */ public class UserThread { - protected void doGetThread(Connection sql, HttpServletRequest request, HttpServletResponse response, int MID) throws ServletException, IOException { + protected void doGetThread(JdbcTemplate 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.getUID() : 0)) { @@ -98,7 +99,7 @@ public class UserThread { } } - public static com.juick.Message printMessage(PrintWriter out, Connection sql, com.juick.Message msg, com.juick.User visitor) { + public static com.juick.Message printMessage(PrintWriter out, JdbcTemplate sql, com.juick.Message msg, com.juick.User visitor) { msg.VisitorCanComment = visitor != null; List<Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMID()); @@ -128,7 +129,7 @@ public class UserThread { out.println(" <div class=\"msg-cont\">"); out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.getMID() + "); return false\"></a></div>"); out.println(" <div class=\"msg-header\"><a href=\"/" + msg.getUser().getUName() + "/\">@" + msg.getUser().getUName() + "</a>:" + tagsStr + "</div>"); - out.println(" <div class=\"msg-ts\">" + PageTemplates.formatJSLocalTime(msg.TimestampString) + "</div>"); + out.println(" <div class=\"msg-ts\">" + PageTemplates.formatJSLocalTime(msg.getDate()) + "</div>"); out.println(" <div class=\"msg-txt\">" + txt + "</div>"); if (msg.AttachmentType != null) { @@ -189,7 +190,7 @@ public class UserThread { return msg; } - public static void printReplies(PrintWriter out, Connection sql, com.juick.Message msg, com.juick.User visitor, boolean listview) { + public static void printReplies(PrintWriter out, JdbcTemplate sql, com.juick.Message msg, com.juick.User visitor, boolean listview) { List<com.juick.Message> replies = MessagesQueries.getReplies(sql, msg.getMID()); List<Integer> blUIDs = new ArrayList<Integer>(); @@ -297,7 +298,7 @@ public class UserThread { } else { out.println(" <div class=\"msg-header\">[удалено]:</div>"); } - out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getMID() + "#" + msg.getRID() + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString) + "</a></div>"); + out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getMID() + "#" + msg.getRID() + "\" title=\"" + PageTemplates.sdfSQL.format(msg.getDate()) + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.getDate()) + "</a></div>"); out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.getText()) + "</div>"); if (msg.AttachmentType != null) { out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>"); @@ -341,7 +342,7 @@ public class UserThread { } else { out.println(" <div class=\"msg-header\">[удалено]:</div>"); } - out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getMID() + "#" + msg.getRID() + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString) + "</a></div>"); + out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getMID() + "#" + msg.getRID() + "\" title=\"" + PageTemplates.sdfSQL.format(msg.getDate()) + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.getDate()) + "</a></div>"); out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.getText()) + "</div>"); if (msg.AttachmentType != null) { out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>"); |