%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="org.crosswire.data.DataObject" %>
<%@ page import="java.util.Date" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Document" %>
<%
response.setContentType("text/xml");
%>
<%
int lastBook = -1;
int lastChapter = -1;
for (Document d : getStats()) {
int chapter = d.getIntValue("CHAPTER");
if (chapter < 2000000) continue;
int book = chapter/1000%1000;
chapter = chapter%1000;
if (book != lastBook) {
if (lastBook != -1) {
%>
<%
}
%>
<%
lastBook = book;
lastChapter = -1;
}
if (chapter != lastChapter) {
if (lastChapter != -1) {
%>
<%
}
%>
<%
lastChapter = chapter;
}
%>
"/>
<%
}
if (lastChapter != -1) {
%>
<%
}
%>
<%!
static private Document[] stats = null;
static synchronized private Document[] getStats() {
if (stats == null || stats[0].getTSValue("LASTRUN").getTime() < (new Date().getTime() - 60 * 60 * 1000)) {
stats = Document.getChapterCoverage();
stats[0].setTSValue("LASTRUN", new Date());
}
return stats;
}
%>