1 package org.cacert.gigi.pages.wot;
3 import java.io.IOException;
4 import java.util.HashMap;
6 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse;
9 import org.cacert.gigi.dbObjects.User;
10 import org.cacert.gigi.output.AssurancesDisplay;
11 import org.cacert.gigi.pages.Page;
12 import org.cacert.gigi.util.AuthorizationContext;
14 public class MyPoints extends Page {
16 public static final String PATH = "/wot/mypoints";
18 private AssurancesDisplay myDisplay = new AssurancesDisplay("asArr", false);
20 private AssurancesDisplay toOtherDisplay = new AssurancesDisplay("otherAsArr", true);
27 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
28 HashMap<String, Object> vars = new HashMap<String, Object>();
29 vars.put("pointlist", myDisplay);
30 vars.put("madelist", toOtherDisplay);
31 User user = getUser(req);
32 vars.put("asArr", user.getReceivedAssurances());
33 vars.put("otherAsArr", user.getMadeAssurances());
34 vars.put("assP", user.getAssurancePoints());
35 if (user.canAssure()) {
36 vars.put("expP", user.getExperiencePoints());
37 vars.put("maxP", user.getMaxAssurePoints());
39 getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
43 public boolean isPermitted(AuthorizationContext ac) {
44 return ac != null && ac.getTarget() instanceof User;