From 1ccaa2d6535ac8fdde810315734636aada18adbe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Sun, 11 Jan 2015 12:12:40 +0100 Subject: [PATCH] UPD: cleanup org-form-page, make the form look different when editing. --- .../cacert/gigi/pages/orga/AffiliationForm.java | 17 ++++++++++------- .../gigi/pages/orga/AffiliationForm.templ | 14 ++++++++------ .../cacert/gigi/pages/orga/CreateOrgForm.java | 6 ++++++ .../cacert/gigi/pages/orga/CreateOrgForm.templ | 13 ++++++++++++- src/org/cacert/gigi/pages/orga/EditOrg.templ | 2 +- 5 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/org/cacert/gigi/pages/orga/AffiliationForm.java b/src/org/cacert/gigi/pages/orga/AffiliationForm.java index defd3baf..a74bf50f 100644 --- a/src/org/cacert/gigi/pages/orga/AffiliationForm.java +++ b/src/org/cacert/gigi/pages/orga/AffiliationForm.java @@ -30,14 +30,17 @@ public class AffiliationForm extends Form { @Override public boolean submit(PrintWriter out, HttpServletRequest req) throws GigiApiException { - User toRemove = User.getByEmail(req.getParameter("del")); - if (toRemove != null) { - o.removeAdmin(toRemove, LoginPage.getUser(req)); + if (req.getParameter("del") != null) { + User toRemove = User.getByEmail(req.getParameter("del")); + if (toRemove != null) { + o.removeAdmin(toRemove, LoginPage.getUser(req)); + } } - - User byEmail = User.getByEmail(req.getParameter("email")); - if (byEmail != null) { - o.addAdmin(byEmail, LoginPage.getUser(req), req.getParameter("master") != null); + if (req.getParameter("do_affiliate") != null) { + User byEmail = User.getByEmail(req.getParameter("email")); + if (byEmail != null) { + o.addAdmin(byEmail, LoginPage.getUser(req), req.getParameter("master") != null); + } } return true; } diff --git a/src/org/cacert/gigi/pages/orga/AffiliationForm.templ b/src/org/cacert/gigi/pages/orga/AffiliationForm.templ index 7fbc513c..7a1c84fc 100644 --- a/src/org/cacert/gigi/pages/orga/AffiliationForm.templ +++ b/src/org/cacert/gigi/pages/orga/AffiliationForm.templ @@ -1,20 +1,22 @@ + + + + + + + +
-: - -? - - - diff --git a/src/org/cacert/gigi/pages/orga/CreateOrgForm.java b/src/org/cacert/gigi/pages/orga/CreateOrgForm.java index 4cd37b9a..27f7dbcf 100644 --- a/src/org/cacert/gigi/pages/orga/CreateOrgForm.java +++ b/src/org/cacert/gigi/pages/orga/CreateOrgForm.java @@ -26,12 +26,15 @@ public class CreateOrgForm extends Form { private String l = ""; + private boolean isEdit = false; + public CreateOrgForm(HttpServletRequest hsr) { super(hsr); } public CreateOrgForm(HttpServletRequest hsr, Organisation t) { super(hsr); + isEdit = true; result = t; o = t.getName(); c = t.getState(); @@ -64,6 +67,9 @@ public class CreateOrgForm extends Form { vars.put("C", c); vars.put("ST", st); vars.put("L", this.l); + if (isEdit) { + vars.put("edit", true); + } t.output(out, l, vars); } } diff --git a/src/org/cacert/gigi/pages/orga/CreateOrgForm.templ b/src/org/cacert/gigi/pages/orga/CreateOrgForm.templ index 3d16d0be..787dec39 100644 --- a/src/org/cacert/gigi/pages/orga/CreateOrgForm.templ +++ b/src/org/cacert/gigi/pages/orga/CreateOrgForm.templ @@ -1,6 +1,11 @@ - + @@ -28,6 +33,12 @@ + + + + + + diff --git a/src/org/cacert/gigi/pages/orga/EditOrg.templ b/src/org/cacert/gigi/pages/orga/EditOrg.templ index fa3fbb64..bd415d7f 100644 --- a/src/org/cacert/gigi/pages/orga/EditOrg.templ +++ b/src/org/cacert/gigi/pages/orga/EditOrg.templ @@ -1,3 +1,3 @@ - +
-- 2.39.2
+ + + + +
::