X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fpages%2Fwot%2FMyPoints.java;h=69f5d7e6f9a3667eff71ffb508e29f1758042652;hb=12b9507ab4cde3ea431c0fed0b86dabecb401f80;hp=fc481437a9148cf0f743637dfd9d76673265cf8c;hpb=822443761eabc6166cddb123a1c99a95614fa11e;p=gigi.git diff --git a/src/org/cacert/gigi/pages/wot/MyPoints.java b/src/org/cacert/gigi/pages/wot/MyPoints.java index fc481437..69f5d7e6 100644 --- a/src/org/cacert/gigi/pages/wot/MyPoints.java +++ b/src/org/cacert/gigi/pages/wot/MyPoints.java @@ -1,37 +1,46 @@ package org.cacert.gigi.pages.wot; import java.io.IOException; -import java.sql.SQLException; import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.cacert.gigi.GigiApiException; +import org.cacert.gigi.dbObjects.User; import org.cacert.gigi.output.AssurancesDisplay; import org.cacert.gigi.pages.Page; +import org.cacert.gigi.util.AuthorizationContext; public class MyPoints extends Page { public static final String PATH = "/wot/mypoints"; - private AssurancesDisplay display = new AssurancesDisplay("asArr"); + private AssurancesDisplay myDisplay = new AssurancesDisplay("asArr", false); - public MyPoints(String title) { - super(title); + private AssurancesDisplay toOtherDisplay = new AssurancesDisplay("otherAsArr", true); + + public MyPoints() { + super("My Points"); } @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { HashMap vars = new HashMap(); - vars.put("pointlist", display); - try { - vars.put("asArr", getUser(req).getReceivedAssurances()); - } catch (SQLException e) { - new GigiApiException(e).format(resp.getWriter(), getLanguage(req)); - return; + vars.put("pointlist", myDisplay); + vars.put("madelist", toOtherDisplay); + User user = getUser(req); + vars.put("asArr", user.getReceivedAssurances()); + vars.put("otherAsArr", user.getMadeAssurances()); + vars.put("assP", user.getAssurancePoints()); + if (user.canAssure()) { + vars.put("expP", user.getExperiencePoints()); + vars.put("maxP", user.getMaxAssurePoints()); } getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars); } + @Override + public boolean isPermitted(AuthorizationContext ac) { + return ac != null && ac.getTarget() instanceof User; + } }