%@ include file="init.jsp" %>
<%@ page import="java.util.Enumeration,java.util.Vector" %>
<%@ page import="gnu.regexp.RE" %>
<%
Vector bookTreeOpen = (Vector)session.getAttribute("bookTreeOpen");
String currentJumpNode = null;
boolean forceOpen = false;
boolean strongs = "on".equals((String) session.getAttribute("strongs"));
String buf = request.getParameter("strongs");
strongs = (buf != null) ? "on".equalsIgnoreCase(buf) : strongs;
session.setAttribute("strongs", (strongs)?"on":"off");
boolean morph = "on".equals((String) session.getAttribute("morph"));
buf = request.getParameter("morph");
morph = (buf != null) ? "on".equalsIgnoreCase(buf) : morph;
session.setAttribute("morph", (morph)?"on":"off");
String showStrong = request.getParameter("showStrong");
String showMorph = request.getParameter("showMorph");
session.setAttribute("lastModType", "GBS");
String gbsBook = (String)request.getParameter("mod");
if (gbsBook != null) {
session.setAttribute("gbsBook", gbsBook);
session.setAttribute("gbsEntry", null);
}
gbsBook = (String)session.getAttribute("gbsBook");
SWModule module = (gbsBook == null) ? null : mgr.getModuleByName(gbsBook);
String gbsEntry = (String)request.getParameter("gbsEntry");
if (gbsEntry != null) {
session.setAttribute("gbsEntry", gbsEntry);
bookTreeOpen = null;
forceOpen = true;
}
gbsEntry = (String)session.getAttribute("gbsEntry");
if (gbsEntry == null)
gbsEntry = "/";
String action = (String)request.getParameter("action");
if ((action != null) && (action.equalsIgnoreCase("closeAll"))) {
bookTreeOpen = null;
}
if (bookTreeOpen == null) {
bookTreeOpen = new Vector();
session.setAttribute("bookTreeOpen", bookTreeOpen);
}
// open our current entry in tree
if ((module != null) && (forceOpen)) {
module.setKeyText(gbsEntry);
String tmp = module.getKeyText();
while (tmp.length() > 0) {
bookTreeOpen.add(tmp);
tmp = module.getKeyParent();
}
}
for (int i = 0; i < 2; i++) {
String []nodes = request.getParameterValues((i>0)?"close":"open");
if (nodes != null) {
for (int j = 0; j < nodes.length; j++) {
String node = nodes[j];
if (node != null) {
if (i>0) {
bookTreeOpen.remove(node);
}
else {
if (!bookTreeOpen.contains(node)) {
bookTreeOpen.add(node);
}
}
}
}
if (nodes.length > 0)
currentJumpNode = nodes[0];
}
}
%>
<%= gbsEntry %>
<%= module.getDescription().replaceAll("&", "&") + " (" + module.getName() + ")" %>
<%
module.setKeyText(gbsEntry);
gbsEntry = module.getKeyText();
boolean printed = false;
boolean rtol = ("RtoL".equalsIgnoreCase(module.getConfigEntry("Direction")));
if ("2".equals(module.getConfigEntry("DisplayLevel"))) {
// be sure we're at the bottom leaf before we enforce display level
if (!module.hasKeyChildren()) {
module.setKeyText(gbsEntry);
String parent = module.getKeyParent();
String heading = null;
if (parent != null) {
module.setKeyText(parent);
heading = new String(module.getRenderText().getBytes("iso8859-1"), "UTF-8");
String[] children = module.getKeyChildren();
// we better have children. We should have been one of them
if ((children != null) && (children.length > 0)) {
%>
<%
for (int i = 0; i < children.length; i++) {
String k = parent + "/" + children[i];
module.setKeyText(k);
k = module.getKeyText();
String[] heads = module.getEntryAttribute("Heading", "Preverse", "0");
if (heads.length > 0) {
%>
<%
printed = true;
}
}
}
}
if (!printed) {
%>
<%
}
%>
<%= new String(heads[0].getBytes("iso8859-1"), "UTF-8") %>
<%
if (!rtol) {
%>
<%
}
%>
<%
}
%>
<%
if (rtol) {
%>
<%
}
%>