diff options
author | Ugnich Anton | 2013-01-03 17:24:54 +0700 |
---|---|---|
committer | Ugnich Anton | 2013-01-03 17:24:54 +0700 |
commit | 881bc336c1cef93d08cd1f14e37f3a3feeb07e58 (patch) | |
tree | fcd3ea5ff881a1f59e4d42fd57dee7003b5bcdc1 /src/java/com/juick/http/www/PageTemplates.java | |
parent | 84e5ac3a172e15f11b04203cf9e93c9d5c8174ed (diff) |
many bugfixes
message number js autoselection
privacy fix
Diffstat (limited to 'src/java/com/juick/http/www/PageTemplates.java')
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 110 |
1 files changed, 46 insertions, 64 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index 67f036fc..080752d1 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -23,9 +23,6 @@ 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.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -55,11 +52,11 @@ public class PageTemplates { out.println("<html>"); out.println("<head>"); out.println(" <title>" + title + "</title>"); - out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2013010101.css\"/>"); + out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2013010300.css\"/>"); out.println(" <link rel=\"icon\" type=\"image/png\" href=\"//static.juick.com/favicon.png\"/>"); out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>"); out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" defer=\"defer\" async=\"async\"></script>"); - out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2013010100.js\" defer=\"defer\"></script>"); + out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2013010300.js\" defer=\"defer\"></script>"); if (headers != null) { out.println(headers); } @@ -85,69 +82,54 @@ public class PageTemplates { out.println(" <li class=\"right\"><a href=\"/" + user.UName + "\" class=\"wide\"><img src=\"//i.juick.com/as/" + user.UID + ".png\" alt=\"" + user.UName + "\"/><label>" + user.UName + "</label></a></li>"); out.println(" <li class=\"right\"><a href=\"/post\" class=\"wide\"><div class=\"head-ico\" id=\"hi-post\"></div><label>" + rb.getString("Post") + "</label></a></li>"); } else { - out.println(" <li class=\"right\"><a href=\"/login\" class=\"wide\">" + rb.getString("Login") + "</a></li>"); + out.println(" <li class=\"right\"><a href=\"/login\" class=\"wide\" rel=\"nofollow\">" + rb.getString("Login") + "</a></li>"); } out.println("</ul>"); out.println("</div>"); } /* - public static void pageFilters(PrintWriter out, Locale loc, com.juick.User user) { - ResourceBundle rb = ResourceBundle.getBundle("Global", loc); + public static void pageUserTitle(PrintWriter out, Connection sql, Locale loc, com.juick.User user, com.juick.User visitor) { + ResourceBundle rb = ResourceBundle.getBundle("User", loc); - out.println("<div id=\"filters\">"); - out.println("<ul>"); - out.println(" <li><a href=\"#\">Messages</a></li>"); - out.println(" <li><a href=\"#\">Photos</a></li>"); - out.println(" <li><a href=\"#\">Recommendations</a></li>"); - out.println(" <li><a href=\"#\">Private</a></li>"); - out.println(" <li><a href=\"#\">Tags</a></li>"); - out.println(" <li><a href=\"#\">Users</a></li>"); - out.println("</ul>"); + // Full name and description + String fullname = null; + String description = null; + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = sql.prepareStatement("SELECT fullname,descr FROM usersinfo WHERE user_id=?"); + stmt.setInt(1, user.UID); + rs = stmt.executeQuery(); + if (rs.first()) { + fullname = rs.getString(1) + " (" + user.UName + ")"; + description = rs.getString(2); + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + if (fullname == null) { + fullname = user.UName; + } + if (description == null) { + description = ""; + } + + out.println("<div id=\"title\">"); + out.println(" <div id=\"title-av\"><a href=\"/" + user.UName + "/\"><img src=\"//i.juick.com/a/" + user.UID + ".png\" width=\"96\" height=\"96\" alt=\"" + user.UName + "\"/></a></div>"); + out.println(" <div id=\"title-stats\"><ul>"); + out.println(" <li><a href=\"/" + user.UName + "/friends\">" + rb.getString("(Stats) I read") + ": " + UserQueries.getStatsIRead(sql, user.UID) + "</a></li>"); + out.println(" <li><a href=\"/" + user.UName + "/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(" </ul></div>"); + out.println(" <div id=\"title-username\"><h1>" + fullname + "</h1><p>" + description + "</p></div>"); out.println("</div>"); + out.println(); } */ - public static void pageUserTitle(PrintWriter out, Connection sql, Locale loc, com.juick.User user, com.juick.User visitor) { - ResourceBundle rb = ResourceBundle.getBundle("User", loc); - - // Full name and description - String fullname = null; - String description = null; - PreparedStatement stmt = null; - ResultSet rs = null; - try { - stmt = sql.prepareStatement("SELECT fullname,descr FROM usersinfo WHERE user_id=?"); - stmt.setInt(1, user.UID); - rs = stmt.executeQuery(); - if (rs.first()) { - fullname = rs.getString(1) + " (" + user.UName + ")"; - description = rs.getString(2); - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - if (fullname == null) { - fullname = user.UName; - } - if (description == null) { - description = ""; - } - - out.println("<div id=\"title\">"); - out.println(" <div id=\"title-av\"><a href=\"/" + user.UName + "/\"><img src=\"//i.juick.com/a/" + user.UID + ".png\" width=\"96\" height=\"96\" alt=\"" + user.UName + "\"/></a></div>"); - out.println(" <div id=\"title-stats\"><ul>"); - out.println(" <li><a href=\"/" + user.UName + "/friends\">" + rb.getString("(Stats) I read") + ": " + UserQueries.getStatsIRead(sql, user.UID) + "</a></li>"); - out.println(" <li><a href=\"/" + user.UName + "/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(" </ul></div>"); - out.println(" <div id=\"title-username\"><h1>" + fullname + "</h1><p>" + description + "</p></div>"); - out.println("</div>"); - out.println(); - } - public static void pageYandexAd(PrintWriter out, int stat_id) { out.println("<div id=\"yandex_ad\"></div>"); out.println("<script type=\"text/javascript\">"); @@ -183,9 +165,9 @@ public class PageTemplates { ResourceBundle rb = ResourceBundle.getBundle("Global", locale); 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=\"dialogl\"></div>"); + out.println("<div id=\"dialogl\" onclick=\"$(this).selectText()\"></div>"); out.println(rb.getString("(Dialog) Message number") + ":"); - out.println("<div id=\"dialogn\"></div>"); + out.println("<div id=\"dialogn\" onclick=\"$(this).selectText()\"></div>"); out.println(rb.getString("(Dialog) Share") + ":"); out.println("<ul>"); out.println(" <li><a id=\"sharefb\"></a></li>"); @@ -196,12 +178,12 @@ public class PageTemplates { out.println("</div>"); } - public static void pageFooter(HttpServletRequest request, PrintWriter out, Locale loc, com.juick.User visitor) { + public static void pageFooter(HttpServletRequest request, PrintWriter out, Locale loc, com.juick.User visitor, boolean sapeon) { ResourceBundle rb = ResourceBundle.getBundle("Global", loc); out.println("<div id=\"fwrapper\"><div id=\"footer\">"); - out.println(" <div id=\"footer-right\"><a href=\"/help/ru/contacts\">" + rb.getString("Contacts") + "</a> · <a href=\"/help/\">" + rb.getString("Help") + "</a></div>"); - out.print(" <div id=\"footer-left\">juick.com © 2008-2012"); - if (sape != null && (visitor == null || visitor.UID == 1)) { + out.println(" <div id=\"footer-right\"><a href=\"/help/ru/contacts\" rel=\"nofollow\">" + rb.getString("Contacts") + "</a> · <a href=\"/help/\" rel=\"nofollow\">" + rb.getString("Help") + "</a></div>"); + out.print(" <div id=\"footer-left\">juick.com © 2008-2013"); + if (sapeon && sape != null && (visitor == null || visitor.UID == 1)) { String links = sape.getPageLinks(request.getRequestURI(), request.getCookies()).render(); if (links != null && !links.isEmpty()) { out.print("<br/>" + rb.getString("Sponsored by") + ": " + links); |