package org.cacert.gigi.output.template;
import java.io.PrintWriter;
-import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import org.cacert.gigi.localisation.Language;
private final String text;
- private final LinkedList<String> store;
+ private final String[] store;
- public SprintfCommand(String text, LinkedList<String> store) {
+ public SprintfCommand(String text, List<String> store) {
this.text = text;
- this.store = store;
+ this.store = store.toArray(new String[store.size()]);
}
@Override
public void output(PrintWriter out, Language l, Map<String, Object> vars) {
String[] parts = l.getTranslation(text).split("%s", -1);
- String[] myvars = store.toArray(new String[store.size()]);
+ String[] myvars = store;
out.print(HTMLEncoder.encodeHTML(parts[0]));
for (int j = 1; j < parts.length; j++) {
String var = myvars[j - 1];
package org.cacert.gigi.pages.admin;
import java.io.IOException;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.Form;
import org.cacert.gigi.output.template.IterableDataset;
+import org.cacert.gigi.output.template.SprintfCommand;
import org.cacert.gigi.pages.Page;
import org.cacert.gigi.pages.error.PageNotFound;
int id = Integer.parseInt(path.substring(1 + PATH.length()));
User u = User.getById(id);
if (u == null || !u.isInGroup(TTP_APPLICANT)) {
- req.setAttribute(PageNotFound.MESSAGE_ATTRIBUTE, "The TTP-request is not available anymore.");
+ SprintfCommand command = new SprintfCommand("The TTP-request is not available anymore. You might want to go %sback%s.", Arrays.asList("!\"<a href='" + PATH + "'>", "!\"</a>"));
+ req.setAttribute(PageNotFound.MESSAGE_ATTRIBUTE, command);
resp.sendError(404);
return;
}