aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-10-16 17:31:27 +0700
committerGravatar Ugnich Anton2012-10-16 17:31:27 +0700
commitc49e78bef068f4c4607d6d572366661e40b404be (patch)
tree25f6cfdbe413aa3209f93a5f39cf26e1dfb89124
parentcd3776013be1846fc7081371abaae4c8ae5ec9f1 (diff)
blog title
-rw-r--r--src/java/com/juick/http/www/Blogs.java35
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java74
-rw-r--r--src/java/com/juick/http/www/Tags.java2
-rw-r--r--src/java/com/juick/http/www/User.java40
-rw-r--r--web/style3.css9
5 files changed, 58 insertions, 102 deletions
diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java
index ea728eab..e43addb9 100644
--- a/src/java/com/juick/http/www/Blogs.java
+++ b/src/java/com/juick/http/www/Blogs.java
@@ -154,10 +154,10 @@ public class Blogs {
if (mids.size() == 20) {
String nextpage = "?before=" + mids.get(mids.size() - 1);
if (paramShow != null) {
- nextpage += "&show=" + paramShow;
+ nextpage += "&show=" + paramShow;
}
if (paramTag > 0) {
- nextpage += "&tag=" + URLEncoder.encode(paramTagStr, "UTF-8");
+ nextpage += "&tag=" + URLEncoder.encode(paramTagStr, "UTF-8");
}
out.println("<p class=\"page\"><a href=\"" + nextpage + "\">Older →</a></p>");
}
@@ -167,23 +167,22 @@ public class Blogs {
out.println("<div id=\"column\" class=\"stickya\">");
- out.println("<h2>" + rb.getString("Lists") + "</h2>");
if (visitor != null) {
- out.println("<ul>");
- out.println(" <li><a href=\"?show=my\">" + rb.getString("My feed") + "</a></li>");
- out.println(" <li><a href=\"?show=private\">" + rb.getString("Private") + "</a></li>");
- out.println(" <li><a href=\"?show=discuss\">" + rb.getString("Discussions") + "</a></li>");
- out.println(" <li><a href=\"?show=recommended\">" + rb.getString("Recommended") + "</a></li>");
- out.println("</ul>");
- out.println("<hr/>");
+ out.println(" <ul>");
+ out.println(" <li><a href=\"?show=my\">" + rb.getString("My feed") + "</a></li>");
+ out.println(" <li><a href=\"?show=private\">" + rb.getString("Private") + "</a></li>");
+ out.println(" <li><a href=\"?show=discuss\">" + rb.getString("Discussions") + "</a></li>");
+ out.println(" <li><a href=\"?show=recommended\">" + rb.getString("Recommended") + "</a></li>");
+ out.println(" </ul>");
+ out.println(" <hr/>");
}
- out.println("<ul>");
- out.println(" <li><a href=\"?\">" + rb.getString("All messages") + "</a></li>");
- out.println(" <li><a href=\"?show=top\">" + rb.getString("Popular") + "</a></li>");
- out.println(" <li><a href=\"?show=photos\">" + rb.getString("With photos") + "</a></li>");
- out.println("</ul>");
- out.println("<hr/>");
- out.println("<p>" + getTags(sql, 30) + "</p>");
+ out.println(" <ul>");
+ out.println(" <li><a href=\"?\">" + rb.getString("All messages") + "</a></li>");
+ out.println(" <li><a href=\"?show=top\">" + rb.getString("Popular") + "</a></li>");
+ out.println(" <li><a href=\"?show=photos\">" + rb.getString("With photos") + "</a></li>");
+ out.println(" </ul>");
+ out.println(" <hr/>");
+ out.println(" <p>" + getTags(sql, 30) + "</p>");
out.println("</div>");
out.println("<div id=\"rcol\"></div>");
@@ -204,7 +203,7 @@ public class Blogs {
PreparedStatement stmt = null;
ResultSet rs = null;
try {
- stmt = sql.prepareStatement("SELECT tags.name AS name,COUNT(DISTINCT messages.user_id) AS cnt FROM (messages INNER JOIN messages_tags ON (messages.ts>TIMESTAMPADD(DAY,-3,NOW()) AND messages.message_id=messages_tags.message_id)) INNER JOIN tags ON messages_tags.tag_id=tags.tag_id GROUP BY tags.tag_id ORDER BY cnt DESC LIMIT ?");
+ stmt = sql.prepareStatement("SELECT tags.name AS name,COUNT(DISTINCT messages.user_id) AS cnt FROM (messages INNER JOIN messages_tags ON (messages.ts>TIMESTAMPADD(DAY,-3,NOW()) AND messages.message_id=messages_tags.message_id)) INNER JOIN tags ON messages_tags.tag_id=tags.tag_id WHERE tags.tag_id NOT IN (SELECT tag_id FROM tags_ignore) GROUP BY tags.tag_id ORDER BY cnt DESC LIMIT ?");
stmt.setInt(1, cnt);
rs = stmt.executeQuery();
rs.beforeFirst();
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);
diff --git a/src/java/com/juick/http/www/Tags.java b/src/java/com/juick/http/www/Tags.java
index 07cff582..534ca8ef 100644
--- a/src/java/com/juick/http/www/Tags.java
+++ b/src/java/com/juick/http/www/Tags.java
@@ -41,7 +41,7 @@ public class Tags {
PreparedStatement stmt = null;
ResultSet rs = null;
try {
- stmt = sql.prepareStatement("SELECT tags.name AS name,COUNT(DISTINCT messages.user_id) AS cnt FROM (messages INNER JOIN messages_tags ON (messages.ts>TIMESTAMPADD(DAY,-3,NOW()) AND messages.message_id=messages_tags.message_id)) INNER JOIN tags ON messages_tags.tag_id=tags.tag_id GROUP BY tags.tag_id ORDER BY cnt DESC LIMIT ?");
+ stmt = sql.prepareStatement("SELECT tags.name AS name,COUNT(DISTINCT messages.user_id) AS cnt FROM (messages INNER JOIN messages_tags ON (messages.ts>TIMESTAMPADD(DAY,-3,NOW()) AND messages.message_id=messages_tags.message_id)) INNER JOIN tags ON messages_tags.tag_id=tags.tag_id WHERE tags.tag_id NOT IN (SELECT tag_id FROM tags_ignore) GROUP BY tags.tag_id ORDER BY cnt DESC LIMIT ?");
stmt.setInt(1, cnt);
rs = stmt.executeQuery();
rs.beforeFirst();
diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java
index 0ddac42d..a1a6029c 100644
--- a/src/java/com/juick/http/www/User.java
+++ b/src/java/com/juick/http/www/User.java
@@ -19,6 +19,7 @@ package com.juick.http.www;
import com.juick.server.MessagesQueries;
import com.juick.server.TagQueries;
+import com.juick.server.UserQueries;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
@@ -98,7 +99,7 @@ public class User {
try {
PageTemplates.pageHead(out, title, null);
PageTemplates.pageNavigation(out, locale, visitor);
- PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
+ //PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
out.println("<div id=\"topwrapper\">");
out.println("<div id=\"wrapper\">");
@@ -112,10 +113,10 @@ public class User {
if (mids.size() == 20) {
String nextpage = "?before=" + mids.get(19);
if (paramShow != null) {
- nextpage += "&show=" + paramShow;
+ nextpage += "&amp;show=" + paramShow;
}
if (paramTag > 0) {
- nextpage += "&tag=" + URLEncoder.encode(paramTagStr, "UTF-8");
+ nextpage += "&amp;tag=" + URLEncoder.encode(paramTagStr, "UTF-8");
}
out.println("<p class=\"page\"><a href=\"" + nextpage + "\">Older →</a></p>");
}
@@ -171,6 +172,7 @@ public class User {
PageTemplates.pageNavigation(out, locale, visitor);
PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
+ out.println("<div id=\"topwrapper\">");
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
out.println("<table class=\"users\"><tr>");
@@ -200,6 +202,7 @@ public class User {
out.println("</div>");
pageUserColumn(out, sql, user, visitor, locale);
out.println("</div>");
+ out.println("</div>");
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
@@ -219,6 +222,7 @@ public class User {
PageTemplates.pageNavigation(out, locale, visitor);
//PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
+ out.println("<div id=\"topwrapper\">");
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
out.println("<table class=\"users\"><tr>");
@@ -248,6 +252,7 @@ public class User {
out.println("</div>");
pageUserColumn(out, sql, user, visitor, locale);
out.println("</div>");
+ out.println("</div>");
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
@@ -259,16 +264,25 @@ public class User {
ResourceBundle rb = ResourceBundle.getBundle("User", locale);
out.println("<div id=\"column\" class=\"stickya\">");
- out.println("<ul>");
- out.println(" <li><a href=\"./\">" + rb.getString("(Menu) Blog") + "</a></li>");
- out.println(" <li><a href=\"./?show=recomm\">" + rb.getString("(Menu) Recommendations") + "</a></li>");
- out.println(" <li><a href=\"./?show=photos\">" + rb.getString("(Menu) Photos") + "</a></li>");
- out.println("</ul>");
- out.println("<hr/>");
- out.println("<p>" + pageUserTags(sql, user, visitor, 15) + "</p>");
- out.println("<form action=\"./\" id=\"searchuser\">");
- out.println("<p><input type=\"text\" name=\"search\" class=\"inp\" placeholder=\"" + rb.getString("Search") + "\"/></p>");
- out.println("</form>");
+ out.println(" <div id=\"ctitle\"><a href=\"./\"><img src=\"http://i.juick.com/as/" + user.UID + ".png\"/>" + user.UName + "</a></div>");
+ out.println(" <hr/>");
+ out.println(" <ul>");
+ out.println(" <li><a href=\"./\">" + rb.getString("(Menu) Blog") + "</a></li>");
+ out.println(" <li><a href=\"./?show=recomm\">" + rb.getString("(Menu) Recommendations") + "</a></li>");
+ out.println(" <li><a href=\"./?show=photos\">" + rb.getString("(Menu) Photos") + "</a></li>");
+ out.println(" </ul>");
+ out.println(" <hr/>");
+ out.println(" <form action=\"./\" id=\"searchuser\">");
+ out.println(" <p><input type=\"text\" name=\"search\" class=\"inp\" placeholder=\"" + rb.getString("Search") + "\"/></p>");
+ out.println(" </form>");
+ out.println(" <p>" + pageUserTags(sql, user, visitor, 15) + "</p>");
+ out.println(" <hr/>");
+ out.println(" <div id=\"ustats\"><ul>");
+ out.println(" <li><a href=\"./friends\">" + rb.getString("(Stats) I read") + ": " + UserQueries.getStatsIRead(sql, user.UID) + "</a></li>");
+ out.println(" <li><a href=\"./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>");
}
diff --git a/web/style3.css b/web/style3.css
index 9dc2f247..09097665 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -74,7 +74,7 @@ table.users { width: 100%; margin: 10px 0; }
table.users td { width: 33%; padding: 6px 0; overflow: hidden; }
table.users img { width: 32px; height: 32px; vertical-align: middle; margin-right: 6px; }
-.title2 { padding: 10px 20px; margin: 20px 0 20px 0; }
+.title2 { padding: 10px 20px; margin: 20px 0; }
.title2-right { float: right; line-height: 24px; }
.title2 h2 { font-size: 24px; }
@@ -82,12 +82,15 @@ table.users img { width: 32px; height: 32px; vertical-align: middle; margin-righ
/********/
-#column { width: 185px; position: absolute; top: 0; padding-top: 10px; }
+#column { width: 185px; position: absolute; top: 0; padding-top: 10px; overflow: hidden; }
#column ul,p,hr { margin: 10px 0; }
#column li { margin: 6px 0; }
#column p { font-size: small; line-height: 140%; }
#column hr { height: 1px; border: none; }
-#column .inp { width: 180px; border: 1px solid; padding: 3px; border-radius: 3px; }
+#column .inp { width: 175px; border: 1px solid; padding: 3px; border-radius: 3px; }
+#ctitle { font-size: 14pt; }
+#ctitle img { vertical-align: middle; margin-right: 5px; }
+#ustats li { margin: 3px 0; font-size: smaller; }
/********/