aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/PageTemplates.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-11-02 03:25:18 +0700
committerGravatar Ugnich Anton2013-11-02 03:25:18 +0700
commit796c55d1591acc0188c0c269409d914f0dce12c5 (patch)
tree8bce0a47a1fc21bb71b2fa2a1887973ae47cac05 /src/java/com/juick/http/www/PageTemplates.java
parent79a9182f4ad429fa43ad379028087d04d5abd126 (diff)
Ad messages
Diffstat (limited to 'src/java/com/juick/http/www/PageTemplates.java')
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index d63cb5f5..c7118277 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -357,11 +357,20 @@ public class PageTemplates {
return msg;
}
- public static void printMessages(PrintWriter out, Connection sql, com.juick.User user, ArrayList<Integer> mids, com.juick.User visitor, Locale locale, int YandexID) {
+ public static void printMessages(PrintWriter out, Connection sql, com.juick.User user, ArrayList<Integer> mids, com.juick.User visitor, Locale locale, int YandexID, int ad_mid) {
ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
ArrayList<com.juick.Message> msgs = MessagesQueries.getMessages(sql, mids);
+ for (int i = 0; i < msgs.size(); i++) {
+ com.juick.Message msg = msgs.get(i);
+ if (msg.MID == ad_mid) {
+ msgs.remove(i);
+ msgs.add(0, msg);
+ break;
+ }
+ }
+
ArrayList<Integer> blUIDs = new ArrayList<Integer>(20);
if (visitor != null) {
for (int i = 0; i < msgs.size(); i++) {
@@ -372,7 +381,7 @@ public class PageTemplates {
for (int i = 0; i < msgs.size(); i++) {
- if (i == 1 && YandexID > 0) {
+ if (i == 1 && YandexID > 0 && ad_mid == 0) {
out.println(" <li class=\"ads\"><div id=\"yandex_ad\"></div></li>");
out.println("<script type=\"text/javascript\">");
out.println("(function(w, d, n, s, t) {");
@@ -440,7 +449,11 @@ public class PageTemplates {
out.println(" <div class=\"msg-cont\">");
out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\"></a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:" + tags + "</div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>");
+ out.print(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a>");
+ if (msg.MID == ad_mid) {
+ out.print(" &#183; " + rb.getString("Sponsored"));
+ }
+ out.println("</div>");
if (msg.Place != null) {
out.println(" <div class=\"msg-place\"><a href=\"/places/" + msg.Place.pid + "\">" + msg.Place.name + "</a></div>");
}