From 98f036ae01fe90ad9d5853918602b705fdd41f02 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Sun, 14 Oct 2012 11:32:58 +0700 Subject: A lot of changes. --- src/java/com/juick/http/www/Blogs.java | 41 +++++--- src/java/com/juick/http/www/Chats.java | 77 -------------- src/java/com/juick/http/www/Login.java | 1 - src/java/com/juick/http/www/Main.java | 13 +-- src/java/com/juick/http/www/Map.java | 64 ------------ src/java/com/juick/http/www/NewMessage.java | 1 - src/java/com/juick/http/www/PageTemplates.java | 134 +++++++++++++++++++------ src/java/com/juick/http/www/Photos.java | 100 ------------------ src/java/com/juick/http/www/Tags.java | 87 ++++++++++++++++ src/java/com/juick/http/www/User.java | 38 +++---- src/java/com/juick/http/www/UserThread.java | 28 ++---- 11 files changed, 252 insertions(+), 332 deletions(-) delete mode 100644 src/java/com/juick/http/www/Chats.java delete mode 100644 src/java/com/juick/http/www/Map.java delete mode 100644 src/java/com/juick/http/www/Photos.java create mode 100644 src/java/com/juick/http/www/Tags.java (limited to 'src/java/com/juick/http') diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java index a1cfdeb0..ea728eab 100644 --- a/src/java/com/juick/http/www/Blogs.java +++ b/src/java/com/juick/http/www/Blogs.java @@ -98,10 +98,10 @@ public class Blogs { response.sendError(404); return; } - } else if (paramShow.equals("incoming")) { + } else if (paramShow.equals("discuss")) { if (visitor != null) { - title = rb.getString("Incoming"); - mids = MessagesQueries.getIncoming(sql, visitor.UID, paramBefore); + title = rb.getString("Discussions"); + mids = MessagesQueries.getDiscussions(sql, visitor.UID, paramBefore); } else { response.sendError(404); return; @@ -130,18 +130,27 @@ public class Blogs { try { PageTemplates.pageHead(out, title, null); PageTemplates.pageNavigation(out, locale, visitor); - PageTemplates.pageTitle(out, title); + out.println("
"); out.println("
"); out.println("
"); - out.println("
    "); + + PageTemplates.pageFilters(out, locale, visitor); if (mids.size() > 0) { + /* + if (paramShow != null && paramShow.equals("photos")) { + PageTemplates.printPhotos(out, sql, mids, locale); + } else { + */ + out.println("
      "); PageTemplates.printMessages(out, sql, mids, locale); + out.println("
    "); + /* + } + */ } - out.println("
"); - if (mids.size() == 20) { String nextpage = "?before=" + mids.get(mids.size() - 1); if (paramShow != null) { @@ -154,29 +163,33 @@ public class Blogs { } out.println("
"); + out.println("
"); // wrapper + - out.println("
"); + out.println("
"); out.println("

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

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

" + rb.getString("Tags") + "

"); - out.println("

" + getTags(sql, 30) + "

"); - out.println("

" + rb.getString("Search") + "

"); - out.println("

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

" + getTags(sql, 30) + "

"); out.println("
"); + out.println("
"); + + out.println("
"); // topwrapper + PageTemplates.pageFooter(request, out, locale, visitor); } finally { out.close(); diff --git a/src/java/com/juick/http/www/Chats.java b/src/java/com/juick/http/www/Chats.java deleted file mode 100644 index d15bb271..00000000 --- a/src/java/com/juick/http/www/Chats.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Juick - * Copyright (C) 2008-2011, Ugnich Anton - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package com.juick.http.www; - -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Locale; -import java.util.ResourceBundle; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * @author Ugnich Anton - */ -public class Chats { - - protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - com.juick.User visitor = Utils.getVisitorUser(sql, request); - Locale locale = request.getLocale(); - ResourceBundle rb = ResourceBundle.getBundle("Chats", locale); - - response.setContentType("text/html; charset=UTF-8"); - PrintWriter out = response.getWriter(); - try { - PageTemplates.pageHead(out, rb.getString("Active chats"), ""); - PageTemplates.pageNavigation(out, locale, visitor); - PageTemplates.pageTitle(out, rb.getString("Active chats")); - - out.println("
"); - out.println("
    "); - - PreparedStatement stmt = null; - ResultSet rs = null; - try { - stmt = sql.prepareStatement("SELECT chats.chat_id,chats.subject,COUNT(chat_users.user_id) AS cnt FROM chats INNER JOIN chat_users USING(chat_id) GROUP BY chat_id ORDER BY cnt DESC"); - rs = stmt.executeQuery(); - rs.beforeFirst(); - while (rs.next()) { - String chatid = Integer.toString(rs.getInt(1), Character.MAX_RADIX); - out.println("
  • " + Utils.encodeHTML(rs.getString(2)) + "
    " + rb.getString("Users online") + ": " + rs.getInt(3) + "
    " + chatid + "@chat.juick.com
  • "); - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - out.println("
"); - out.println("
"); - - PageTemplates.pageFooter(request, out, locale, visitor); - } finally { - out.close(); - } - } -} diff --git a/src/java/com/juick/http/www/Login.java b/src/java/com/juick/http/www/Login.java index 0006f9d0..3cf4a318 100644 --- a/src/java/com/juick/http/www/Login.java +++ b/src/java/com/juick/http/www/Login.java @@ -45,7 +45,6 @@ public class Login { try { PageTemplates.pageHead(out, rb.getString("Login"), ""); PageTemplates.pageNavigation(out, locale, visitor); - PageTemplates.pageTitle(out, rb.getString("Login")); out.println("
"); out.println("
"); diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index 256e70f9..055327dd 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -42,10 +42,8 @@ public class Main extends HttpServlet implements XmppListener { Connection sqlSearch; XmppConnection xmpp; Blogs blogs = new Blogs(); - Chats chats = new Chats(); - Photos photos = new Photos(); + Tags tags = new Tags(); RootRedirects rootRedirects = new RootRedirects(); - Map map = new Map(); Login login = new Login(); User pagesUser = new User(); UserThread pagesUserThread = new UserThread(); @@ -124,12 +122,9 @@ public class Main extends HttpServlet implements XmppListener { String uri = request.getRequestURI(); if (uri.equals("/")) { blogs.doGet(sql, sqlSearch, request, response); - } else if (uri.equals("/chats")) { - chats.doGet(sql, request, response); - } else if (uri.equals("/photos")) { - photos.doGet(sql, request, response); - } else if (uri.equals("/map")) { - map.doGet(sql, request, response); + } else if (uri.equals("/tags")) { + com.juick.User visitor = Utils.getVisitorUser(sql, request); + tags.doGetTags(sql, request, response, visitor); } else if (uri.equals("/post")) { com.juick.User visitor = Utils.getVisitorUser(sql, request); if (visitor != null) { diff --git a/src/java/com/juick/http/www/Map.java b/src/java/com/juick/http/www/Map.java deleted file mode 100644 index 96524ac0..00000000 --- a/src/java/com/juick/http/www/Map.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Juick - * Copyright (C) 2008-2011, Ugnich Anton - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package com.juick.http.www; - -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Connection; -import java.util.Locale; -import java.util.ResourceBundle; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * @author Ugnich Anton - */ -public class Map { - - protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - com.juick.User visitor = Utils.getVisitorUser(sql, request); - Locale locale = request.getLocale(); - ResourceBundle rb = ResourceBundle.getBundle("Map", locale); - - response.setContentType("text/html; charset=UTF-8"); - PrintWriter out = response.getWriter(); - try { - PageTemplates.pageHead(out, rb.getString("Messages on map"), "" - + "" - + ""); - PageTemplates.pageNavigation(out, locale, visitor); - PageTemplates.pageTitle(out, rb.getString("Messages on map")); - - out.println("
"); - out.println("
"); - out.println("
    "); - out.println("

    " + rb.getString("Popular places") + "

      "); - out.println("
      "); - out.println(""); - - PageTemplates.pageFooter(request, out, locale, visitor); - } finally { - out.close(); - } - } -} diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java index 1efb753d..1e00a553 100644 --- a/src/java/com/juick/http/www/NewMessage.java +++ b/src/java/com/juick/http/www/NewMessage.java @@ -49,7 +49,6 @@ public class NewMessage { + "" + ""); PageTemplates.pageNavigation(out, locale, visitor); - PageTemplates.pageTitle(out, rbnm.getString("New message")); out.println("
      "); out.println("
      "); diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index a76e0280..08e88342 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -24,7 +24,11 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; import java.util.Locale; import java.util.ResourceBundle; import java.util.regex.Matcher; @@ -39,6 +43,9 @@ import ru.sape.Sape; public class PageTemplates { public static Sape sape = null; + private static SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); + private static SimpleDateFormat sdfSimple = new SimpleDateFormat("d MMM"); + private static SimpleDateFormat sdfFull = new SimpleDateFormat("d MMM yyyy"); public static void pageHead(PrintWriter out, String title, String headers) { out.println(""); @@ -46,10 +53,10 @@ public class PageTemplates { out.println(""); out.println(" "); out.println(" " + title + ""); - out.println(" "); + out.println(" "); out.println(" "); - out.println(" "); - out.println(" "); + out.println(" "); + out.println(" "); out.println(" "); out.println(" "); out.println(" "); @@ -63,18 +70,16 @@ public class PageTemplates { public static void pageNavigation(PrintWriter out, Locale loc, com.juick.User user) { ResourceBundle rb = ResourceBundle.getBundle("Global", loc); + out.println("
      "); out.println("
      "); - out.println("
      \"Juick\"/
      "); - out.println(" "); + out.println("
      \"Juick\"/
      "); + out.println(" "); + out.println("
      \">
      "); + out.println(" "); out.println("
      "); + out.println("
      "); } - public static void pageTitle(PrintWriter out, String title) { - out.println("
      "); - out.println("

      " + title + "

      "); + public static void pageFilters(PrintWriter out, Locale loc, com.juick.User user) { + ResourceBundle rb = ResourceBundle.getBundle("Global", loc); + + out.println("
      "); + out.println(""); out.println("
      "); } @@ -236,7 +251,19 @@ public class PageTemplates { int days = (minsago / 1440); return days + " day" + ((days % 10 == 1) ? "" : "s") + " ago"; } else { - return fulldate; + try { + Date pDate = sdfSQL.parse(fulldate); + Calendar c = Calendar.getInstance(); + int curyear = c.get(Calendar.YEAR); + c.setTime(pDate); + if (c.get(Calendar.YEAR) == curyear) { + return sdfSimple.format(pDate); + } else { + return sdfFull.format(pDate); + } + } catch (ParseException e) { + return fulldate; + } } } @@ -355,11 +382,11 @@ public class PageTemplates { txt = formatMessage(txt); - out.print("
    • "); + out.println("
    • "); + out.println("
      \""
      "); + out.println(" "); + out.println("
      @" + uname + ":" + tags + "
      "); + out.println("
      " + txt + "
      "); if (rs.getString(12) != null) { if (rs.getString(12).equals("jpg")) { @@ -372,15 +399,6 @@ public class PageTemplates { } } - out.println("
      \""
      "); - out.println(" "); - out.println("
      @" + uname + ":" + tags + "
      "); - out.println("
      " + txt + "
      "); - if (rs.getInt(10) > 0) { String repliesby = rs.getString(11); if (repliesby == null) { @@ -389,7 +407,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("
    • "); @@ -400,4 +418,60 @@ public class PageTemplates { Utils.finishSQL(rs, stmt); } } + /* + public static void printPhotos(PrintWriter out, Connection sql, ArrayList mids, Locale locale) { + ResourceBundle rb = ResourceBundle.getBundle("Global", locale); + + out.println(""); + out.println(" "); + + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = sql.prepareStatement("SELECT STRAIGHT_JOIN messages.message_id,messages.user_id,users.nick,messages_txt.tags,messages.readonly,messages.privacy,messages_txt.txt,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),messages.ts,messages.replies,messages_txt.repliesby,messages.attach,messages.place_id,places.name,messages.lat,messages.lon FROM ((messages INNER JOIN messages_txt ON messages.message_id=messages_txt.message_id) INNER JOIN users ON messages.user_id=users.id) LEFT JOIN places ON messages.place_id=places.place_id WHERE messages.message_id IN (" + Utils.convertArray2String(mids) + ") ORDER BY messages.message_id DESC"); + rs = stmt.executeQuery(); + rs.beforeFirst(); + int cnt = 0; + while (rs.next()) { + int mid = rs.getInt(1); + int uid = rs.getInt(2); + String uname = rs.getString(3); + String tags = rs.getString(4); + String txt = rs.getString(7); + + txt = formatMessage(txt); + + if (cnt % 2 == 0 && cnt > 0) { + out.println(" "); + out.println(" "); + } + + out.print(" "); + + cnt++; + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + + out.println(" "); + out.println("
      "); + + out.println("
      "); + out.println(" \"\"/"); + out.println("
      " + formatDate(rs.getInt(8), rs.getString(9), locale) + "
      "); + out.println("
      @" + uname + "
      "); + if (rs.getInt(10) > 0) { + out.println("
      " + rs.getInt(10) + "
      "); + } + out.println("
      " + txt + "
      "); + out.println("
      "); + } + */ } diff --git a/src/java/com/juick/http/www/Photos.java b/src/java/com/juick/http/www/Photos.java deleted file mode 100644 index a2665501..00000000 --- a/src/java/com/juick/http/www/Photos.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Juick - * Copyright (C) 2008-2011, Ugnich Anton - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package com.juick.http.www; - -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Locale; -import java.util.ResourceBundle; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * @author Ugnich Anton - */ -public class Photos { - - protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - com.juick.User visitor = Utils.getVisitorUser(sql, request); - Locale locale = request.getLocale(); - ResourceBundle rb = ResourceBundle.getBundle("Photos", locale); - - response.setContentType("text/html; charset=UTF-8"); - PrintWriter out = response.getWriter(); - try { - PageTemplates.pageHead(out, rb.getString("Last photos and videos"), "" - + "" - + "" - + ""); - PageTemplates.pageNavigation(out, locale, visitor); - PageTemplates.pageTitle(out, rb.getString("Last photos and videos")); - - out.println("
      "); - out.println("
      Loading...
      "); - out.println("
        "); - - PreparedStatement stmt = null; - ResultSet rs = null; - try { - stmt = sql.prepareStatement("SELECT messages.message_id,messages.attach,users.nick FROM messages INNER JOIN users ON messages.user_id=users.id WHERE messages.attach IS NOT NULL ORDER BY message_id DESC LIMIT 20"); - rs = stmt.executeQuery(); - rs.beforeFirst(); - while (rs.next()) { - if (rs.getString(2).equals("jpg")) { - out.println("
      • \"\"
      • "); - } else { - out.println("
      • \"\"
      • "); - } - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - out.println("
      "); - out.println("
      "); - out.println(""); - - PageTemplates.pageFooter(request, out, locale, visitor); - } finally { - out.close(); - } - } -} diff --git a/src/java/com/juick/http/www/Tags.java b/src/java/com/juick/http/www/Tags.java new file mode 100644 index 00000000..07cff582 --- /dev/null +++ b/src/java/com/juick/http/www/Tags.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.juick.http.www; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.Locale; +import java.util.ResourceBundle; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author ugnich + */ +public class Tags { + + protected void doGetTags(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException { + Locale locale = request.getLocale(); + ResourceBundle rbnm = ResourceBundle.getBundle("Blogs", locale); + + response.setContentType("text/html; charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + PageTemplates.pageHead(out, rbnm.getString("Tags"), null); + PageTemplates.pageNavigation(out, locale, visitor); + + int cnt = 30; + com.juick.Tag tags[] = new com.juick.Tag[cnt]; + int maxUsageCnt = 0; + 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.setInt(1, cnt); + rs = stmt.executeQuery(); + rs.beforeFirst(); + cnt = 0; + while (rs.next()) { + tags[cnt] = new com.juick.Tag(); + tags[cnt].Name = rs.getString(1); + tags[cnt].UsageCnt = rs.getInt(2); + if (tags[cnt].UsageCnt > maxUsageCnt) { + maxUsageCnt = tags[cnt].UsageCnt; + } + cnt++; + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + + Arrays.sort(tags, 0, cnt); + + for (int i = 0; i < cnt; i++) { + String tag = Utils.encodeHTML(tags[i].Name); + try { + tag = "" + tag + ""; + } catch (UnsupportedEncodingException e) { + } + + if (tags[i].UsageCnt > maxUsageCnt / 3 * 2) { + out.print("" + tag + " "); + } else if (tags[i].UsageCnt > maxUsageCnt / 3) { + out.print("" + tag + " "); + } else { + out.print(tag + " "); + } + } + + PageTemplates.pageFooter(request, out, locale, visitor); + } finally { + out.close(); + } + } +} diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index 73dd5827..0ddac42d 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -100,6 +100,7 @@ public class User { PageTemplates.pageNavigation(out, locale, visitor); PageTemplates.pageUserTitle(out, sql, locale, user, visitor); + out.println("
      "); out.println("
      "); out.println("
      "); out.println("
        "); @@ -122,6 +123,7 @@ public class User { pageUserColumn(out, sql, user, visitor, locale); out.println("
      "); + out.println("
      "); // topwrapper PageTemplates.pageFooter(request, out, locale, visitor); } finally { @@ -146,11 +148,7 @@ public class User { out.println("
      "); out.println("
      "); - - out.print("

      "); - pageUserTags(out, sql, user, visitor, 0); - out.print("

      "); - + out.println("

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

      "); out.println("
      "); pageUserColumn(out, sql, user, visitor, locale); out.println("
      "); @@ -219,7 +217,7 @@ public class User { try { PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) I read"), null); PageTemplates.pageNavigation(out, locale, visitor); - PageTemplates.pageUserTitle(out, sql, locale, user, visitor); + //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); out.println("
      "); out.println("
      "); @@ -260,21 +258,21 @@ public class User { public static void pageUserColumn(PrintWriter out, Connection sql, com.juick.User user, com.juick.User visitor, Locale locale) { ResourceBundle rb = ResourceBundle.getBundle("User", locale); - out.println("
      "); - out.println("

      " + rb.getString("(Menu) Messages") + "

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

      " + rb.getString("(Menu) Tags") + " " + rb.getString("all") + "

      "); - pageUserTags(out, sql, user, visitor, 15); - out.println("

      " + rb.getString("(Menu) Search") + "

      "); - out.println("

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

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

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

      "); + out.println("
      "); out.println("
      "); } - public static void pageUserTags(PrintWriter out, Connection sql, com.juick.User user, com.juick.User visitor, int cnt) { + public static String pageUserTags(Connection sql, com.juick.User user, com.juick.User visitor, int cnt) { com.juick.Tag tags[] = null; int maxUsageCnt = 0; @@ -313,6 +311,7 @@ public class User { Arrays.sort(tags, 0, cnt); } + String ret = ""; for (int i = 0; i < cnt; i++) { String tag = Utils.encodeHTML(tags[i].Name); try { @@ -321,12 +320,13 @@ public class User { } if (tags[i].UsageCnt > maxUsageCnt / 3 * 2) { - out.print("" + tag + " "); + ret += "" + tag + " "; } else if (tags[i].UsageCnt > maxUsageCnt / 3) { - out.print("" + tag + " "); + ret += "" + tag + " "; } else { - out.print(tag + " "); + ret += tag + " "; } } + return ret; } } diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index e64b4437..1680ca8e 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -71,7 +71,7 @@ public class UserThread { PageTemplates.pageNavigation(out, locale, visitor); PageTemplates.pageUserTitle(out, sql, locale, user, visitor); - + out.println("
      "); out.println("
      "); out.println("
      "); @@ -80,8 +80,8 @@ public class UserThread { printReplies(out, sql, MID, locale, listview); out.println("
      "); - out.println("
      "); + out.println("
      "); // topwrapper out.println("