Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1241 → Rev 1242

/PhotoAlbum/trunk/src/ak/photoalbum/webapp/IndexAction.java
1,6 → 1,7
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;
18,27 → 19,35
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
PathForm theForm = (PathForm)form;
IndexForm theForm = (IndexForm)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;
List index = new ArrayList();
List pages = new ArrayList();
 
if(dir == null) dir = ""; // the images root
 
logger.info("get index for " + dir);
Logic.getLogic().getEntry(dir, entry, top, prev, current, next);
index = Logic.getLogic().listDirectory(dir);
if(!Logic.getLogic().listDirectory(dir, page, index, pages))
return mapping.findForward("error");
 
request.setAttribute("dir", FileUtils.replaceFileSeparator(dir, " - "));
request.setAttribute("dir", FileUtils.replaceFileSeparator(dir, " - "));
request.setAttribute("index", index);
request.setAttribute("top", top);
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");
}