/*
- * Sone - EditProfileFieldAjaxPage.java - Copyright © 2011 David Roden
+ * Sone - EditProfileFieldAjaxPage.java - Copyright © 2011–2013 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import net.pterodactylus.sone.data.Profile.Field;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.WebInterface;
-import net.pterodactylus.util.json.JsonObject;
+import net.pterodactylus.sone.web.page.FreenetRequest;
/**
* AJAX page that lets the user rename a profile field.
// JSONPAGE METHODS
//
- /**
- * {@inheritDoc}
- */
@Override
- protected JsonObject createJsonObject(Request request) {
+ protected JsonReturnObject createJsonObject(FreenetRequest request) {
String fieldId = request.getHttpRequest().getParam("field");
Sone currentSone = getCurrentSone(request.getToadletContext());
Profile profile = currentSone.getProfile();
if ((existingField != null) && !existingField.equals(field)) {
return createErrorJsonObject("duplicate-field-name");
}
- field.setName(name);
+ profile.renameField(field, name);
currentSone.setProfile(profile);
return createSuccessJsonObject();
}