X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=b3f8865ed9bbe38609a7787a663ef2728b211563;hb=5526715b1997424e40f2fa7d6a332dfc44819975;hp=e85b066295bf8d94dcead544a9c69d50a0f3ecf8;hpb=1127a71127c6488152e5cbe3b8c6d941eaf14e83;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index e85b066..b3f8865 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -29,8 +29,10 @@ import java.util.logging.Level; import java.util.logging.Logger; import net.pterodactylus.sone.core.Core; +import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.freenet.L10nFilter; import net.pterodactylus.sone.main.SonePlugin; +import net.pterodactylus.sone.template.SoneAccessor; import net.pterodactylus.sone.web.page.CSSPage; import net.pterodactylus.sone.web.page.PageToadlet; import net.pterodactylus.sone.web.page.PageToadletFactory; @@ -140,6 +142,7 @@ public class WebInterface extends AbstractService { private void registerToadlets() { DefaultTemplateFactory templateFactory = new DefaultTemplateFactory(); templateFactory.addAccessor(Object.class, new ReflectionAccessor()); + templateFactory.addAccessor(Sone.class, new SoneAccessor()); templateFactory.addFilter("date", new DateFilter()); templateFactory.addFilter("l10n", new L10nFilter(l10n())); @@ -160,6 +163,12 @@ public class WebInterface extends AbstractService { Template editProfileTemplate = templateFactory.createTemplate(createReader("/templates/editProfile.html")); editProfileTemplate.set("formPassword", formPassword); + Template viewSoneTemplate = templateFactory.createTemplate(createReader("/templates/viewSone.html")); + viewSoneTemplate.set("formPassword", formPassword); + + Template addFriendTemplate = templateFactory.createTemplate(createReader("/templates/addFriend.html")); + addFriendTemplate.set("formPassword", formPassword); + Template deleteSoneTemplate = templateFactory.createTemplate(createReader("/templates/deleteSone.html")); deleteSoneTemplate.set("formPassword", formPassword); @@ -170,6 +179,8 @@ public class WebInterface extends AbstractService { pageToadlets.add(pageToadletFactory.createPageToadlet(new CreateSonePage(createSoneTemplate, this), "CreateSone")); pageToadlets.add(pageToadletFactory.createPageToadlet(new EditProfilePage(editProfileTemplate, this), "EditProfile")); pageToadlets.add(pageToadletFactory.createPageToadlet(new CreatePostPage(createPostTemplate, this))); + pageToadlets.add(pageToadletFactory.createPageToadlet(new ViewSonePage(viewSoneTemplate, this))); + pageToadlets.add(pageToadletFactory.createPageToadlet(new AddFriendPage(addFriendTemplate, this))); 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"));