From c49e78bef068f4c4607d6d572366661e40b404be Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Tue, 16 Oct 2012 17:31:27 +0700 Subject: blog title --- src/java/com/juick/http/www/Blogs.java | 35 ++++++------ src/java/com/juick/http/www/PageTemplates.java | 74 +++----------------------- src/java/com/juick/http/www/Tags.java | 2 +- src/java/com/juick/http/www/User.java | 40 +++++++++----- web/style3.css | 9 ++-- 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("

Older →

"); } @@ -167,23 +167,22 @@ public class Blogs { out.println("
"); - out.println("

" + rb.getString("Lists") + "

"); if (visitor != null) { - out.println(""); - out.println("
"); + out.println(" "); + out.println("
"); } - out.println(""); - out.println("
"); - out.println("

" + getTags(sql, 30) + "

"); + out.println(" "); + out.println("
"); + out.println("

" + getTags(sql, 30) + "

"); out.println("
"); out.println("
"); @@ -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(" "); out.println(" "); out.println(" "); - out.println(" "); out.println(" "); out.println(" "); out.println(" "); @@ -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("
"); out.println("
\""
"); out.println("
"); out.println("

" + fullname + "

" + description + "

"); out.println("
"); @@ -407,7 +347,7 @@ public class PageTemplates { out.println("
" + formatReplies(rs.getInt(10), locale) + " " + rb.getString("(replies) by") + " " + repliesby + "
"); } else if (cancomment) { out.println("
"); - out.println("
"); + out.println("
"); out.println("
"); } out.println(" "); @@ -417,7 +357,7 @@ public class PageTemplates { } finally { Utils.finishSQL(rs, stmt); } - } + } /* public static void printPhotos(PrintWriter out, Connection sql, ArrayList 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("
"); out.println("
"); @@ -112,10 +113,10 @@ public class User { if (mids.size() == 20) { String nextpage = "?before=" + mids.get(19); 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("

Older →

"); } @@ -171,6 +172,7 @@ public class User { PageTemplates.pageNavigation(out, locale, visitor); PageTemplates.pageUserTitle(out, sql, locale, user, visitor); + out.println("
"); out.println("
"); out.println("
"); out.println(""); @@ -200,6 +202,7 @@ public class User { out.println(""); pageUserColumn(out, sql, user, visitor, locale); out.println(""); + out.println(""); 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("
"); out.println("
"); out.println("
"); out.println("
"); @@ -248,6 +252,7 @@ public class User { out.println(""); pageUserColumn(out, sql, user, visitor, locale); out.println(""); + out.println(""); PageTemplates.pageFooter(request, out, locale, visitor); } finally { @@ -259,16 +264,25 @@ public class User { ResourceBundle rb = ResourceBundle.getBundle("User", locale); out.println("
"); - out.println(""); - out.println("
"); - out.println("

" + pageUserTags(sql, user, visitor, 15) + "

"); - out.println("
"); - out.println("

"); - out.println(""); + out.println(" "); + out.println("
"); + out.println(" "); + out.println("
"); + out.println("
"); + out.println("

"); + out.println(" "); + out.println("

" + pageUserTags(sql, user, visitor, 15) + "

"); + out.println("
"); + out.println("
"); out.println("
"); } 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; } /********/ -- cgit v1.2.3