%@ 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, pdf_url;
String pdf_img_url = "/legislative/images/Pdf.gif";
// RE dayRE = null, dateRE = null, basefilenameRE = null;
RE fileRE = null, basefilenameRE = null;
try {
// THESE REGEXES SHOULD BE USED WHEN WE ARE PARSING
// HTML FILES...
// dayRE = new RE("^.+>(.+)( Meeting Day).+$");
// dateRE = new RE("^.+>(.+)(, [12][90]\\d\\d).+$");
// THESE REGEXES SHOULD BE USED WHEN WE ARE DISPLAYING
// PDFs ONLY...
// dayRE = new RE("-(\\d\\d)");
// dateRE = new RE("(\\d\\d\\d\\d\\d\\d\\d\\d)-");
fileRE = new RE("J(\\d)([1-9,A,B,C])(\\d\\d)\\d(\\d\\d)");
// Expect an eight-character filename...
basefilenameRE = new RE("^.{8}\\.");
} 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());
pdf_url = "/legislative/publications/SJOURNAL/2005" + "/" + 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 dayMatch = null, dateMatch = null;
REMatch fileMatch = null;
String fileName = basefileMatch.toString();
fileMatch = fileRE.getMatch(fileName);
String year = "200" + fileName.substring(fileMatch.getSubStartIndex(1),fileMatch.getSubEndIndex(1));
String month = fileName.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 = fileName.substring(fileMatch.getSubStartIndex(3),fileMatch.getSubEndIndex(3));
String mtgDay = fileName.substring(fileMatch.getSubStartIndex(4),fileMatch.getSubEndIndex(4));
// dayMatch = dayRE.getMatch(basefileMatch.toString());
// dateMatch = dateRE.getMatch(basefileMatch.toString());
Date meetingdate = null;
try {
meetingdate = meetingdate_fmt_in.parse(year+month+day);
} catch (java.text.ParseException peX) {
peX.printStackTrace();
return peX.getMessage();
}
// String day = dayMatch.toString(1);
// if (day.startsWith("0")) { day = day.substring(1); }
link_text_sb.append("Meeting Day No. " + mtgDay + " (" + meetingdate_fmt_out.format(meetingdate) + ")");
// Create a valid Date object from this RE.
calendar.setTime(meetingdate);
/*
if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
table_cell_sb.append("
Week ending " + meetingdate_fmt_out.format(meetingdate) + " | ");
}
*/
table_cell_sb.append("| ");
// END PDF-ONLY SECTION...
/*
// USE THIS SECTION WHEN WE'RE DISPLAYING HTMLs AND PDFs...
try {
String line;
BufferedReader br = new BufferedReader(new FileReader(f));
REMatch dayMatch = null, dateMatch = null;
while ((line = br.readLine()) != null) {
if (dayRE.isMatch(line)) {
dayMatch = dayRE.getMatch(line);
link_text_sb.append(dayMatch.toString(1));
link_text_sb.append(dayMatch.toString(2));
} else if (dateRE.isMatch(line)) {
dateMatch = dateRE.getMatch(line);
link_text_sb.append(" (");
link_text_sb.append(dateMatch.toString(1));
link_text_sb.append(dateMatch.toString(2));
link_text_sb.append(")");
break;
} else { continue; }
}
// Create a valid Date object from this RE.
calendar.setTime(dateformat.parse(dateMatch.toString(1) + dateMatch.toString(2)));
if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
table_cell_sb.append(" |
Week ending " + dateMatch.toString(1) + " |
");
}
// 12/14/99 -- Our WP-to-HTML converter program is not handling
// Senate Journal files correctly. Until further notice, the
// displayed link will point to PDF instead of the HTML.
// table_cell_sb.append("| ");
table_cell_sb.append(" | ");
} catch (IOException ioX) {
ioX.printStackTrace();
return ioX.getMessage();
} catch (IllegalArgumentException iaX) {
iaX.printStackTrace();
return iaX.getMessage();
} catch (java.text.ParseException pX) {
pX.printStackTrace();
return pX.getMessage();
}
*/
// 12/14/99 -- Since the HTML version is not being displayed, and the text
// link points to the PDF, we can omit the PDF image...
// UNCOMMENT THIS SECTION WHEN WE ARE READY TO DISPLAY HTML VERSIONS AGAIN!
/*
return new String( table_cell_sb.toString() + link_text_sb.toString() + " | " +
" | ");
*/
// REMOVE THIS LINE WHEN WE ARE READY TO DISPLAY HTML VERSIONS AGAIN!
return new String( table_cell_sb.toString() + link_text_sb.toString() + " (PDF) | ");
}
}
%>
<%
String errorpage = "";
JournalIndexScriptHandler journalhandler = null;
journalhandler = new JournalIndexScriptHandler();
/* Full filesystem path to lsa root directory */
journalhandler.setNativeRoot("/web/www/legislative");
/* Path of files to be indexed. Must be relative to agencyroot. */
journalhandler.setRelativePath("publications/SJOURNAL/2005");
/* Regular expression identifying the standard extension of each file type to be indexed. */
try {
// THIS FILTER IS FOR THE VERSION THAT DISPLAYS HTML AND PDF...
// journalhandler.setFilter(".+html");
// THIS FILTER IS FOR THE VERSION THAT DISPLAYS PDFs ONLY...
journalhandler.setFilter(".{8}\\.PDF");
} catch (InvalidFilterException fex) {
StringWriter sw = new StringWriter(1000);
fex.printStackTrace(new PrintWriter(sw));
errorpage = sw.toString();
}
/* Template to be used for list (or table) of indexed filenames. The template must contain at least one substitution tag, labelled "list". */
journalhandler.setListTemplate("
");
/* Template to be used for each item on the list. The template must contain at least one substitution tag, labelled "item." */
journalhandler.setItemTemplate("<%% item %%\076
");
journalhandler.setSortOrder(FilteredIndex.ORDER_DESCENDING);
journalhandler.setSortAttribute(FilteredIndex.ATTRIBUTE_NAME);
%>
<%= errorpage %>
Indiana General Assembly
<%= Include.ender() %>