1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.utils.parameters
4 import net.pterodactylus.sone.web.WebInterface
5 import net.pterodactylus.sone.web.page.FreenetRequest
6 import net.pterodactylus.util.template.Template
7 import net.pterodactylus.util.template.TemplateContext
10 * This page lets the user lock a [net.pterodactylus.sone.data.Sone] to prevent it from being inserted.
12 class LockSonePage(template: Template, webInterface: WebInterface):
13 SoneTemplatePage("lockSone.html", template, "Page.LockSone.Title", webInterface, false) {
15 override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) {
16 request.parameters["returnPage", 256]!!.let { returnPage ->
17 request.parameters["sone", 44]!!
18 .let { webInterface.core.getLocalSone(it) }
19 ?.let { webInterface.core.lockSone(it) }
20 throw RedirectException(returnPage)