aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-11-02 16:16:30 +0700
committerGravatar Ugnich Anton2012-11-02 16:16:30 +0700
commitb895a6e7a29193754a97e33b6af8bd66f1006fc4 (patch)
tree8a1921555d2fc9c600ac275e048319637f0a1680
parent4cb2de9cc1c5bf387d5cf81ab12fd9b0e16d9fc4 (diff)
Message, user toolbars
-rw-r--r--src/java/UserThread.properties4
-rw-r--r--src/java/UserThread_ru.properties4
-rw-r--r--src/java/com/juick/http/www/Blogs.java2
-rw-r--r--src/java/com/juick/http/www/NewMessage.java6
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java71
-rw-r--r--src/java/com/juick/http/www/User.java24
-rw-r--r--src/java/com/juick/http/www/UserThread.java28
-rw-r--r--web/style3.css20
8 files changed, 79 insertions, 80 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&amp;v=2&amp;sensor=false&amp;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>();
diff --git a/web/style3.css b/web/style3.css
index 69d38182..9612d0fa 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -14,9 +14,8 @@ img { border: none; }
#logo { float: left; margin: 3px 0 0 30px; }
#header a { text-decoration: none; font-size: 18px; }
-#search { float: left; margin: 5px 0 0 32px; }
-#search .text { width: 300px; padding: 4px; border-radius: 2px; }
-#search .submit { padding: 3px; margin-left: 5px; border-radius: 2px; }
+#search { float: left; margin: 10px 0 0 33px; }
+#search .text { width: 285px; padding: 4px; border-radius: 2px; }
#nav-right { float: right; }
#nav-right li { float: left; }
@@ -53,6 +52,7 @@ img { border: none; }
#geomap { margin-top: 1em; width: 570px; height: 360px; overflow: hidden; }
#content .msg { padding: 15px; margin: 8px 0 16px 0; width: 570px; border: 1px solid; }
+#content .msgthread { margin-bottom: 0; }
#content .msg-avatar { float: left; }
#content .msg-avatar img { width: 48px; height: 48px; vertical-align: top; }
#content .msg-ts { float: right; }
@@ -69,6 +69,12 @@ img { border: none; }
#content .msg-comment input { border: 1px solid; width: 50px; margin-left: 6px; vertical-align: top; }
#content .msg-recomms { margin: 10px 0 0 68px; overflow: hidden; font-size: small; }
+.mtoolbar { width: 600px; margin-left: 1px; }
+.mtoolbar ul { padding: 5px; }
+.mtoolbar li { display: inline; }
+.mtoolbar a { padding: 5px; }
+.mtoolbar div { display: inline-block; width: 16px; height: 16px; background-image: url(//static.juick.com/toolbar-icons.png); background-repeat: no-repeat; vertical-align: middle; margin: 5px; }
+
#content textarea.newmessage { border: 1px solid; width: 570px; padding: 2px; resize: vertical; }
table.users { width: 100%; margin: 10px 0; }
@@ -91,6 +97,10 @@ table.users img { width: 32px; height: 32px; vertical-align: middle; margin-righ
#column .inp { width: 175px; border: 1px solid; padding: 3px; border-radius: 3px; }
#ctitle { font-size: 14pt; }
#ctitle img { vertical-align: middle; margin-right: 5px; }
+#ctoolbar { margin: 10px 0; padding: 5px; line-height: 0; }
+#ctoolbar li { display: inline; }
+#ctoolbar a { padding: 5px 10px;}
+#ctoolbar div { display: inline-block; width: 16px; height: 16px; background-image: url(//static.juick.com/toolbar-icons.png); background-repeat: no-repeat; vertical-align: middle; margin: 5px 0; }
#ustats li { margin: 3px 0; font-size: smaller; }
/********/
@@ -113,11 +123,11 @@ a { color: #069; }
#nav-menu { background: #DDD; }
#title-stats { border-color: #CCC; }
#search .text { border: none; background-color: #EEE; }
-#search .submit { border: none; background-color: #DDD; }
#filters { border-color: #CCC; }
#filters a { color: #999; }
#content .msg { background: #FFF; border-color: #EEE; }
+#content .msgthread { border-bottom-color: #CCC; }
#content .msg-place { color: #999; }
#content .msg-comments { color: #AAA; border-color: #DDD; }
#content .msg-ts>a { color: #999; }
@@ -125,6 +135,7 @@ a { color: #069; }
#content .msg-comment textarea { border-color: #DDD; }
#content .msg-comment input { border-color: #CCC; background-color: #EEE; color: #999; }
#content .msg-recomms { color: #AAA; }
+.mtoolbar { background-color: #E5E5DD; }
#content textarea.newmessage { border-color: #DDD; }
@@ -133,5 +144,6 @@ a { color: #069; }
#column hr { background-color: #CCC; }
#column .inp { border-color: #CCC; background: #F5F5E9; }
+#ctoolbar { background-color: #E5E5DD; }
#footer { color: #999; }