]> WPIA git - gigi.git/commitdiff
Removed Data table. this idea was crap
authorJanis Streib <janis@dogcraft.de>
Sat, 5 Jul 2014 20:42:13 +0000 (22:42 +0200)
committerFelix Dörre <felix@dogcraft.de>
Thu, 10 Jul 2014 22:35:14 +0000 (00:35 +0200)
src/org/cacert/gigi/output/CertificateTable.java
src/org/cacert/gigi/output/DataTable.java [deleted file]
src/org/cacert/gigi/output/MailTable.java
src/org/cacert/gigi/pages/account/MailAdd.java

index 836f3449a9f58406a22fc9b93267191e3c4c6d9d..413de877b9235bb0988f33fe0ee99b1dfe076cbe 100644 (file)
@@ -3,51 +3,53 @@ package org.cacert.gigi.output;
 import java.io.PrintWriter;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.LinkedList;
 import java.util.Map;
 
 import org.cacert.gigi.Language;
-import org.cacert.gigi.output.DataTable.Cell;
 
 public class CertificateTable implements Outputable {
        String resultSet;
        public CertificateTable(String resultSet) {
                this.resultSet = resultSet;
        }
+       private static final String[] columnNames = new String[]{
+                       "Renew/Revoke/Delete", "Status", "Email Address", "SerialNumber",
+                       "Revoked", "Expires", "Login"};
 
        @Override
        public void output(PrintWriter out, Language l, Map<String, Object> vars) {
                ResultSet rs = (ResultSet) vars.get(resultSet);
                try {
                        out.println("<form method=\"post\" action=\"account.php\">");
-                       final LinkedList<Cell> cells = new LinkedList<>();
-                       cells.add(new Cell("Renew/Revoke/Delete", true));
-                       cells.add(new Cell("Status", true));
-                       cells.add(new Cell("Email Address", true));
-                       cells.add(new Cell("SerialNumber", true));
-                       cells.add(new Cell("Revoked", true));
-                       cells.add(new Cell("Expires", true));
-                       cells.add(new Cell("Login", true));
-                       cells.add(new Cell("Comment *", true, 2));
+                       out.println("<table align=\"center\" valign=\"middle\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"wrapper\">");
+                       out.println("<tr>");
+                       for (String column : columnNames) {
+                               out.print("<td class=\"DataTD\">");
+                               out.print(l.getTranslation(column));
+                               out.println("</td>");
+                       }
+                       out.print("<td colspan=\"2\" class=\"DataTD\">");
+                       out.print(l.getTranslation("Comment *"));
+                       out.println("</td></tr>");
+
                        rs.beforeFirst();
                        while (rs.next()) {
                                // out.println(rs.getString("id"));
-                               cells.add(new Cell());
-                               cells.add(new Cell("State", false));
-                               cells.add(new Cell(rs.getString("CN"), false));
-                               cells.add(new Cell(rs.getString("serial"), false));
+                               out.print("<tr><td class=\"DataTD\">&nbsp;</td><td class=\"DataTD\">State</td><td class=\"DataTD\">");
+                               out.println(rs.getString("CN"));
+                               out.print("</td><td class=\"DataTD\">");
+                               out.println(rs.getString("serial"));
+                               out.print("</td><td class=\"DataTD\">");
                                if (rs.getString("revoked") == null) {
-                                       cells.add(new Cell("N/A", false));
+                                       out.println("N/A");
                                } else {
-                                       cells.add(new Cell(rs.getString("revoked"), false));
+                                       out.println(rs.getString("revoked"));
                                }
-                               cells.add(new Cell(rs.getString("expire"), false));
-                               cells.add(new Cell(rs.getString("a"), false));
-                               cells.add(new Cell(rs.getString("a"), false));
+                               out.print("</td><td class=\"DataTD\">");
+                               out.println(rs.getString("expire"));
+                               out.println("</td><td class=\"DataTD\">a</td><td class=\"DataTD\">a</td></tr>");
                        }
-                       DataTable t = new DataTable(9, cells);
-                       t.output(out, l, vars);
-                       out.println("</form>");
+                       out.println("</table>");
                } catch (SQLException e) {
                        e.printStackTrace();
                }
diff --git a/src/org/cacert/gigi/output/DataTable.java b/src/org/cacert/gigi/output/DataTable.java
deleted file mode 100644 (file)
index 0a30180..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.cacert.gigi.output;
-
-import java.io.PrintWriter;
-import java.util.LinkedList;
-import java.util.Map;
-
-import org.cacert.gigi.Language;
-
-public class DataTable implements Outputable {
-       private LinkedList<Cell> cells;
-       private int columnCount;
-
-       public DataTable(int coloumnCount, LinkedList<Cell> content) {
-               this.columnCount = coloumnCount;
-               this.cells = content;
-       }
-
-       public void output(PrintWriter out, Language l) {
-               float mesCells = cells.size();
-               for (Cell c : cells) {
-                       if (c.getColSpan() > 1) {
-                               mesCells += c.getColSpan();
-                       }
-               }
-               out.println("<table align=\"center\" valign=\"middle\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"wrapper\">");
-               int cellsRendered = 0;
-               for (int i = 0; i < Math.ceil(mesCells / columnCount) - 1; i++) {
-                       out.println("<tr>");
-                       for (int j = 0; j < columnCount;) {
-                               Cell current = cells.get(cellsRendered++);
-                               j += current.getColSpan();
-                               out.println("<td ");
-                               out.print(current.getHtmlAttribs());
-                               out.print(" >");
-                               out.print(current.shouldTranslate() ? l.getTranslation(current
-                                               .getText()) : current.getText());
-                               out.print("</td>");
-                       }
-                       out.println("</tr>");
-               }
-               out.println("</table>");
-       }
-
-       public static class Cell {
-               private String text, htmlAttribs;
-               private boolean translate;
-               private int colSpan;
-
-               public Cell() {
-                       this("&nbsp;", false);
-               }
-
-               public Cell(String text, boolean translate, int colSpan,
-                               String htmlAttribs) {
-                       this.text = text;
-                       this.translate = translate;
-                       this.htmlAttribs = htmlAttribs;
-                       if (colSpan > 1) {
-                               this.htmlAttribs += " colspan=\"" + colSpan + "\"";
-                       }
-                       this.colSpan = colSpan;
-               }
-
-               public Cell(String text, boolean translate) {
-                       this(text, translate, 1, "class=\"DataTD\"");
-               }
-
-               public Cell(String text, boolean translate, int colSpan) {
-                       this(text, translate, colSpan, "class=\"DataTD\"");
-               }
-
-               public boolean shouldTranslate() {
-                       return translate;
-               }
-
-               public String getText() {
-                       return text;
-               }
-
-               public int getColSpan() {
-                       return colSpan;
-               }
-
-               public String getHtmlAttribs() {
-                       return htmlAttribs;
-               }
-
-       }
-
-       @Override
-       public void output(PrintWriter out, Language l, Map<String, Object> vars) {
-               output(out, l);
-       }
-
-}
index 5e310b7b7acb403a6a13f1a60764ce43bf93bf6a..8f871ac72010933e49b49e0aea7a50afd6da1758 100644 (file)
@@ -1,13 +1,9 @@
 package org.cacert.gigi.output;
 
 import java.io.PrintWriter;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.LinkedList;
 import java.util.Map;
 
 import org.cacert.gigi.Language;
-import org.cacert.gigi.output.DataTable.Cell;
 
 public class MailTable implements Outputable {
        private String resultSet, userMail;
@@ -19,43 +15,7 @@ public class MailTable implements Outputable {
 
        @Override
        public void output(PrintWriter out, Language l, Map<String, Object> vars) {
-               ResultSet rs = (ResultSet) vars.get(resultSet);
-               String userMail = (String) vars.get(this.userMail);
-               LinkedList<Cell> cells = new LinkedList<>();
-               cells.add(new Cell("Email Accounts", true, 4, "class=\"title\""));
-               cells.add(new Cell("Default", true));
-               cells.add(new Cell("Status", true));
-               cells.add(new Cell("Delete", true));
-               cells.add(new Cell("Address", true));
-               try {
-                       rs.beforeFirst();
-                       while (rs.next()) {
-                               cells.add(new Cell());
-                               cells.add(new Cell(
-                                               rs.getString("hash").trim().isEmpty() ? "Verified"
-                                                               : "Unverified", true));
-                               if (rs.getString("email").equals(userMail)) {
-                                       cells.add(new Cell(
-                                                       "N/A"
-                                                                       , true));
-                               } else {
-                                       cells.add(new Cell("<input type=\"checkbox\" name=\"delid[]\" value=\""
-                                                                                       + rs.getInt("id") + "\">", false));
-                               }
-                               cells.add(new Cell(rs.getString("email"), false));
-                       }
-               } catch (SQLException e) {
-                       e.printStackTrace();
-               }
-               String trans = l.getTranslation("Make Default");
-               cells.add(new Cell(
-                               "<input type=\"submit\" name=\"makedefault\" value=\"" + trans
-                                               + "\">", false, 2));
-               trans = l.getTranslation("Delete");
-               cells.add(new Cell("<input type=\"submit\" name=\"process\" value=\""
-                               + trans + "\">", false, 2));
-               DataTable t = new DataTable(4, cells);
-               t.output(out, l, vars);
+
        }
 
 }
index e311cbcb40089504ba0d8fafadc30ca368db3a46..07f43559ebaf1dafcfa97e89bc6a8e25370a4001 100644 (file)
@@ -1,19 +1,15 @@
 package org.cacert.gigi.pages.account;
 
 import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.LinkedList;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.cacert.gigi.Language;
-import org.cacert.gigi.output.DataTable;
-import org.cacert.gigi.output.DataTable.Cell;
 import org.cacert.gigi.pages.Page;
 
-public class MailAdd extends Page{
+public class MailAdd extends Page {
        public static final String DEFAULT_PATH = "/account/mails/add";
+
        public MailAdd(String title) {
                super(title);
        }
@@ -21,22 +17,7 @@ public class MailAdd extends Page{
        @Override
        public void doGet(HttpServletRequest req, HttpServletResponse resp)
                        throws IOException {
-               LinkedList<Cell> cells = new LinkedList<>();
-               cells.add(new Cell("Add Email", true, 2, "class=\"title\""));
-               cells.add(new Cell("Email Address", true));
-               cells.add(new Cell("<input type=\"text\" name=\"newemail\">", false));
-               Language language = getLanguage(req);
-               String trans = language.getTranslation("I own or am authorised to control this email address");
-               cells.add(new Cell("<input type=\"submit\" name=\"process\" value=\""
-                               + trans + "\">", false, 2));
-               DataTable dt = new DataTable(2, cells);
-               dt.output(resp.getWriter(), language);
-               PrintWriter out = resp.getWriter();
-               out.println("<p>");
-               out.println(language
-                               .getTranslation(
-                                               "Currently we only issue certificates for Punycode domains if the person requesting them has code signing attributes attached to their account, as these have potentially slightly higher security risk."));
-               out.println("</p>");
+
        }
 
 }