]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/account/History.java
upd: rename package name and all references to it
[gigi.git] / src / org / cacert / gigi / pages / account / History.java
diff --git a/src/org/cacert/gigi/pages/account/History.java b/src/org/cacert/gigi/pages/account/History.java
deleted file mode 100644 (file)
index 470ed1c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.cacert.gigi.pages.account;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.cacert.gigi.dbObjects.User;
-import org.cacert.gigi.output.template.OutputableArrayIterable;
-import org.cacert.gigi.pages.Page;
-import org.cacert.gigi.util.AuthorizationContext;
-
-public class History extends Page {
-
-    public static final String SUPPORT_PATH = "/support/user/*/history";
-
-    public static final String PATH = "/account/history";
-
-    private static final int intStart = SUPPORT_PATH.indexOf('*');
-
-    private boolean support;
-
-    public History(boolean support) {
-        super(support ? "Support History" : "History");
-        this.support = support;
-    }
-
-    @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
-        User u;
-        HashMap<String, Object> vars = new HashMap<>();
-        if (support) {
-            String info = req.getPathInfo();
-            int id = Integer.parseInt(info.substring(intStart, info.length() - SUPPORT_PATH.length() + intStart + 1));
-            u = User.getById(id);
-            if (u == null) {
-                resp.sendError(404);
-                return;
-            }
-            vars.put("username", u.getPreferredName().toString());
-        } else {
-            u = getUser(req);
-        }
-        String[] adminLog = u.getAdminLog();
-        vars.put("entries", new OutputableArrayIterable(adminLog, "entry"));
-        getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
-    }
-
-    @Override
-    public boolean isPermitted(AuthorizationContext ac) {
-        return ac != null && ( !support || ac.canSupport());
-    }
-}