X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=e387b4406135bc625c97db3c688bac968c81d152;hb=1b1f5f1907fb307abd9f94cf3a1f9a2ee247c8d1;hp=08d04a8da029fc3892d8123f4a6cb81139139aa5;hpb=bc86422e88b526c062126b9edde3acf0eeb486a2;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 08d04a8..e387b44 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -37,6 +37,7 @@ import net.pterodactylus.sone.freenet.L10nFilter; import net.pterodactylus.sone.freenet.wot.Identity; import net.pterodactylus.sone.main.SonePlugin; import net.pterodactylus.sone.template.CollectionAccessor; +import net.pterodactylus.sone.template.CssClassNameFilter; import net.pterodactylus.sone.template.GetPagePlugin; import net.pterodactylus.sone.template.IdentityAccessor; import net.pterodactylus.sone.template.PostAccessor; @@ -111,7 +112,7 @@ public class WebInterface { * * @return The Sone core */ - public Core core() { + public Core getCore() { return sonePlugin.core(); } @@ -120,7 +121,7 @@ public class WebInterface { * * @return The node’s l10n helper */ - public BaseL10n l10n() { + public BaseL10n getL10n() { return sonePlugin.l10n().getBase(); } @@ -129,7 +130,7 @@ public class WebInterface { * * @return The node’s session manager */ - public SessionManager sessionManager() { + public SessionManager getSessionManager() { try { return sonePlugin.pluginRespirator().getSessionManager(new URI("/")); } catch (URISyntaxException use1) { @@ -176,16 +177,17 @@ public class WebInterface { DefaultTemplateFactory templateFactory = new DefaultTemplateFactory(); templateFactory.addAccessor(Object.class, new ReflectionAccessor()); templateFactory.addAccessor(Collection.class, new CollectionAccessor()); - templateFactory.addAccessor(Sone.class, new SoneAccessor(core())); - templateFactory.addAccessor(Post.class, new PostAccessor(core())); - templateFactory.addAccessor(Reply.class, new ReplyAccessor(core())); - templateFactory.addAccessor(Identity.class, new IdentityAccessor(core())); + templateFactory.addAccessor(Sone.class, new SoneAccessor(getCore())); + templateFactory.addAccessor(Post.class, new PostAccessor(getCore())); + templateFactory.addAccessor(Reply.class, new ReplyAccessor(getCore())); + templateFactory.addAccessor(Identity.class, new IdentityAccessor(getCore())); templateFactory.addFilter("date", new DateFilter()); - templateFactory.addFilter("l10n", new L10nFilter(l10n())); + templateFactory.addFilter("l10n", new L10nFilter(getL10n())); templateFactory.addFilter("substring", new SubstringFilter()); templateFactory.addFilter("xml", new XmlFilter()); templateFactory.addFilter("change", new RequestChangeFilter()); templateFactory.addFilter("match", new MatchFilter()); + templateFactory.addFilter("css", new CssClassNameFilter()); templateFactory.addPlugin("getpage", new GetPagePlugin()); templateFactory.addPlugin("paginate", new PaginationPlugin()); templateFactory.setTemplateProvider(new ClassPathTemplateProvider(templateFactory)); @@ -198,7 +200,6 @@ public class WebInterface { Template createPostTemplate = templateFactory.createTemplate(createReader("/templates/createPost.html")); Template createReplyTemplate = templateFactory.createTemplate(createReader("/templates/createReply.html")); Template editProfileTemplate = templateFactory.createTemplate(createReader("/templates/editProfile.html")); - Template backupProfileTemplate = templateFactory.createTemplate(createReader("/templates/backup.xml")); Template viewSoneTemplate = templateFactory.createTemplate(createReader("/templates/viewSone.html")); Template viewPostTemplate = templateFactory.createTemplate(createReader("/templates/viewPost.html")); Template likePostTemplate = templateFactory.createTemplate(createReader("/templates/like.html")); @@ -213,14 +214,12 @@ public class WebInterface { Template logoutTemplate = templateFactory.createTemplate(createReader("/templates/logout.html")); Template optionsTemplate = templateFactory.createTemplate(createReader("/templates/options.html")); Template aboutTemplate = templateFactory.createTemplate(createReader("/templates/about.html")); - Template helpTemplate = templateFactory.createTemplate(createReader("/templates/help.html")); 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 KnownSonesPage(knownSonesTemplate, this), "KnownSones")); pageToadlets.add(pageToadletFactory.createPageToadlet(new EditProfilePage(editProfileTemplate, this), "EditProfile")); - pageToadlets.add(pageToadletFactory.createPageToadlet(new BackupProfilePage(backupProfileTemplate, this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new CreatePostPage(createPostTemplate, this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new CreateReplyPage(createReplyTemplate, this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new ViewSonePage(viewSoneTemplate, this))); @@ -236,7 +235,6 @@ public class WebInterface { pageToadlets.add(pageToadletFactory.createPageToadlet(new LogoutPage(logoutTemplate, this), "Logout")); pageToadlets.add(pageToadletFactory.createPageToadlet(new OptionsPage(optionsTemplate, this), "Options")); pageToadlets.add(pageToadletFactory.createPageToadlet(new AboutPage(aboutTemplate, this, SonePlugin.VERSION), "About")); - pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("help.html", helpTemplate, "Page.Help.Title", this), "Help")); pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("noPermission.html", noPermissionTemplate, "Page.NoPermission.Title", this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("wotPluginMissing.html", wotPluginMissingTemplate, "Page.WotPluginMissing.Title", this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new StaticPage("css/", "/static/css/", "text/css"))); @@ -334,4 +332,5 @@ public class WebInterface { } } + }