Implement page deletion.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Oct 2010 14:13:33 +0000 (16:13 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Oct 2010 14:13:33 +0000 (16:13 +0200)
src/main/java/net/pterodactylus/sone/web/DeleteSonePage.java

index 4cccc63..4e63278 100644 (file)
@@ -17,6 +17,8 @@
 
 package net.pterodactylus.sone.web;
 
+import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.web.page.Page.Request.Method;
 import net.pterodactylus.util.template.Template;
 
 /**
@@ -50,6 +52,13 @@ public class DeleteSonePage extends SoneTemplatePage {
        @Override
        protected void processTemplate(Request request, Template template) throws RedirectException {
                super.processTemplate(request, template);
+               if (request.getMethod() == Method.POST) {
+                       if (request.getHttpRequest().isPartSet("deleteSone")) {
+                               Sone currentSone = getCurrentSone(request.getToadletContext());
+                               webInterface.core().deleteSone(currentSone);
+                       }
+                       throw new RedirectException("index.html");
+               }
        }
 
        //