%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <%! static final String dataDir = "/home/webSites/viewCalgary/htdocs/Associations"; %> <% String comm = null; //the community name (as it will be when used in a subdir) String commDir = null; //the community data dir 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 //community parameter comm = request.getParameter("comm"); try { commDir = dataDir + File.separator + comm; File file = new File(dataDir); if (file.canRead() == false) { throw new IOException("Could not read from the community directory"); } } catch (Exception e) { throw new IOException("Could not read from the community directory"); } //get the properties Properties props = new Properties(); try { File file = new File(commDir, "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(commDir, "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("
|
| <%= font + buff.toString() + "" %> | <% if (! imageSize.equals("s")) { %>|||||||||||||||||||
|
|||||||||||||||||||
|
|
|||||||||||||||||||
|
The contents of this site are provided for your entertainment only. No responsibility is accepted for any damages resulting from any use of this site. (c) 1999,2000 Tactical Executive Systems Ltd. |