<%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <%! static final String dataDir = "/home/webSites/viewCalgary/htdocs/festivals/kidsFest"; %> <% String font = null; //font tag to use for text String imageSize = null; //picture resolution int imagesPerPage; int pageNo; //page to display int totalNumberOfPages; String pageGuide; //the html for the page guide //get the properties Properties props = new Properties(); try { File file = new File(dataDir, "tour.properties"); FileInputStream fis = new FileInputStream(file); props.load(fis); fis.close(); } catch (Exception ignored) { throw new IOException("Could not read the properties file"); } //get the map Vector map = new Vector(); try { File file = new File(dataDir, "tour.map"); BufferedReader br = new BufferedReader(new FileReader(file)); String line; while( (line = br.readLine()) != null ) { map.addElement(line); } br.close(); } catch (Exception ignored) { throw new IOException("Could not read the map file"); } //font parameter String fontParm = request.getParameter("font"); if (fontParm == null) fontParm = "m"; if (fontParm.equals("s")) font = props.getProperty("font.small"); else if (fontParm.equals("m")) font = props.getProperty("font.medium"); else if (fontParm.equals("l")) font = props.getProperty("font.large"); else { fontParm = "m"; font = props.getProperty("font.medium"); } //imageSize parameter String imageSizeParm = request.getParameter("res"); if (imageSizeParm == null) imageSize = "s"; else if (imageSizeParm.equals("s")) imageSize = "s"; else if (imageSizeParm.equals("m")) imageSize = "m"; else if (imageSizeParm.equals("l")) imageSize = "l"; else imageSize = "m"; //imagesPerPage parameter String imagesPerPageParm = request.getParameter("ipp"); if(imagesPerPageParm == null) { if (imageSize.equals("s")) imagesPerPageParm = props.getProperty("ipp.small"); if (imageSize.equals("m")) imagesPerPageParm = props.getProperty("ipp.medium"); if (imageSize.equals("l")) imagesPerPageParm = props.getProperty("ipp.large"); } imagesPerPage = 3; try { imagesPerPage = Integer.parseInt(imagesPerPageParm); } catch (Exception e) { } //page parameter String pageParm = request.getParameter("page"); pageNo = 1; try { pageNo = Integer.parseInt(pageParm); } catch (NumberFormatException e) { } totalNumberOfPages = (int)(map.size() / imagesPerPage) + ((map.size() % imagesPerPage == 0) ? 0 : 1); if (pageNo <= 0) pageNo = totalNumberOfPages; if (pageNo > totalNumberOfPages) pageNo = (pageNo-1) % totalNumberOfPages + 1; //build the horizontal index of pages { StringBuffer buff = new StringBuffer(); buff.append("
"); buff.append(""); buff.append(""); buff.append(""); buff.append(""); buff.append(""); buff.append(""); buff.append("
"); buff.append(font); buff.append("Next"); buff.append(""); buff.append(""); buff.append(font); buff.append("Prev"); buff.append(""); buff.append(""); buff.append(font); for (int i=0; i" + (i+1) + ""); } buff.append(""); buff.append(""); buff.append(font); buff.append("Children's Festival Home"); buff.append(""); buff.append(""); buff.append(font); buff.append("ViewCalgary Home"); buff.append(""); buff.append("
"); pageGuide = buff.toString(); } %> ViewCalgary - International Children's Festival

International Children's Festival

<%= pageGuide %>
<% int pos = imagesPerPage * (pageNo - 1); for (int i=0; i= map.size()) break; String picName = (String) map.elementAt(pos++); Properties pp = new Properties(); try { File file = new File(dataDir, "t" + picName + ".properties"); FileInputStream fis = new FileInputStream(file); pp.load(fis); fis.close(); } catch (Exception ignored) { throw new IOException("Could not read the picture's properties file" + " t" + picName + ".properties"); } String title = pp.getProperty("title"); String text = pp.getProperty("text"); if (text == null) text = ""; %> <% if (! imageSize.equals("s")) { %> <% } %> <% } %>
<%= font + "" + title + "
" %> <%= font + text + "" %>
<%=font%> <% if (!imageSize.equals("m")) { %> Medium <% } if (!imageSize.equals("l")) { %>    Large <% } %>

<%=font%>
Top of Page