aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/juick')
-rw-r--r--src/java/com/juick/http/www/Discover.java14
-rw-r--r--src/java/com/juick/http/www/Help.java16
-rw-r--r--src/java/com/juick/http/www/Home.java29
-rw-r--r--src/java/com/juick/http/www/Login.java27
-rw-r--r--src/java/com/juick/http/www/NewMessage.java19
-rw-r--r--src/java/com/juick/http/www/PM.java32
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java90
-rw-r--r--src/java/com/juick/http/www/Settings.java14
-rw-r--r--src/java/com/juick/http/www/SignUp.java36
-rw-r--r--src/java/com/juick/http/www/User.java88
-rw-r--r--src/java/com/juick/http/www/UserThread.java70
11 files changed, 190 insertions, 245 deletions
diff --git a/src/java/com/juick/http/www/Discover.java b/src/java/com/juick/http/www/Discover.java
index 4fb4c9c0..4e4a6b3d 100644
--- a/src/java/com/juick/http/www/Discover.java
+++ b/src/java/com/juick/http/www/Discover.java
@@ -25,8 +25,6 @@ import java.net.URLDecoder;
import java.net.URLEncoder;
import java.sql.Connection;
import java.util.ArrayList;
-import java.util.Locale;
-import java.util.ResourceBundle;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -39,8 +37,6 @@ public class Discover {
protected void doGet(Connection sql, Connection sqlSearch, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("Blogs", locale);
String requesturi = request.getRequestURI();
@@ -77,15 +73,15 @@ public class Discover {
canonical = "<link rel=\"canonical\" href=\"http://juick.com/tag/" + URLEncoder.encode(paramTag.Name, "UTF-8") + "\"/>";
}
PageTemplates.pageHead(out, title, canonical);
- PageTemplates.pageNavigation(out, locale, visitor, null);
+ PageTemplates.pageNavigation(out, visitor, null);
- PageTemplates.pageHomeColumn(out, sql, visitor, locale);
+ PageTemplates.pageHomeColumn(out, sql, visitor);
out.println("<section id=\"content\">");
if (mids.size() > 0) {
out.println("<ul>");
- PageTemplates.printMessages(out, sql, null, mids, visitor, locale, visitor == null ? 2 : 3, 0);
+ PageTemplates.printMessages(out, sql, null, mids, visitor, visitor == null ? 2 : 3, 0);
out.println("</ul>");
}
@@ -96,8 +92,8 @@ public class Discover {
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();
diff --git a/src/java/com/juick/http/www/Help.java b/src/java/com/juick/http/www/Help.java
index c6a64622..101988bb 100644
--- a/src/java/com/juick/http/www/Help.java
+++ b/src/java/com/juick/http/www/Help.java
@@ -23,8 +23,6 @@ import java.io.FileReader;
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;
@@ -36,17 +34,11 @@ import javax.servlet.http.HttpServletResponse;
public class Help {
protected void doRedirectToHelpIndex(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- String lang = request.getLocale().getLanguage();
- if (!(lang.equals("ru") || lang.equals("fr"))) {
- lang = "en";
- }
- Utils.sendTemporaryRedirect(response, "/help/" + lang + "/");
+ Utils.sendTemporaryRedirect(response, "/help/ru/");
}
protected void doGetHelp(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
String path[] = request.getRequestURI().split("/");
String page;
@@ -74,8 +66,8 @@ public class Help {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
try {
- PageTemplates.pageHead(out, rb.getString("Help"), "");
- PageTemplates.pageNavigation(out, locale, visitor, null);
+ PageTemplates.pageHead(out, "Помощь", "");
+ PageTemplates.pageNavigation(out, visitor, null);
out.println("<aside id=\"column\">");
printFile(out, new File("/var/www/juick.com/help3/" + path[2] + "/navigation"));
@@ -87,7 +79,7 @@ public class Help {
printFile(out, f);
out.println("</section>");
- PageTemplates.pageFooter(request, out, locale, visitor, false);
+ PageTemplates.pageFooter(request, out, visitor, false);
PageTemplates.pageEnd(out);
} finally {
out.close();
diff --git a/src/java/com/juick/http/www/Home.java b/src/java/com/juick/http/www/Home.java
index ae82633f..204c35b3 100644
--- a/src/java/com/juick/http/www/Home.java
+++ b/src/java/com/juick/http/www/Home.java
@@ -24,8 +24,6 @@ import java.io.PrintWriter;
import java.net.URLEncoder;
import java.sql.Connection;
import java.util.ArrayList;
-import java.util.Locale;
-import java.util.ResourceBundle;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -37,9 +35,6 @@ import javax.servlet.http.HttpServletResponse;
public class Home {
protected void doGet(Connection sql, Connection sqlSearch, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException {
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("Blogs", locale);
-
int paramBefore = 0;
String paramBeforeStr = request.getParameter("before");
if (paramBeforeStr != null) {
@@ -59,25 +54,25 @@ public class Home {
String paramShow = request.getParameter("show");
if (paramSearch != null) {
- title = rb.getString("Search") + ": " + Utils.encodeHTML(paramSearch);
+ title = "Поиск: " + Utils.encodeHTML(paramSearch);
mids = MessagesQueries.getSearch(sql, sqlSearch, Utils.encodeSphinx(paramSearch), paramBefore);
} else if (paramShow == null || paramShow.equals("top")) {
- title = rb.getString("Popular");
+ title = "Популярные";
mids = MessagesQueries.getPopular(sql, paramBefore);
} else if (paramShow.equals("my") && visitor != null) {
- title = rb.getString("My feed");
+ title = "Моя лента";
mids = MessagesQueries.getMyFeed(sql, visitor.UID, paramBefore);
} else if (paramShow.equals("private") && visitor != null) {
- title = rb.getString("Private");
+ title = "Приватные";
mids = MessagesQueries.getPrivate(sql, visitor.UID, paramBefore);
} else if (paramShow.equals("discuss") && visitor != null) {
- title = rb.getString("Discussions");
+ title = "Обсуждения";
mids = MessagesQueries.getDiscussions(sql, visitor.UID, paramBefore);
} else if (paramShow.equals("recommended") && visitor != null) {
- title = rb.getString("Recommended");
+ title = "Рекомендации";
mids = MessagesQueries.getRecommended(sql, visitor.UID, paramBefore);
} else if (paramShow.equals("all")) {
- title = rb.getString("Last messages");
+ title = "Все сообщения";
if (visitor != null) {
mids = MessagesQueries.getAll(sql, visitor.UID, paramBefore);
} else {
@@ -92,9 +87,9 @@ public class Home {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, title, null);
- PageTemplates.pageNavigation(out, locale, visitor, null);
+ PageTemplates.pageNavigation(out, visitor, null);
- PageTemplates.pageHomeColumn(out, sql, visitor, locale);
+ PageTemplates.pageHomeColumn(out, sql, visitor);
out.println("<section id=\"content\">");
@@ -116,7 +111,7 @@ public class Home {
}
out.println("<ul>");
- PageTemplates.printMessages(out, sql, null, mids, visitor, locale, visitor == null ? 2 : 3, ad_mid);
+ PageTemplates.printMessages(out, sql, null, mids, visitor, visitor == null ? 2 : 3, ad_mid);
out.println("</ul>");
}
@@ -138,8 +133,8 @@ public class Home {
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();
diff --git a/src/java/com/juick/http/www/Login.java b/src/java/com/juick/http/www/Login.java
index 954d21c9..a24eac2b 100644
--- a/src/java/com/juick/http/www/Login.java
+++ b/src/java/com/juick/http/www/Login.java
@@ -22,8 +22,6 @@ import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-import java.util.Locale;
-import java.util.ResourceBundle;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@@ -42,10 +40,6 @@ public class Login {
return;
}
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("Login", locale);
- ResourceBundle rbg = ResourceBundle.getBundle("Global", locale);
-
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
try {
@@ -168,27 +162,20 @@ public class Login {
out.println(" <li><a href=\"/tag/учеба\" style=\"left: 616px; top: 84px; width: 43px; height: 17px\">учеба</a></li>");
out.println("</ul>");
- out.println("<div id=\"bottom1\">juick.com &copy; 2008-2013 &nbsp; <a href=\"/help/ru/contacts\" rel=\"nofollow\">" + rbg.getString("Contacts") + "</a> &#183; <a href=\"/help/\" rel=\"nofollow\">" + rbg.getString("Help") + "</a></div>");
-
- if (PageTemplates.sape != null) {
- String links = PageTemplates.sape.getPageLinks(request.getRequestURI(), request.getCookies()).render();
- if (links != null && !links.isEmpty()) {
- out.println("<div id=\"bottom2\">" + rbg.getString("Sponsored by") + ": " + links + "</div>");
- }
- }
+ out.println("<div id=\"bottom1\">juick.com &copy; 2008-2014 &nbsp; <a href=\"/help/ru/contacts\" rel=\"nofollow\">Контакты</a> &#183; <a href=\"/help/\" rel=\"nofollow\">Помощь</a></div>");
out.println("<div id=\"signup\">");
- out.println(" " + rb.getString("SignUp") + ":");
+ out.println(" Зарегистрироваться:");
out.println(" <div id=\"facebook\"><a href=\"/_fblogin\" rel=\"nofollow\">Facebook</a></div>");
- out.println(" <div id=\"vk\"><a href=\"/_vklogin\" rel=\"nofollow\">" + rb.getString("VKontakte") + "</a></div>");
+ out.println(" <div id=\"vk\"><a href=\"/_vklogin\" rel=\"nofollow\">ВКонтакте</a></div>");
out.println(" <div id=\"xmpp\"><a href=\"#\" onclick=\"$('#xmppinfo').toggle(); return false\">XMPP</a>");
- out.println(" <div id=\"xmppinfo\">" + rb.getString("XMPPLogin") + " <a href=\"xmpp:juick@juick.com?message;body=LOGIN\">juick@juick.com</a></div>");
+ out.println(" <div id=\"xmppinfo\">Отправьте <b>LOGIN</b> на <a href=\"xmpp:juick@juick.com?message;body=LOGIN\">juick@juick.com</a></div>");
out.println(" </div>");
out.println("</div>");
- out.println("<div id=\"signin\"><a href=\"#\" onclick=\"$('#signinform').toggle(); $('#nickinput').focus(); return false\">" + rb.getString("HaveAccount") + "</a>");
+ out.println("<div id=\"signin\"><a href=\"#\" onclick=\"$('#signinform').toggle(); $('#nickinput').focus(); return false\">Уже зарегистрированы?</a>");
out.println("<div id=\"signinform\"><form action=\"/login\" method=\"POST\">");
- out.println("<input class=\"txt\" type=\"text\" name=\"username\" placeholder=\"" + rb.getString("Username") + "\" id=\"nickinput\"/>");
- out.println("<input class=\"txt\" type=\"password\" name=\"password\" placeholder=\"" + rb.getString("Password") + "\"/>");
+ out.println("<input class=\"txt\" type=\"text\" name=\"username\" placeholder=\"Имя пользователя\" id=\"nickinput\"/>");
+ out.println("<input class=\"txt\" type=\"password\" name=\"password\" placeholder=\"Пароль\"/>");
out.println("<input class=\"submit\" type=\"submit\" value=\"OK\"/>");
out.println("</form></div>");
out.println("</div>");
diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java
index 7ab93e1d..2c8aed9c 100644
--- a/src/java/com/juick/http/www/NewMessage.java
+++ b/src/java/com/juick/http/www/NewMessage.java
@@ -25,8 +25,6 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.sql.Connection;
import java.util.ArrayList;
-import java.util.Locale;
-import java.util.ResourceBundle;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -38,22 +36,19 @@ import javax.servlet.http.HttpServletResponse;
public class NewMessage {
protected void doGetNewMessage(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException {
- Locale locale = request.getLocale();
- ResourceBundle rbnm = ResourceBundle.getBundle("NewMessage", locale);
-
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
try {
- PageTemplates.pageHead(out, rbnm.getString("New message"), "<script src=\"//maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAVVtPtxkw4soCEHg44FsNChRB4OFYjAXt73He16Zkp6a_0tPs2RTU6i6UlcMs4QvPBYvIY8rWvcxqOg\" type=\"text/javascript\"></script>"
+ PageTemplates.pageHead(out, "Написать", "<script src=\"//maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAVVtPtxkw4soCEHg44FsNChRB4OFYjAXt73He16Zkp6a_0tPs2RTU6i6UlcMs4QvPBYvIY8rWvcxqOg\" type=\"text/javascript\"></script>"
+ "<script src=\"//static.juick.com/mc.js\" type=\"text/javascript\" defer=\"defer\"></script>"
+ "<script src=\"//static.juick.com/maps.js?2010111500\" type=\"text/javascript\" defer=\"defer\"></script>"
+ "<script src=\"//static.juick.com/post3.js\" type=\"text/javascript\" defer=\"defer\"></script>");
- PageTemplates.pageNavigation(out, locale, visitor, null);
+ PageTemplates.pageNavigation(out, visitor, null);
out.println("<section id=\"content\" class=\"pagetext\">");
out.println("<form action=\"/post\" method=\"post\" id=\"postmsg\" enctype=\"multipart/form-data\">");
- out.println("<p style=\"text-align: left\"><b>" + rbnm.getString("Location") + ": <span id=\"location\"></span></b> <span id=\"locationclear\">&mdash; <a href=\"#\" onclick=\"clearLocation()\">" + rbnm.getString("Clear") + "</a></span></p>");
- out.println("<p style=\"text-align: left\"><b>" + rbnm.getString("Photo") + ":</b> <span id=\"attachmentfile\"><input type=\"file\" name=\"attach\"/> <i>" + rbnm.getString("Photo_JPG") + "</i></span></p>");
+ out.println("<p style=\"text-align: left\"><b>Место: <span id=\"location\"></span></b> <span id=\"locationclear\">&mdash; <a href=\"#\" onclick=\"clearLocation()\">Отменить</a></span></p>");
+ out.println("<p style=\"text-align: left\"><b>Фото:</b> <span id=\"attachmentfile\"><input type=\"file\" name=\"attach\"/> <i>(JPG, PNG, до 10Мб)</i></span></p>");
String body = request.getParameter("body");
if (body == null) {
@@ -66,14 +61,14 @@ public class NewMessage {
}
out.println("<p><textarea name=\"body\" class=\"newmessage\" rows=\"7\" cols=\"10\">" + body + "</textarea><br/>");
- out.println("<input type=\"hidden\" name=\"place_id\"/>" + "" + "<input type=\"submit\" class=\"subm\" value=\" " + rbnm.getString("Post") + " \"/></p>");
+ out.println("<input type=\"hidden\" name=\"place_id\"/>" + "" + "<input type=\"submit\" class=\"subm\" value=\" Отправить \"/></p>");
out.println("</form>");
out.println("<div id=\"geomap\"></div>");
- out.println("<p style=\"text-align: left\"><b>" + rbnm.getString("Tags") + ":</b></p>");
+ out.println("<p style=\"text-align: left\"><b>Теги:</b></p>");
printUserTags(sql, out, visitor);
out.println("</section>");
- PageTemplates.pageFooter(request, out, locale, visitor, false);
+ PageTemplates.pageFooter(request, out, visitor, false);
PageTemplates.pageEnd(out);
} finally {
out.close();
diff --git a/src/java/com/juick/http/www/PM.java b/src/java/com/juick/http/www/PM.java
index ec51d44c..6d8e04ba 100644
--- a/src/java/com/juick/http/www/PM.java
+++ b/src/java/com/juick/http/www/PM.java
@@ -27,8 +27,6 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.util.ArrayList;
-import java.util.Locale;
-import java.util.ResourceBundle;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -40,10 +38,6 @@ import javax.servlet.http.HttpServletResponse;
public class PM {
protected void doGetInbox(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException {
- Locale locale = request.getLocale();
- ResourceBundle rbg = ResourceBundle.getBundle("Global", locale);
- ResourceBundle rb = ResourceBundle.getBundle("Blogs", locale);
-
/*
int paramBefore = 0;
String paramBeforeStr = request.getParameter("before");
@@ -62,9 +56,9 @@ public class PM {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, title, null);
- PageTemplates.pageNavigation(out, locale, visitor, null);
+ PageTemplates.pageNavigation(out, visitor, null);
- PageTemplates.pageHomeColumn(out, sql, visitor, locale);
+ PageTemplates.pageHomeColumn(out, sql, visitor);
out.println("<section id=\"content\">");
@@ -79,11 +73,11 @@ public class PM {
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>");
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>");
- out.println(" <div class=\"msg-ts\"><a href=\"#\" onclick=\"return false\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"#\" onclick=\"return false\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString) + "</a></div>");
out.println(" <div class=\"msg-txt\">" + txt + "</div>");
out.println(" <form action=\"/pm/send\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"uname\" value=\"" + msg.User.UName + "\"/>");
- out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"replypm\" placeholder=\"" + rbg.getString("Reply") + "\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>");
+ out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"replypm\" placeholder=\"Написать ответ\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>");
out.println(" </form>");
out.println(" </div>");
@@ -101,8 +95,8 @@ public class PM {
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();
@@ -110,10 +104,6 @@ public class PM {
}
protected void doGetSent(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException {
- Locale locale = request.getLocale();
- ResourceBundle rbg = ResourceBundle.getBundle("Global", locale);
- ResourceBundle rb = ResourceBundle.getBundle("Blogs", locale);
-
/*
int paramBefore = 0;
String paramBeforeStr = request.getParameter("before");
@@ -137,9 +127,9 @@ public class PM {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, title, null);
- PageTemplates.pageNavigation(out, locale, visitor, null);
+ PageTemplates.pageNavigation(out, visitor, null);
- PageTemplates.pageHomeColumn(out, sql, visitor, locale);
+ PageTemplates.pageHomeColumn(out, sql, visitor);
out.println("<section id=\"content\">");
@@ -162,7 +152,7 @@ public class PM {
out.println(" <div class=\"msg-avatar\"><img src=\"//i.juick.com/a/" + visitor.UID + ".png\"/></div>");
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-header\">→ <a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>");
- out.println(" <div class=\"msg-ts\"><a href=\"#\" onclick=\"return false\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"#\" onclick=\"return false\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString) + "</a></div>");
out.println(" <div class=\"msg-txt\">" + txt + "</div>");
out.println(" </div>");
out.println(" </li>");
@@ -179,8 +169,8 @@ public class PM {
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();
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 462fdf31..c8d47245 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -31,8 +31,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
-import java.util.Locale;
-import java.util.ResourceBundle;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
@@ -69,7 +67,7 @@ public class PageTemplates {
out.println("<body>");
}
- public static void pageNavigation(PrintWriter out, Locale loc, com.juick.User visitor, String search) {
+ public static void pageNavigation(PrintWriter out, com.juick.User visitor, String search) {
out.println("<header>");
out.println(" <div id=\"logo\"><a href=\"/\">Juick</a></div>");
out.println(" <nav id=\"global\"><ul>");
@@ -138,7 +136,7 @@ public class PageTemplates {
out.println("</script>");
}
- public static void pageHomeColumn(PrintWriter out, Connection sql, com.juick.User visitor, Locale locale) {
+ public static void pageHomeColumn(PrintWriter out, Connection sql, com.juick.User visitor) {
if (tagsHTML == null) {
tagsHTML = PageTemplates.getPopularTags(sql, 60);
}
@@ -197,14 +195,13 @@ public class PageTemplates {
return ret;
}
- public static void pageDialogTemplate(PrintWriter out, Locale locale) {
- ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
+ public static void pageDialogTemplate(PrintWriter out) {
out.println("<div id=\"dialogb\" onclick=\"$('#dialogb').hide();$('#dialogw').hide()\"></div>");
- out.println("<div id=\"dialogw\">" + rb.getString("(Dialog) Link to message") + ":");
+ out.println("<div id=\"dialogw\">Ссылка на сообщение:");
out.println("<div id=\"dialogl\" onclick=\"$(this).selectText()\"></div>");
- out.println(rb.getString("(Dialog) Message number") + ":");
+ out.println("Номер сообщения:");
out.println("<div id=\"dialogn\" onclick=\"$(this).selectText()\"></div>");
- out.println(rb.getString("(Dialog) Share") + ":");
+ out.println("Поделиться:");
out.println("<ul>");
out.println(" <li><a id=\"sharefb\"></a></li>");
out.println(" <li><a id=\"sharetw\"></a></li>");
@@ -214,7 +211,7 @@ public class PageTemplates {
out.println("</div>");
}
- public static void pageFooter(HttpServletRequest request, PrintWriter out, Locale loc, com.juick.User visitor, boolean sapeon) {
+ public static void pageFooter(HttpServletRequest request, PrintWriter out, com.juick.User visitor, boolean sapeon) {
out.println("<div id=\"fwrapper\"><div id=\"footer\">");
out.println(" <div id=\"footer-right\"><a href=\"/settings\" rel=\"nofollow\">Настройки</a> &#183; <a href=\"/help/ru/contacts\" rel=\"nofollow\">Контакты</a> &#183; <a href=\"/help/\" rel=\"nofollow\">Справка</a> &#183; <a href=\"/help/ru/adv\" rel=\"nofollow\">Реклама</a></div>");
out.print(" <div id=\"footer-left\">juick.com &copy; 2008-2014");
@@ -253,17 +250,44 @@ public class PageTemplates {
return ret;
}
- public static String formatDate(int minsago, String fulldate, Locale loc) {
- if (minsago < 1) {
- return "now";
- } else if (minsago < 60) {
- return minsago + " minute" + ((minsago % 10 == 1) ? "" : "s") + " ago";
- } else if (minsago < 1440) {
- int hours = (minsago / 60);
- return hours + " hour" + ((hours % 10 == 1) ? "" : "s") + " ago";
- } else if (minsago < 20160) {
- int days = (minsago / 1440);
- return days + " day" + ((days % 10 == 1) ? "" : "s") + " ago";
+ public static String formatDate(int minutes, String fulldate) {
+ if (minutes < 1) {
+ return "сейчас";
+ } else if (minutes < 60) {
+ String unit;
+ int ld = minutes % 10;
+ if ((minutes < 10 || minutes > 20) && ld == 1) {
+ unit = "минуту";
+ } else if ((minutes < 10 || minutes > 20) && ld > 1 && ld < 5) {
+ unit = "минуты";
+ } else {
+ unit = "минут";
+ }
+ return minutes + " " + unit + " назад";
+ } else if (minutes < 1440) {
+ int hours = (minutes / 60);
+ String unit;
+ int ld = hours % 10;
+ if ((hours < 10 || hours > 20) && ld == 1) {
+ unit = "час";
+ } else if ((hours < 10 || hours > 20) && ld > 1 && ld < 5) {
+ unit = "часа";
+ } else {
+ unit = "часов";
+ }
+ return hours + " " + unit + " назад";
+ } else if (minutes < 20160) {
+ int days = (minutes / 1440);
+ String unit;
+ int ld = days % 10;
+ if ((days < 10 || days > 20) && ld == 1) {
+ unit = "день";
+ } else if ((days < 10 || days > 20) && ld > 1 && ld < 5) {
+ unit = "дня";
+ } else {
+ unit = "дней";
+ }
+ return days + " " + unit + " назад";
} else {
try {
Date pDate = sdfSQL.parse(fulldate);
@@ -294,8 +318,16 @@ public class PageTemplates {
return "";
}
- public static String formatReplies(int replies, Locale loc) {
- return replies + " repl" + (replies % 10 == 1 ? "y" : "ies");
+ public static String formatReplies(int replies) {
+ int ld = replies % 10;
+ int lh = replies % 100;
+ if ((lh < 10 || lh > 20) && ld == 1) {
+ return replies + " ответ";
+ } else if ((lh < 10 || lh > 20) && ld > 1 && ld < 5) {
+ return replies + " ответа";
+ } else {
+ return replies + " ответов";
+ }
}
private static Pattern regexLinks2 = Pattern.compile("((?<=\\s)|(?<=\\A))([\\[\\{]|&lt;)((?:ht|f)tps?://(?:www\\.)?([^\\/\\s\\\"\\)\\!]+)/?(?:[^\\]\\}](?<!&gt;))*)([\\]\\}]|&gt;)");
@@ -386,9 +418,7 @@ public class PageTemplates {
return msg;
}
- public static void printMessages(PrintWriter out, Connection sql, com.juick.User user, ArrayList<Integer> mids, com.juick.User visitor, Locale locale, int YandexID, int ad_mid) {
- ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
-
+ public static void printMessages(PrintWriter out, Connection sql, com.juick.User user, ArrayList<Integer> mids, com.juick.User visitor, int YandexID, int ad_mid) {
ArrayList<com.juick.Message> msgs = MessagesQueries.getMessages(sql, mids);
for (int i = 0; i < msgs.size(); i++) {
@@ -478,9 +508,9 @@ public class PageTemplates {
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\"></a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:" + tags + "</div>");
- out.print(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a>");
+ out.print(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString) + "</a>");
if (msg.MID == ad_mid) {
- out.print(" &#183; <a href=\"/help/ru/adv\">" + rb.getString("Sponsored") + "</a>");
+ out.print(" &#183; <a href=\"/help/ru/adv\">Реклама</a>");
}
out.println("</div>");
@@ -494,12 +524,12 @@ public class PageTemplates {
if (visitor != null && (msg.ReadOnly == false || visitor.UID == msg.User.UID)) {
out.println(" <form action=\"/post\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + msg.MID + "\"/>");
- out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"" + rb.getString("Add a comment") + "\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>");
+ out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Написать комментарий\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>");
out.println(" </form>");
}
if (msg.Replies > 0) {
String repliesby = (msg.RepliesBy != null) ? msg.RepliesBy : "...";
- out.println(" <div class=\"msg-comments\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\">" + formatReplies(msg.Replies, locale) + "</a> " + rb.getString("(replies) by") + " " + repliesby + "</div>");
+ out.println(" <div class=\"msg-comments\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\">" + formatReplies(msg.Replies) + "</a> от " + repliesby + "</div>");
}
out.println(" </div>");
out.println(" </li>");
diff --git a/src/java/com/juick/http/www/Settings.java b/src/java/com/juick/http/www/Settings.java
index 5273507e..de37bdd0 100644
--- a/src/java/com/juick/http/www/Settings.java
+++ b/src/java/com/juick/http/www/Settings.java
@@ -22,8 +22,6 @@ import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-import java.util.Locale;
-import java.util.ResourceBundle;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@@ -37,28 +35,26 @@ public class Settings {
protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("Login", locale);
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
try {
- PageTemplates.pageHead(out, rb.getString("Login"), "");
- PageTemplates.pageNavigation(out, locale, visitor, null);
+ PageTemplates.pageHead(out, "Логин", "");
+ PageTemplates.pageNavigation(out, visitor, null);
out.println("<div id=\"topwrapper\">");
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
out.println("<form action=\"/login\" method=\"post\">");
- out.println("<p>" + rb.getString("Username") + ": <input type=\"text\" name=\"username\"/></p>");
- out.println("<p>" + rb.getString("Password") + ": <input type=\"password\" name=\"password\"/></p>");
+ out.println("<p>Имя пользователя: <input type=\"text\" name=\"username\"/></p>");
+ out.println("<p>Пароль: <input type=\"password\" name=\"password\"/></p>");
out.println("<p><input type=\"submit\" value=\" OK \"/></p>");
out.println("</form>");
out.println("</div>");
out.println("</div>");
out.println("</div>"); // topwrapper
- PageTemplates.pageFooter(request, out, locale, visitor, false);
+ PageTemplates.pageFooter(request, out, visitor, false);
PageTemplates.pageEnd(out);
} finally {
out.close();
diff --git a/src/java/com/juick/http/www/SignUp.java b/src/java/com/juick/http/www/SignUp.java
index f6212e3d..2fbe2e2d 100644
--- a/src/java/com/juick/http/www/SignUp.java
+++ b/src/java/com/juick/http/www/SignUp.java
@@ -24,8 +24,6 @@ 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.Cookie;
import javax.servlet.http.HttpServletRequest;
@@ -39,8 +37,6 @@ public class SignUp {
protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("SignUp", locale);
String type = request.getParameter("type");
String hash = request.getParameter("hash");
@@ -65,8 +61,8 @@ public class SignUp {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
try {
- PageTemplates.pageHead(out, rb.getString("Unknown account"), "");
- PageTemplates.pageNavigation(out, locale, visitor, null);
+ PageTemplates.pageHead(out, "Новый пользователь", "");
+ PageTemplates.pageNavigation(out, visitor, null);
out.println("<section id=\"content\">");
@@ -80,42 +76,35 @@ public class SignUp {
}
out.println(account + "</h1>");
- out.println("<h2 class=\"signup-h2\">" + rb.getString("Link with existing") + "</h2>");
+ out.println("<h2 class=\"signup-h2\">Связать с существующим аккаунтом Juick</h2>");
out.println("<form action=\"/signup\" method=\"post\">");
out.println("<input type=\"hidden\" name=\"action\" value=\"link\"/>");
out.println("<input type=\"hidden\" name=\"type\" value=\"" + type + "\"/>");
out.println("<input type=\"hidden\" name=\"hash\" value=\"" + hash + "\"/>");
if (visitor != null) {
- out.println("<input type=\"submit\" value=\"" + rb.getString("Link with this") + "\"/>");
+ out.println("<input type=\"submit\" value=\"Связать с этим аккаунтом\"/>");
} else {
- out.println("<p>" + rb.getString("Username") + ": <input type=\"text\" name=\"username\"/></p>");
- out.println("<p>" + rb.getString("Password") + ": <input type=\"password\" name=\"password\"/></p>");
+ out.println("<p>Имя пользователя: <input type=\"text\" name=\"username\"/></p>");
+ out.println("<p>Пароль: <input type=\"password\" name=\"password\"/></p>");
out.println("<p><input type=\"submit\" value=\" OK \"/></p>");
}
out.println("</form>");
out.println("<hr class=\"signup-hr\"/>");
- out.println("<h2 class=\"signup-h2\">" + rb.getString("Create new") + "</h2>");
+ out.println("<h2 class=\"signup-h2\">Создать новый аккаунт Juick</h2>");
out.println("<form action=\"/signup\" method=\"post\">");
out.println("<input type=\"hidden\" name=\"action\" value=\"new\"/>");
out.println("<input type=\"hidden\" name=\"type\" value=\"" + type + "\"/>");
out.println("<input type=\"hidden\" name=\"hash\" value=\"" + hash + "\"/>");
- out.println("<p>" + rb.getString("Username") + ": <input type=\"text\" name=\"username\" id=\"username\" onblur=\"checkUsername()\"/><br/><i>" + rb.getString("Username restrictions") + "</i></p>");
- out.println("<p>" + rb.getString("Password") + ": <input type=\"password\" name=\"password\"/><br/><i>" + rb.getString("Password restrictions") + "</i></p>");
- out.println("<p>" + rb.getString("Language") + ": <select name=\"lang\">");
- String langs[] = rb.getString("Languages").split(",");
- String langcodes[] = rb.getString("Language codes").split(",");
- for (int i = 0; i < langs.length; i++) {
- out.println(" <option value=\"" + langcodes[i] + "\">" + langs[i] + "</option>");
- }
- out.println("</select></p>");
+ out.println("<p>Имя пользователя: <input type=\"text\" name=\"username\" id=\"username\" onblur=\"checkUsername()\"/><br/><i>(От 2-х до 16-и латинских символов и/или цифр, дефис)</i></p>");
+ out.println("<p>Пароль: <input type=\"password\" name=\"password\"/><br/><i>(от 6-и до 32-х символов)</i></p>");
out.println("<p><input type=\"submit\" value=\" OK \"/></p>");
out.println("</form>");
out.println("</section>");
- PageTemplates.pageFooter(request, out, locale, visitor, false);
+ PageTemplates.pageFooter(request, out, visitor, false);
PageTemplates.pageEnd(out);
} finally {
out.close();
@@ -163,15 +152,14 @@ public class SignUp {
} else { // Create new account
String username = request.getParameter("username");
String password = request.getParameter("password");
- String lang = request.getParameter("lang");
- if (username == null || password == null || lang == null || username.length() < 2 || username.length() > 16 || !username.matches("^[a-zA-Z0-9\\-]+$") || password.length() < 6 || password.length() > 32 || lang.length() != 2) {
+ if (username == null || password == null || username.length() < 2 || username.length() > 16 || !username.matches("^[a-zA-Z0-9\\-]+$") || password.length() < 6 || password.length() > 32) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
// CHECK USERNAME
- uid = UserQueries.createUser(sql, username, password, lang);
+ uid = UserQueries.createUser(sql, username, password);
if (uid <= 0) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
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>");
}
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index ff05cf4b..57c1a696 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -23,8 +23,6 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.util.ArrayList;
-import java.util.Locale;
-import java.util.ResourceBundle;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -37,7 +35,6 @@ public class UserThread {
protected void doGetThread(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User user, int MID) throws ServletException, IOException {
com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
- Locale locale = request.getLocale();
if (!MessagesQueries.canViewThread(sql, MID, visitor != null ? visitor.UID : 0)) {
response.sendError(403);
@@ -65,25 +62,22 @@ public class UserThread {
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);
out.println("<section id=\"content\" style=\"margin-left: 0; width: 100%\">");
- com.juick.Message msg = printMessage(out, sql, user, MID, visitor, locale);
- printReplies(out, sql, msg, visitor, locale, listview);
+ com.juick.Message msg = printMessage(out, sql, user, MID, visitor);
+ printReplies(out, sql, msg, visitor, listview);
out.println("</section>");
- PageTemplates.pageDialogTemplate(out, locale);
- PageTemplates.pageFooter(request, out, locale, visitor, false);
+ PageTemplates.pageDialogTemplate(out);
+ PageTemplates.pageFooter(request, out, visitor, false);
PageTemplates.pageEnd(out);
} finally {
out.close();
}
}
- public static com.juick.Message printMessage(PrintWriter out, Connection sql, com.juick.User user, int mid, com.juick.User visitor, Locale locale) {
- ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
- ResourceBundle rbthread = ResourceBundle.getBundle("UserThread", locale);
-
+ public static com.juick.Message printMessage(PrintWriter out, Connection sql, com.juick.User user, int mid, com.juick.User visitor) {
com.juick.Message msg = MessagesQueries.getMessage(sql, mid);
msg.VisitorCanComment = visitor != null;
@@ -146,13 +140,13 @@ public class UserThread {
if (msg.VisitorCanComment) {
out.println(" <form action=\"/post\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + mid + "\"/>");
- out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"" + rb.getString("Add a comment") + "\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>");
+ out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Написать комментарий\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>");
out.println(" </form>");
}
ArrayList<String> recomm = MessagesQueries.getMessageRecommendations(sql, mid);
if (!recomm.isEmpty()) {
- out.print(" <div class=\"" + (msg.VisitorCanComment ? "msg-recomms" : "msg-comments") + "\">" + rb.getString("Recommended by") + " (" + recomm.size() + "): ");
+ out.print(" <div class=\"" + (msg.VisitorCanComment ? "msg-recomms" : "msg-comments") + "\">Рекомендовали (" + recomm.size() + "): ");
for (int i = 0; i < recomm.size(); i++) {
if (i > 0) {
out.print(", ");
@@ -169,15 +163,15 @@ public class UserThread {
if (visitor != null) {
if (visitor.UID != msg.User.UID) {
if (MessagesQueries.isSubscribed(sql, visitor.UID, mid)) {
- out.println(" <li><a href=\"/post?body=U+%23" + mid + "\"><div style=\"background-position: -48px 0\"></div>" + rbthread.getString("(MToolbar) Subcribed") + "</a></li>");
+ out.println(" <li><a href=\"/post?body=U+%23" + mid + "\"><div style=\"background-position: -48px 0\"></div>Подписан</a></li>");
} else {
- out.println(" <li><a href=\"/post?body=S+%23" + mid + "\"><div style=\"background-position: -16px 0\"></div>" + rbthread.getString("(MToolbar) Subcribe") + "</a></li>");
+ out.println(" <li><a href=\"/post?body=S+%23" + mid + "\"><div style=\"background-position: -16px 0\"></div>Подписаться</a></li>");
}
if (!visitorInBL) {
- out.println(" <li><a href=\"/post?body=%21+%23" + mid + "\"><div style=\"background-position: -32px 0\"></div>" + rbthread.getString("(MToolbar) Recommend") + "</a></li>");
+ out.println(" <li><a href=\"/post?body=%21+%23" + mid + "\"><div style=\"background-position: -32px 0\"></div>Рекомендовать</a></li>");
}
} else {
- out.println(" <li><a href=\"/post?body=D+%23" + mid + "\"><div style=\"background-position: 0\"></div>" + rbthread.getString("(MToolbar) Delete") + "</a></li>");
+ out.println(" <li><a href=\"/post?body=D+%23" + mid + "\"><div style=\"background-position: 0\"></div>Удалить</a></li>");
}
}
out.println(" </ul></li>");
@@ -186,9 +180,7 @@ public class UserThread {
return msg;
}
- public static void printReplies(PrintWriter out, Connection sql, com.juick.Message msg, com.juick.User visitor, Locale locale, boolean listview) {
- ResourceBundle rbuser = ResourceBundle.getBundle("User", locale);
-
+ public static void printReplies(PrintWriter out, Connection sql, com.juick.Message msg, com.juick.User visitor, boolean listview) {
ArrayList<com.juick.Message> replies = MessagesQueries.getReplies(sql, msg.MID);
ArrayList<Integer> blUIDs = new ArrayList<Integer>();
@@ -242,22 +234,22 @@ public class UserThread {
out.println("<div class=\"title2\">");
out.print(" <div class=\"title2-right\">");
if (listview) {
- out.print("<a href=\"?view=tree\">" + rbuser.getString("View as tree") + "</a>");
+ out.print("<a href=\"?view=tree\">Показать деревом</a>");
} else {
if (foldable) {
- out.print("<span id=\"unfoldall\"><a href=\"#\" onclick=\"$('#replies>li').show(); $('#replies .msg-comments').hide(); $('#unfoldall').hide(); return false\">" + rbuser.getString("Expand all") + "</a> &#183; </span>");
+ out.print("<span id=\"unfoldall\"><a href=\"#\" onclick=\"$('#replies>li').show(); $('#replies .msg-comments').hide(); $('#unfoldall').hide(); return false\">Раскрыть все</a> &#183; </span>");
}
- out.print("<a href=\"?view=list\">" + rbuser.getString("View as list") + "</a>");
+ out.print("<a href=\"?view=list\">Показать списком</a>");
}
out.print("</div>");
- out.println(" <h2>" + rbuser.getString("Replies") + " (" + replies.size() + ")</h2>");
+ out.println(" <h2>Ответы (" + replies.size() + ")</h2>");
out.println("</div>");
out.println("<ul id=\"replies\">");
if (listview) {
- printList(out, replies, locale);
+ printList(out, replies);
} else {
- printTree(out, replies, 0, 0, false, locale);
+ printTree(out, replies, 0, 0, false);
}
out.println("</ul>");
@@ -268,9 +260,7 @@ public class UserThread {
}
}
- public static void printTree(PrintWriter out, ArrayList<com.juick.Message> replies, int ReplyTo, int margin, boolean hidden, Locale locale) {
- ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
-
+ public static void printTree(PrintWriter out, ArrayList<com.juick.Message> replies, int ReplyTo, int margin, boolean hidden) {
if (margin > 240) {
margin = 240;
}
@@ -291,36 +281,34 @@ public class UserThread {
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "," + msg.RID + "); return false\"></a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString) + "</a></div>");
out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>");
if (msg.AttachmentType != null) {
out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.MID + "-" + msg.RID + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.MID + "-" + msg.RID + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
}
if (msg.VisitorCanComment) {
- out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">" + rb.getString("Comment") + "</a></div>");
+ out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
}
int childs = msg.getChildsCount();
if (ReplyTo == 0 && childs > 1 && replies.size() > 10) {
- out.println(" <div class=\"msg-comments\"><a href=\"#\" onclick=\"return showMoreReplies(" + msg.RID + ")\">" + PageTemplates.formatReplies(childs, locale) + " more</a></div>");
+ out.println(" <div class=\"msg-comments\"><a href=\"#\" onclick=\"return showMoreReplies(" + msg.RID + ")\">" + PageTemplates.formatReplies(childs) + " more</a></div>");
}
out.println(" </div>");
out.println(" </li>");
if (ReplyTo == 0 && childs > 1 && replies.size() > 10) {
- printTree(out, msg.childs, msg.RID, margin + 20, true, locale);
+ printTree(out, msg.childs, msg.RID, margin + 20, true);
} else if (childs > 0) {
- printTree(out, msg.childs, msg.RID, margin + 20, hidden, locale);
+ printTree(out, msg.childs, msg.RID, margin + 20, hidden);
}
}
}
}
- public static void printList(PrintWriter out, ArrayList<com.juick.Message> replies, Locale locale) {
- ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
-
+ public static void printList(PrintWriter out, ArrayList<com.juick.Message> replies) {
for (int i = 0; i < replies.size(); i++) {
com.juick.Message msg = replies.get(i);
@@ -329,17 +317,17 @@ public class UserThread {
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "," + msg.RID + "); return false\"></a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString) + "</a></div>");
out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>");
if (msg.AttachmentType != null) {
out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.MID + "-" + msg.RID + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.MID + "-" + msg.RID + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>");
}
out.print(" <div class=\"msg-links\">/" + msg.RID);
if (msg.ReplyTo > 0) {
- out.print(" " + rb.getString("in reply to") + " <a href=\"#" + msg.ReplyTo + "\">/" + msg.ReplyTo + "</a>");
+ out.print(" в ответ на <a href=\"#" + msg.ReplyTo + "\">/" + msg.ReplyTo + "</a>");
}
if (msg.VisitorCanComment) {
- out.println(" &#183; <a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">" + rb.getString("Comment") + "</a></div>");
+ out.println(" &#183; <a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
}
out.println(" </div>");