]> WPIA git - gigi.git/commitdiff
UPD: Refactored mail forms to the Form objects
authorJanis Streib <janis@dogcraft.de>
Tue, 22 Jul 2014 21:05:43 +0000 (23:05 +0200)
committerJanis Streib <janis@dogcraft.de>
Tue, 22 Jul 2014 21:33:29 +0000 (23:33 +0200)
src/org/cacert/gigi/pages/account/MailAddForm.java [new file with mode: 0644]
src/org/cacert/gigi/pages/account/MailAddForm.templ [new file with mode: 0644]
src/org/cacert/gigi/pages/account/MailManagementForm.java [new file with mode: 0644]
src/org/cacert/gigi/pages/account/MailManagementForm.templ [new file with mode: 0644]
src/org/cacert/gigi/pages/account/MailOverview.java
src/org/cacert/gigi/pages/account/MailOverview.templ

diff --git a/src/org/cacert/gigi/pages/account/MailAddForm.java b/src/org/cacert/gigi/pages/account/MailAddForm.java
new file mode 100644 (file)
index 0000000..a36c202
--- /dev/null
@@ -0,0 +1,32 @@
+package org.cacert.gigi.pages.account;
+
+import java.io.PrintWriter;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.cacert.gigi.Language;
+import org.cacert.gigi.output.Form;
+import org.cacert.gigi.output.template.Template;
+
+public class MailAddForm extends Form {
+       private static Template t;
+       static {
+               t = new Template(ChangePasswordPage.class.getResource("MailAddForm.templ"));
+       }
+
+       public MailAddForm(HttpServletRequest hsr) {
+               super(hsr);
+       }
+
+       @Override
+       public boolean submit(PrintWriter out, HttpServletRequest req) {
+               return false;
+       }
+
+       @Override
+       protected void outputContent(PrintWriter out, Language l, Map<String, Object> vars) {
+               t.output(out, l, vars);
+       }
+
+}
diff --git a/src/org/cacert/gigi/pages/account/MailAddForm.templ b/src/org/cacert/gigi/pages/account/MailAddForm.templ
new file mode 100644 (file)
index 0000000..40a6cf6
--- /dev/null
@@ -0,0 +1,16 @@
+<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper dataTable">
+  <thead>
+  <tr>
+    <th colspan="2" class="title"><?=_Add Email?></th>
+  </tr>
+  </thead>
+<tbody>
+  <tr>
+    <td width="125"><?=_Email Addresses?> </td>
+    <td width="125"><input type="text" name="newemail" value=""></td>
+  </tr>
+  <tr>
+    <td colspan="2"><input type="submit" name="addmail" value="<?=_I own or am authorised to control this email address?>"></td>
+  </tr>
+</tbody>
+</table>
diff --git a/src/org/cacert/gigi/pages/account/MailManagementForm.java b/src/org/cacert/gigi/pages/account/MailManagementForm.java
new file mode 100644 (file)
index 0000000..0eaa16c
--- /dev/null
@@ -0,0 +1,32 @@
+package org.cacert.gigi.pages.account;
+
+import java.io.PrintWriter;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.cacert.gigi.Language;
+import org.cacert.gigi.output.Form;
+import org.cacert.gigi.output.template.Template;
+
+public class MailManagementForm extends Form {
+       private static Template t;
+       static {
+               t = new Template(ChangePasswordPage.class.getResource("MailManagementForm.templ"));
+       }
+
+       public MailManagementForm(HttpServletRequest hsr) {
+               super(hsr);
+       }
+
+       @Override
+       public boolean submit(PrintWriter out, HttpServletRequest req) {
+               return false;
+       }
+
+       @Override
+       protected void outputContent(PrintWriter out, Language l, Map<String, Object> vars) {
+               t.output(out, l, vars);
+       }
+
+}
diff --git a/src/org/cacert/gigi/pages/account/MailManagementForm.templ b/src/org/cacert/gigi/pages/account/MailManagementForm.templ
new file mode 100644 (file)
index 0000000..37338eb
--- /dev/null
@@ -0,0 +1,20 @@
+<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper dataTable">
+  <thead>
+  <tr>
+    <th colspan="4"><?=_Email Accounts?></th>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+    <td><?=_Default?></td>
+    <td><?=_Status?></td>
+    <td><?=_Delete?></td>
+    <td><?=_Address?></td>
+  </tr>
+ <?=$mailData?>
+  <tr>
+    <td colspan="2"><input type="submit" name="makedefault" value="Setze als Standard"></td>
+    <td colspan="2"><input type="submit" name="delete" value="Löschen"></td>
+  </tr>
+  </tbody>
+</table>
index fa69e8e3f2347d1aa635be5b9b9fc2da3f02cffd..c90ff92b93305ecb7701496f22449c349adbadc9 100644 (file)
@@ -41,12 +41,20 @@ public class MailOverview extends Page {
                        vars.put("mailData", t);
                        vars.put("res", rs);
                        vars.put("us", us.getEmail());
+                       vars.put("addForm", new MailAddForm(req));
+                       vars.put("manForm", new MailManagementForm(req));
                        getDefaultTemplate().output(resp.getWriter(), lang, vars);
                } catch (SQLException e) {
                        e.printStackTrace();
                }
        }
 
+       @Override
+       public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+               System.out.println();
+               super.doPost(req, resp);
+       }
+
        private class MailTable implements Outputable {
                private String mails, userMail;
 
index 55a8f4fff34730d476ff678cbda050185c96f42c..968f17321e8976be21130129a2d3f93b7b6a3d0e 100644 (file)
@@ -1,42 +1,9 @@
-<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper dataTable">
-  <thead>
-  <tr>
-    <th colspan="4"><?=_Email Accounts?></th>
-  </tr>
-  </thead>
-  <tbody>
-  <tr>
-    <td><?=_Default?></td>
-    <td><?=_Status?></td>
-    <td><?=_Delete?></td>
-    <td><?=_Address?></td>
-  </tr>
- <?=$mailData?>
-  <tr>
-    <td colspan="2"><input type="submit" name="makedefault" value="Setze als Standard"></td>
-    <td colspan="2"><input type="submit" name="process" value="Löschen"></td>
-  </tr>
-  </tbody>
-</table>
+<?=$manForm?>
 <p>
 <?=_Please Note: You can not set an unverified account as a default account, and you can not remove a default account. To remove the default account you must set another verified account as the default.?>
 </p>
 <br/>
-<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper dataTable">
-  <thead>
-  <tr>
-    <th colspan="2" class="title"><?=_Add Email?></th>
-  </tr>
-  </thead>
-<tbody>
-  <tr>
-    <td width="125"><?=_Email Addresses?> </td>
-    <td width="125"><input type="text" name="newemail" value=""></td>
-  </tr>
-  <tr>
-    <td colspan="2"><input type="submit" name="process" value="<?=_I own or am authorised to control this email address?>"></td>
-  </tr>
-</tbody></table>
+<?=$addForm?>
 <p>
 <?=_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.?>
 </p>