diff options
Diffstat (limited to 'src/java/com/juick/http/www/User.java')
-rw-r--r-- | src/java/com/juick/http/www/User.java | 88 |
1 files changed, 38 insertions, 50 deletions
diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index d29ae767..6fb3dfc0 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -30,8 +30,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; 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; @@ -44,8 +42,6 @@ public class User { protected void doGetBlog(Connection sql, Connection sqlSearch, HttpServletRequest request, HttpServletResponse response, com.juick.User user) throws ServletException, IOException { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); - Locale locale = request.getLocale(); - ResourceBundle rb = ResourceBundle.getBundle("User", locale); String title = "@" + user.UName + " - "; ArrayList<Integer> mids; @@ -86,17 +82,17 @@ public class User { title += "*" + Utils.encodeHTML(paramTag.Name); mids = MessagesQueries.getUserTag(sql, user.UID, paramTag.TID, privacy, paramBefore); } else if (paramSearch != null) { - title += rb.getString("(Menu) Search") + ": " + Utils.encodeHTML(paramSearch); + title += "Поиск: " + Utils.encodeHTML(paramSearch); mids = MessagesQueries.getUserSearch(sql, sqlSearch, user.UID, Utils.encodeSphinx(paramSearch), privacy, paramBefore); } else { - title += rb.getString("(Menu) Blog"); + title += "Блог"; mids = MessagesQueries.getUserBlog(sql, user.UID, privacy, paramBefore); } } else if (paramShow.equals("recomm")) { - title += rb.getString("(Menu) Recommendations"); + title += "Рекомендации"; mids = MessagesQueries.getUserRecommendations(sql, user.UID, paramBefore); } else if (paramShow.equals("photos")) { - title += rb.getString("(Menu) Photos"); + title += "Фотографии"; mids = MessagesQueries.getUserPhotos(sql, user.UID, privacy, paramBefore); } else { response.sendError(404); @@ -107,14 +103,14 @@ public class User { PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, title, "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + user.UName + "\" href=\"//rss.juick.com/" + user.UName + "/blog\"/>"); - PageTemplates.pageNavigation(out, locale, visitor, null); + PageTemplates.pageNavigation(out, visitor, null); - pageUserColumn(out, sql, user, visitor, locale); + pageUserColumn(out, sql, user, visitor); out.println("<section id=\"content\">"); out.println("<ul>"); if (mids.size() > 0) { - PageTemplates.printMessages(out, sql, user, mids, visitor, locale, visitor == null ? 4 : 5, 0); + PageTemplates.printMessages(out, sql, user, mids, visitor, visitor == null ? 4 : 5, 0); } out.println("</ul>"); @@ -134,8 +130,8 @@ public class User { out.println("</section>"); - PageTemplates.pageFooter(request, out, locale, visitor, true); - PageTemplates.pageDialogTemplate(out, locale); + PageTemplates.pageFooter(request, out, visitor, true); + PageTemplates.pageDialogTemplate(out); PageTemplates.pageEnd(out); } finally { out.close(); @@ -147,23 +143,21 @@ public class User { protected void doGetTags(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User user) throws ServletException, IOException { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); - Locale locale = request.getLocale(); - ResourceBundle rb = ResourceBundle.getBundle("User", locale); response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Menu) Tags"), null); - PageTemplates.pageNavigation(out, locale, visitor, null); + PageTemplates.pageHead(out, "@" + user.UName + ": Теги", null); + PageTemplates.pageNavigation(out, visitor, null); - pageUserColumn(out, sql, user, visitor, locale); + pageUserColumn(out, sql, user, visitor); out.println("<section id=\"content\">"); out.println("<p>" + pageUserTags(sql, user, visitor, 0) + "</p>"); out.println("</section>"); - PageTemplates.pageFooter(request, out, locale, visitor, false); - PageTemplates.pageDialogTemplate(out, locale); + PageTemplates.pageFooter(request, out, visitor, false); + PageTemplates.pageDialogTemplate(out); PageTemplates.pageEnd(out); } finally { out.close(); @@ -172,16 +166,14 @@ public class User { protected void doGetFriends(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User user) throws ServletException, IOException { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); - Locale locale = request.getLocale(); - ResourceBundle rb = ResourceBundle.getBundle("User", locale); response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) I read"), null); - PageTemplates.pageNavigation(out, locale, visitor, null); + PageTemplates.pageHead(out, "@" + user.UName + ": Я читаю", null); + PageTemplates.pageNavigation(out, visitor, null); - pageUserColumn(out, sql, user, visitor, locale); + pageUserColumn(out, sql, user, visitor); out.println("<section id=\"content\">"); out.println("<table class=\"users\"><tr>"); @@ -210,8 +202,8 @@ public class User { out.println("</tr></table>"); out.println("</section>"); - PageTemplates.pageFooter(request, out, locale, visitor, false); - PageTemplates.pageDialogTemplate(out, locale); + PageTemplates.pageFooter(request, out, visitor, false); + PageTemplates.pageDialogTemplate(out); PageTemplates.pageEnd(out); } finally { out.close(); @@ -220,16 +212,14 @@ public class User { protected void doGetReaders(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User user) throws ServletException, IOException { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); - Locale locale = request.getLocale(); - ResourceBundle rb = ResourceBundle.getBundle("User", locale); response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) My readers"), null); - PageTemplates.pageNavigation(out, locale, visitor, null); + PageTemplates.pageHead(out, "@" + user.UName + ": Мои подписчики", null); + PageTemplates.pageNavigation(out, visitor, null); - pageUserColumn(out, sql, user, visitor, locale); + pageUserColumn(out, sql, user, visitor); out.println("<section id=\"content\">"); out.println("<table class=\"users\"><tr>"); @@ -258,54 +248,52 @@ public class User { out.println("</tr></table>"); out.println("</section>"); - PageTemplates.pageFooter(request, out, locale, visitor, false); - PageTemplates.pageDialogTemplate(out, locale); + PageTemplates.pageFooter(request, out, visitor, false); + PageTemplates.pageDialogTemplate(out); PageTemplates.pageEnd(out); } finally { out.close(); } } - public static void pageUserColumn(PrintWriter out, Connection sql, com.juick.User user, com.juick.User visitor, Locale locale) { - ResourceBundle rb = ResourceBundle.getBundle("User", locale); - + public static void pageUserColumn(PrintWriter out, Connection sql, com.juick.User user, com.juick.User visitor) { out.println("<aside id=\"column\">"); out.println(" <div id=\"ctitle\"><a href=\"./\"><img src=\"//i.juick.com/as/" + user.UID + ".png\" alt=\"\"/>" + user.UName + "</a></div>"); if (visitor != null && visitor.UID > 0 && visitor.UID != user.UID) { out.println(" <ul id=\"ctoolbar\">"); if (UserQueries.isSubscribed(sql, visitor.UID, user.UID)) { - out.println(" <li><a href=\"/post?body=U+%40" + user.UName + "\" title=\"" + rb.getString("(UToolbar) Subcribed") + "\"><div style=\"background-position: -48px 0\"></div></a></li>"); + out.println(" <li><a href=\"/post?body=U+%40" + user.UName + "\" title=\"Подписан\"><div style=\"background-position: -48px 0\"></div></a></li>"); } else { - out.println(" <li><a href=\"/post?body=S+%40" + user.UName + "\" title=\"" + rb.getString("(UToolbar) Subcribe") + "\"><div style=\"background-position: -16px 0\"></div></a></li>"); + out.println(" <li><a href=\"/post?body=S+%40" + user.UName + "\" title=\"Подписаться\"><div style=\"background-position: -16px 0\"></div></a></li>"); } if (UserQueries.isInBL(sql, visitor.UID, user.UID)) { - out.println(" <li><a href=\"/post?body=BL+%40" + user.UName + "\" title=\"" + rb.getString("(UToolbar) Unblock") + "\"><div style=\"background-position: -96px 0\"></div></a></li>"); + out.println(" <li><a href=\"/post?body=BL+%40" + user.UName + "\" title=\"Разблокировать\"><div style=\"background-position: -96px 0\"></div></a></li>"); } else { - out.println(" <li><a href=\"/post?body=BL+%40" + user.UName + "\" title=\"" + rb.getString("(UToolbar) Block") + "\"><div style=\"background-position: -80px 0\"></div></a></li>"); + out.println(" <li><a href=\"/post?body=BL+%40" + user.UName + "\" title=\"Заблокировать\"><div style=\"background-position: -80px 0\"></div></a></li>"); } if (!UserQueries.isInBLAny(sql, user.UID, visitor.UID)) { - out.println(" <li><a href=\"/pm/sent?uname=" + user.UName + "\" title=\"" + rb.getString("(UToolbar) Private") + "\"><div style=\"background-position: -112px 0\"></div></a></li>"); + out.println(" <li><a href=\"/pm/sent?uname=" + user.UName + "\" title=\"Написать приватное сообщение\"><div style=\"background-position: -112px 0\"></div></a></li>"); } out.println(" </ul>"); } else { 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(" <li><a href=\"./\">Блог</a></li>"); + out.println(" <li><a href=\"./?show=recomm\">Рекомендации</a></li>"); + out.println(" <li><a href=\"./?show=photos\">Фотографии</a></li>"); out.println(" </ul>"); out.println(" <hr/>"); out.println(" <form action=\"./\">"); - out.println(" <p><input type=\"text\" name=\"search\" class=\"inp\" placeholder=\"" + rb.getString("Search") + "\"/></p>"); + out.println(" <p><input type=\"text\" name=\"search\" class=\"inp\" placeholder=\"Поиск\"/></p>"); out.println(" </form>"); out.println(" <p>" + pageUserTags(sql, user, visitor, 15) + "<a href=\"./tags\">...</a></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(" <li><a href=\"./friends\">Я читаю: " + UserQueries.getStatsIRead(sql, user.UID) + "</a></li>"); + out.println(" <li><a href=\"./readers\">Мои подписчики: " + UserQueries.getStatsMyReaders(sql, user.UID) + "</a></li>"); + out.println(" <li>Сообщений: " + UserQueries.getStatsMessages(sql, user.UID) + "</li>"); + out.println(" <li>Комментариев: " + UserQueries.getStatsReplies(sql, user.UID) + "</li>"); out.println(" </ul></div>"); out.println("</aside>"); } |