[sword-cvs] swordweb passagestudy.jsp,1.13,1.14

sword@www.crosswire.org sword@www.crosswire.org
Sun, 26 Oct 2003 13:16:17 -0700


Update of /usr/local/cvsroot/swordweb
In directory www:/tmp/cvs-serv2534

Modified Files:
	passagestudy.jsp 
Log Message:
Added first cut of supposedly working strongs/morph toggles


Index: passagestudy.jsp
===================================================================
RCS file: /usr/local/cvsroot/swordweb/passagestudy.jsp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- passagestudy.jsp	26 Oct 2003 00:31:26 -0000	1.13
+++ passagestudy.jsp	26 Oct 2003 20:16:14 -0000	1.14
@@ -19,6 +19,17 @@
 		session.setAttribute("toolsTreeOpen", toolsTreeOpen);
 	}
 
+	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");
+
+
 	for (int i = 0; i < 2; i++) {
 		String []nodes = request.getParameterValues((i>0)?"close":"open");
 		if (nodes != null) {
@@ -86,8 +97,8 @@
 	<tiles:put name="sidebar_right" type="string">
 		<div id="commentaries">
 		<h2>Word Study</h2>
-			<h3><a href="passagestudy.jsp?strongs=on">Strongs</a></h3>
-			<h3><a href="passagestudy.jsp?morph=on">Morphology</a></h3>
+			<h3><a href="passagestudy.jsp?strongs=<%= (strongs) ? "off" : "on" %>">Strongs</a></h3>
+			<h3><a href="passagestudy.jsp?morph=<%= (morph) ? "off" : "on" %>">Morphology</a></h3>
 		<h2>Preferred Comentaries:</h2>
 
 	<% if (prefCommentaries.size() > 0) { %>
@@ -148,10 +159,16 @@
 		<%
 			if (activeModule.getCategory().equals(SwordOrb.BIBLES)) {
 				String chapterPrefix = activeKey.substring(0, activeKey.indexOf(":"));
+				int activeVerse = Integer.parseInt(activeKey.substring(activeKey.indexOf(":")+1));
 				for (activeModule.setKeyText(chapterPrefix + ":1"); (activeModule.error() == (char)0); activeModule.next()) {
 					String keyText = activeModule.getKeyText();
+					int curVerse = Integer.parseInt(keyText.substring(keyText.indexOf(":")+1));
 					if (!chapterPrefix.equals(keyText.substring(0, keyText.indexOf(":"))))
 						break;
+					mgr.setGlobalOption("Strong's Numbers",
+							((strongs) && (curVerse >= activeVerse -1) && (curVerse <= activeVerse + 1)) ? "on" : "off");
+					mgr.setGlobalOption("Morphological Tags", 
+							((morph) && (curVerse >= activeVerse -1) && (curVerse <= activeVerse + 1)) ? "on" : "off");
 					boolean rtol = ("RtoL".equalsIgnoreCase(activeModule.getConfigEntry("Direction")));
 			%>
 				<div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">