1 24 package org.riotfamily.pages.riot.command; 25 26 import org.riotfamily.pages.Page; 27 import org.riotfamily.riot.list.command.CommandContext; 28 import org.riotfamily.riot.list.command.core.DeleteCommand; 29 import org.springframework.web.util.HtmlUtils; 30 31 public class DeletePageCommand extends DeleteCommand { 32 33 protected boolean isEnabled(CommandContext context, String action) { 34 return super.isEnabled(context, action) 35 && !PageCommandUtils.isSystemPage(context) 36 && PageCommandUtils.isTranslated(context); 37 } 38 39 public String getConfirmationMessage(CommandContext context) { 40 Page page = PageCommandUtils.getPage(context); 41 String label = HtmlUtils.htmlEscape(page.getPathComponent()); 42 43 int numChilds = page.getChildPages().size(); 44 if (numChilds > 0) { 45 return context.getMessageResolver().getMessage( 46 "org.riotfamily.pages.confirm.delete.withChildren", 47 new Object [] {label, new Integer (numChilds)}, 48 "Do you really want to delete this page and all of its child pages?"); 49 } 50 return context.getMessageResolver().getMessage( 51 "org.riotfamily.pages.confirm.delete", 52 new Object [] {label}, 53 "Do you really want to delete this page?"); 54 } 55 56 } 57 | Popular Tags |