[sword-svn] r228 - trunk

scribe at crosswire.org scribe at crosswire.org
Fri Nov 25 16:45:23 MST 2005


Author: scribe
Date: 2005-11-25 16:45:22 -0700 (Fri, 25 Nov 2005)
New Revision: 228

Modified:
   trunk/fulllibrary.jsp
   trunk/init.jsp
   trunk/parallelstudy.jsp
   trunk/passagestudy.jsp
   trunk/preferences.jsp
Log:
revert jsps back before jansorg's cool, but in-progress, additions


Modified: trunk/fulllibrary.jsp
===================================================================
--- trunk/fulllibrary.jsp	2005-11-25 23:27:46 UTC (rev 227)
+++ trunk/fulllibrary.jsp	2005-11-25 23:45:22 UTC (rev 228)
@@ -2,9 +2,7 @@
 
 <%@ page import="java.util.Enumeration,java.util.Vector" %>
 <%@ page import="gnu.regexp.RE" %>
-<%@ page import="org.crosswire.swordweb.*" %>
 
-
 <%
 	Vector catTreeOpen = (Vector)session.getAttribute("catTreeOpen");
 
@@ -50,25 +48,11 @@
 	<tiles:put name="sidebar_left" type="string">
 
 	<div id="library">
+
 		<h2><t:t>OSIS Library</t:t></h2>
-		<ul>		
+		<ul>
 <%
-			SidebarModuleView sidebarView = new SimpleModuleView(mgr);
-			SidebarItemRenderer modRenderer = new SidebarItemRenderer() { //an anonymous class which renders a list of modules with links to read each of them
-				public String renderModuleItem(SWModule module) {
-					StringBuffer ret = new StringBuffer();
-					ret.append("<li><a href=\"fulllibrary.jsp?show=")
-						.append(URLEncoder.encode(module.getName()))
-						.append("#cv\" title=\"Information about this module\">")
-						.append(module.getDescription().replaceAll("&", "&amp;"))
-						.append("</a></li>");
-		
-					return ret.toString();
-				}
-			};
-		
 			Vector leaves = new Vector();
-			Vector modules = new Vector();
 			for (int i = 0; i < modInfo.length; i++) {
 				if (!leaves.contains(modInfo[i].category)) {
 					leaves.add(modInfo[i].category);
@@ -82,13 +66,22 @@
 					</li>
 <%
 					if (open) {
+%>
+						<ul>
+<%
 						for (int j = 0; j < modInfo.length; j++) {
 							if (modInfo[i].category.equals(modInfo[j].category)) {
-								modules.add(modInfo[j].name);
+								SWModule module = mgr.getModuleByName(modInfo[j].name);
+								if (module != null) {
+%>
+									<li><a href="fulllibrary.jsp?show=<%= URLEncoder.encode(modInfo[j].name) %>"><%= modInfo[j].name %></a>  <%= module.getDescription() %></li>
+<%
+								}
 							}
 						}
-
-						out.print( sidebarView.renderView( modules, modRenderer ) ); //insert the sub list of the modules in the current category
+%>
+						</ul>
+<%
 					}
 
 				}

Modified: trunk/init.jsp
===================================================================
--- trunk/init.jsp	2005-11-25 23:27:46 UTC (rev 227)
+++ trunk/init.jsp	2005-11-25 23:45:22 UTC (rev 228)
@@ -31,15 +31,14 @@
 			styleFiles = new Vector();
 			styleDescriptions = new Vector();
 
-			styleNames.add("Washed Out");
-			styleFiles.add("wash.css");
- 			
- 			styleNames.add("Parchment");
+			styleNames.add("Parchment");
 			styleFiles.add("parchment.css");
 
 			styleNames.add("Sandy Creek");
 			styleFiles.add("sandy.css");
 
+			styleNames.add("Washed Out");
+			styleFiles.add("wash.css");
 
 			tabNames  = new Vector();
 			tabLinks  = new Vector();

Modified: trunk/parallelstudy.jsp
===================================================================
--- trunk/parallelstudy.jsp	2005-11-25 23:27:46 UTC (rev 227)
+++ trunk/parallelstudy.jsp	2005-11-25 23:45:22 UTC (rev 228)
@@ -1,5 +1,4 @@
 <%@ include file="init.jsp" %>
-<%@ page import="org.crosswire.swordweb.*" %>
 
 <%
 	session.setAttribute("lastModType", "Bible");
@@ -48,43 +47,6 @@
 	session.setAttribute("morph", (morph)?"on":"off");
 
 	boolean startList = false;
-
-	String parallelViewType = (String) session.getAttribute("parallel");
-	buf = request.getParameter("parallel");
-	if (buf != null) {
-		parallelViewType = buf;
-	}
-	if (parallelViewType == null) {
-		parallelViewType = "sidebyside";
-	}
-	session.setAttribute("parallel", parallelViewType);
-	
-	SidebarModuleView sidebarView = new SimpleModuleView(mgr);
-	SidebarItemRenderer delModRenderer = new SidebarItemRenderer() {
-		public String renderModuleItem(SWModule module) {
-			StringBuffer ret = new StringBuffer();
-			ret.append("<li><a href=\"parallelstudy.jsp?del=")
-				.append(URLEncoder.encode(module.getName()))
-				.append("#cv\" title=\"Remove from displayed modules\">")
-				.append(module.getDescription().replaceAll("&", "&amp;"))
-				.append("</a></li>");
-
-			return ret.toString();
-		}
-	};
-	
-	SidebarItemRenderer addModRenderer = new SidebarItemRenderer() {
-		public String renderModuleItem(SWModule module) {
-			StringBuffer ret = new StringBuffer();
-			ret.append("<li><a href=\"parallelstudy.jsp?add=")
-				.append(URLEncoder.encode(module.getName()))
-				.append("#cv\" title=\"Add to displayed modules\">")
-				.append(module.getDescription().replaceAll("&", "&amp;"))
-				.append("</a></li>");
-
-			return ret.toString();
-		}
-	};
 %>
 
 
@@ -102,37 +64,68 @@
 		<h3><t:t>Displayed modules</t:t></h3>
 		<p><t:t>click to remove</t:t></p>
 		<%
-			Vector modules = new Vector();
+			startList = false;
 			for (int i = 0; i < parDispModules.size(); i++) {
 				SWModule module = mgr.getModuleByName((String)parDispModules.get(i));
 				if (module != null && ((module.getCategory().equals(SwordOrb.BIBLES))||(module.getCategory().equals("Cults / Unorthodox / Questionable Material")))) {
-					modules.add(module.getName());
+				if (!startList) { out.print("<ul>"); startList = true; }
+		%>
+					<li>
+						<a href="parallelstudy.jsp?del=<%= URLEncoder.encode(module.getName()) %>#cv" title="Remove from displayed modules">
+							<%= module.getDescription().replaceAll("&", "&amp;") %>
+						</a>
+					</li>
+		<%
 				}
 			}
-			out.print( sidebarView.renderView(modules, delModRenderer) );
+			if (startList) { out.print("</ul>"); startList = true; }
 		%>
 
 		<h3><t:t>Available modules</t:t></h3>
 		<p><t:t>click to add</t:t></p>
-		<%			
-			modules.clear();
+		<%
+			startList = false;
 			for (int i = 0; i < modInfo.length; i++) {
-				if (modInfo[i].category.equals(SwordOrb.BIBLES) && !parDispModules.contains(modInfo[i].name)) {
-					modules.add(modInfo[i].name);
+				if (modInfo[i].category.equals(SwordOrb.BIBLES)) {
+					SWModule module = mgr.getModuleByName(modInfo[i].name);
+					if ( parDispModules.contains(module.getName()) ) {
+						continue;
+					}
+
+					if (!startList) { out.print("<ul>"); startList = true; }
+		%>
+				<li>
+					<a href="parallelstudy.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>#cv" title="Add to displayed modules">
+						<%= module.getDescription().replaceAll("&", "&amp;") %>
+					</a>
+				</li>
+		<%
 				}
 			}
-			out.print( sidebarView.renderView(modules, addModRenderer) );
+			if (startList) { out.print("</ul>"); startList = true; }
 		%>
 
 		<h3><t:t>Cults / Unorthodox / Questionable Material</t:t></h3><p><t:t>click to add</t:t></p>
 		<%
-			modules.clear();
+			startList = false;
 			for (int i = 0; i < modInfo.length; i++) {
-				if (modInfo[i].category.equals("Cults / Unorthodox / Questionable Material") && !parDispModules.contains(modInfo[i].name)) {
-					modules.add(modInfo[i].name);
+				if (modInfo[i].category.equals("Cults / Unorthodox / Questionable Material")) {
+					SWModule module = mgr.getModuleByName(modInfo[i].name);
+					if ( parDispModules.contains(module.getName()) ) {
+						continue;
+					}
+
+					if (!startList) { out.print("<ul>"); startList = true; }
+		%>
+				<li>
+					<a href="parallelstudy.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>#cv" title="Add to displayed modules">
+						<%= module.getDescription().replaceAll("&", "&amp;") %>
+					</a>
+				</li>
+		<%
 				}
 			}
-			out.print( sidebarView.renderView(modules, addModRenderer) );	
+			if (startList) { out.print("</ul>"); startList = true; }
 		%>
 
 		</div>
@@ -149,13 +142,6 @@
 			</ul>
 		</div>
 -->
-		<div id="studytools">
-			<h2><t:t>Parallel viewing:</t:t></h2>
-			<ul>
-				<li><a href="parallelstudy.jsp?parallel=sidebyside">Side by side</a></li>
-				<li><a href="parallelstudy.jsp?parallel=toptobottom">Top to bottom</a></li>
-			</ul>
-		</div>
 
 		<div id="commentaries">
 		<h2><t:t>Comentaries:</t:t></h2>
@@ -163,34 +149,49 @@
 		<h3><t:t>Displayed modules</t:t></h3>
 		<p><t:t>click to remove</t:t></p>
 		<%
-			Vector modules = new Vector();
+			startList = false;
 			for (int i = 0; i < parDispModules.size(); i++) {
 				SWModule module = mgr.getModuleByName((String)parDispModules.get(i));
 				if (module != null && module.getCategory().equals(SwordOrb.COMMENTARIES)) {
-					modules.add(module.getName());
+				if (!startList) { out.print("<ul>"); startList = true; }
+		%>
+				<li>
+					<a href="parallelstudy.jsp?del=<%= URLEncoder.encode(module.getName()) %>#cv" title="Remove from displayed modules">
+						<%= module.getDescription().replaceAll("&", "&amp;") %>
+					</a>
+				</li>
+		<%
 				}
 			}
-
-			out.print( sidebarView.renderView(modules, delModRenderer) );
+			if (startList) { out.print("</ul>"); startList = true; }
 		%>
 
 		<h3><t:t>Available modules</t:t></h3>
 		<p><t:t>click to add</t:t></p>
 		<%
-			modules.clear();
+			startList = false;
 			for (int i = 0; i < modInfo.length; i++) {
-				if (modInfo[i].category.equals(SwordOrb.COMMENTARIES) && !parDispModules.contains(modInfo[i].name)) {
-					modules.add(modInfo[i].name);
+				if (modInfo[i].category.equals(SwordOrb.COMMENTARIES)) {
+					SWModule module = mgr.getModuleByName(modInfo[i].name);
+					if ( parDispModules.contains(module.getName()) ) {
+						continue;
+					}
+					if (!startList) { out.print("<ul>"); startList = true; }
+		%>
+				<li>
+					<a href="parallelstudy.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>#cv" title="Add to displayed modules">
+						<%= module.getDescription().replaceAll("&", "&amp;") %>
+					</a>
+				</li>
+		<%
 				}
 			}
-			
-			out.print( sidebarView.renderView(modules, addModRenderer) );
+			if (startList) { out.print("</ul>"); startList = true; }
 		%>
 
 		</div>
 
-	</tiles:put> 	<%--  	end of right sightbat tag area  --%>
-	
+	</tiles:put>
 	<tiles:put name="content" type="string">
 		<%
 			if (activeModule != null) {
@@ -207,61 +208,148 @@
 		</div>
 
 		<% //insert next and previous chapter links
-			String prevChapterString = RangeInformation.getPreviousChapter(activeKey, activeModule);
-			String nextChapterString = RangeInformation.getNextChapter(activeKey, activeModule);
+			// activeKey contains the current key ATM
+			// Split up into book, chapter and verse.
+			// Then add and subtract 1 to the chapter to the next and previous one
+
+			String bookname = activeKey.substring(0, activeKey.lastIndexOf(" "));
+			int chapter = Integer.parseInt( activeKey.substring(activeKey.lastIndexOf(" ")+1, activeKey.indexOf(":")) );
+			//int verse = Integer.parseInt(activeKey.substring(activeKey.indexOf(":")+1));
+
+			String prevChapterString = bookname + " " + String.valueOf(chapter-1) + ":1";
+			String nextChapterString = bookname + " " + String.valueOf(chapter+1) + ":1";
+
 		%>
 		<ul class="booknav">
 			<li><a href="parallelstudy.jsp?key=<%= URLEncoder.encode(prevChapterString) %>" title="Display <%= prevChapterString %>"><t:t>previous chapter</t:t></a></li>
-			<li><h3><%= activeKey %></h3></li>
+			<!-- <li><a href="" title="display all of Romans 8"><t:t>this chapter</t:t></a></li> -->
 			<li><a href="parallelstudy.jsp?key=<%= URLEncoder.encode(nextChapterString) %>" title="Display <%= nextChapterString %>"><t:t>next chapter</t:t></a></li>
 		</ul>
 
 
 		<%-- table which contains all verse items --%>
+		<table>
+		<caption>
+		</caption>
+
+		<colgroup>
+		<% //setup col attributes
+				for (int i = 0; i < parDispModules.size(); i++) {
+					SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
+		%>
+					<col width="<%= 100/parDispModules.size() %>%" />
 		<%
-			Vector moduleList = new Vector();
-			for (int i = 0; i < parDispModules.size(); i++) {
-				moduleList.add( mgr.getModuleByName((String)parDispModules.get(i)) );
-			}
-			
-			Vector entryList = null;
-			if ((activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) || (activeModule.getCategory().equals(SwordOrb.BIBLES))) {
-				entryList = RangeInformation.getChapterEntryList(activeKey, activeModule);
-			}
-			else { //a simple commentary entry, not multiple ones
-				entryList = new Vector();
-				entryList.add(activeKey);
-			}
-			
-			ModuleTextRendering rendering = null;
-			ModuleEntryRenderer entryRenderer = null;
-			if (parallelViewType.equals("sidebyside")) {
-				rendering = new HorizontallyParallelTextRendering();
-				entryRenderer = new StandardEntryRenderer( new String("parallelstudy.jsp"), activeKey, mgr );
-			}
-			else { //if (parallelViewType.equals("toptobottom"))
-				rendering = new VerticallyParallelTextRendering();
-				entryRenderer = new SimpleEntryRenderer( new String("parallelstudy.jsp"), activeKey, mgr );
-			}
+				}
+		%>
+		</colgroup>
 
-			if (strongs) {
-				entryRenderer.enableFilterOption("Strong's Numbers");
+		<thead>
+
+		<%
+			activeModule = mgr.getModuleByName((String)parDispModules.get(0));
+			if (activeModule.getCategory().equals(SwordOrb.BIBLES) ||
+			    activeModule.getCategory().equals(SwordOrb.COMMENTARIES) ||
+			    activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material"))
+			{
+		%>
+
+		<tr>
+
+		<% //insert module names at the top
+				for (int i = 0; i < parDispModules.size(); i++) {
+					SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
+		%>
+					<th>
+						&quot;<%= mod.getDescription().replaceAll("&", "&amp;") + " (" + mod.getName() + ")" %>&quot;
+					</th>
+		<%
+				}
+		%>
+
+		</tr>
+		</thead>
+
+		<tbody>
+		<%
+			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();
+				if (!chapterPrefix.equals(keyText.substring(0, keyText.indexOf(":"))))
+					break;
+
+				int curVerse = Integer.parseInt(keyText.substring(keyText.indexOf(":")+1));
+				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");
+			%>
+
+
+				<tr>
+		<%
+					for (int i = 0; i < parDispModules.size(); i++) {
+						SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
+						boolean rtol = ("RtoL".equalsIgnoreCase(mod.getConfigEntry("Direction")));
+
+						if (mod != activeModule)
+							mod.setKeyText( keyText );
+		%>
+							<td <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
+								<span class="versenum">
+									<a <%= (keyText.equals(activeKey)) ? "id=\"cv\"" : "" %> href="parallelstudy.jsp?key=<%= URLEncoder.encode(keyText) %>#cv"> <%= keyText.substring(keyText.indexOf(":")+1) %></a>
+								</span>
+
+					<%
+					String lang = mod.getConfigEntry("Lang");
+//					<span xml:lang="<%= (lang.equals("")) ? "en" : lang 
+					%>
+
+					<%= new String(mod.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
+<%
+//					</span>
+%>
+
+					</td>
+		<%
+					}
+		%>
+				</tr>
+		<%
+				}
+		%>
+		<tr>
+
+		<% //insert module names at the top
+				for (int i = 0; i < parDispModules.size(); i++) {
+					SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
+					String copyLine = mod.getConfigEntry("ShortCopyright");
+					String promoLine = mod.getConfigEntry("ShortPromo");
+					if (copyLine.equalsIgnoreCase("<swnull>"))
+						copyLine = "";
+					if (promoLine.equalsIgnoreCase("<swnull>"))
+						promoLine = "";
+					if (mod.getCategory().equals("Cults / Unorthodox / Questionable Material")) {
+						copyLine = "<t:t>WARNING: This text is considered unorthodox by most of Christendom.</t:t> " + copyLine;
+					}
+		%>
+					<td>
+		<div class="copyLine"><%= copyLine %></div>
+		<div class="promoLine"><%= promoLine %></div>
+					</td>
+		<%
+				}
+		%>
+
+		</tr>
+		<%
 			}
-			if (morph) {
-				entryRenderer.enableFilterOption("Morphological Tags");
-			}
-			
-			out.print( rendering.render(moduleList, entryList, entryRenderer) ); //print out the text page
-			
-			
-			String copyLine = activeModule.getConfigEntry("ShortCopyright");
-			if (copyLine.equalsIgnoreCase("<swnull>")) {
-				copyLine = "";
-			}
-			if (activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) {
-				copyLine = "<t:t>WARNING: This text is considered unorthodox by most of Christendom.</t:t> " + copyLine;
-			}
 		%>
+
+		</tbody>
+		</table>
+
 		</div>
 	</tiles:put>
 </tiles:insert>

Modified: trunk/passagestudy.jsp
===================================================================
--- trunk/passagestudy.jsp	2005-11-25 23:27:46 UTC (rev 227)
+++ trunk/passagestudy.jsp	2005-11-25 23:45:22 UTC (rev 228)
@@ -1,5 +1,4 @@
 <%@ include file="init.jsp" %>
-<%@ page import="org.crosswire.swordweb.*" %>
 
 <%
 	session.setAttribute("lastModType", "Bible");
@@ -56,21 +55,6 @@
 			}
 		}
 	}
-
-	//the sidebar rendering object is shared in the left (Bibles) and right (Commentaries) sidebar
-	SidebarModuleView sidebarView = new SimpleModuleView(mgr);
-	SidebarItemRenderer displayModRenderer = new SidebarItemRenderer() { //an anonymous class which renders a list of modules with links to read each of them
-		public String renderModuleItem(SWModule module) {
-			StringBuffer ret = new StringBuffer();
-			ret.append("<li><a href=\"passagestudy.jsp?mod=")
-				.append(URLEncoder.encode(module.getName()))
-				.append("#cv\" title=\"Read text of this module\">")
-				.append(module.getDescription().replaceAll("&", "&amp;"))
-				.append("</a></li>");
-
-			return ret.toString();
-		}
-	};
 %>
 
 <tiles:insert beanName="basic" flush="true" >
@@ -81,21 +65,28 @@
 		<h2><t:t>Translations:</t:t></h2>
 		<h3><t:t>Preferred Translations</t:t></h3>
 
-	<% if (prefBibles.size() > 0) {
-		out.print( sidebarView.renderView(prefBibles, displayModRenderer) ); //render the preferred Bibles section
-		
-	} else { //no preferred Bibles
-	%>
+	<% if (prefBibles.size() > 0) { %>
 		<ul>
+		<%
+			for (int i = 0; i < prefBibles.size(); i++) {
+				SWModule module = mgr.getModuleByName((String)prefBibles.get(i));
+		%>
+				<li><a href="passagestudy.jsp?mod=<%= URLEncoder.encode(module.getName())+"#cv" %>" title="view Romans 8:26-39 in <%= module.getDescription().replaceAll("&", "&amp;") %>"><%= module.getDescription().replaceAll("&", "&amp;") %></a></li>
+		<%
+			}
+		%>
+		</ul>
+	<% } else { %>
+		<ul>
 		<li><t:t>Preferred Translations can be selected from the preferences tab</t:t></li>
 		</ul>
 	<% } %>
 
 
-	<%
-		boolean open = toolsTreeOpen.contains("allBibles");
-	%>
-	<h3><t:t>All Translations</t:t></h3>
+		<%
+			boolean open = toolsTreeOpen.contains("allBibles");
+		%>
+<h3><t:t>All Translations</t:t></h3>
 			<%
 			if (open) { //already open
 			%>
@@ -109,15 +100,21 @@
 			}
 			%>
 		<%
-			if (open && (modInfo.length > 0)) {
-				Vector modules = new Vector();
+			if ((open) && (modInfo.length > 0)) {
+%>
+		<ul>
+<%
 				for (int i = 0; i < modInfo.length; i++) {
 					if (modInfo[i].category.equals(SwordOrb.BIBLES)) {
-						modules.add(modInfo[i].name);
+						SWModule module = mgr.getModuleByName(modInfo[i].name);
+			%>
+					<li><a href="passagestudy.jsp?mod=<%= URLEncoder.encode(modInfo[i].name)+"#cv" %>" title="view Romans 8:26-39 in <%= module.getDescription().replaceAll("&", "&amp;") %>"><%= module.getDescription().replaceAll("&", "&amp;") %></a></li>
+			<%
 					}
 				}
-				modules.removeAll( prefBibles ); //don't include the prefered bibles in the long module list
-				out.print( sidebarView.renderView(modules, displayModRenderer) ); //render the complete Bible modules list
+%>
+		</ul>
+<%
 			}
 		%>
 		</div>
@@ -135,15 +132,22 @@
 	<div id="commentaries">
 		<h2><t:t>Comentaries:</t:t></h2>
 		<h3><t:t>Preferred Comentaries:</t:t></h3>
-	<% 
-		if (prefCommentaries.size() > 0) {
-			out.print( sidebarView.renderView(prefCommentaries, displayModRenderer) ); //render the preferred Commentaries list
-	   	} else { 
-	%>
-			<ul>
-				<li><t:t>Preferred commentaries can be selected from the preferences tab</t:t></li>
-			</ul>
-	<% 	} %>
+	<% if (prefCommentaries.size() > 0) { %>
+		<ul>
+		<%
+			for (int i = 0; i < prefCommentaries.size(); i++) {
+				SWModule module = mgr.getModuleByName((String)prefCommentaries.get(i));
+		%>
+				<li><a href="passagestudy.jsp?mod=<%= URLEncoder.encode(module.getName())+"#cv" %>" title="view Romans 8:26-39 in <%= module.getDescription().replaceAll("&", "&amp;") %>"><%= module.getDescription().replaceAll("&", "&amp;") %></a></li>
+		<%
+			}
+		%>
+		</ul>
+	<% } else { %>
+		<ul>
+		<li><t:t>Preferred commentaries can be selected from the preferences tab</t:t></li>
+		</ul>
+	<% } %>
 
 
 
@@ -165,16 +169,21 @@
 		%>
 
 		<%
-			if (open && (modInfo.length > 0)) {
-				Vector modules = new Vector();
-				
+			if ((open) && (modInfo.length > 0)) {
+%>
+		<ul>
+<%
 				for (int i = 0; i < modInfo.length; i++) {
 					if (modInfo[i].category.equals(SwordOrb.COMMENTARIES)) {
-						modules.add(modInfo[i].name);
+						SWModule module = mgr.getModuleByName(modInfo[i].name);
+			%>
+					<li><a href="passagestudy.jsp?mod=<%= URLEncoder.encode(modInfo[i].name)+"#cv" %>" title="view Romans 8:26-39 in <%= module.getDescription().replaceAll("&", "&amp;") %>"><%= module.getDescription().replaceAll("&", "&amp;") %></a></li>
+			<%
 					}
 				}
-				modules.removeAll( prefCommentaries ); //no preferred commentaries in the long list				
-				out.print( sidebarView.renderView(modules, displayModRenderer) ); //render the complete Commentary module list
+%>
+		</ul>
+<%
 			}
 		%>
 		</div>
@@ -187,53 +196,153 @@
 		%>
 
 		<div id="passagestudy">
-<%--  		<h2><%= activeKey %></h2>  --%>
+		<h2><%= activeKey %></h2>
+		<h3><a href="fulllibrary.jsp?show=<%= URLEncoder.encode(activeModule.getName()) %>"><%= activeModule.getDescription().replaceAll("&", "&amp;") + " (" + activeModule.getName() + ")" %></a></h3>
 
 		<% //insert next and previous chapter links
-			String prevChapterString = RangeInformation.getPreviousChapter(activeKey, activeModule);
-			String nextChapterString = RangeInformation.getNextChapter(activeKey, activeModule);
+			// activeKey contains the current key ATM
+			// Split up into book, chapter and verse.
+			// Then add and subtract 1 to the chapter to the next and previous one
+
+			String bookname = activeKey.substring(0, activeKey.lastIndexOf(" "));
+			int chapter = Integer.parseInt( activeKey.substring(activeKey.lastIndexOf(" ")+1, activeKey.indexOf(":")) );
+			//int verse = Integer.parseInt(activeKey.substring(activeKey.indexOf(":")+1));
+
+			String prevChapterString = bookname + " " + String.valueOf(chapter-1) + ":1";
+			String nextChapterString = bookname + " " + String.valueOf(chapter+1) + ":1";
+
 		%>
 		<ul class="booknav">
 			<li><a href="passagestudy.jsp?key=<%= URLEncoder.encode(prevChapterString) %>" title="Display <%= prevChapterString %>"><t:t>previous chapter</t:t></a></li>
-			<li><h3><%= activeKey %></h3></li>
+			<!-- <li><a href="" title="display all of Romans 8"><t:t>this chapter</t:t></a></li> -->
 			<li><a href="passagestudy.jsp?key=<%= URLEncoder.encode(nextChapterString) %>" title="Display <%= nextChapterString %>"><t:t>next chapter</t:t></a></li>
 		</ul>
 
 		<%
-			Vector moduleList = new Vector();
-			moduleList.add( activeModule );
-			
-			Vector entryList = null;
 			if ((activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) || (activeModule.getCategory().equals(SwordOrb.BIBLES))) {
-				entryList = RangeInformation.getChapterEntryList(activeKey, activeModule);
-			}
-			else { //a simple commentary entry, not multiple ones
-				entryList = new Vector();
-				entryList.add(activeKey);
-			}
+				String chapterPrefix = activeKey.substring(0, activeKey.indexOf(":"));
+				int activeVerse = Integer.parseInt(activeKey.substring(activeKey.indexOf(":")+1));
+				int anchorVerse = (activeVerse > 2)?activeVerse - 2: -1;
+				boolean first = true;
+				for (activeModule.setKeyText(chapterPrefix + ":1"); (activeModule.error() == (char)0); activeModule.next()) {
+					if (first) {
+			%>
+				<table>
+			<%
+						first = false;
+					}
+					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")));
+			%>
+			<%
+					String[] heads = activeModule.getEntryAttribute("Heading", "Preverse", "0");
+					if (heads.length > 0) {
+			%>
+					<tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
+				<h3>
+					<%= new String(heads[0].getBytes("iso8859-1"), "UTF-8") %>
+				 </h3></div></td><tr>
+			<%
+					}
+			%>
+					<tr>
 
-			ModuleTextRendering rendering = new HorizontallyParallelTextRendering(); //passagestudy is a parallel view with just one module at the same time
-			ModuleEntryRenderer entryRenderer = new StandardEntryRenderer( new String("passagestudy.jsp"), activeKey, mgr );
-			if (strongs) {
-				entryRenderer.enableFilterOption("Strong's Numbers");
+			<%
+					if (!rtol) {
+			%>
+					<td valign="top" align="right"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
+					<span class="versenum"><a <%= (curVerse == anchorVerse)?"id=\"cv\"":"" %> href="passagestudy.jsp?key=<%= URLEncoder.encode(keyText)+"#cv" %>">
+						<%= keyText.substring(keyText.indexOf(":")+1) %></a>
+					</span></div></td>
+			<%
+					}
+			%>
+
+					<td><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
+
+					<%
+					String lang = activeModule.getConfigEntry("Lang");
+//					<div xml:lang="<%= (lang.equals("")) ? "en" : lang 
+					%>
+					<%= new String(activeModule.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
+<%
+//					</div>
+%>
+					</div></td>
+			<%
+					if (rtol) {
+			%>
+					<td valign="top" align="right"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
+					<span class="versenum"><a <%= (curVerse == anchorVerse)?"id=\"cv\"":"" %> href="passagestudy.jsp?key=<%= URLEncoder.encode(keyText)+"#cv" %>">
+						<%= keyText.substring(keyText.indexOf(":")+1) %></a>
+					</span></div></td>
+			<%
+					}
+			%>
+
+
+					</tr>
+		<%
+					if (keyText.equals(activeKey)) {
+						if (showStrong != null) {
+							String [] keyInfo = activeModule.getKeyChildren();
+							SWModule lex =  mgr.getModuleByName(("1".equals(keyInfo[0])) ? "StrongsHebrew":"StrongsGreek");
+							lex.setKeyText(showStrong);
+					%>
+					<tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
+							<div class="lexiconentry"><p>
+							<%= new String(lex.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
+							</p></div>
+					</div></td></tr>
+					<%	} %>
+					<%
+						if (showMorph != null) {
+							String [] keyInfo = activeModule.getKeyChildren();
+							SWModule lex =  mgr.getModuleByName(("1".equals(keyInfo[0])) ? "StrongHebrew":"Robinson");
+							lex.setKeyText(showMorph);
+					%>
+					<tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
+							<div class="lexiconentry"><p>
+							<%= new String(lex.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
+							</p></div>
+					</div></td></tr>
+					<%	}
+					}
+				}
+				if (!first) {
+			%>
+				</table>
+			<%
+				}
 			}
-			if (morph) {
-				entryRenderer.enableFilterOption("Morphological Tags");
+			else {
+			%>
+				<div class="verse">
+				<span class="versenum"><%= activeKey %></span>
+					<%= new String(activeModule.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
+				</div>
+			<%
 			}
-			
-			//Do the actual rendering
-			out.print( rendering.render(moduleList, entryList, entryRenderer) );
-						
 			String copyLine = activeModule.getConfigEntry("ShortCopyright");
-			if (copyLine.equalsIgnoreCase("<swnull>")) {
+			if (copyLine.equalsIgnoreCase("<swnull>"))
 				copyLine = "";
-			}
 			if (activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) {
 				copyLine = "<t:t>WARNING: This text is considered unorthodox by most of Christendom.</t:t> " + copyLine;
 			}
 		%>
-		
 		<div class="copyLine"><%= copyLine %></div>
+		<ul class="booknav">
+			<li><a href="passagestudy.jsp?key=<%= URLEncoder.encode(prevChapterString) %>" title="Display <%= prevChapterString %>"><t:t>previous chapter</t:t></a></li>
+			<!-- <li><a href="" title="display all of Romans 8"><t:t>this chapter</t:t></a></li> -->
+			<li><a href="passagestudy.jsp?key=<%= URLEncoder.encode(nextChapterString) %>" title="Display <%= nextChapterString %>"><t:t>next chapter</t:t></a></li>
+		</ul>
 		<div class="promoLine"><%= promoLine %></div>
 		</div>
 	</tiles:put>

Modified: trunk/preferences.jsp
===================================================================
--- trunk/preferences.jsp	2005-11-25 23:27:46 UTC (rev 227)
+++ trunk/preferences.jsp	2005-11-25 23:45:22 UTC (rev 228)
@@ -1,5 +1,4 @@
 <%@ include file="init.jsp" %>
-<%@ page import="org.crosswire.swordweb.*" %>
 
 <%
 	String addModule = (String)request.getParameter("add");
@@ -34,31 +33,6 @@
 	saveModPrefsCookie(response, "PrefBibles", prefBibles);
 	saveModPrefsCookie(response, "PrefCommentaries", prefCommentaries);
 
-	SidebarModuleView sidebarView = new SimpleModuleView(mgr);
-	SidebarItemRenderer selectModRenderer = new SidebarItemRenderer() { //an anonymous class which renders a list of modules with links to read each of them
-		public String renderModuleItem(SWModule module) {
-			StringBuffer ret = new StringBuffer();
-			ret.append("<li><a href=\"preferences.jsp?add=")
-				.append(URLEncoder.encode(module.getName()))
-				.append("#cv\" title=\"Add this module\">")
-				.append(module.getDescription().replaceAll("&", "&amp;"))
-				.append("</a></li>");
-
-			return ret.toString();
-		}
-	};
-	SidebarItemRenderer removeModRenderer = new SidebarItemRenderer() { //an anonymous class which renders a list of modules with links to read each of them
-		public String renderModuleItem(SWModule module) {
-			StringBuffer ret = new StringBuffer();
-			ret.append("<li><a href=\"preferences.jsp?del=")
-				.append(URLEncoder.encode(module.getName()))
-				.append("#cv\" title=\"Remove this module\">")
-				.append(module.getDescription().replaceAll("&", "&amp;"))
-				.append("</a></li>");
-
-			return ret.toString();
-		}
-	};
 %>
 
 <tiles:insert beanName="basic" flush="true" >
@@ -70,22 +44,33 @@
 		<h2><t:t>Translations:</t:t></h2>
 		<h3><t:t>Preferred Translations</t:t></h3>
 		<%
-			
-			out.print( sidebarView.renderView(prefBibles, selectModRenderer) ); //render the preferred Bibles section
+		if (prefBibles.size() > 0) {
+			out.println("<ul>");
+		}
+			for (int i = 0; i < prefBibles.size(); i++) {
+				SWModule module = mgr.getModuleByName((String)prefBibles.get(i));
 		%>
+				<li><a href="preferences.jsp?add=<%= URLEncoder.encode(module.getName()) %>" title="Add <%= module.getDescription().replaceAll("&", "&amp;") %>"><%= module.getDescription().replaceAll("&", "&amp;") %></a></li>
+		<%
+			}
+		if (prefBibles.size() > 0) {
+			out.println("</ul>");
+		}
+		%>
 
 		<h3><t:t>All Translations</t:t></h3>
+		<ul>
 		<%
-			Vector modules = new Vector();
 			for (int i = 0; i < modInfo.length; i++) {
 				if (modInfo[i].category.equals(SwordOrb.BIBLES)) {
-					modules.add(modInfo[i].name);
+					SWModule module = mgr.getModuleByName(modInfo[i].name);
+		%>
+				<li><a href="preferences.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>" title="Add <%= module.getDescription().replaceAll("&", "&amp;") %>"><%= module.getDescription().replaceAll("&", "&amp;") %></a></li>
+		<%
 				}
 			}
-			modules.removeAll(prefBibles); //don't insert the pref mods again
-			
-			out.print( sidebarView.renderView(modules, selectModRenderer) ); //render the preferred Bibles section
 		%>
+		</ul>
 
 		</div>
 	</tiles:put>
@@ -95,69 +80,100 @@
 
 		<h2><t:t>Comentaries:</t:t></h2>
 		<h3><t:t>Preferred Comentaries</t:t></h3>
-		
 		<%
-			out.print( sidebarView.renderView(prefCommentaries, selectModRenderer) ); //render the preferred Bibles section
+		if (prefCommentaries.size() > 0) {
+			out.println("<ul>");
+		}
+			for (int i = 0; i < prefCommentaries.size(); i++) {
+				SWModule module = mgr.getModuleByName((String)prefCommentaries.get(i));
 		%>
+				<li><a href="preferences.jsp?add=<%= URLEncoder.encode(module.getName()) %>" title="Add <%= module.getDescription().replaceAll("&", "&amp;") %>"><%= module.getDescription().replaceAll("&", "&amp;") %></a></li>
+		<%
+			}
+		if (prefCommentaries.size() > 0) {
+			out.println("</ul>");
+		}
+		%>
 
 
-		<h3><t:t>All Comentaries</t:t></h3>
+<h3><t:t>All Comentaries</t:t></h3>
+		<ul>
 		<%
-			Vector modules = new Vector();
 			for (int i = 0; i < modInfo.length; i++) {
 				if (modInfo[i].category.equals(SwordOrb.COMMENTARIES)) {
-					modules.add(modInfo[i].name);
+					SWModule module = mgr.getModuleByName(modInfo[i].name);
+		%>
+				<li><a href="preferences.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>" title="Add <%= module.getDescription().replaceAll("&", "&amp;") %>"><%= module.getDescription().replaceAll("&", "&amp;") %></a></li>
+		<%
 				}
-			} 
-			modules.removeAll(prefCommentaries);//don't show the preferred mods again
-			
-			out.print( sidebarView.renderView(modules, selectModRenderer) ); //render the preferred Bibles section
+			}
 		%>
+		</ul>
 
 		</div>
 	</tiles:put>
 
 	<tiles:put name="content" type="string">
-	<div id="preferences">
+<div id="preferences">
 		<h2><t:t>Preferred Translations</t:t></h2>
-		<p><t:t>Click to remove. Reselect on the side to move to the top.</t:t></p>
+		<p><t:t>Click to remove.  Reselect on the side to move to the top.</t:t></p>
 		<%
-			out.print( sidebarView.renderView(prefBibles, removeModRenderer) ); //render the preferred Bibles section
+		if (prefBibles.size() > 0) {
+			out.println("<ul>");
+		}
+			for (int i = 0; i < prefBibles.size(); i++) {
+				SWModule mod = mgr.getModuleByName((String)prefBibles.get(i));
 		%>
+				<li><a href="preferences.jsp?del=<%= URLEncoder.encode(mod.getName()) %>"><%= mod.getDescription() %> (<%= mod.getName() %>)</a></li>
+
+		<%
+			}
+		if (prefBibles.size() > 0) {
+			out.println("</ul>");
+		}
+		%>
 		<h2><t:t>Preferred Commentaries</t:t></h2>
-		<p><t:t>Click to remove. Reselect on the side to move to the top.</t:t></p>
+		<p><t:t>Click to remove.  Reselect on the side to move to the top.</t:t></p>
 		<%
-			out.print( sidebarView.renderView(prefCommentaries, removeModRenderer) ); //render the preferred Bibles section
+		if (prefCommentaries.size() > 0) {
+			out.println("<ul>");
+		}
+			for (int i = 0; i < prefCommentaries.size(); i++) {
+				SWModule mod = mgr.getModuleByName((String)prefCommentaries.get(i));
 		%>
-		
+				<li><a href="preferences.jsp?del=<%= URLEncoder.encode(mod.getName()) %>"><%= mod.getDescription() %> (<%= mod.getName() %>)</a></li>
+
+		<%
+			}
+		if (prefCommentaries.size() > 0) {
+			out.println("</ul>");
+		}
+		%>
 		<h2><t:t>Preferred Style</t:t></h2>
 		<ul>
-			<% for (int i = 0; i < styleNames.size(); i++) { %>
-				<li><a href="preferences.jsp?setStyle=<%= URLEncoder.encode((String)styleNames.get(i)) %>" title="<%= (String) styleNames.get(i) %>"><t:t><%= (String) styleNames.get(i) %></t:t></a></li>
-			<% } %>
+<% for (int i = 0; i < styleNames.size(); i++) { %>
+			<li><a href="preferences.jsp?setStyle=<%= URLEncoder.encode((String)styleNames.get(i)) %>" title="<%= (String) styleNames.get(i) %>"><t:t><%= (String) styleNames.get(i) %></t:t></a></li>
+<% } %>
 		</ul>
 
 		<h2><t:t>Tabs</t:t></h2>
 		<ul>
-		<% 	for (int i = 0; i < tabNames.size(); i++) {
-				boolean visible = !"false".equals(showTabs.get(i));
-				String n = (String)tabNames.get(i);
-				String l = (String)tabLinks.get(i);
-				if (!"preferences.jsp".equals(l)) {
-		%>
-					<li><a href="preferences.jsp?<%=(visible)?"hide":"show"%>Tab=<%= Integer.toString(i)%>" title="<%= ((visible)?"Hide ":"Show ") + n %> Tab"><t:t><%= ((visible)?"Hide ":"Show ") + n %> Tab</t:t></a></li>
-		<% 		}
-			} 
-		%>
+<% for (int i = 0; i < tabNames.size(); i++) {
+	boolean visible = !"false".equals(showTabs.get(i));
+	String n = (String)tabNames.get(i);
+	String l = (String)tabLinks.get(i);
+	if (!"preferences.jsp".equals(l)) {
+ %>
+			<li><a href="preferences.jsp?<%=(visible)?"hide":"show"%>Tab=<%= Integer.toString(i)%>" title="<%= ((visible)?"Hide ":"Show ") + n %> Tab"><t:t><%= ((visible)?"Hide ":"Show ") + n %> Tab</t:t></a></li>
+<% }} %>
 		</ul>
-		
 		<h2 id="misc"><t:t>Misc Options</t:t></h2>
 		<ul>
 			<li><a id="headings" href="preferences.jsp?Headings=<%= "Off".equalsIgnoreCase(headings)?"On":"Off" %>#misc" title="<%= "Off".equalsIgnoreCase(headings)?"Show":"Hide" %> Headings in Bibles"><t:t><%= "Off".equalsIgnoreCase(headings)?"Show":"Hide" %> Headings in Bibles</t:t></a></li>
 			<li><a id="javascript" href="preferences.jsp?Javascript=<%= "Off".equalsIgnoreCase(javascript)?"On":"Off" %>#misc" title="<%= "Off".equalsIgnoreCase(javascript)?"Use":"Don't Use" %> Javascript"><t:t><%= "Off".equalsIgnoreCase(javascript)?"Use":"Don't Use" %> Javascript</t:t></a></li>
 		</ul>
 
-	</div>
+</div>
 	</tiles:put>
 </tiles:insert>
 



More information about the sword-cvs mailing list