X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteSonePage.kt;fp=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteSonePage.kt;h=f65e378a7d8434998e22716f2d43ad571df2245a;hp=b2a6d7b696e1e92cb49ff908a57d423dbdf5f132;hb=03cec6a6772c2d836d94864adddaf544cbe9d72f;hpb=6f1f26e3998cfef155b0cf59152827accea70d30 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt index b2a6d7b..f65e378 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt @@ -1,24 +1,28 @@ package net.pterodactylus.sone.web.pages -import net.pterodactylus.sone.data.Sone -import net.pterodactylus.sone.utils.isPOST -import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest -import net.pterodactylus.util.template.Template -import net.pterodactylus.util.template.TemplateContext +import net.pterodactylus.sone.data.* +import net.pterodactylus.sone.main.* +import net.pterodactylus.sone.utils.* +import net.pterodactylus.sone.web.* +import net.pterodactylus.sone.web.page.* +import net.pterodactylus.util.template.* +import javax.inject.* /** * Lets the user delete a Sone. Of course the Sone is not really deleted from * Freenet; merely all references to it are removed from the local plugin * installation. */ -class DeleteSonePage(template: Template, webInterface: WebInterface): - LoggedInPage("deleteSone.html", template, "Page.DeleteSone.Title", webInterface) { +@MenuName("DeleteSone") +@TemplatePath("/templates/deleteSone.html") +@ToadletPath("deleteSone.html") +class DeleteSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("Page.DeleteSone.Title", webInterface, loaders, templateRenderer) { - override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) { - if (freenetRequest.isPOST) { - if (freenetRequest.httpRequest.isPartSet("deleteSone")) { - webInterface.core.deleteSone(currentSone) + override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { + if (soneRequest.isPOST) { + if (soneRequest.httpRequest.isPartSet("deleteSone")) { + soneRequest.core.deleteSone(currentSone) } throw RedirectException("index.html") }