%@ 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");
}
%>