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 +++++++--- web/style3.css | 20 ++++++-- 8 files changed, 79 insertions(+), 80 deletions(-) create mode 100644 src/java/UserThread.properties create mode 100644 src/java/UserThread_ru.properties 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(); 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; } -- cgit v1.2.3