diff options
-rw-r--r-- | src/java/com/juick/http/www/Blogs.java | 6 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Help.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Login.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/NewMessage.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 8 | ||||
-rw-r--r-- | src/java/com/juick/http/www/User.java | 8 | ||||
-rw-r--r-- | src/java/com/juick/http/www/UserThread.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Utils.java | 2 |
8 files changed, 21 insertions, 11 deletions
diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java index 756088e2..548231ae 100644 --- a/src/java/com/juick/http/www/Blogs.java +++ b/src/java/com/juick/http/www/Blogs.java @@ -74,6 +74,7 @@ public class Blogs { return; } } else if (requesturi.startsWith("/places/")) { + //TODO перенести сюда блок, который страницей ниже } int paramBefore = 0; @@ -164,7 +165,7 @@ public class Blogs { PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, title, null); - PageTemplates.pageNavigation(out, locale, visitor); + PageTemplates.pageNavigation(out, locale, visitor, paramSearch); out.println("<div id=\"topwrapper\">"); out.println("<div id=\"wrapper\">"); @@ -185,6 +186,9 @@ public class Blogs { if (paramShow != null) { nextpage += "&show=" + paramShow; } + if (paramSearch != null) { + nextpage += "&search=" + URLEncoder.encode(paramSearch, "UTF-8"); + } out.println("<p class=\"page\"><a href=\"" + nextpage + "\">Older →</a></p>"); } diff --git a/src/java/com/juick/http/www/Help.java b/src/java/com/juick/http/www/Help.java index a67b3929..e780e196 100644 --- a/src/java/com/juick/http/www/Help.java +++ b/src/java/com/juick/http/www/Help.java @@ -75,7 +75,7 @@ public class Help { PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, rb.getString("Help"), ""); - PageTemplates.pageNavigation(out, locale, visitor); + PageTemplates.pageNavigation(out, locale, visitor, null); out.println("<div id=\"topwrapper\">"); out.println("<div id=\"wrapper\">"); diff --git a/src/java/com/juick/http/www/Login.java b/src/java/com/juick/http/www/Login.java index 3cf4a318..326206da 100644 --- a/src/java/com/juick/http/www/Login.java +++ b/src/java/com/juick/http/www/Login.java @@ -44,7 +44,7 @@ public class Login { PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, rb.getString("Login"), ""); - PageTemplates.pageNavigation(out, locale, visitor); + PageTemplates.pageNavigation(out, locale, visitor, null); out.println("<div id=\"wrapper\">"); out.println("<div id=\"content\">"); diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java index 9ca7e7ed..b66b87d1 100644 --- a/src/java/com/juick/http/www/NewMessage.java +++ b/src/java/com/juick/http/www/NewMessage.java @@ -48,7 +48,7 @@ public class NewMessage { + "<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); + PageTemplates.pageNavigation(out, locale, visitor, null); out.println("<div id=\"wrapper\"><div id=\"content\" class=\"pagetext\">"); out.println("<form action=\"/post\" method=\"post\" id=\"postmsg\" enctype=\"multipart/form-data\">"); diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index a22f198e..628c9be9 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -69,12 +69,16 @@ public class PageTemplates { out.println("<body>"); } - public static void pageNavigation(PrintWriter out, Locale loc, com.juick.User user) { + public static void pageNavigation(PrintWriter out, Locale loc, com.juick.User user, String search) { ResourceBundle rb = ResourceBundle.getBundle("Global", loc); out.println("<div id=\"hwrapper\">"); out.println("<ul id=\"header\">"); out.println(" <li id=\"logo\"><a href=\"" + (user != null ? "/?show=my" : "/") + "\"><div class=\"head-ico\" id=\"hi-logo\"></div></a></li>"); - out.println(" <li id=\"search\"><form action=\"/\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\"/></form></li>"); + out.print(" <li id=\"search\"><form action=\"/\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\""); + if (search != null) { + out.print(" value=\"" + Utils.encodeHTML(search) + "\""); + } + out.println("/></form></li>"); if (user != null) { out.println(" <li class=\"right\"><a href=\"/logout\"><div class=\"head-ico\" id=\"hi-logout\"></div></a></li>"); out.println(" <li class=\"right\"><a href=\"/settings\"><div class=\"head-ico\" id=\"hi-settings\"></div></a></li>"); diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index 03d50059..0236a352 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -107,7 +107,7 @@ 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); + PageTemplates.pageNavigation(out, locale, visitor, null); //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); out.println("<div id=\"topwrapper\">"); @@ -154,7 +154,7 @@ public class User { PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Menu) Tags"), null); - PageTemplates.pageNavigation(out, locale, visitor); + PageTemplates.pageNavigation(out, locale, visitor, null); //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); out.println("<div id=\"topwrapper\">"); @@ -182,7 +182,7 @@ public class User { PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) I read"), null); - PageTemplates.pageNavigation(out, locale, visitor); + PageTemplates.pageNavigation(out, locale, visitor, null); //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); out.println("<div id=\"topwrapper\">"); @@ -233,7 +233,7 @@ public class User { PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) I read"), null); - PageTemplates.pageNavigation(out, locale, visitor); + PageTemplates.pageNavigation(out, locale, visitor, null); //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); out.println("<div id=\"topwrapper\">"); diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index 38c08ef8..0cb0243c 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -65,7 +65,7 @@ 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); + PageTemplates.pageNavigation(out, locale, visitor, null); //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); out.println("<div id=\"topwrapper\">"); diff --git a/src/java/com/juick/http/www/Utils.java b/src/java/com/juick/http/www/Utils.java index 15782bf0..38550691 100644 --- a/src/java/com/juick/http/www/Utils.java +++ b/src/java/com/juick/http/www/Utils.java @@ -104,10 +104,12 @@ public class Utils { public static String encodeHTML(String str) { String ret = str; + ret = ret.replaceAll("&", "&"); ret = ret.replaceAll("<", "<"); ret = ret.replaceAll(">", ">"); ret = ret.replaceAll("'", "'"); ret = ret.replaceAll("\"", """); + ret = ret.replaceAll("\n", " "); return str; } |