aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/NewMessage.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-01 13:56:53 +0300
committerGravatar Vitaly Takmazov2016-12-01 13:56:53 +0300
commit3d7f60c1c0b48dad2f58bffe3352d1c5c1b93f00 (patch)
treeab311d5d6102b2c76c03b266fc1b794108cba0fc /juick-www/src/main/java/com/juick/www/NewMessage.java
parent92d6700919e87c81db4a42a4b286257f62566cbf (diff)
juick-api: Tags controller from perl, refactoring
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/NewMessage.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/NewMessage.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/juick-www/src/main/java/com/juick/www/NewMessage.java b/juick-www/src/main/java/com/juick/www/NewMessage.java
index c066c5b3..ca783779 100644
--- a/juick-www/src/main/java/com/juick/www/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/NewMessage.java
@@ -19,6 +19,7 @@ package com.juick.www;
import com.juick.Tag;
import com.juick.server.*;
+import com.juick.server.helpers.TagStats;
import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.math.NumberUtils;
@@ -100,16 +101,16 @@ public class NewMessage {
}
void printUserTags(JdbcTemplate sql, PrintWriter out, com.juick.User visitor) {
- List<Tag> tags = TagQueries.getUserTagsAll(sql, visitor.getUid());
+ List<TagStats> tags = TagQueries.getTagsStats(sql, visitor.getUid());
if (tags.isEmpty()) {
return;
}
- int min = tags.get(0).UsageCnt;
- int max = tags.get(0).UsageCnt;
+ int min = tags.get(0).getUsageCount();
+ int max = tags.get(0).getUsageCount();
for (int i = 1; i < tags.size(); i++) {
- int usagecnt = tags.get(i).UsageCnt;
+ int usagecnt = tags.get(i).getUsageCount();
if (usagecnt < min) {
min = usagecnt;
}
@@ -126,12 +127,12 @@ public class NewMessage {
}
String taglink = "";
try {
- taglink = "<a onclick=\"return addTag('" + StringEscapeUtils.escapeHtml4(tags.get(i).getName()) + "')\" href=\"/" +
- visitor.getName() + "/?tag=" + URLEncoder.encode(tags.get(i).getName(), "utf-8") +
- "\" title=\"" + tags.get(i).UsageCnt + "\">" + StringEscapeUtils.escapeHtml4(tags.get(i).getName()) + "</a>";
+ taglink = "<a onclick=\"return addTag('" + StringEscapeUtils.escapeHtml4(tags.get(i).getTag().getName()) + "')\" href=\"/" +
+ visitor.getName() + "/?tag=" + URLEncoder.encode(tags.get(i).getTag().getName(), "utf-8") +
+ "\" title=\"" + tags.get(i).getUsageCount() + "\">" + StringEscapeUtils.escapeHtml4(tags.get(i).getTag().getName()) + "</a>";
} catch (UnsupportedEncodingException e) {
}
- int usagecnt = tags.get(i).UsageCnt;
+ int usagecnt = tags.get(i).getUsageCount();
if (usagecnt <= max / 5 + min) {
out.print("<span style=\"font-size: small\">" + taglink + "</span>");
} else if (usagecnt <= max / 5 * 2 + min) {