From b895a6e7a29193754a97e33b6af8bd66f1006fc4 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Fri, 2 Nov 2012 16:16:30 +0700 Subject: Message, user toolbars --- src/java/UserThread.properties | 4 ++ src/java/UserThread_ru.properties | 4 ++ src/java/com/juick/http/www/Blogs.java | 2 +- src/java/com/juick/http/www/NewMessage.java | 6 +-- src/java/com/juick/http/www/PageTemplates.java | 71 +++----------------------- src/java/com/juick/http/www/User.java | 24 +++++++-- src/java/com/juick/http/www/UserThread.java | 28 +++++++--- 7 files changed, 63 insertions(+), 76 deletions(-) create mode 100644 src/java/UserThread.properties create mode 100644 src/java/UserThread_ru.properties (limited to 'src') diff --git a/src/java/UserThread.properties b/src/java/UserThread.properties new file mode 100644 index 00000000..b33f4fe0 --- /dev/null +++ b/src/java/UserThread.properties @@ -0,0 +1,4 @@ +(MToolbar)\ Subcribe=Subscribe +(MToolbar)\ Subcribed=Subscribed +(MToolbar)\ Recommend=Recommend +(MToolbar)\ Delete=Delete diff --git a/src/java/UserThread_ru.properties b/src/java/UserThread_ru.properties new file mode 100644 index 00000000..8e5e2632 --- /dev/null +++ b/src/java/UserThread_ru.properties @@ -0,0 +1,4 @@ +(Toolbar)\ Subcribe=\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f +(Toolbar)\ Subcribed=\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d +(Toolbar)\ Recommend=\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u0442\u044c +(Toolbar)\ Delete=\u0423\u0434\u0430\u043b\u0438\u0442\u044c diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java index e43addb9..1bb308c5 100644 --- a/src/java/com/juick/http/www/Blogs.java +++ b/src/java/com/juick/http/www/Blogs.java @@ -144,7 +144,7 @@ public class Blogs { } else { */ out.println(""); /* } diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java index 36ff190a..40ffeb46 100644 --- a/src/java/com/juick/http/www/NewMessage.java +++ b/src/java/com/juick/http/www/NewMessage.java @@ -45,9 +45,9 @@ public class NewMessage { PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, rbnm.getString("New message"), "" - + "" - + "" - + ""); + + "" + + "" + + ""); PageTemplates.pageNavigation(out, locale, visitor); out.println("
"); diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index e8f96be3..ba5665ed 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -52,9 +52,8 @@ public class PageTemplates { out.println(""); out.println(""); out.println(""); - out.println(" "); out.println(" " + title + ""); - out.println(" "); + out.println(" "); out.println(" "); out.println(" "); out.println(" "); @@ -72,8 +71,8 @@ public class PageTemplates { out.println("
"); out.println("
"); out.println("
\"Juick\"/
"); - out.println("
"); - out.println("
\">
"); + out.println(" "); + out.println("
"); out.println("
"); out.println("
    "); if (user != null) { @@ -275,7 +274,7 @@ public class PageTemplates { return msg; } - public static void printMessages(PrintWriter out, Connection sql, ArrayList mids, Locale locale) { + public static void printMessages(PrintWriter out, Connection sql, ArrayList mids, com.juick.User visitor, Locale locale) { ResourceBundle rb = ResourceBundle.getBundle("Global", locale); PreparedStatement stmt = null; @@ -300,12 +299,14 @@ public class PageTemplates { // lat // lon - boolean cancomment = true; + boolean cancomment = visitor != null; tags = (tags != null) ? formatTags(tags) : ""; if (rs.getInt(5) == 1) { tags += " *readonly"; - cancomment = false; + if (visitor != null && visitor.UID != uid) { + cancomment = false; + } } switch (rs.getInt(6)) { case 2: @@ -357,60 +358,4 @@ public class PageTemplates { Utils.finishSQL(rs, stmt); } } - /* - public static void printPhotos(PrintWriter out, Connection sql, ArrayList mids, Locale locale) { - ResourceBundle rb = ResourceBundle.getBundle("Global", locale); - - out.println(""); - out.println(" "); - - PreparedStatement stmt = null; - ResultSet rs = null; - try { - stmt = sql.prepareStatement("SELECT STRAIGHT_JOIN messages.message_id,messages.user_id,users.nick,messages_txt.tags,messages.readonly,messages.privacy,messages_txt.txt,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),messages.ts,messages.replies,messages_txt.repliesby,messages.attach,messages.place_id,places.name,messages.lat,messages.lon FROM ((messages INNER JOIN messages_txt ON messages.message_id=messages_txt.message_id) INNER JOIN users ON messages.user_id=users.id) LEFT JOIN places ON messages.place_id=places.place_id WHERE messages.message_id IN (" + Utils.convertArray2String(mids) + ") ORDER BY messages.message_id DESC"); - rs = stmt.executeQuery(); - rs.beforeFirst(); - int cnt = 0; - while (rs.next()) { - int mid = rs.getInt(1); - int uid = rs.getInt(2); - String uname = rs.getString(3); - String tags = rs.getString(4); - String txt = rs.getString(7); - - txt = formatMessage(txt); - - if (cnt % 2 == 0 && cnt > 0) { - out.println(" "); - out.println(" "); - } - - out.print(" "); - - cnt++; - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - out.println(" "); - out.println("
    "); - - out.println("
    "); - out.println(" \"\"/"); - out.println("
    " + formatDate(rs.getInt(8), rs.getString(9), locale) + "
    "); - out.println("
    @" + uname + "
    "); - if (rs.getInt(10) > 0) { - out.println("
    " + rs.getInt(10) + "
    "); - } - out.println("
    " + txt + "
    "); - out.println("
    "); - } - */ } diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index 93656d0e..f1896837 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -106,7 +106,7 @@ public class User { out.println("
    "); out.println("
      "); if (mids.size() > 0) { - PageTemplates.printMessages(out, sql, mids, locale); + PageTemplates.printMessages(out, sql, mids, visitor, locale); } out.println("
    "); @@ -266,8 +266,26 @@ public class User { ResourceBundle rb = ResourceBundle.getBundle("User", locale); out.println("
    "); - out.println(" "); - out.println("
    "); + out.println(" "); + if (visitor != null && visitor.UID > 0 && visitor.UID != user.UID) { + out.println("
      "); + if (UserQueries.isSubscribed(sql, visitor.UID, user.UID)) { + out.println("
    • "); + } else { + out.println("
    • "); + } + if (UserQueries.isInBL(sql, visitor.UID, user.UID)) { + out.println("
    • "); + } else { + out.println("
    • "); + } + if (!UserQueries.isInBL(sql, user.UID, visitor.UID)) { + out.println("
    • "); + } + out.println("
    "); + } else { + out.println("
    "); + } out.println("
      "); out.println("
    • " + rb.getString("(Menu) Blog") + "
    • "); out.println("
    • " + rb.getString("(Menu) Recommendations") + "
    • "); diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index 2935ab2d..d90d7e94 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -75,9 +75,9 @@ public class UserThread { out.println("
      "); out.println("
      "); - printMessage(out, sql, MID, locale); + printMessage(out, sql, MID, visitor, locale); - printReplies(out, sql, MID, locale, listview); + printReplies(out, sql, MID, visitor, locale, listview); out.println("
      "); out.println("
      "); @@ -89,8 +89,9 @@ public class UserThread { } } - public static void printMessage(PrintWriter out, Connection sql, int mid, Locale locale) { + public static void printMessage(PrintWriter out, Connection sql, int mid, com.juick.User visitor, Locale locale) { ResourceBundle rb = ResourceBundle.getBundle("Global", locale); + ResourceBundle rbthread = ResourceBundle.getBundle("UserThread", locale); PreparedStatement stmt = null; ResultSet rs = null; @@ -112,7 +113,7 @@ public class UserThread { // lat // lon - boolean cancomment = true; + boolean cancomment = visitor != null; tags = (tags != null) ? PageTemplates.formatTags(tags) : ""; if (rs.getInt(5) == 1) { @@ -134,7 +135,7 @@ public class UserThread { txt = PageTemplates.formatMessage(txt); out.println(""); } } catch (SQLException e) { @@ -180,7 +196,7 @@ public class UserThread { } - public static void printReplies(PrintWriter out, Connection sql, int mid, Locale locale, boolean listview) { + public static void printReplies(PrintWriter out, Connection sql, int mid, com.juick.User visitor, Locale locale, boolean listview) { ResourceBundle rbuser = ResourceBundle.getBundle("User", locale); ArrayList replies = new ArrayList(); -- cgit v1.2.3