- /* log in the new Sone. */
- setCurrentSone(request.getToadletContext(), sone);
- throw new RedirectException("index.html");
- } catch (SoneException se1) {
- logger.log(Level.FINE, "Could not create Sone “%s” at (“%s”, “%s”), %s!", new Object[] { name, requestUri, insertUri, se1.getType() });
- if (se1.getType() == Type.INVALID_SONE_NAME) {
- template.set("errorName", true);
- } else if (se1.getType() == Type.INVALID_URI) {
- template.set("errorUri", true);
+ @Override
+ protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
+ super.processTemplate(request, templateContext);
+ List<Sone> localSones = new ArrayList<Sone>(webInterface.getCore().getLocalSones());
+ Collections.sort(localSones, Sone.NICE_NAME_COMPARATOR);
+ templateContext.set("sones", localSones);
+ List<OwnIdentity> ownIdentitiesWithoutSone = getOwnIdentitiesWithoutSone(webInterface.getCore());
+ templateContext.set("identitiesWithoutSone", ownIdentitiesWithoutSone);
+ if (request.getMethod() == Method.POST) {
+ String id = request.getHttpRequest().getPartAsStringFailsafe("identity", 44);
+ OwnIdentity selectedIdentity = null;
+ for (OwnIdentity ownIdentity : ownIdentitiesWithoutSone) {
+ if (ownIdentity.getId().equals(id)) {
+ selectedIdentity = ownIdentity;
+ break;