1 package org.cacert.gigi.output;
3 import java.io.PrintWriter;
4 import java.sql.ResultSet;
5 import java.sql.SQLException;
6 import java.util.LinkedList;
9 import org.cacert.gigi.Language;
10 import org.cacert.gigi.output.DataTable.Cell;
12 public class MailTable implements Outputable {
13 private String resultSet, userMail;
15 public MailTable(String key, String userMail) {
17 this.userMail = userMail;
21 public void output(PrintWriter out, Language l, Map<String, Object> vars) {
22 ResultSet rs = (ResultSet) vars.get(resultSet);
23 String userMail = (String) vars.get(this.userMail);
24 LinkedList<Cell> cells = new LinkedList<>();
25 cells.add(new Cell("Email Accounts", true, 4, "class=\"title\""));
26 cells.add(new Cell("Default", true));
27 cells.add(new Cell("Status", true));
28 cells.add(new Cell("Delete", true));
29 cells.add(new Cell("Address", true));
33 cells.add(new Cell());
35 rs.getString("hash").trim().isEmpty() ? "Verified"
36 : "Unverified", true));
37 if (rs.getString("email").equals(userMail)) {
42 cells.add(new Cell("<input type=\"checkbox\" name=\"delid[]\" value=\""
43 + rs.getInt("id") + "\">", false));
45 cells.add(new Cell(rs.getString("email"), false));
47 } catch (SQLException e) {
50 String trans = l.getTranslation("Make Default");
52 "<input type=\"submit\" name=\"makedefault\" value=\"" + trans
54 trans = l.getTranslation("Delete");
55 cells.add(new Cell("<input type=\"submit\" name=\"process\" value=\""
56 + trans + "\">", false, 2));
57 DataTable t = new DataTable(4, cells);
58 t.output(out, l, vars);