summaryrefslogtreecommitdiff
path: root/html
diff options
context:
space:
mode:
authorKjetil Orbekk <Kjetil Ørbekk orbekk@pvv.ntnu.no>2010-09-03 14:20:40 -0400
committerKjetil Orbekk <Kjetil Ørbekk orbekk@pvv.ntnu.no>2010-09-03 14:20:40 -0400
commitac9d7b3012496f411f7ba6c19d31c9496b44327f (patch)
tree28742e4192fd72cc10c024a730d00e5fbea5b1b7 /html
parentd5ab045ec80a10b341db2ac5a591d84741ea846a (diff)
Add approve functionality.
Diffstat (limited to 'html')
-rw-r--r--html/approve.jsp81
1 files changed, 81 insertions, 0 deletions
diff --git a/html/approve.jsp b/html/approve.jsp
new file mode 100644
index 0000000..b0455dc
--- /dev/null
+++ b/html/approve.jsp
@@ -0,0 +1,81 @@
+<%@ page contentType="text/html; charset=UTF-8"
+ import="java.util.List"
+%>
+<html>
+<head>
+<meta name="robots" content="noindex, nofollow" />
+<title>Quote approval</title>
+<style type="text/css">
+body {font-family: monospace;}
+hr {
+ border-style: solid;
+ border-color: black;
+ border-width: 1px;
+}
+</style>
+</head>
+<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000">
+
+<%
+if (lq.UserUtil.isAuthenticated()) {
+ out.println("Logget inn som: " + lq.UserUtil.getAuthenticatedEmail() + "<br>");
+
+ if (!lq.Strings.nullOrEmpty(request.getParameter("id"))) {
+ String action = request.getParameter("action");
+ if (action != null && (action.equals("approve") || action.equals("reject"))) {
+ try {
+ Long id = Long.parseLong(request.getParameter("id"));
+ if (action.equals("approve")) {
+ lq.QuoteUtils.approveQuote(id);
+ out.println("Godkjente quote #" + id);
+ }
+ else {
+ lq.QuoteUtils.rejectQuote(id);
+ out.println("Avviste quote #" + id);
+ }
+ }
+ catch (NumberFormatException e) {
+ out.println("lmao for en gimp hax<br>");
+ }
+ }
+ else {
+ out.println("Feilkode π/3");
+ }
+ out.println("<p><p>");
+ }
+
+ List<lq.Quote> pendingQuotes = lq.QuoteUtils.getQuotesPendingApproval();
+
+ for (lq.Quote quote : pendingQuotes) {
+ String nick = lq.Strings.escape(quote.getAuthor());
+ String timestamp = lq.DateUtil.timestampFormat.format(quote.getTimestamp());
+ String date = lq.DateUtil.dateFormat.format(quote.getQuoteDate());
+ String content = lq.Strings.escape(quote.getContent());
+
+ out.println("<br><pre>");
+ out.println("Fra " + quote.getIp() + ", " + timestamp);
+ out.println("Nick: " + nick);
+ out.println("Date: " + date);
+ out.println();
+ out.println(content);
+ out.println("</pre>");
+ out.println("<a href=\"approve.jsp?"
+ + "id=" + quote.getId() + "&"
+ + "action=reject\">avvis</a>");
+ out.println(", ");
+ out.println("<a href=\"approve.jsp?"
+ + "id=" + quote.getId() + "&"
+ + "action=approve\">godkjenn</a>");
+ out.println("<hr>");
+ }
+
+ String logoutUrl = lq.UserUtil.getLogoutUrl(request.getRequestURI());
+ out.println("<a href=\"" + logoutUrl + "\">Logg ut</a>");
+}
+else {
+ String loginUrl = lq.UserUtil.getLoginUrl(request.getRequestURI());
+ out.println("<a href=\"" + loginUrl + "\">Logg inn</a>");
+}
+%>
+</body>
+</html>