diff options
Diffstat (limited to 'src/java/com/juick/http/www/PageTemplates.java')
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 122 |
1 files changed, 38 insertions, 84 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index 16a00d24..462fdf31 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -55,9 +55,9 @@ public class PageTemplates { out.println("<!DOCTYPE html>"); out.print("<html>"); out.print("<head>"); - out.print("<link rel=\"stylesheet\" href=\"/style.2014012700.css\"/>"); + out.print("<link rel=\"stylesheet\" href=\"/style.2014013002.css\"/>"); out.print("<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>"); - out.print("<script type=\"text/javascript\" src=\"/scripts.2014012700.js\" defer=\"defer\"></script>"); + out.print("<script type=\"text/javascript\" src=\"/scripts.2014013000.js\" defer=\"defer\"></script>"); if (headers != null) { out.print(headers); } @@ -69,75 +69,43 @@ public class PageTemplates { out.println("<body>"); } - 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\">"); - if (user != null) { - out.println(" <li><a href=\"/?show=my\"><div class=\"head-ico\" id=\"hi-home\"></div><label>" + rb.getString("Home") + "</label></a></li>"); - } else { - out.println(" <li><a href=\"/\"><div class=\"head-ico\" id=\"hi-logo\"></div></a></li>"); - } - - out.print(" <li id=\"search\"><form action=\"/\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\""); + public static void pageNavigation(PrintWriter out, Locale loc, 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>"); + out.println(" <li><a href=\"/\">Популярные</a></li>"); + out.println(" <li>/</li>"); + out.println(" <li><a href=\"/?show=all\">Все сообщения</a></li>"); + out.println(" </ul></nav>"); + out.print(" <div id=\"search\"><form action=\"/\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"Поиск\""); 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>"); - 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>"); + out.println("/></form></div>"); + out.println(" <section id=\"headdiv\">"); + if (visitor != null) { + out.println(" <nav id=\"user\"><ul>"); + out.println(" <li><a href=\"/?show=my\">Моя лента</a></li>"); + out.println(" <li>/</li>"); + out.println(" <li><a href=\"/pm/inbox\">Приватные</a></li>"); + out.println(" <li>/</li>"); + out.println(" <li><a href=\"/?show=discuss\">Обсуждения</a></li>"); + out.println(" <li>/</li>"); + out.println(" <li><a href=\"/?show=recommended\">Рекомендации</a></li>"); + out.println(" </ul></nav>"); + out.println(" <nav id=\"actions\"><ul>"); + out.println(" <li><a href=\"/post\">Написать</a></li>"); + out.println(" <li>/</li>"); + out.println(" <li><a href=\"/" + visitor.UName + "\">@" + visitor.UName + "</a></li>"); + out.println(" <li>/</li>"); + out.println(" <li><a href=\"/logout\">Выйти</a></li>"); + out.println(" </ul></nav>"); } else { - out.println(" <li class=\"right\"><a href=\"/login\" class=\"wide\" rel=\"nofollow\">" + rb.getString("Login") + "</a></li>"); + out.println("<p>Чтобы добавлять сообщения и комментарии, <a href=\"/login\">представьтесь</a>.</p>"); } - out.println("</ul>"); - out.println("</div>"); - } - /* - 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); + out.println(" </section>"); + out.println("</header>"); } - } 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>"); @@ -171,26 +139,13 @@ public class PageTemplates { } public static void pageHomeColumn(PrintWriter out, Connection sql, com.juick.User visitor, Locale locale) { - ResourceBundle rb = ResourceBundle.getBundle("Blogs", locale); - if (tagsHTML == null) { tagsHTML = PageTemplates.getPopularTags(sql, 60); } - out.println("<div id=\"column\" class=\"abs\">"); - out.println(" <ul>"); - if (visitor != null) { - out.println(" <li><a href=\"/?show=my\">" + rb.getString("My feed") + "</a></li>"); - out.println(" <li><a href=\"/pm/inbox\">" + rb.getString("Private") + "</a> · <a href=\"/pm/sent\">" + rb.getString("Private sent") + "</a></li>"); - out.println(" <li><a href=\"/?show=discuss\">" + rb.getString("Discussions") + "</a></li>"); - out.println(" <li><a href=\"/?show=recommended\">" + rb.getString("Recommended") + "</a></li>"); - } - out.println(" <li class=\"margtop\"><a href=\"/\">" + rb.getString("Popular") + "</a></li>"); - out.println(" <li><a href=\"/?show=all\">" + rb.getString("All messages") + "</a></li>"); - out.println(" </ul>"); - out.println(" <hr/>"); + out.println("<aside id=\"column\">"); out.println(" <p>" + tagsHTML + "</p>"); - out.println("</div>"); + out.println("</aside>"); } public static String getPopularTags(Connection sql, int cnt) { @@ -260,14 +215,13 @@ public class PageTemplates { } 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\" rel=\"nofollow\">" + rb.getString("Contacts") + "</a> · <a href=\"/help/\" rel=\"nofollow\">" + rb.getString("Help") + "</a> · <a href=\"/help/ru/adv\" rel=\"nofollow\">" + rb.getString("Advertising") + "</a></div>"); - out.print(" <div id=\"footer-left\">juick.com © 2008-2013"); + out.println(" <div id=\"footer-right\"><a href=\"/settings\" rel=\"nofollow\">Настройки</a> · <a href=\"/help/ru/contacts\" rel=\"nofollow\">Контакты</a> · <a href=\"/help/\" rel=\"nofollow\">Справка</a> · <a href=\"/help/ru/adv\" rel=\"nofollow\">Реклама</a></div>"); + out.print(" <div id=\"footer-left\">juick.com © 2008-2014"); if (sapeon && sape != null && (visitor == null || visitor.UID == 1) && request.getQueryString() == null) { String links = sape.getPageLinks(request.getRequestURI(), request.getCookies()).render(); if (links != null && !links.isEmpty()) { - out.print("<br/>" + rb.getString("Sponsored by") + ": " + links); + out.print("<br/>Спонсоры: " + links); } } out.println("</div>"); |