%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ include file="/WEB-INF/inc/content-props.jsp" %>
<%= global.getProperty( "title" ) %>
<%= global.getProperty( "title" ) %>
<%
File dir = contentDir;
String startIndexString = request.getParameter( "index" );
int startIndex = 0;
try {
startIndex = Integer.parseInt( startIndexString );
}
catch( Exception t ) {
}
FilenameFilter filter = new FilenameFilter( ) {
public boolean accept( File dir, String name ) {
return name.endsWith( ".gif" );
}
};
DateFormat dateFormat = new SimpleDateFormat( "EEEE MMMM d yyyy" );
File images[] = dir.listFiles( filter );
Arrays.sort( images, new Comparator() {
public int compare( Object o1, Object o2 ) {
File f1 = (File)o1;
File f2 = (File)o2;
long m1 = f1.lastModified();
long m2 = f2.lastModified();
if ( m1 < m2 ) return 1;
if ( m1 > m2 ) return -1;
return 0;
}
} );
int endIndex = Math.min( startIndex + 10, images.length );
/* Print nav-header */
%>
Archive pages: <%
for ( int index = 0; index < images.length; index += 10 ) {
String pageUrl = "?index=" + (index);
int pageEnd = Math.min( index, images.length );
%><%="" + (index + 1) %>-<%="" + (pageEnd + 10) %> <%
}
out.flush();
for ( int index = startIndex; index < endIndex; ++ index ) {
%>
<%
String imageName = images[ index ].getName();
String noExt = imageName.substring( 0, imageName.lastIndexOf( '.' ) );
File propertyFile = new File( dir, noExt + ".properties" );
if ( propertyFile.exists() ) {
Properties properties = new Properties();
FileInputStream input = null;
try {
input = new FileInputStream( propertyFile );
properties.load( input );
Calendar when = new GregorianCalendar(
Integer.parseInt( properties.getProperty( "year" ) ),
Integer.parseInt( properties.getProperty( "month" ) ),
Integer.parseInt( properties.getProperty( "day" ) ) );
%><%= properties.getProperty( "author" ) %> - <%= dateFormat.format( when.getTime() ) %>
<%
String message = properties.getProperty( "message" );
if ( message != null ) {
%>
<%
}
}
catch ( Throwable t ) {
%>Error displaying entry header!!
<%
}
finally {
if ( input != null ) input.close();
}
}
%>
<%
%>
<%
out.flush();
}
%>