%@ page language="java"%> <%@ page import="ii.indices.*, java.util.*, java.text.*, java.io.*, ii.io.*, com.nicusa.cgi.*, ii.util.*, gnu.regexp.*"%> <%! class JournalIndexScriptHandler extends IndexScriptHandler { SimpleDateFormat dateformat; Calendar calendar; public JournalIndexScriptHandler() { dateformat = new SimpleDateFormat("MMMM d, yyyy"); calendar = Calendar.getInstance(); } public String getLinkTag(File f) { String link_url; RE fileRE = null, basefilenameRE = null; try { // THESE REGEXES SHOULD BE USED WHEN WE ARE DISPLAYING // PDFs ONLY... fileRE = new RE("J(\\d)([1-9,A,B,C])(\\d\\d)\\d(\\d\\d|JOINT)"); // Expect an eight-character filename... basefilenameRE = new RE("^.{6}(\\d\\d|JOINT)\\."); } catch (REException reX) { reX.printStackTrace(); return reX.getMessage(); } StringBuffer link_text_sb = new StringBuffer(80); StringBuffer table_cell_sb = new StringBuffer(180); String filename = f.getName(); String subdir = getRelativePath(); if (!subdir.endsWith(File.separator)) { subdir = subdir + File.separator; } link_url = "/legislative" + "/" + subdir + f.getName(); REMatch basefileMatch = basefilenameRE.getMatch(f.getName()); String pdf_url = "/legislative/publications/HJOURNAL/2007" + "/" + basefileMatch.toString() + "PDF"; // USE THIS SECTION WHEN WE'RE DISPLAYING ONLY PDFs... SimpleDateFormat meetingdate_fmt_in = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat meetingdate_fmt_out = new SimpleDateFormat("MMMM dd, yyyy"); REMatch fileMatch = null; String fileName = basefileMatch.toString(); fileMatch = fileRE.getMatch(f.getName()); String year = "200" + f.getName().substring(fileMatch.getSubStartIndex(1),fileMatch.getSubEndIndex(1)); String month = f.getName().substring(fileMatch.getSubStartIndex(2),fileMatch.getSubEndIndex(2)); if (month.equals("A")){ month = "10"; } else if (month.equals("B")){ month = "11"; } else if (month.equals("C")){ month = "12"; } else { month = "0" + month; } String day = f.getName().substring(fileMatch.getSubStartIndex(3),fileMatch.getSubEndIndex(3)); String mtgDay = f.getName().substring(fileMatch.getSubStartIndex(4),fileMatch.getSubEndIndex(4)); Date meetingdate = null; try { meetingdate = meetingdate_fmt_in.parse(year+month+day); } catch (java.text.ParseException peX) { peX.printStackTrace(); return peX.getMessage(); } if ("JOINT".equals(mtgDay)) { link_text_sb.append("Joint Meeting (" + meetingdate_fmt_out.format(meetingdate) + ")"); } else { link_text_sb.append("Meeting Day No. " + mtgDay + " (" + meetingdate_fmt_out.format(meetingdate) + ")"); } // Create a valid Date object from this RE. calendar.setTime(meetingdate); table_cell_sb.append("
"); /* Template to be used for each item on the list. The template must contain at least one substitution tag, labelled "item." */ journalhandler.setItemTemplate("<%% list %%\076