diff options
Diffstat (limited to 'src/java/com/juick/http/www/PageTemplates.java')
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 14 |
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("<", "<"); tag = tag.replaceAll(">", ">"); 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"; } |