Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
936 | dev | 1 | package ak.photoalbum.webapp; |
2 | |||
3 | import java.util.List; |
||
4 | import javax.servlet.http.HttpServletRequest; |
||
5 | import javax.servlet.http.HttpServletResponse; |
||
6 | import org.apache.struts.action.ActionMapping; |
||
7 | import org.apache.struts.action.ActionForm; |
||
8 | import org.apache.struts.action.ActionForward; |
||
9 | import org.apache.log4j.Logger; |
||
10 | import ak.photoalbum.util.FileUtils; |
||
11 | |||
12 | public final class IndexAction |
||
13 | extends BaseAction |
||
14 | { |
||
15 | private static final Logger logger = Logger.getLogger(IndexAction.class); |
||
16 | |||
17 | public ActionForward executeAction(ActionMapping mapping, ActionForm form, |
||
18 | HttpServletRequest request, HttpServletResponse response) |
||
19 | throws Exception |
||
20 | { |
||
21 | PathForm theForm = (PathForm)form; |
||
22 | String dir = theForm.getPath(); |
||
23 | IndexEntry entry = new IndexEntry(); |
||
24 | IndexEntry top = new IndexEntry(); |
||
25 | IndexEntry prev = new IndexEntry(); |
||
26 | IndexEntry current = new IndexEntry(); |
||
27 | IndexEntry next = new IndexEntry(); |
||
28 | List index; |
||
29 | |||
30 | if(dir == null) dir = ""; // the images root |
||
31 | |||
32 | logger.info("get index for " + dir); |
||
33 | Logic.getLogic().getEntry(dir, entry, top, prev, current, next); |
||
34 | index = Logic.getLogic().listDirectory(dir); |
||
35 | |||
36 | request.setAttribute("dir", FileUtils.replaceFileSeparator(dir, " - ")); |
||
37 | request.setAttribute("index", index); |
||
38 | request.setAttribute("top", top); |
||
39 | request.setAttribute("prevEntry", prev); |
||
40 | request.setAttribute("current", current); |
||
41 | request.setAttribute("nextEntry", next); |
||
42 | |||
43 | return mapping.findForward("success"); |
||
44 | } |
||
45 | } |