aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java10
-rw-r--r--src/java/com/juick/http/www/UserThread.java16
-rw-r--r--web/scripts3.js16
-rw-r--r--web/style3.css13
4 files changed, 43 insertions, 12 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index f171eb07..c3ed163b 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -52,9 +52,9 @@ public class PageTemplates {
out.println("<!DOCTYPE html>");
out.print("<html>");
out.print("<head>");
- out.print("<link rel=\"stylesheet\" href=\"/style.2014031701.css\"/>");
+ out.print("<link rel=\"stylesheet\" href=\"/style.2014031801.css\"/>");
out.print("<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>");
- out.print("<script type=\"text/javascript\" src=\"/scripts.2014031201.js\"></script>");
+ out.print("<script type=\"text/javascript\" src=\"/scripts.2014031801.js\"></script>");
if (headers != null) {
out.print(headers);
}
@@ -92,7 +92,7 @@ public class PageTemplates {
out.print("<li><a href=\"/logout\">Выйти</a></li>");
out.println("</ul></nav>");
} else {
- out.println("<p>Чтобы добавлять сообщения и комментарии, <a href=\"/login\">представьтесь</a>.</p>");
+ out.println("<p>Чтобы добавлять сообщения и комментарии, <a href=\"#\" onclick=\"return openDialogLogin()\">представьтесь</a>.</p>");
}
out.println(" </section>");
out.println("</header>");
@@ -511,7 +511,9 @@ public class PageTemplates {
}
out.print(" <nav class=\"l\">");
msg.ReadOnly |= blUIDs.contains(msg.User.UID);
- if (visitor != null && (msg.ReadOnly == false || visitor.UID == msg.User.UID)) {
+ if (visitor == null && msg.ReadOnly == false) {
+ out.print("<a href=\"#\" onclick=\"return openDialogLogin()\">Комментировать</a> ");
+ } else if (visitor != null && (msg.ReadOnly == false || visitor.UID == msg.User.UID)) {
out.print("<a href=\"#\" onclick=\"return showCommentFooter(this)\">Комментировать</a> ");
}
out.print("<a href=\"/post?body=%21+%23" + msg.MID + "\">Рекомендовать</a>");
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index 8496fbe4..6b42d4a1 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -260,9 +260,9 @@ public class UserThread {
out.println("<ul id=\"replies\">");
if (listview) {
- printList(out, replies);
+ printList(out, replies, visitor);
} else {
- printTree(out, replies, 0, 0, false);
+ printTree(out, replies, visitor, 0, 0, false);
}
out.println("</ul>");
@@ -273,7 +273,7 @@ public class UserThread {
}
}
- public static void printTree(PrintWriter out, ArrayList<com.juick.Message> replies, int ReplyTo, int margin, boolean hidden) {
+ public static void printTree(PrintWriter out, ArrayList<com.juick.Message> replies, com.juick.User visitor, int ReplyTo, int margin, boolean hidden) {
if (margin > 240) {
margin = 240;
}
@@ -302,6 +302,8 @@ public class UserThread {
if (msg.VisitorCanComment) {
out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
+ } else if (visitor == null) {
+ out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return openDialogLogin()\">Ответить</a></div>");
}
int childs = msg.getChildsCount();
@@ -313,15 +315,15 @@ public class UserThread {
out.println(" </li>");
if (ReplyTo == 0 && childs > 1 && replies.size() > 10) {
- printTree(out, msg.childs, msg.RID, margin + 20, true);
+ printTree(out, msg.childs, visitor, msg.RID, margin + 20, true);
} else if (childs > 0) {
- printTree(out, msg.childs, msg.RID, margin + 20, hidden);
+ printTree(out, msg.childs, visitor, msg.RID, margin + 20, hidden);
}
}
}
}
- public static void printList(PrintWriter out, ArrayList<com.juick.Message> replies) {
+ public static void printList(PrintWriter out, ArrayList<com.juick.Message> replies, com.juick.User visitor) {
for (int i = 0; i < replies.size(); i++) {
com.juick.Message msg = replies.get(i);
@@ -342,6 +344,8 @@ public class UserThread {
if (msg.VisitorCanComment) {
out.println(" &#183; <a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
+ } else if (visitor == null) {
+ out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return openDialogLogin()\">Ответить</a></div>");
}
out.println(" </div>");
out.println(" </li>");
diff --git a/web/scripts3.js b/web/scripts3.js
index bf283594..ca111020 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -212,6 +212,22 @@ function checkUsername() {
/******************************************************************************/
+function openDialogLogin() {
+ var html='<div class="dialoglogin"><p>Пожалуйста, представьтесь:'
+ +'<a href="/_fblogin" id="signfb">Facebook</a> '
+ +'<a href="/_vklogin" id="signvk">ВКонтакте</a></p>'
+ +'<p>Уже зарегистрированы?</p>'
+ +'<form action="/login" method="POST">'
+ +'<input class="signinput" type="text" name="username" placeholder="Имя пользователя"/><br/>'
+ +'<input class="signinput" type="password" name="password" placeholder="Пароль"/><br/>'
+ +'<input class="signsubmit" type="submit" value="OK"/>'
+ +'</form></div>';
+ openDialog(html);
+ return false;
+}
+
+/******************************************************************************/
+
function setPopular(e,mid,popular) {
$.ajax('http://api.juick.com/messages/set_popular?mid='+mid+'&popular='+popular+'&hash='+hash).done(function() {
var a=$(e).closest("article");
diff --git a/web/style3.css b/web/style3.css
index f2a16f8a..43af1fdc 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -154,6 +154,15 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef
#dialogw { position: relative; display: inline-block; text-align: left; z-index: 11; }
#dialogc { position: absolute; top: -15px; right: -15px; width: 30px; height: 30px; z-index: 12; cursor: pointer; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAQAAACROWYpAAAEEElEQVQ4y32Va2yTVRzGf23fd10vUNq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kRZI3oscjxyM/Rx7FJenBwP6L7KWLdvy5K5kRA6qZSYety9nDiYM//HFLeXbvzsmr5kl66KKDmeSJQUaG8FJDgHbW0e3YzwnPmVe+33lz582Oy+P7OcF+ullHOwFqeEKGMgKIl2r8tLCUjWxnl7HH6KXX2GPdxXY2spQW/FTzlACOSC8eyplEgBYWsoI1rGUta1jBQloIMIlyCkhv9r2w48JLObVMwU+ARhoJ4GcKtZTjxZXL9Vm6BSsGJnYcOHFl4MSBHRMDK5b/e69yxzyNAvYf9TCL+HAwka4AAAAASUVORK5CYII="); }
+.dialoglogin { width: 300px; background: #EEEEE5; padding: 25px; }
+#signfb,#signvk { display: block; width: 100%; height: 32px; line-height: 32px; text-indent: 37px; text-decoration: none; overflow: hidden; margin: 10px 0; }
+#signfb { color: #FFF; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAAXNSR0IArs4c6QAAADNQTFRFO1edX3ewl6bLnKrOoK3QrrrYvMXe2N7r3OLu3+Tv5urz7O/29vf6+Pn7+vv9/Pz9////ykQjsQAAAEZJREFUOMtjYBgFuAATO68ADxdOaUYuATDAqYBbAL8CFgECCjiBcqz4XMiPz3oQEKCtAgEkwEdIAQchBWyEFDAPkDdHsAIAhZkIwz/VK/UAAAAASUVORK5CYII=") no-repeat #3A569C; }
+#signvk { margin-bottom: 30px; color: #FFF; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAAXNSR0IArs4c6QAAAHJQTFRFbY+zbo+zbpCzb5C0cpO1c5O2dZW3dpa4e5m6gJ29gZ69lq/In7bNo7jPrcDUs8XXvs3dv87dy9fkztnlz9rm0Nrm093o1N7o1+Dq3OTt3ubu4Ofv5Orw7fH27vL28PP38vX49Pb5+vv8+/z9/Pz9////2jSYlQAAAG5JREFUOMvtkEcOgDAMBE3vvXdIyP+/iMMRKfYHmMtcRtE6AD8f1Is8pyKgAs0RGYO2HSWqMQaoBHVRgYsS3AsrtyFlrqgdJlCLb95gxQO6IkZCqL+KCjz0TQU5ejOf2a3aJXPF7BOB2PvMhp8PDzGRFgEe7xvEAAAAAElFTkSuQmCC") no-repeat #6d8fb3; }
+.dialoglogin form { margin-top: 7px; }
+.signinput,.signsubmit { border: 1px solid #CCC; margin: 3px 0; padding: 3px; }
+.signinput { width: 292px; }
+.signsubmit { width: 70px; }
+
.dialogshare { padding: 20px; background: #EEEEE5; border: 1px solid #999; min-width: 300px; overflow: auto; }
.dialogl { padding: 5px; margin: 3px 0 20px; border: 1px solid #DDD; background: #F5F5E9; }
.dialogshare li { float: left; margin: 5px 10px 0 0; }
@@ -192,9 +201,9 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef
article>nav.s { display: block; }
article textarea { width: 205px; }
article footer { float: left; }
-
+
#content textarea { width: 100%; }
-
+
.msg,.msg-cont { width: auto; min-width: 280px; }
.msg-cont,.ads { margin-left: 0; }
.msg-avatar { margin: 10px 10px 0 10px; width: 40px; height: 40px; }