1,7 → 1,6 |
package ak.photoalbum.webapp; |
|
import java.util.List; |
import java.util.ArrayList; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.struts.action.ActionMapping; |
19,23 → 18,20 |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
IndexForm theForm = (IndexForm)form; |
PathForm theForm = (PathForm)form; |
String dir = theForm.getPath(); |
int page = theForm.getPageInt(); |
IndexEntry entry = new IndexEntry(); |
IndexEntry top = new IndexEntry(); |
IndexEntry prev = new IndexEntry(); |
IndexEntry current = new IndexEntry(); |
IndexEntry next = new IndexEntry(); |
List index = new ArrayList(); |
List pages = new ArrayList(); |
List index; |
|
if(dir == null) dir = ""; // the images root |
|
logger.info("get index for " + dir); |
Logic.getLogic().getEntry(dir, entry, top, prev, current, next); |
if(!Logic.getLogic().listDirectory(dir, page, index, pages)) |
return mapping.findForward("error"); |
index = Logic.getLogic().listDirectory(dir); |
|
request.setAttribute("dir", FileUtils.replaceFileSeparator(dir, " - ")); |
request.setAttribute("index", index); |
43,11 → 39,6 |
request.setAttribute("prevEntry", prev); |
request.setAttribute("current", current); |
request.setAttribute("nextEntry", next); |
request.setAttribute("pages", pages); |
request.setAttribute("firstPage", pages.get(0)); |
request.setAttribute("lastPage", pages.get(pages.size() - 1)); |
request.setAttribute("prevPage", (page == 0) ? null : pages.get(page-1)); |
request.setAttribute("nextPage", (page == pages.size() - 1) ? null : pages.get(page+1)); |
|
return mapping.findForward("success"); |
} |