1 4 package org.roller.presentation.bookmarks.actions; 5 6 import org.apache.struts.action.Action; 7 import org.apache.struts.action.ActionForm; 8 import org.apache.struts.action.ActionForward; 9 import org.apache.struts.action.ActionMapping; 10 import org.roller.model.BookmarkManager; 11 import org.roller.pojos.FolderData; 12 import org.roller.presentation.RollerRequest; 13 import org.roller.presentation.bookmarks.formbeans.FolderFormEx; 14 15 import java.util.LinkedList ; 16 17 import javax.servlet.http.HttpServletRequest ; 18 import javax.servlet.http.HttpServletResponse ; 19 20 26 public class FolderEditAction extends Action 27 { 28 public ActionForward execute( 29 ActionMapping mapping, 30 ActionForm actionForm, 31 HttpServletRequest request, 32 HttpServletResponse response) 33 throws Exception 34 { 35 RollerRequest rreq = RollerRequest.getRollerRequest(request); 36 BookmarkManager bmgr = rreq.getRoller().getBookmarkManager(); 37 FolderFormEx form = (FolderFormEx)actionForm; 38 39 FolderData parentFolder = null; 40 if (null!=rreq.getFolder() && null==request.getParameter("correct")) 41 { 42 request.setAttribute("state","edit"); 45 46 FolderData fd = rreq.getFolder(); 47 form.copyFrom(fd, request.getLocale()); 48 parentFolder = fd.getParent(); 49 } 50 else if (null != request.getParameter("correct")) 51 { 52 request.setAttribute("state","correcting"); 54 55 String parentId = request.getParameter(RollerRequest.PARENTID_KEY); 56 parentFolder = bmgr.retrieveFolder(parentId); 57 } 58 else 59 { 60 request.setAttribute("state","add"); 62 63 String parentId = request.getParameter(RollerRequest.PARENTID_KEY); 64 parentFolder = bmgr.retrieveFolder(parentId); 65 } 66 67 request.setAttribute(RollerRequest.PARENTID_KEY, parentFolder.getId()); 68 request.setAttribute("parentFolder", parentFolder); 69 70 return mapping.findForward("FolderForm"); 71 } 72 73 } 74 | Popular Tags |