summaryrefslogtreecommitdiff
path: root/html
diff options
context:
space:
mode:
authorKjetil Orbekk <Kjetil Ørbekk orbekk@pvv.ntnu.no>2010-09-03 18:05:18 -0400
committerKjetil Orbekk <Kjetil Ørbekk orbekk@pvv.ntnu.no>2010-09-03 18:05:18 -0400
commit505f176b0b23fd5c21bb37cfc3a5d063ee6219b5 (patch)
tree5f75d3f700ca40413c1caafe4d58d14c8bcd833f /html
parentbd7cf278a1ece4169d4ce4c784fa33ea9c931635 (diff)
Refactor quote formatting code.
Diffstat (limited to 'html')
-rw-r--r--html/quotes.jsp26
1 files changed, 2 insertions, 24 deletions
diff --git a/html/quotes.jsp b/html/quotes.jsp
index aac4cad..6177673 100644
--- a/html/quotes.jsp
+++ b/html/quotes.jsp
@@ -63,31 +63,9 @@ if (order == null) {
quotes = lq.QuoteUtil.getQuotesOrderedByIdDesc();
}
+lq.Printer printer = new lq.Printer(out);
for (lq.Quote quote : quotes) {
- out.println("<br>");
- out.println("<a href=\"vote.jsp?id=" + quote.getId() + "\">" +
- "#" + quote.getId() +
- "</a>"+
- ", lagt til av " + lq.Strings.escape(quote.getAuthor()) + "<br>");
-
- String score = quote.getScore().toString();
- String date = lq.DateUtil.dateFormat.format(quote.getQuoteDate());
- out.println("Dato: " + date + ", Score: ");
- out.println("<span id=\"v" + quote.getId() + "\">");
- out.println((score==null?"-":(score+ " (fra " + quote.getVotes().size() +")")));
- out.println("<br> Vote: <font size=\"-1\">");
- for(int nv=1; nv<=5; nv++)
- out.println("<a href=\"javascript:ajaxvote(" + quote.getId() + ","+nv+")\">"+nv+"</a> ");
- out.println("</font> </span>");
-
- out.println("<br> <br>");
- out.println();
- String content = lq.Strings.escape(quote.getContent());
- out.println(content
- .replaceAll("(http://[^ \r\n]+)","<a href=\"$1\">$1</a>")
- .replaceAll("\n","<br>\n"));
- out.println("");
- out.println("<hr>");
+ printer.printQuote(quote);
}
%>