<%@ page language="java" import="historyPlaces.*,java.util.*" %> <%@ include file="header.inc" %> <%-- Initialize DB --%> <% engine db = new engine(); %> <h2>Show Hierarchy</h2> <p>The focus of this part of the deliverable is to provide the user with an interface to view a hierarchy of places that can go to an arbitrary depth. It should also be able to provide the user with a simple way to see where they are within the hierarchy of places. Also the ability to create a place at any depth should be given to the user.</p> <% int lastPlaceID = -1; String paramater = request.getParameter("pid"); int paramaterNum = -1; if(paramater != null){ paramaterNum = Integer.parseInt(paramater); } if(paramaterNum == -1) paramaterNum = 1; LinkedList hierarchy = db.getHierarchy(paramaterNum); out.print("<span style=\"font-size: 12px;\">" + db.buildNav(hierarchy) + "</span>\n <br /> \n <br />"); int parentID = -1; for(int i = hierarchy.size() - 1; i >= 0; i--){ place curPlace1 = (place)hierarchy.get(i); out.println("Place Name: <strong>" + curPlace1.getPlaceName() + "</strong>"); out.println("<p style=margin-left:15px;>"); out.println("Comment: " + curPlace1.getComment() + "<br/>"); if(curPlace1.getPhotoID() >= 1){ out.println("<p style=margin-left:30px;>"); out.println("<strong>Photo Info</strong><br/>"); //photo curPhoto = db.getPhoto(1); photo curPhoto = db.getPhoto(curPlace1.getPhotoID()); out.println("Comment: " + curPhoto.getComment() + "<br/>"); out.println("Date Taken (YYYYY-MM-DD): " + curPhoto.getDate() + "<br/>"); out.println("Photographer: " + curPhoto.getPhotographer() + "<br/>"); if(curPhoto.isURL()){ out.println("<strong>Place Photo</strong><br/><img src=\"" + curPhoto.getURL() + "\">"); }else{ out.println("<strong>Place Photo</strong><br/><img src=\"images\\" + curPhoto.getFilename() + "\">"); } out.println("</p>"); }else{ out.println("<strong>No Image Available!</strong>"); } out.println("</p>"); parentID = curPlace1.getPlaceID(); } LinkedList myChildren = db.getChildren(parentID); place curPlace = new place(); if(myChildren.size() != 0){ out.println("<h3>Available Children</h3> <font style=\"font-size:12px;\"># in parentheses is the number of children below that specific place</font>"); out.println("<ul>"); for(int i = 0; i < myChildren.size(); i++){ curPlace = (place)myChildren.get(i); if(curPlace.getPlaceID() != curPlace.getParentID()){ out.println("<li><a href=./hierarchy.jsp?pid=" + curPlace.getPlaceID() + ">" + curPlace.getPlaceName() + "</a> (" + db.numberOfChildren(curPlace.getPlaceID()) + ")</li>"); } } out.println("</ul>"); out.println("<a href=\"./create.jsp?parent=" + curPlace.getParentID() + "\">Create a New Place Here!</a>"); }else{ out.println("<strong>End of hierarchy!</strong>"); place lastPlace = db.getPlace(lastPlaceID); out.println("<a href=\"./create.jsp?parent=" + paramaterNum + "\">Create a New Place Here!</a>"); } %> <%@ include file="footer.inc" %>