X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FRescuePage.kt;h=1cbc725f0a8fdcb35764074d7a03f36b998ebddc;hb=6de1ddee725ce440b1a91880a45edae195c2d593;hp=0479133694de5115d993ac8c1b24c872abf623eb;hpb=fe0689ea60c46a0d62e9598adf7fd25c0182fa7b;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt index 0479133..1cbc725 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt @@ -1,34 +1,32 @@ package net.pterodactylus.sone.web.pages -import net.pterodactylus.sone.data.Sone -import net.pterodactylus.sone.utils.isPOST -import net.pterodactylus.sone.utils.parameters -import net.pterodactylus.sone.web.WebInterface +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.Template -import net.pterodactylus.util.template.TemplateContext -import javax.inject.Inject +import net.pterodactylus.util.template.* +import javax.inject.* /** * Page that lets the user control the rescue mode for a Sone. */ @MenuName("Rescue") -class RescuePage @Inject constructor(template: Template, webInterface: WebInterface): - LoggedInPage("rescue.html", template, "Page.Rescue.Title", webInterface) { +@TemplatePath("/templates/rescue.html") +@ToadletPath("rescue.html") +class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("Page.Rescue.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { val soneRescuer = soneRequest.core.getSoneRescuer(currentSone) templateContext["soneRescuer"] = soneRescuer if (soneRequest.isPOST) { - soneRequest.parameters["edition", 9]?.toIntOrNull()?.also { - if (it > -1) { - soneRescuer.setEdition(it.toLong()) - } - } if (soneRequest.parameters["fetch", 8] == "true") { soneRescuer.startNextFetch() + } else if (soneRequest.parameters["fetchSkip"] == "true") { + soneRescuer.startNextFetchWithSkip() } - throw RedirectException("rescue.html") + redirectTo("rescue.html") } }