From 67b673e281bf9a08b104e1d07be4e7ea9090e973 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Oct 2010 07:00:06 +0200 Subject: [PATCH] =?utf8?q?Add=20stub=20of=20=E2=80=9Cedit=20profile?= =?utf8?q?=E2=80=9D=20page.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../pterodactylus/sone/web/EditProfilePage.java | 65 ++++++++++++++++++++++ .../net/pterodactylus/sone/web/WebInterface.java | 4 ++ src/main/resources/i18n/sone.en.properties | 7 +++ src/main/resources/templates/editProfile.html | 8 +++ 4 files changed, 84 insertions(+) create mode 100644 src/main/java/net/pterodactylus/sone/web/EditProfilePage.java create mode 100644 src/main/resources/templates/editProfile.html diff --git a/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java b/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java new file mode 100644 index 0000000..fda7fb4 --- /dev/null +++ b/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java @@ -0,0 +1,65 @@ +/* + * Sone - EditProfilePage.java - Copyright © 2010 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.sone.web; + +import net.pterodactylus.util.template.Template; + +/** + * This page lets the user edit her profile. + * + * @author David ‘Bombe’ Roden + */ +public class EditProfilePage extends SoneTemplatePage { + + /** + * Creates a new “edit profile” page. + * + * @param template + * The template to render + * @param webInterface + * The Sone web interface + */ + public EditProfilePage(Template template, WebInterface webInterface) { + super("editProfile.html", template, "Page.EditProfile.Title", webInterface); + } + + // + // TEMPLATEPAGE METHODS + // + + /** + * {@inheritDoc} + */ + @Override + protected void processTemplate(Request request, Template template) throws RedirectException { + super.processTemplate(request, template); + } + + // + // SONETEMPLATEPAGE METHODS + // + + /** + * {@inheritDoc} + */ + @Override + protected boolean requiresLogin() { + return true; + } + +} diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 67c54c0..d22d94e 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -147,6 +147,9 @@ public class WebInterface extends AbstractService { Template createSoneTemplate = templateFactory.createTemplate(createReader("/templates/createSone.html")); createSoneTemplate.set("formPassword", formPassword); + Template editProfileTemplate = templateFactory.createTemplate(createReader("/templates/editProfile.html")); + editProfileTemplate.set("formPassword", formPassword); + Template deleteSoneTemplate = templateFactory.createTemplate(createReader("/templates/deleteSone.html")); deleteSoneTemplate.set("formPassword", formPassword); @@ -155,6 +158,7 @@ public class WebInterface extends AbstractService { PageToadletFactory pageToadletFactory = new PageToadletFactory(sonePlugin.pluginRespirator().getHLSimpleClient(), "/Sone/"); pageToadlets.add(pageToadletFactory.createPageToadlet(new IndexPage(indexTemplate, this), "Index")); pageToadlets.add(pageToadletFactory.createPageToadlet(new CreateSonePage(createSoneTemplate, this), "CreateSone")); + pageToadlets.add(pageToadletFactory.createPageToadlet(new EditProfilePage(editProfileTemplate, this), "EditProfile")); pageToadlets.add(pageToadletFactory.createPageToadlet(new DeleteSonePage(deleteSoneTemplate, this), "DeleteSone")); pageToadlets.add(pageToadletFactory.createPageToadlet(new LoginPage(loginTemplate, this), "Login")); pageToadlets.add(pageToadletFactory.createPageToadlet(new LogoutPage(logoutTemplate, this), "Logout")); diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index d578084..2496408 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -6,6 +6,8 @@ Navigation.Menu.Item.Index.Name=Your Sone Navigation.Menu.Item.Index.Tooltip=Show your Sone Navigation.Menu.Item.CreateSone.Name=Create Sone Navigation.Menu.Item.CreateSone.Tooltip=Create a new Sone +Navigation.Menu.Item.EditProfile.Name=Edit Profile +Navigation.Menu.Item.EditProfile.Tooltip=Edit the Profile of your Sone Navigation.Menu.Item.DeleteSone.Name=Delete Sone Navigation.Menu.Item.DeleteSone.Tooltip=Deletes the current Sone Navigation.Menu.Item.Logout.Name=Logout @@ -42,4 +44,9 @@ Page.DeleteSone.Button.No=No, do not delete. Page.Index.Title=Your Sone - Sone +Page.EditProfile.Title=Edit Profile - Sone +Page.EditProfile.Page.Title=Edit Profile +Page.EditProfile.Page.Description=On this page you can enter your profile data. +Page.EditProfile.Page.Hint.Optionality=And remember, every single field of this profile is optional! You are not required to enter a single thing here! Also, everything you enter here will probably be stored in Freenet for a very long time! + Page.Logout.Title=Logout - Sone diff --git a/src/main/resources/templates/editProfile.html b/src/main/resources/templates/editProfile.html new file mode 100644 index 0000000..4c3c5b8 --- /dev/null +++ b/src/main/resources/templates/editProfile.html @@ -0,0 +1,8 @@ +
+ +

<%= Page.EditProfile.Page.Title|l10n|html>

+ +
<%= Page.EditProfile.Page.Description|l10n|html>
+
<%= Page.EditProfile.Page.Hint.Optionality|l10n|html>
+ +
-- 2.7.4