]> WPIA git - gigi.git/blob - src/org/cacert/gigi/pages/wot/AssuranceForm.java
Begin the assurance form
[gigi.git] / src / org / cacert / gigi / pages / wot / AssuranceForm.java
1 package org.cacert.gigi.pages.wot;
2
3 import java.io.InputStreamReader;
4 import java.io.PrintWriter;
5 import java.util.HashMap;
6 import java.util.Map;
7
8 import org.cacert.gigi.Language;
9 import org.cacert.gigi.User;
10 import org.cacert.gigi.output.Outputable;
11 import org.cacert.gigi.output.Template;
12 import org.cacert.gigi.util.HTMLEncoder;
13
14 public class AssuranceForm implements Outputable {
15         User assuree;
16         static final Template templ;
17         static {
18                 templ = new Template(new InputStreamReader(
19                                 AssuranceForm.class.getResourceAsStream("AssuranceForm.templ")));
20         }
21
22         public AssuranceForm(int assuree) {
23                 this.assuree = new User(assuree);
24         }
25
26         @Override
27         public void output(PrintWriter out, Language l, Map<String, Object> vars) {
28                 HashMap<String, Object> res = new HashMap<String, Object>();
29                 res.putAll(vars);
30                 res.put("fname", HTMLEncoder.encodeHTML(assuree.getFname()));
31                 res.put("mname",
32                                 assuree.getMname() == null ? "" : HTMLEncoder
33                                                 .encodeHTML(assuree.getMname()));
34                 res.put("lname", HTMLEncoder.encodeHTML(assuree.getLname()));
35                 res.put("suffix",
36                                 assuree.getSuffix() == null ? "" : HTMLEncoder
37                                                 .encodeHTML(assuree.getSuffix()));
38                 templ.output(out, l, res);
39         }
40 }