From ac9d7b3012496f411f7ba6c19d31c9496b44327f Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Fri, 3 Sep 2010 14:20:40 -0400 Subject: Add approve functionality. --- html/approve.jsp | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 html/approve.jsp (limited to 'html') 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" +%> + + + +Quote approval + + + + +<% +if (lq.UserUtil.isAuthenticated()) { + out.println("Logget inn som: " + lq.UserUtil.getAuthenticatedEmail() + "
"); + + 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
"); + } + } + else { + out.println("Feilkode π/3"); + } + out.println("

"); + } + + List 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("

");
+        out.println("Fra " + quote.getIp() + ", " + timestamp);
+        out.println("Nick: " + nick);
+        out.println("Date: " + date);
+        out.println();
+        out.println(content);
+        out.println("
"); + out.println("avvis"); + out.println(", "); + out.println("godkjenn"); + out.println("
"); + } + + String logoutUrl = lq.UserUtil.getLogoutUrl(request.getRequestURI()); + out.println("Logg ut"); +} +else { + String loginUrl = lq.UserUtil.getLoginUrl(request.getRequestURI()); + out.println("Logg inn"); +} +%> + + -- cgit v1.2.3