diff options
author | 2012-10-16 17:31:27 +0700 | |
---|---|---|
committer | 2012-10-16 17:31:27 +0700 | |
commit | c49e78bef068f4c4607d6d572366661e40b404be (patch) | |
tree | 25f6cfdbe413aa3209f93a5f39cf26e1dfb89124 /src/java/com/juick/http/www/PageTemplates.java | |
parent | cd3776013be1846fc7081371abaae4c8ae5ec9f1 (diff) |
blog title
Diffstat (limited to 'src/java/com/juick/http/www/PageTemplates.java')
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 74 |
1 files changed, 7 insertions, 67 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index 922bc922..a38b90f8 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -17,6 +17,7 @@ */ package com.juick.http.www; +import com.juick.server.UserQueries; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -56,7 +57,6 @@ public class PageTemplates { out.println(" <link rel=\"stylesheet\" href=\"http://static.juick.com/style3.css?2012030601\"/>"); out.println(" <link rel=\"icon\" type=\"image/png\" href=\"http://static.juick.com/favicon.png\"/>"); out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>"); - out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js\"></script>"); out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\"></script>"); out.println(" <script type=\"text/javascript\" src=\"http://static.juick.com/scripts3.js?20120306\"></script>"); out.println(" <script type=\"text/javascript\" src=\"http://static.juick.com/js/jquery.autoresize.js\"></script>"); @@ -135,73 +135,13 @@ public class PageTemplates { description = ""; } - // I read - int iread = 0; - try { - stmt = sql.prepareStatement("SELECT COUNT(*) FROM subscr_users WHERE suser_id=?"); - stmt.setInt(1, user.UID); - rs = stmt.executeQuery(); - if (rs.first()) { - iread = rs.getInt(1); - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - // My readers - int myreaders = 0; - try { - stmt = sql.prepareStatement("SELECT COUNT(*) FROM subscr_users WHERE user_id=?"); - stmt.setInt(1, user.UID); - rs = stmt.executeQuery(); - if (rs.first()) { - myreaders = rs.getInt(1); - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - // Messages - int messages = 0; - try { - stmt = sql.prepareStatement("SELECT COUNT(*) FROM messages WHERE user_id=?"); - stmt.setInt(1, user.UID); - rs = stmt.executeQuery(); - if (rs.first()) { - messages = rs.getInt(1); - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - // Replies - int replies = 0; - try { - stmt = sql.prepareStatement("SELECT COUNT(*) FROM replies WHERE user_id=?"); - stmt.setInt(1, user.UID); - rs = stmt.executeQuery(); - if (rs.first()) { - replies = rs.getInt(1); - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - out.println("<div id=\"title\">"); out.println(" <div id=\"title-av\"><a href=\"/" + user.UName + "/\"><img src=\"http://i.juick.com/a/" + user.UID + ".png\" width=\"96\" height=\"96\" alt=\"" + user.UName + "\"/></a></div>"); out.println(" <div id=\"title-stats\"><ul>"); - out.println(" <li><a href=\"/" + user.UName + "/friends\">" + rb.getString("(Stats) I read") + ": " + iread + "</a></li>"); - out.println(" <li><a href=\"/" + user.UName + "/readers\">" + rb.getString("(Stats) My readers") + ": " + myreaders + "</a></li>"); - out.println(" <li>" + rb.getString("(Stats) Messages") + ": " + messages + "</li>"); - out.println(" <li>" + rb.getString("(Stats) Replies") + ": " + replies + "</li>"); + out.println(" <li><a href=\"/" + user.UName + "/friends\">" + rb.getString("(Stats) I read") + ": " + UserQueries.getStatsIRead(sql, user.UID) + "</a></li>"); + out.println(" <li><a href=\"/" + user.UName + "/readers\">" + rb.getString("(Stats) My readers") + ": " + UserQueries.getStatsMyReaders(sql, user.UID) + "</a></li>"); + out.println(" <li>" + rb.getString("(Stats) Messages") + ": " + UserQueries.getStatsMessages(sql, user.UID) + "</li>"); + out.println(" <li>" + rb.getString("(Stats) Replies") + ": " + UserQueries.getStatsReplies(sql, user.UID) + "</li>"); out.println(" </ul></div>"); out.println(" <div id=\"title-username\"><h1>" + fullname + "</h1><p>" + description + "</p></div>"); out.println("</div>"); @@ -407,7 +347,7 @@ public class PageTemplates { out.println(" <div class=\"msg-comments\"><a href=\"/" + uname + "/" + mid + "\">" + formatReplies(rs.getInt(10), locale) + "</a> " + rb.getString("(replies) by") + " " + repliesby + "</div>"); } else if (cancomment) { out.println(" <form action=\"/post\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + mid + "\"/>"); - out.println(" <div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\""+rb.getString("Add a comment")+"\" onkeypress=\"postformListener(this.form,event)\"></textarea></div>"); + out.println(" <div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"" + rb.getString("Add a comment") + "\" onkeypress=\"postformListener(this.form,event)\"></textarea></div>"); out.println(" </form>"); } out.println(" </li>"); @@ -417,7 +357,7 @@ public class PageTemplates { } finally { Utils.finishSQL(rs, stmt); } - } + } /* public static void printPhotos(PrintWriter out, Connection sql, ArrayList<Integer> mids, Locale locale) { ResourceBundle rb = ResourceBundle.getBundle("Global", locale); |