diff options
author | Vitaly Takmazov | 2016-11-15 14:21:27 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-15 14:21:27 +0300 |
commit | 51d9de02265d6cc9d6045d79497d2a987ae2f7f7 (patch) | |
tree | d7dd2e534452cab45b8ebdba1e52c498951c5035 /juick-www/src/main/java/com/juick/www/PageTemplates.java | |
parent | 32a6feb195171e06d60117ad758cc8beb50e5ca3 (diff) |
core classes are now serializeable with JAXB (to use as babbler extension)
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/PageTemplates.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/PageTemplates.java | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/juick-www/src/main/java/com/juick/www/PageTemplates.java b/juick-www/src/main/java/com/juick/www/PageTemplates.java index f8873739..4f7e17b7 100644 --- a/juick-www/src/main/java/com/juick/www/PageTemplates.java +++ b/juick-www/src/main/java/com/juick/www/PageTemplates.java @@ -72,7 +72,7 @@ public class PageTemplates { out.println("<![endif]-->"); out.println("</head>"); out.flush(); - if (visitor.getUID() > 0) { + if (visitor.getUid() > 0) { out.println("<body id=\"body\" data-hash=\"" + visitor.getAuthHash() + "\">"); } else { out.println("<body id=\"body\">"); @@ -93,7 +93,7 @@ public class PageTemplates { } out.println("/></form></div>"); out.println(" <section id=\"headdiv\">"); - if (visitor.getUID() > 0) { + if (visitor.getUid() > 0) { out.print(" <nav id=\"user\"><ul>"); out.print("<li><a href=\"/?show=my\">Моя лента</a></li>"); out.print("<li><a href=\"/pm/inbox\">Приватные</a></li>"); @@ -102,7 +102,7 @@ public class PageTemplates { out.println("</ul></nav>"); out.print(" <nav id=\"actions\"><ul>"); out.print("<li><a href=\"/#post\">Написать</a></li>"); - out.print("<li><a href=\"/" + visitor.getUName() + "\">@" + visitor.getUName() + "</a></li>"); + out.print("<li><a href=\"/" + visitor.getName() + "\">@" + visitor.getName() + "</a></li>"); out.print("<li><a href=\"/logout\">Выйти</a></li>"); out.println("</ul></nav>"); } else { @@ -151,7 +151,7 @@ public class PageTemplates { String queryString = request.getQueryString(); String requestURI = request.getRequestURI(); - if (sapeon && sape != null && (visitor.getUID() == 0 || visitor.getUID() == 1) && queryString == null) { + if (sapeon && sape != null && (visitor.getUid() == 0 || visitor.getUid() == 1) && queryString == null) { String links = sape.getPageLinks(requestURI, request.getCookies()).render(); if (links != null && !links.isEmpty()) { out.print("<br/>Спонсоры: " + links); @@ -284,7 +284,7 @@ public class PageTemplates { for (int i = 0; i < msgs.size(); i++) { com.juick.Message msg = msgs.get(i); - if (msg.getMID() == ad_mid) { + if (msg.getMid() == ad_mid) { msgs.remove(i); msgs.add(0, msg); break; @@ -294,43 +294,43 @@ public class PageTemplates { List<Integer> blUIDs = new ArrayList<Integer>(20); if (visitor != null) { for (Message msg : msgs) { - blUIDs.add(msg.getUser().getUID()); + blUIDs.add(msg.getUser().getUid()); } - blUIDs = UserQueries.checkBL(sql, visitor.getUID(), blUIDs); + blUIDs = UserQueries.checkBL(sql, visitor.getUid(), blUIDs); } for (Message msg : msgs) { - List<Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMID()); + List<Tag> tags = MessagesQueries.getMessageTags(sql, msg.getMid()); String tagsStr = formatTags(tags); if (msg.ReadOnly) { tagsStr += "<a>readonly</a>"; } - if (msg.Privacy < 0) { + if (msg.getPrivacy() < 0) { tagsStr += "<a>friends</a>"; } - if (msg.getMID() == ad_mid) { + if (msg.getMid() == ad_mid) { tagsStr += "<a>реклама</a>"; } String txt; - if (msg.Tags.stream().anyMatch(t -> t.getName().equals("code"))) { + if (msg.getTags().stream().anyMatch(t -> t.getName().equals("code"))) { txt = Utils.formatMessageCode(msg.getText()); } else { txt = Utils.formatMessage(msg.getText()); } - out.println("<article data-mid=\"" + msg.getMID() + "\">"); + out.println("<article data-mid=\"" + msg.getMid() + "\">"); out.println(" <header class=\"u\">"); - out.println(" @<a href=\"/" + msg.getUser().getUName() + "/\">" + msg.getUser().getUName() + "</a>:"); - out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getUName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUID() + ".png\" alt=\"" + msg.getUser().getUName() + "\"/></a></div>"); - out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getUser().getUName() + "/" + msg.getMID() + "\"><time datetime=\"" + sdfSQL.format(msg.getDate()) + "Z\" title=\"" + sdfSQL.format(msg.getDate()) + " GMT\">" + formatDate(msg.TimeAgo, msg.getDate()) + "</time></a></div>"); + out.println(" @<a href=\"/" + msg.getUser().getName() + "/\">" + msg.getUser().getName() + "</a>:"); + out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUid() + ".png\" alt=\"" + msg.getUser().getName() + "\"/></a></div>"); + out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getUser().getName() + "/" + msg.getMid() + "\"><time datetime=\"" + sdfSQL.format(msg.getDate()) + "Z\" title=\"" + sdfSQL.format(msg.getDate()) + " GMT\">" + formatDate(msg.TimeAgo, msg.getDate()) + "</time></a></div>"); out.println(" <div class=\"msg-tags\">" + tagsStr + "</div>"); out.println(" </header>"); if (msg.AttachmentType != null) { - String fname = msg.getMID() + "." + msg.AttachmentType; + String fname = msg.getMid() + "." + msg.AttachmentType; out.println(" <p class=\"ir\"><a href=\"//i.juick.com/photos-512/" + fname + "\" data-fname=\"" + fname + "\"><img src=\"//i.juick.com/photos-512/" + fname + "\" alt=\"\"/></a></p>"); } out.println(" <p>" + txt + "</p>"); @@ -338,21 +338,21 @@ public class PageTemplates { out.println(" <div class=\"irbr\"></div>"); } out.print(" <nav class=\"l\">"); - msg.ReadOnly |= blUIDs.contains(msg.getUser().getUID()); - if (visitor.getUID() == 0) { + msg.ReadOnly |= blUIDs.contains(msg.getUser().getUid()); + if (visitor.getUid() == 0) { out.print("<a href=\"#\" class=\"a-login\">Мне нравится</a>"); } else { - out.print("<a href=\"/post?body=!+%23" + msg.getMID() + "\" class=\"a-like\">Мне нравится</a>"); + out.print("<a href=\"/post?body=!+%23" + msg.getMid() + "\" class=\"a-like\">Мне нравится</a>"); } - if (visitor.getUID() == 0 && !msg.ReadOnly) { - out.print("<a href=\"/"+ msg.getMID() + "\" class=\"a-login\">Комментировать</a> "); - } else if (visitor.getUID() > 0 && (!msg.ReadOnly || visitor.getUID() == msg.getUser().getUID())) { - out.print("<a class=\"a-comment\" href=\"/" + msg.getMID() + "\">Комментировать</a> "); + if (visitor.getUid() == 0 && !msg.ReadOnly) { + out.print("<a href=\"/"+ msg.getMid() + "\" class=\"a-login\">Комментировать</a> "); + } else if (visitor.getUid() > 0 && (!msg.ReadOnly || visitor.getUid() == msg.getUser().getUid())) { + out.print("<a class=\"a-comment\" href=\"/" + msg.getMid() + "\">Комментировать</a> "); } - if (visitor.getUID() > 0 && msg.Privacy < 0 && msg.getUser().getUID() == visitor.getUID()) { + if (visitor.getUid() > 0 && msg.getPrivacy() < 0 && msg.getUser().getUid() == visitor.getUid()) { out.print(" <a href=\"#\" class=\"a-privacy\">Открыть доступ</a>"); } - if (visitor.getUID() > 0 && visitor.getUID() == 3694) { + if (visitor.getUid() > 0 && visitor.getUid() == 3694) { out.print(" <a href=\"#\" class=\"a-popular-plus\">+</a>"); out.print(" <a href=\"#\" class=\"a-popular-minus\">-</a>"); out.print(" <a href=\"#\" class=\"a-popular-delete\">x</a>"); @@ -361,10 +361,10 @@ public class PageTemplates { out.print(" <nav class=\"s\">"); if (msg.Likes > 0) { - out.print("<a href=\"/" + msg.getUser().getUName() + "/" + msg.getMID() + "\" class=\"likes\"><i data-icon=\"ei-heart\" data-size=\"s\"></i> " + msg.Likes + "</a>"); + out.print("<a href=\"/" + msg.getUser().getName() + "/" + msg.getMid() + "\" class=\"likes\"><i data-icon=\"ei-heart\" data-size=\"s\"></i> " + msg.Likes + "</a>"); } if (msg.Replies > 0) { - out.print("<a href=\"/" + msg.getUser().getUName() + "/" + msg.getMID() + "\" class=\"replies\"><i data-icon=\"ei-comment\" data-size=\"s\"></i> " + msg.Replies + "</a>"); + out.print("<a href=\"/" + msg.getUser().getName() + "/" + msg.getMid() + "\" class=\"replies\"><i data-icon=\"ei-comment\" data-size=\"s\"></i> " + msg.Replies + "</a>"); } out.println("</nav>"); out.print("</article>"); |