From 80dc112383a88def23eb95e34e3d7f739994bd3b Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Fri, 31 Jan 2014 01:01:48 +0700 Subject: New header design --- src/java/com/juick/http/www/Discover.java | 14 +-- src/java/com/juick/http/www/Help.java | 18 ++-- src/java/com/juick/http/www/Home.java | 15 +-- src/java/com/juick/http/www/NewMessage.java | 8 +- src/java/com/juick/http/www/PM.java | 33 +++---- src/java/com/juick/http/www/PageTemplates.java | 122 ++++++++----------------- src/java/com/juick/http/www/SignUp.java | 9 +- src/java/com/juick/http/www/User.java | 65 +++++-------- src/java/com/juick/http/www/UserThread.java | 11 +-- 9 files changed, 98 insertions(+), 197 deletions(-) (limited to 'src/java/com') diff --git a/src/java/com/juick/http/www/Discover.java b/src/java/com/juick/http/www/Discover.java index 98f46656..ca6415ff 100644 --- a/src/java/com/juick/http/www/Discover.java +++ b/src/java/com/juick/http/www/Discover.java @@ -74,9 +74,9 @@ public class Discover { PageTemplates.pageHead(out, title, null); PageTemplates.pageNavigation(out, locale, visitor, null); - out.println("
"); - out.println("
"); - out.println("
"); + PageTemplates.pageHomeColumn(out, sql, visitor, locale); + + out.println("
"); if (mids.size() > 0) { out.println("
    "); @@ -88,14 +88,10 @@ public class Discover { String nextpage = "?before=" + mids.get(mids.size() - 1); out.println("

    Older →

    "); } - PageTemplates.pageFooter(request, out, locale, visitor, true); - out.println("
"); - out.println("
"); // wrapper - PageTemplates.pageHomeColumn(out, sql, visitor, locale); - - out.println("
"); // topwrapper + out.println(""); + PageTemplates.pageFooter(request, out, locale, visitor, true); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageEnd(out); } finally { diff --git a/src/java/com/juick/http/www/Help.java b/src/java/com/juick/http/www/Help.java index 028539df..c6a64622 100644 --- a/src/java/com/juick/http/www/Help.java +++ b/src/java/com/juick/http/www/Help.java @@ -77,21 +77,17 @@ public class Help { PageTemplates.pageHead(out, rb.getString("Help"), ""); PageTemplates.pageNavigation(out, locale, visitor, null); - out.println("
"); - out.println("
"); - out.println("
"); - printFile(out, f); - PageTemplates.pageFooter(request, out, locale, visitor, false); - out.println("
"); - out.println("
"); - - out.println("
"); + out.println("
"); + out.println(""); - out.println("
"); + out.println("
"); + printFile(out, f); + out.println("
"); + + PageTemplates.pageFooter(request, out, locale, 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 5ef43858..ae82633f 100644 --- a/src/java/com/juick/http/www/Home.java +++ b/src/java/com/juick/http/www/Home.java @@ -94,9 +94,9 @@ public class Home { PageTemplates.pageHead(out, title, null); PageTemplates.pageNavigation(out, locale, visitor, null); - out.println("
"); - out.println("
"); - out.println("
"); + PageTemplates.pageHomeColumn(out, sql, visitor, locale); + + out.println("
"); if (paramShow == null && paramBefore == 0) { out.println(""); @@ -136,14 +136,9 @@ public class Home { out.println(""); } - PageTemplates.pageFooter(request, out, locale, visitor, true); - out.println("
"); - out.println("
"); // wrapper - - PageTemplates.pageHomeColumn(out, sql, visitor, locale); - - out.println("
"); // topwrapper + out.println(""); + PageTemplates.pageFooter(request, out, locale, visitor, true); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageEnd(out); } finally { diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java index 20e1102c..7ab93e1d 100644 --- a/src/java/com/juick/http/www/NewMessage.java +++ b/src/java/com/juick/http/www/NewMessage.java @@ -50,7 +50,7 @@ public class NewMessage { + ""); PageTemplates.pageNavigation(out, locale, visitor, null); - out.println("
"); + out.println("
"); out.println("
"); out.println("

" + rbnm.getString("Location") + ": " + rbnm.getString("Clear") + "

"); out.println("

" + rbnm.getString("Photo") + ": " + rbnm.getString("Photo_JPG") + "

"); @@ -71,11 +71,9 @@ public class NewMessage { out.println("
"); out.println("

" + rbnm.getString("Tags") + ":

"); printUserTags(sql, out, visitor); - PageTemplates.pageFooter(request, out, locale, visitor, false); - out.println("
"); - out.println("
"); - out.println("
"); + out.println(""); + PageTemplates.pageFooter(request, out, locale, 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 5a07cd5a..ec51d44c 100644 --- a/src/java/com/juick/http/www/PM.java +++ b/src/java/com/juick/http/www/PM.java @@ -64,9 +64,9 @@ public class PM { PageTemplates.pageHead(out, title, null); PageTemplates.pageNavigation(out, locale, visitor, null); - out.println("
"); - out.println("
"); - out.println("
"); + PageTemplates.pageHomeColumn(out, sql, visitor, locale); + + out.println("
"); if (!msgs.isEmpty()) { out.println("
    "); @@ -99,14 +99,9 @@ public class PM { } */ - PageTemplates.pageFooter(request, out, locale, visitor, true); - out.println("
"); - out.println("
"); // wrapper - - PageTemplates.pageHomeColumn(out, sql, visitor, locale); - - out.println("
"); // topwrapper + out.println(""); + PageTemplates.pageFooter(request, out, locale, visitor, true); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageEnd(out); } finally { @@ -144,9 +139,9 @@ public class PM { PageTemplates.pageHead(out, title, null); PageTemplates.pageNavigation(out, locale, visitor, null); - out.println("
"); - out.println("
"); - out.println("
"); + PageTemplates.pageHomeColumn(out, sql, visitor, locale); + + out.println("
"); out.println(""); out.println("
"); @@ -182,14 +177,9 @@ public class PM { } */ - PageTemplates.pageFooter(request, out, locale, visitor, true); - out.println("
"); - out.println("
"); // wrapper - - PageTemplates.pageHomeColumn(out, sql, visitor, locale); - - out.println("
"); // topwrapper + out.println(""); + PageTemplates.pageFooter(request, out, locale, visitor, true); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageEnd(out); } finally { @@ -199,6 +189,9 @@ public class PM { public void doPostPM(Connection sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException { String uname = request.getParameter("uname"); + if (uname.startsWith("@")) { + uname = uname.substring(1); + } int uid = 0; if (UserQueries.checkUserNameValid(uname)) { uid = UserQueries.getUIDbyName(sql, uname); 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(""); out.print(""); out.print(""); - out.print(""); + out.print(""); out.print(""); - out.print(""); + out.print(""); if (headers != null) { out.print(headers); } @@ -69,75 +69,43 @@ public class PageTemplates { out.println(""); } - public static void pageNavigation(PrintWriter out, Locale loc, com.juick.User user, String search) { - ResourceBundle rb = ResourceBundle.getBundle("Global", loc); - out.println("
"); - out.println("
"); + out.println("
"); + if (visitor != null) { + out.println(" "); + out.println(" "); } else { - out.println("
  • " + rb.getString("Login") + "
  • "); + out.println("

    Чтобы добавлять сообщения и комментарии, представьтесь.

    "); } - out.println(""); - 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); + out.println(" "); + out.println(""); } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - if (fullname == null) { - fullname = user.UName; - } - if (description == null) { - description = ""; - } - - out.println("
    "); - out.println("
    \""
    "); - out.println("
    "); - out.println("

    " + fullname + "

    " + description + "

    "); - out.println("
    "); - out.println(); - } - */ public static void pageYandexAd(PrintWriter out, int stat_id) { out.println("
    "); @@ -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("
    "); - out.println(" "); - out.println("
    "); + out.println("
    "); + out.println(""); } 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("
    "); - out.println(" "); - out.print("
    juick.com © 2008-2013"); + out.println(" "); + out.print("
    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("
    " + rb.getString("Sponsored by") + ": " + links); + out.print("
    Спонсоры: " + links); } } out.println("
    "); diff --git a/src/java/com/juick/http/www/SignUp.java b/src/java/com/juick/http/www/SignUp.java index b5780676..f6212e3d 100644 --- a/src/java/com/juick/http/www/SignUp.java +++ b/src/java/com/juick/http/www/SignUp.java @@ -67,9 +67,8 @@ public class SignUp { try { PageTemplates.pageHead(out, rb.getString("Unknown account"), ""); PageTemplates.pageNavigation(out, locale, visitor, null); - out.println("
    "); - out.println("
    "); - out.println("
    "); + + out.println("
    "); out.print("

    "); if (type.charAt(0) == 'f') { @@ -114,9 +113,7 @@ public class SignUp { out.println("

    "); out.println(""); - out.println("

    "); - out.println("
    "); - out.println("
    "); // topwrapper + out.println(""); PageTemplates.pageFooter(request, out, locale, visitor, false); PageTemplates.pageEnd(out); diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index 2af66275..51a282d2 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -108,11 +108,10 @@ public class User { try { PageTemplates.pageHead(out, title, ""); PageTemplates.pageNavigation(out, locale, visitor, null); - //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); - out.println("
    "); - out.println("
    "); - out.println("
    "); + pageUserColumn(out, sql, user, visitor, locale); + + out.println("
    "); out.println("
      "); if (mids.size() > 0) { PageTemplates.printMessages(out, sql, user, mids, visitor, locale, visitor == null ? 4 : 5, 0); @@ -132,18 +131,10 @@ public class User { } out.println("

      Older →

      "); } - PageTemplates.pageFooter(request, out, locale, visitor, true); - out.println("
    "); - - pageUserColumn(out, sql, user, visitor, locale); - out.println("
    "); - - //out.println("
    "); - //PageTemplates.pageYandexAd(out, visitor == null ? 4 : 5); // разный ID для залогиненых и нет - //out.println("
    "); - out.println("
    "); // topwrapper + out.println(""); + PageTemplates.pageFooter(request, out, locale, visitor, true); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageEnd(out); } finally { @@ -164,18 +155,14 @@ public class User { try { PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Menu) Tags"), null); PageTemplates.pageNavigation(out, locale, visitor, null); - //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); - out.println("
    "); - out.println("
    "); - out.println("
    "); - out.println("

    " + pageUserTags(sql, user, visitor, 0) + "

    "); - PageTemplates.pageFooter(request, out, locale, visitor, false); - out.println("
    "); pageUserColumn(out, sql, user, visitor, locale); - out.println("
    "); - out.println("
    "); + out.println("
    "); + out.println("

    " + pageUserTags(sql, user, visitor, 0) + "

    "); + out.println("
    "); + + PageTemplates.pageFooter(request, out, locale, visitor, false); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageEnd(out); } finally { @@ -193,11 +180,10 @@ public class User { try { PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) I read"), null); PageTemplates.pageNavigation(out, locale, visitor, null); - //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); - out.println("
    "); - out.println("
    "); - out.println("
    "); + pageUserColumn(out, sql, user, visitor, locale); + + out.println("
    "); out.println(""); PreparedStatement stmt = null; @@ -222,12 +208,9 @@ public class User { } out.println("
    "); - PageTemplates.pageFooter(request, out, locale, visitor, false); - out.println("
    "); - pageUserColumn(out, sql, user, visitor, locale); - out.println("
    "); - out.println("
    "); + out.println(""); + PageTemplates.pageFooter(request, out, locale, visitor, false); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageEnd(out); } finally { @@ -245,11 +228,10 @@ public class User { try { PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) My readers"), null); PageTemplates.pageNavigation(out, locale, visitor, null); - //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); - out.println("
    "); - out.println("
    "); - out.println("
    "); + pageUserColumn(out, sql, user, visitor, locale); + + out.println("
    "); out.println(""); PreparedStatement stmt = null; @@ -274,12 +256,9 @@ public class User { } out.println("
    "); - PageTemplates.pageFooter(request, out, locale, visitor, false); - out.println("
    "); - pageUserColumn(out, sql, user, visitor, locale); - out.println("
    "); - out.println("
    "); + out.println(""); + PageTemplates.pageFooter(request, out, locale, visitor, false); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageEnd(out); } finally { @@ -290,7 +269,7 @@ public class User { public static void pageUserColumn(PrintWriter out, Connection sql, com.juick.User user, com.juick.User visitor, Locale locale) { ResourceBundle rb = ResourceBundle.getBundle("User", locale); - out.println("
    "); + out.println("
    "); - out.println("
    "); + out.println(""); } public static String pageUserTags(Connection sql, com.juick.User user, com.juick.User visitor, int cnt) { diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index c37ead00..ff05cf4b 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -66,18 +66,11 @@ public class UserThread { try { PageTemplates.pageHead(out, title, ""); PageTemplates.pageNavigation(out, locale, visitor, null); - //PageTemplates.pageUserTitle(out, sql, locale, user, visitor); - - out.println("
    "); - out.println("
    "); - out.println("
    "); + out.println("
    "); com.juick.Message msg = printMessage(out, sql, user, MID, visitor, locale); printReplies(out, sql, msg, visitor, locale, listview); - - out.println("
    "); - out.println("
    "); - out.println("
    "); // topwrapper + out.println(""); PageTemplates.pageDialogTemplate(out, locale); PageTemplates.pageFooter(request, out, locale, visitor, false); -- cgit v1.2.3