aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/PageTemplates.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-12-26 14:30:03 +0700
committerGravatar Ugnich Anton2012-12-26 14:30:03 +0700
commit9adb555fe41f6322310be1fea406d9d8d44acafe (patch)
treebcc81e6bebdb607ec5f0651379adf78e97214f16 /src/java/com/juick/http/www/PageTemplates.java
parentf4bbf04c16efada11d1d371f0b6abc2f30780bc7 (diff)
New tags URLs
Diffstat (limited to 'src/java/com/juick/http/www/PageTemplates.java')
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 5032cbf5..4e499344 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -179,14 +179,20 @@ public class PageTemplates {
out.println("</div></div>");
}
- public static String formatTags(ArrayList<String> tags) {
+ public static String formatTags(ArrayList<String> tags, com.juick.User user) {
String ret = "";
for (int i = 0; i < tags.size(); i++) {
String tag = tags.get(i);
tag = tag.replaceAll("<", "&lt;");
tag = tag.replaceAll(">", "&gt;");
try {
- ret += " *<a href=\"/?tag=" + URLEncoder.encode(tags.get(i), "utf-8") + "\">" + tag + "</a>";
+ ret += " *<a href=\"";
+ if (user == null) {
+ ret += "/tag/";
+ } else {
+ ret += "./?tag=";
+ }
+ ret += URLEncoder.encode(tags.get(i), "utf-8") + "\">" + tag + "</a>";
} catch (UnsupportedEncodingException e) {
}
}
@@ -304,7 +310,7 @@ public class PageTemplates {
return msg;
}
- public static void printMessages(PrintWriter out, Connection sql, ArrayList<Integer> mids, com.juick.User visitor, Locale locale) {
+ public static void printMessages(PrintWriter out, Connection sql, com.juick.User user, ArrayList<Integer> mids, com.juick.User visitor, Locale locale) {
ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
ArrayList<com.juick.Message> msgs = MessagesQueries.getMessages(sql, mids);
@@ -320,7 +326,7 @@ public class PageTemplates {
for (int i = 0; i < msgs.size(); i++) {
com.juick.Message msg = msgs.get(i);
- String tags = msg.Tags.isEmpty() ? "" : formatTags(msg.Tags);
+ String tags = msg.Tags.isEmpty() ? "" : formatTags(msg.Tags, user);
if (msg.ReadOnly) {
tags += " *readonly";
}