diff options
author | Ugnich Anton | 2012-11-02 16:16:30 +0700 |
---|---|---|
committer | Ugnich Anton | 2012-11-02 16:16:30 +0700 |
commit | b895a6e7a29193754a97e33b6af8bd66f1006fc4 (patch) | |
tree | 8a1921555d2fc9c600ac275e048319637f0a1680 /src/java | |
parent | 4cb2de9cc1c5bf387d5cf81ab12fd9b0e16d9fc4 (diff) |
Message, user toolbars
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/UserThread.properties | 4 | ||||
-rw-r--r-- | src/java/UserThread_ru.properties | 4 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Blogs.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/NewMessage.java | 6 | ||||
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 71 | ||||
-rw-r--r-- | src/java/com/juick/http/www/User.java | 24 | ||||
-rw-r--r-- | src/java/com/juick/http/www/UserThread.java | 28 |
7 files changed, 63 insertions, 76 deletions
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("<ul>"); - PageTemplates.printMessages(out, sql, mids, locale); + PageTemplates.printMessages(out, sql, mids, visitor, locale); out.println("</ul>"); /* } 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"), "<script src=\"//maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAVVtPtxkw4soCEHg44FsNChRB4OFYjAXt73He16Zkp6a_0tPs2RTU6i6UlcMs4QvPBYvIY8rWvcxqOg\" type=\"text/javascript\"></script>" - + "<script src=\"//static.juick.com/mc.js\" type=\"text/javascript\"></script>" - + "<script src=\"//static.juick.com/map.js?2010111500\" type=\"text/javascript\"></script>" - + "<script src=\"//static.juick.com/post3.js\" type=\"text/javascript\"></script>"); + + "<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); out.println("<div id=\"wrapper\"><div id=\"content\" class=\"pagetext\">"); 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("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); - out.println(" <meta charset=\"utf-8\"/>"); out.println(" <title>" + title + "</title>"); - out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012102203.css\"/>"); + out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012110200.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>"); @@ -72,8 +71,8 @@ public class PageTemplates { out.println("<div id=\"hwrapper\">"); out.println("<div id=\"header\">"); out.println(" <div id=\"logo\"><a href=\"" + (user != null ? "/?show=my" : "/") + "\"><img src=\"//static.juick.com/logo3.png\" width=\"120\" height=\"40\" alt=\"Juick\"/></a></div>"); - out.println(" <form action=\"/\" id=\"search\">"); - out.println(" <div id=\"search\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\"/><input type=\"submit\" class=\"submit\" value=\">\"></div>"); + out.println(" <form action=\"/\">"); + out.println(" <div id=\"search\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\"/></div>"); out.println(" </form>"); out.println(" <ul id=\"nav-right\">"); if (user != null) { @@ -275,7 +274,7 @@ public class PageTemplates { return msg; } - public static void printMessages(PrintWriter out, Connection sql, ArrayList<Integer> mids, Locale locale) { + public static void printMessages(PrintWriter out, Connection sql, ArrayList<Integer> 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<Integer> mids, Locale locale) { - ResourceBundle rb = ResourceBundle.getBundle("Global", locale); - - out.println("<table class=\"photos\">"); - out.println(" <tr>"); - - 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(" </tr>"); - out.println(" <tr>"); - } - - out.print(" <td id=\"photo-" + mid + "\" class=\"photo\""); - if (mid == mids.get(0)) { - out.print(" style=\"border: 0\""); - } - out.print(">"); - - out.println("<div class=\"photowrap\">"); - out.println(" <a href=\"#\" onclick=\"return photoDetails(" + mid + ")\"><img src=\"http://i.juick.com/" + (rs.getString(12).equals("jpg") ? "photos-512" : "thumbs") + "/" + mid + ".jpg\" alt=\"\"/></a>"); - out.println(" <div class=\"photo-ts\" title=\"" + rs.getString(9) + "\">" + formatDate(rs.getInt(8), rs.getString(9), locale) + "</div>"); - out.println(" <div class=\"photo-uname\">@" + uname + "</div>"); - if (rs.getInt(10) > 0) { - out.println(" <div class=\"photo-comments\">" + rs.getInt(10) + "</div>"); - } - out.println(" <div class=\"photo-txt\">" + txt + "</div>"); - out.println(" </td>"); - - cnt++; - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - out.println(" </tr>"); - out.println("</table>"); - } - */ } 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("<div id=\"content\">"); out.println("<ul>"); if (mids.size() > 0) { - PageTemplates.printMessages(out, sql, mids, locale); + PageTemplates.printMessages(out, sql, mids, visitor, locale); } out.println("</ul>"); @@ -266,8 +266,26 @@ public class User { ResourceBundle rb = ResourceBundle.getBundle("User", locale); out.println("<div id=\"column\" class=\"stickya\">"); - out.println(" <div id=\"ctitle\"><a href=\"./\"><img src=\"//i.juick.com/as/" + user.UID + ".png\"/>" + user.UName + "</a></div>"); - out.println(" <hr/>"); + out.println(" <div id=\"ctitle\"><a href=\"./\"><img src=\"//i.juick.com/as/" + user.UID + ".png\" alt=\"\"/>" + user.UName + "</a></div>"); + if (visitor != null && visitor.UID > 0 && visitor.UID != user.UID) { + out.println(" <ul id=\"ctoolbar\">"); + if (UserQueries.isSubscribed(sql, visitor.UID, user.UID)) { + out.println(" <li><a href=\"/post?body=U+%40" + user.UName + "\"><div style=\"background-position: -48px 0\"></div></a></li>"); + } else { + out.println(" <li><a href=\"/post?body=S+%40" + user.UName + "\"><div style=\"background-position: -16px 0\"></div></a></li>"); + } + if (UserQueries.isInBL(sql, visitor.UID, user.UID)) { + out.println(" <li><a href=\"/post?body=BL+%40" + user.UName + "\"><div style=\"background-position: -96px 0\"></div></a></li>"); + } else { + out.println(" <li><a href=\"/post?body=BL+%40" + user.UName + "\"><div style=\"background-position: -80px 0\"></div></a></li>"); + } + if (!UserQueries.isInBL(sql, user.UID, visitor.UID)) { + out.println(" <li><a href=\"/post?body=PM+%40" + user.UName + "\"><div style=\"background-position: -112px 0\"></div></a></li>"); + } + out.println(" </ul>"); + } else { + out.println(" <hr/>"); + } out.println(" <ul>"); out.println(" <li><a href=\"./\">" + rb.getString("(Menu) Blog") + "</a></li>"); out.println(" <li><a href=\"./?show=recomm\">" + rb.getString("(Menu) Recommendations") + "</a></li>"); 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("<div id=\"wrapper\">"); out.println("<div id=\"content\" style=\"margin-left: 0; width: 100%\">"); - 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("</div>"); out.println("</div>"); @@ -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("<ul>"); - out.println(" <li id=\"msg-" + mid + "\" class=\"msg\" style=\"border: 0\">"); + out.println(" <li id=\"msg-" + mid + "\" class=\"msg msgthread\">"); out.println(" <div class=\"msg-avatar\"><a href=\"/" + uname + "/\"><img src=\"//i.juick.com/a/" + uid + ".png\" alt=\"" + uname + "\"/></a></div>"); out.println(" <div class=\"msg-ts\"><a href=\"/" + uname + "/" + mid + "\" title=\"" + rs.getString(9) + "\">" + PageTemplates.formatDate(rs.getInt(8), rs.getString(9), locale) + "</a></div>"); @@ -170,6 +171,21 @@ public class UserThread { } out.println(" </li>"); + out.println(" <li class=\"mtoolbar\"><ul>"); + out.println(" <li><a href=\"/" + mid + "\"><div style=\"background-position: -64px 0\"></div>" + mid + "</a></li>"); + if (visitor != null) { + if (visitor.UID != uid) { + if (MessagesQueries.isSubscribed(sql, visitor.UID, mid)) { + out.println(" <li><a href=\"/post?body=U+%23" + mid + "\"><div style=\"background-position: -48px 0\"></div>" + rbthread.getString("(MToolbar) Subcribed") + "</a></li>"); + } else { + out.println(" <li><a href=\"/post?body=S+%23" + mid + "\"><div style=\"background-position: -16px 0\"></div>" + rbthread.getString("(MToolbar) Subcribe") + "</a></li>"); + } + out.println(" <li><a href=\"/post?body=%21+%23" + mid + "\"><div style=\"background-position: -32px 0\"></div>" + rbthread.getString("(MToolbar) Recommend") + "</a></li>"); + } else { + out.println(" <li><a href=\"/post?body=D+%23" + mid + "\"><div style=\"background-position: 0\"></div>" + rbthread.getString("(MToolbar) Delete") + "</a></li>"); + } + } + out.println(" </ul></li>"); out.println("</ul>"); } } 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<com.juick.Message> replies = new ArrayList<com.juick.Message>(); |